// JavaScript Document
function GetXmlHttpObjectRsvp()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


function stateChangedRsvp() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
  var txt = xmlHttp.responseText;
  document.getElementById("rsvp_light").innerHTML=txt;
  document.getElementById("rsvp_light").style.display = 'block';
//  jsc();
 } 
else
{
	var hei = screen.height * .3;
 document.getElementById("rsvp_light").innerHTML="<div style='background:#000; position:absolute; text-align:center; vertical-align:middle; width:100%; height:100%; z-index:100; opacity:0.8; filter:alpha(opacity=80);'></div><div align='center' style='vertical-align:middle; top:"+hei+"px; position:fixed; z-index:100; height:100%; width:100%; min-height:600px;'><img src='images/loading.gif' /></div>";
  document.getElementById("rsvp_light").style.display = 'block';
}
}



function rsvpload(id)
{
xmlHttp = GetXmlHttpObjectRsvp()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
	  var url = "rsvp.php?ev="+id;
xmlHttp.onreadystatechange=stateChangedRsvp 
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function rsvp_form()
{
	if(document.rsvp_form.name.value == '')
	{
		alert("Please enter your Name.");
		document.rsvp_form.name.focus();
		return false;
	}
	if(document.rsvp_form.email.value == '')
	{
		alert("Please enter your E-mail.");
		document.rsvp_form.email.focus();
		return false;
	}
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i ;
	if(!filter(document.rsvp_form.email.value))
	{
	 alert("Please enter valid Email Address.");  
	 document.rsvp_form.email.focus();
	 return false;
	}
	if(document.rsvp_form.phone.value == '')
	{
		alert("Please enter your Phone Number.");
		document.rsvp_form.phone.focus();
		return false;
	}
	if(isNaN(document.rsvp_form.phone.value))
	{
		alert("Phone Number can be Numeric only.");
		document.rsvp_form.phone.focus();
		return false;
	}	
return true;
}
function submit_rsvp_form()
{
	if(rsvp_form()) 
	{
		document.rsvp_form.submit();
	}
}
function hidersvpdiv()
{
  document.getElementById("rsvp_light").style.display = 'none';
}