<!-- tab section -->

var isChecked=false;
function usrtoggle(chkbox){
	isChecked=chkbox
	if(isChecked){
		document.getElementById('usrDetail').style.display='none';
		document.getElementById('usrTable').style.display='';
	}
	else{
		document.getElementById('usrDetail').style.display='';
		document.getElementById('usrTable').style.display='none';
	}
}
function billinfo(chkbox,frm){
	isChecked=chkbox
	if(isChecked){
		frm.billing_firstname.value = frm.firstname.value;
		frm.billing_lastname.value = frm.lastname.value;
		frm.billing_address1.value = frm.address1.value;
		frm.billing_address2.value = frm.address2.value;
		frm.billing_city.value = frm.city.value;
		frm.billing_state.value = frm.state.value;
		frm.billing_country.value = frm.country.value;
		frm.billing_zipcode.value = frm.zipcode.value;
		frm.billing_phone.value = frm.phone.value;
		frm.billing_email.value = frm.email.value;
		frm.billing_alternatephone.value = frm.alternatephone.value;
		frm.billing_cellphone.value = frm.cellphone.value;
	}
	else{
		frm.billing_firstname.value = '';
		frm.billing_lastname.value = '';
		frm.billing_address1.value = '';
		frm.billing_address2.value = '';
		frm.billing_city.value = '';
		frm.billing_state.value = '';
		frm.billing_country.value = '';
		frm.billing_zipcode.value = '';
		frm.billing_phone.value = '';
		frm.billing_email.value = '';
		frm.billing_alternatephone.value = '';
		frm.billing_cellphone.value = '';
	}
}

function redirection(path)
{
	window.location.href=path;		
}

function hidemsgbox(id) {
	document.getElementById(id).style.display = 'none';	
}

function setDefaultText(frm,setvalue,setclass)
{
	frm.couponcode.className = setclass;
	frm.couponcode.value = setvalue;
}

function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= (MaxLen));
}
// to display the text areas length 
function len_display(Object,MaxLen,element){
	var len_remain = MaxLen-Object.value.length;
   if(len_remain >=0){
   document.getElementById(element).value=len_remain; }
}


function checkTextAreaMaxLength(textBox,e, length,element)
{
	var mLen = textBox["MaxLength"];
	if(null==mLen)
		mLen=length;
	
	var maxLength = parseInt(mLen);
	if(!checkSpecialKeys(e,textBox,element,maxLength))
	{
	 if(textBox.value.length > maxLength-1)
	 {
		if(window.event)//IE
		  e.returnValue = false;
		else//Firefox
			e.preventDefault();
	 }
	 else
	 {
	 document.getElementById(element).value=maxLength - (textBox.value.length + 1);
	 }
	}  
}
	function checkSpecialKeys(e,textBox,element,maxLength)
	{
	if(e.keyCode !=8 && e.keyCode!=46 && e.keyCode!=37 && e.keyCode!=38 && e.keyCode!=39 && e.keyCode!=40)
		return false;
	else
		{
		if(textBox.value.length>0)
			document.getElementById(element).value=maxLength - (textBox.value.length-1);
		return true;
		}
	}   
	
	function modWindow(url,w,h) {
		if (window.showModalDialog)
			window.showModalDialog(url, window, 'dialogHeight:'+h+'px;dialogWidth:'+w+'px;center:yes','resizable: yes; help: no; status: no; scroll: no;');
		else
			alert('You need Internet Explorer 5 or higher.');
	}
	
	
	function checkTourAvailability(time,scheduleid,bookdate)
	{
	document.getElementById('displaydiv').innerHTML = 'Loading...';
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
		  alert("Your browser does not support AJAX!");
		  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4)
		  {
			document.getElementById('displaydiv').innerHTML = xmlHttp.responseText;
		  }
		}
	  xmlHttp.open("GET","pages/schedulertime.cfm?time="+time+"&scheduleid="+scheduleid+"&bookdate="+bookdate,true);
	  xmlHttp.send(null);
	}
	
	function blankfield(id) {
		document.getElementById(id).innerHTML='Loading...';	
	}
	
	function loadDateList(tourid,tourtype,path)
	{
	document.getElementById('datelist'+tourid).style.display = 'block';
	document.getElementById('datelist'+tourid).innerHTML = '<img src="'+path+'/tour/images/ajax-loader.gif" border="0" />';
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
		  alert("Your browser does not support AJAX!");
		  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4)
		  {
			document.getElementById('datelist'+tourid).innerHTML = xmlHttp.responseText;
		  }
		}
	  xmlHttp.open("GET", path+"/tour/pages/tourdatelist.cfm?tourid="+tourid+"&tourtype="+tourtype,true);
	  xmlHttp.send(null);
	}
	
	function unloadDateList(id) {
		document.getElementById(id).innerHTML = '';	
		document.getElementById(id).style.display = 'none';
	}
	
	function setDateFromlist(dat,dateid,divid) {
		document.getElementById(dateid).value = dat;
		document.getElementById(divid).innerHTML = '';	
		document.getElementById(divid).style.display = 'none';
	}
	
	