var xmlHttp;
//this for couple registery (sing up)
function typeSort(values)
{
	
	if(values=='Honeymoon Registry Only')
	{	
		if(document.getElementById("honeymoonLayout").style.display == 'none')
		{
			document.getElementById("honeymoonLayout").style.display ='block';
		}
		
		if(document.getElementById("giftsLayout").style.display =='block')
		{
			document.getElementById("giftsLayout").style.display ='none';
		}
		
		 //document.getElementById("giftsLayout").display ='block';
	}
	
	if(values=='Honeymoon and Gift Registry')
	{
		if(document.getElementById("honeymoonLayout").style.display == 'none')
		{
			document.getElementById("honeymoonLayout").style.display ='block';
		}
		
		if(document.getElementById("giftsLayout").style.display =='none')
		{
			document.getElementById("giftsLayout").style.display ='block';
		}
	}
	
	if(values=='Gift Registry Only')
	{
		if(document.getElementById("honeymoonLayout").style.display == 'block')
		{
			document.getElementById("honeymoonLayout").style.display ='none';
		}
		
		if(document.getElementById("giftsLayout").style.display =='none')
		{
			document.getElementById("giftsLayout").style.display ='block';
		}
	}
	
	if(values=='')
	{
		if(document.getElementById("honeymoonLayout").style.display == 'block')
		{
			document.getElementById("honeymoonLayout").style.display ='none';
		}
		
		if(document.getElementById("giftsLayout").style.display =='block')
		{
			document.getElementById("giftsLayout").style.display ='none';
		}
	}
}

function enAbleHoneymoonLayout(values)
{
	if(values=="yes")
	{
		document.getElementById("honeymoonLayout-2").style.display ='block';
departureDate = new Epoch('cal1', 'popup', document.getElementById('departureDate'),false);
					returnDate = new Epoch('cal1', 'popup', document.getElementById('returnDate'),false);
	}

	if(values=="no")
	{
		document.getElementById("honeymoonLayout-2").style.display ='none';
	}
}

/*function typeSort(values)
{
	xmlHttpObject();

    var url="../PhpRespondajax/respond.php"
	    url +="?request=registry"+"&item="+values
	    url=url+"&sid="+Math.random();
	    xmlHttp.onreadystatechange=setTypeSort;
	    xmlHttp.open("GET",url,true) ;
	    xmlHttp.send(null);

}

function setTypeSort()
{
    
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		 document.getElementById("htmlTypeSort").innerHTML=xmlHttp.responseText 
	 } 
}*/

// check duplicate username in the couple registry page
function CheckDupUsername(values)
{
	xmlHttpObject();

 document.getElementById("checkUserName").innerHTML="Checking..." 
    var url="../PhpRespondajax/respond.php"
	    url +="?request=CheckDupUsername"+"&item="+values
	    url=url+"&sid="+Math.random();
	    xmlHttp.onreadystatechange=setCheckDupUsername;
	    xmlHttp.open("GET",url,true) ;
	    xmlHttp.send(null);

}

function setCheckDupUsername()
{
    
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		 document.getElementById("checkUserName").innerHTML=xmlHttp.responseText 
	 } 
}




//ajax object
function xmlHttpObject()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }
}


function GetXmlHttpObject(handler)
{
	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;
}