function InfoByDate(form){
	   
	var sName = form.Name.value;
	var eEmail =  form.email.value;

	if(sName == "" || sName == "Name" )
	{ 
		alert("Please insert your name");
		return false;
	}

	if(eEmail == "" || eEmail == "Email" )
	{ 
		alert("Please insert your Email");
		return false;
	}else{
		if(validarEmail(eEmail) == "no")
		{
			alert("Please insert your E-mail the following way name@server.domain");	
			return false;
		}
	}
	document.getElementById("divEmailSent").innerHTML = "<img src='http://www.pscars.com/images/inventory/loader/30%20%281%29.gif' width='160' height='20' alt='Wait'/>"
	
	
	var divToBeWorkedOn = '#divEmailSent';
	var webMethod = 'http://oscarc/webs/Contest_ch.asmx/MediaInformationContact'
//	var webMethod = 'http://www.pscars.com/wsContactCH/Contest_ch.asmx/MediaInformationContact'
	var parameters = "{'sName':'" + sName + "','eEmail':'" + eEmail + "'}"
	$.ajax({
			type: "POST",
			url: webMethod,
			data: parameters,
			contentType: "application/json; charset=utf-8",
			dataType: "json",
			success: function(msg) { 
			if(msg != null)
			{
					var answer = msg.d;
					form.Name.value = "Name";
					 form.email.value = "Email";					
					$(divToBeWorkedOn).html(answer.replace(/"/gi,""));
			}else{
					form.Name.value = "Name";
					 form.email.value = "Email";				
					$(divToBeWorkedOn).html("Unavailable");    
			}

			},
			error: function(e){
					form.Name.value = "Name";
					 form.email.value = "Email";				
					$(divToBeWorkedOn).html("Unavailable");    
					
			}
	});
	return false
   }
   
   
   
   function MultipleCOntact(formx)
   {
	   
	   
	var sNamecs = formx.Namecs.value;
	var sCOmpanycs = formx.Companycs.value;
	var eEmailcs =  formx.emailcs.value;
	var pPhonecs = formx.Phonecs.value;
	var mMessagecs = formx.Messagecs.value;

	if(sNamecs == "" )
	{ 
		alert("Please insert your name");
		return false;
	}

	if(eEmailcs == "")
	{ 
		alert("Please insert your Email");
		return false;
	}else{
		if(validarEmail(eEmailcs) == "no")
		{
			alert("Please insert your E-mail the following way name@server.domain");	
			return false;
		}
	}
	document.getElementById("divEmailSentcs").innerHTML = "<img src='http://www.pscars.com/images/inventory/loader/30%20%281%29.gif' width='160' height='20' alt='Wait'/>"
	
	
	var divToBeWorkedOn = '#divEmailSentcs';
//	var webMethod = 'http://oscarc/webs/Contest_ch.asmx/ContactUsModal'
	var webMethod = 'http://www.pscars.com/wsContactCH/Contest_ch.asmx/ContactUsModal'
	var parameters = "{'SName':'" + sNamecs + "','sCompany':'" + sCOmpanycs + "','eEmail':'" + eEmailcs + "','sPhone':'" + pPhonecs + "','Message':'" + mMessagecs + "'}"
	$.ajax({
			type: "POST",
			url: webMethod,
			data: parameters,
			contentType: "application/json; charset=utf-8",
			dataType: "json",
			success: function(msg) { 
			if(msg != null)
			{
					var answer = msg.d;
					//form.Name.value = "Name";
					// form.email.value = "Email";					
					$(divToBeWorkedOn).html(answer.replace(/"/gi,""));
			}else{
					//form.Name.value = "Name";
					//form.email.value = "Email";				
					$(divToBeWorkedOn).html("Unavailable");    
			}

			},
			error: function(e){
					//form.Name.value = "Name";
					// form.email.value = "Email";				
					$(divToBeWorkedOn).html("Unavailable");    
					
			}
	});
	return false   
	   
	   
	}
   
   
   function validarEmail(valor) {
  		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){

  } else {
   return ("no");
  }
 }
 
 
 $(document).ready(function(){
						   		   
	//When you click on a link with class of poplight and the href starts with a # 
	$('a.poplight[href^=#]').click(function() {
		var popID = $(this).attr('rel'); //Get Popup Name
		var popURL = $(this).attr('href'); //Get Popup href to define size
				
		//Pull Query & Variables from href URL
		var query= popURL.split('?');
		var dim= query[1].split('&');
		var popWidth = dim[0].split('=')[1]; //Gets the first query string value

		//Fade in the Popup and add close button
		var paddingclose = 400;
		//alert(popID)
		if(popID == "popup2"){
			paddingclose = 600;
			}
		$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<div style="position:fixed;;z-index: 999999; padding-left:'+ paddingclose +'px;border: 0px solid #ddd; 	"><a href="#" class="close"><img src="http://www.pscars.com/images/close_pop2.png" class="btn_close" title="Close Window" alt="Close" /></a><div>');
		
		//Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
		var popMargTop = ($('#' + popID).height() + 0) / 2;
		var popMargLeft = ($('#' + popID).width() + 80) / 2;
		
		//Apply Margin to Popup
		$('#' + popID).css({ 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
		
		//Fade in Background
		$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
		
		return false;
	});
	
	
	//Close Popups and Fade Layer
	$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
	  	$('#fade , .popup_block, .popup_block2, .popup_block3,.locationPopUp').fadeOut(function() {
			$('#fade').remove();
			// a.close  
	}); //fade them both out
		
		return false;
	});

	
});
 
 
 
 function InfoByDate1(form){
	   
	var sName = form.Name1.value;
	var eEmail =  form.email1.value;

	if(sName == "" || sName == "Name" )
	{ 
		alert("Please insert your name");
		return false;
	}

	if(eEmail == "" || eEmail == "Email" )
	{ 
		alert("Please insert your Email");
		return false;
	}else{
		if(validarEmail(eEmail) == "no")
		{
			alert("Please insert your E-mail the following way name@server.domain");	
			return false;
		}
	}
	document.getElementById("divEmailSent1").innerHTML = "<img src='http://www.pscars.com/images/inventory/loader/30%20%281%29.gif' width='160' height='20' alt='Wait'/>"
	
	
	var divToBeWorkedOn = '#divEmailSent1';
	var webMethod = 'http://www.pscars.com/wsContactCH/Contest_ch.asmx/MediaInformationContact'
	var parameters = "{'sName':'" + sName + "','eEmail':'" + eEmail + "'}"
	
	$.ajax({
			type: "POST",
			url: webMethod,
			data: parameters,
			contentType: "application/json; charset=utf-8",
			dataType: "json",
			success: function(msg) {  
					var answer = msg.d;
					form.Name1.value = "Name";
					 form.email1.value = "Email";					
					$(divToBeWorkedOn).html(answer.replace(/"/gi,""));

			},
			error: function(e){
					form.Name1.value = "Name";
					 form.email1.value = "Email";				
					$(divToBeWorkedOn).html("Unavailable");    
					
			}
	});
	return false
   }
