﻿var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;
// open hidden layer
function mopen(id)
{	    
    // cancel close timer
    mcancelclosetime();
    // close old layer
    if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
    // get new layer and show it
    ddmenuitem = document.getElementById(id);
    ddmenuitem.style.visibility = 'visible';
}
// close showed layer
function mclose(){ if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; }
// go close timer
function mclosetime() { closetimer = window.setTimeout(mclose, timeout); }
// cancel close timer
function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } }
// close layer when click-out
document.onclick = mclose; 

function ShowHideDiv(divName)
{ 
  var strModifiedDivName = "moveMe" + divName;
  if (document.getElementById(strModifiedDivName).style.visibility == "hidden")
	    document.getElementById(strModifiedDivName).style.visibility = "visible";					
  else if(document.getElementById(strModifiedDivName).style.visibility == "visible")
    	document.getElementById(strModifiedDivName).style.visibility = "hidden";			    
}			
function ShowHideDynamicDiv(anchor,divName, objid)
{ 
  objid = objid.replace(anchor,divName) ;
  if (document.getElementById(objid).style.visibility == "hidden")
        document.getElementById(objid).style.visibility = "visible";					
  else if(document.getElementById(objid).style.visibility == "visible")
    	document.getElementById(objid).style.visibility = "hidden";			    
}
function FunctionUCInnerSearch(source,args)
{
    if(document.getElementById("ctl00_ContentPlaceHolder2_UCQuickSearchInner1_txtKeyword").value=='Enter Hotel Name or Location')
    {            
        alert('Please provide or correct the following information:\n-Please enter hotel name or location');           
    }
    else
    {           
        document.getElementById('ctl00_ContentPlaceHolder2_UCQuickSearchInner1_btnSearch').click();
    }
} 
function FunctionUCQuickSearch(source,args)
{  
    if(document.getElementById("UCQuickSearch1_txtKeyword").value=='Enter Hotel Name or Location')
    {        
        alert('Please provide or correct the following information:\n-Please enter hotel name or location');         
    }
    else if(document.getElementById("UCQuickSearch1_txtKeyword").value.trim() == '')
    {        
        alert('Please provide or correct the following information:\n-Please enter hotel name or location');              
    }
    else
    {        
        document.getElementById('UCQuickSearch1_btnSearch').click();      
    }
}        
function FunctionUCSearch(source,args)
{  
    
    if(document.getElementById("ctl00_ContentPlaceHolder2_UCSearch1_txtKeyword").value=='Make a New Search')
    {        
        alert('Please provide or correct the following information:\n-Please enter hotel name or location');       
    }
    else
    {        
        document.getElementById('ctl00_ContentPlaceHolder2_UCSearch1_btnSearch').click();
    }
}
function FunctionJoinClub(source,args)
{   
    if(document.getElementById("ctl00_ContentPlaceHolder2_txtKeyword").value=='Quick Search')
    {        
        alert('Please provide or correct the following information:\n-Please enter hotel name or location');       
    }
    else
    {        
        document.getElementById('ctl00_ContentPlaceHolder2_btnSearch').click();
    }
}
function FunctionSavedSearch(source,args)
{   
    if(document.getElementById("ctl00_ContentPlaceHolder2_txtTitle").value=='Enter a title to save your Search')
    {   
        alert('Please provide or correct the following information:\n-Please enter a title to save your Search');       
    }
    else
    {        
       document.getElementById('ctl00_ContentPlaceHolder2_btnSave').click();
    }
}
function ShowHotelWebsite()
{
	window.open(document.getElementById("ct100_ContentPlaceHolder2_hdnWebsite").value, "_blank");
}
function chkApprove_Click()
{
	if(document.getElementById("ct100_ContentPlaceHolder2_chkApprove").checked)
		document.getElementById("ct100_ContentPlaceHolder2_btnAccept").disabled=false;
	else
		document.getElementById("ct100_ContentPlaceHolder2_btnAccept").disabled=true;
}
function Minimum3Chars(source,args)
{
    var strKeyword;
    strKeyword = '';    
    strKeyword = args.Value.trim();                
    if (strKeyword.length < 2)
    {
        args.IsValid = false
    }
    else
    {   
        args.IsValid = true;
    }    
}
function HideTextSS(objId)
{
    if(document.getElementById(objId).value == "Enter a title to save your Search")
    {
  
        document.getElementById(objId).value = ""
    }            
}
function ShowTextSS(objId)
{
    if(document.getElementById(objId).value.trim() == "")
    {
        document.getElementById(objId).value = "Enter a title to save your Search"
    }            
}           
function HideText(objId)
{
    if(document.getElementById(objId).value == "Enter Hotel Name or Location")
    {        
        document.getElementById(objId).value = ""
    }            
}        
function ShowText(objId)
{
    if(document.getElementById(objId).value.trim() == "")
    {        
        document.getElementById(objId).value = "Enter Hotel Name or Location"
    }            
}
function HideEmailText(objId)
{
    if(document.getElementById(objId).value == "Enter your Email")
    {        
        document.getElementById(objId).value = ""
    }            
}        
function ShowEmailText(objId)
{
    if(document.getElementById(objId).value.trim() == "")
    {        
        document.getElementById(objId).value = "Enter your Email"
    }            
}
function HideTextJoin(objId)
{
    if(document.getElementById(objId).value == "Quick Search")
    {
        document.getElementById(objId).value = ""
    }            
}        
function ShowTextJoin(objId)
{
    if(document.getElementById(objId).value.trim() == "")
    {
        document.getElementById(objId).value = "Quick Search"
    }            
}
 var MENUtimeout	= 500;
    var MENUclosetimer	= 0;
    var MENUddmenuitem	= 0;
    var Onlink=0
    // open hidden layer
    function MENUopen(id)
    {	
        // cancel close timer
        Onlink=1
	    MENUcancelclosetime();
        MENUddmenuitem = document.getElementById(id);
	    // close old layer
	    if(MENUddmenuitem){
	        $("#panel").slideDown("fast");
		    $(this).toggleClass("active"); return false;
		} 
		        
	    // get new layer and show it
	    MENUddmenuitem = document.getElementById(id);
	   //MENUddmenuitem.style.display = 'inline';

    }
    // close showed layer
    function MENUclose()
    {
	    if((MENUddmenuitem)&&(Onlink==0)){
	    //MENUddmenuitem.style.display = 'none';
	    $("#panel").slideUp("fast");
		$(this).toggleClass("active"); return false;
	    } //MENUddmenuitem.style.display = 'none';
    }

    // go close timer
    function MENUclosetime()
    {   Onlink=0
	    MENUclosetimer = window.setTimeout(MENUclose, MENUtimeout);
	}

    // cancel close timer
    function MENUcancelclosetime()
    {
	    if(MENUclosetimer)
	    {
		    window.clearTimeout(MENUclosetimer);
		    MENUclosetimer = null;
	    }
    }
    
function ShowSignUpWindow(basePath,UserEmail)
{   
    if ((UserEmail = '') || (UserEmail = 'Enter your Email'))
    {
        alert("Please enter your Email Address");
    }
    else
    {    
        window.showModalDialog('' + basePath + 'SignUp.aspx?UserEmail=' + UserEmail + '' , '' , "dialogWidth:600px; dialogHeight:600px; center:yes");
    }
}