
function openLayerBC()
{

 tWidth = $(document).width();
 tHeight = $(document).height();
 //$("select").fadeOut('fast');
 $('#filter').css("width",tWidth+"px");
 $('#filter').css("height",tHeight+"px");
// $('#filter').css('z-index',9990);
 $("#filter").css("opacity", 0.6);
 $('#filter').fadeIn('fast');
 
 //$('#filter').bind("click",closePopup1);
 $('#filter,#close').click(function() {
				$('#filter').fadeOut('fast');
				$('#popup').hide();
	  o = document.getElementById(divid);
	  o.style.display = o.style.display=='block'?'none':'block';
			});
$('#cl,#close').click(function() {
				$('#filter').fadeOut('fast');
				$('#popup').hide();
	  o = document.getElementById(divid);
	  o.style.display = o.style.display=='block'?'none':'block';
			});

 }
 
function openPopUp1(divid,parent)
	{
	var name=document.getElementById("p_newsletter_name").value;
	var email=document.getElementById("p_newsletter_email").value;
	var err="";
	var i=0;
	if(name=="")
		{
		err=err+"Please Enter Name.\n";
		i++;
		}
	if(email=="")
		{
		err=err+"Please Enter Email Address.\n";
		i++;
		}
	
	if(i>0)
		{
		alert(""+err);	
		return false;		
		}
	
	if(!echeck(email))
		{
		return false;	
		}
	
	openLayerBC();
	
	//alert($("#login_newsletter_name").val());
	$('#newsletter_name').val(name);
	$('#newsletter_email').val(email);
	ww = $(document).width();
	newLeft = (ww/2)-(800/2);
	$('#popup').css('z-index',2000000);
	$("#popup").css("left",newLeft);
	$("#popup").css("top",$(window).scrollTop()+0); 
	$("#popup").show();
	
	
	
	//$.('#newsletter_name').val(name);
	//$.().val(name);
	
	return false;
	}


/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 
 function openPopUpMap(URL, media) 
{
	var left;
	var screenWidth = document.body.clientWidth;

	if(media == 'rating')
	{
		h = 280;
		w = 400;
	}

	if(media == 'print')
	{
		h = 500;
		w = 770;
	}


	if(media == 'venue_spec')
	{
		h = 320;
		w = 530;
	}

	
	if(media == 'cal')
	{
		h = 600;
		w = 930;
	}

	
	if(media == 'tellafriend')
	{
		h = 400;
		w = 550;
	}
	
	if(media == 'backline')
	{
		h = 530;
		w = 530;
	}
	
	
	if(media == 'music')
	{
		h = 35;
		w = 417;
	}
	if(media == 'video')
	{
		h = 500;
		w = 680;
	}
	if(media == 'map')
	{
		h = 390;
		w = 585;
	}
	
	left = $(window).scrollLeft()+((screenWidth - w)/2);
	//alert(left);
	day = new Date();
	id = day.getTime();
	
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left = "+left+",top = 200');");
}
