function GetDirection(MyDirection)
{
		document.getElementById("Direction").value = MyDirection;
		document.getElementById("SBook").submit();
}

//-->
function MM_openwin(MM_file,MM_height,MM_width)
{
   MM_config=""
   MM_config+="toolbar=no,";
   MM_config+="location=no,"
   MM_config+="directories=no,";
   MM_config+="status=yes,"
   MM_config+="menubar=no," //Not on Apple Mac for obvious reasons
   MM_config+="scrollbars=yes,"
   MM_config+="resizable=yes," //Mac windows are always resizable
   MM_config+="copyhistory=no,"
   MM_config+="fullscreen=yes,"
   MM_config+="directories=no,"
   MM_config+="width="+MM_width+","
   MM_config+="height="+MM_height
   var MM_win=open(MM_file,"",MM_config);
   MM_win.focus();
}


function ShowImage(strImagePath, intImageWidth, intImageHeight)
{
	var ShowImageWin;
	var strName =  "ShowImage"
	var strFeatures;

	strFeatures = "dependent=yes,directories=no,location=no,menubar=no,resizable=yes,personalbar=no,scrollbars=no,titlebar=no,toolbar=no,screenX=50,screenY=50,top=50, left=50, width=" + intImageWidth.toString() + ", height=" + intImageHeight.toString()
	ShowImageWin = window.open(strImagePath, strName, strFeatures);
	ShowImageWin.focus();

	return false;
}




function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function Links(){
		document.getElementById("LTitle").value;
		document.getElementById("LUrl").value;
		document.getElementById("LCats").value;
		document.getElementById("LDescription").value;
		document.getElementById("LName").value;
		document.getElementById("LEmail").value;
		document.getElementById("LCode").value;
}

function CheckBooking()
{
	var testresults
	var error="";
	var emails = document.getElementById("AEmail").value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

	if(document.getElementById("CheckIn").value==""){
		error+="Fill check in date\n";
	}
	if(document.getElementById("CheckOut").value==""){
		error+="Fill check out date\n";
	}
	if(document.getElementById("CheckIn").value>=document.getElementById("CheckOut").value){
		error+="Please pick up correct date check in and check out\n";
	}
	if(document.getElementById("AName").value==""){
		error+="Fill your first name\n";
	}
	if(document.getElementById("ALastName").value==""){
		error+="Fill your last name\n";
	}
	if(document.getElementById("AAddress").value==""){
		error+="Fill address\n";
	}
	if(document.getElementById("ACity").value==""){
		error+="Fill city\n";
	}
	if(document.getElementById("APostCode").value==""){
		error+="Fill postcode\n";
	}

	if(emails =="" || (filter.test(emails)==false)){
		error+="Please fill your correct email address\n";
	}

	if(error!=""){
		alert(error);
	}
	else{
	form2.submit();
	}
}

function ClearBooking(){
		document.getElementById("CheckIn").value="";
		document.getElementById("CheckOut").value="";
		document.getElementById("AName").value="";
		document.getElementById("ALastName").value="";
		document.getElementById("AAddress").value="";
		document.getElementById("AStreet").value="";
		document.getElementById("ACity").value="";
		document.getElementById("APostCode").value="";
		document.getElementById("AEmail").value="";
		document.getElementById("ATel").value="";
		document.getElementById("AMobile").value="";
		document.getElementById("AFax").value="";
		document.getElementById("AOthers").value="";
		document.getElementById("NumLine").innerHTML=300;
}

//================= check key fillter
function CheckLen(evt)
{

				var lens = document.getElementById("AOthers").value.length;
				if(lens>0){
					document.getElementById("NumLine").innerHTML = (200 - lens);
					
					var newnums = (200 - lens);

					if((newnums)<=0)
					{
						alert("Character allowed 300 characters");
						return false;
					}

				}		
				 
}

//================= check key submit
function CheckLenS(evt)
{

				var lens = document.getElementById("AOthers").value.length;
				if(lens!=0){
					document.getElementById("NumLineS").innerHTML = (50 - lens);
				}
				
				 
}

function OnlyChars(evt)
{

				 var charCode = (evt.which) ? evt.which : event.keyCode
				// alert(charCode);
				 if ((!((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123)) && charCode!=8)){
					 if(!((charCode>=3585 && charCode<=3642) || (charCode>=3647 && charCode<=3661))){
					 	return false;
					 }
				 }
				 
}

function OnlyCharsNumber(evt)
{

				 var charCode = (evt.which) ? evt.which : event.keyCode
				 if (!((charCode > 47 && charCode < 59) || (charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123)) && charCode!=8){
					if(!((charCode>=3585 && charCode<=3642) || (charCode>=3647 && charCode<=3661))){
					 return false;
					}
				 }
				 
}

function OnlyCharsSpace(evt)
{

				 var charCode = (evt.which) ? evt.which : event.keyCode
				 if (!((charCode > 31 && charCode < 59) || (charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123)) && charCode!=8 ){
					if(!((charCode>=3585 && charCode<=3642) || (charCode>=3647 && charCode<=3661))){
					 return false;
					}
				 }
				 
}

function NumberCheck(evt)
{

				 var charCode = (evt.which) ? evt.which : event.keyCode
				 if (!(charCode > 42 && charCode < 80) && charCode!=8)
				 return false;
				 
}


//========================= Ajax check keycode
var urlGetKeyCode = "runimage.php?Sess="; 
function handleHttpResponseGKey() {    
	if (http.readyState == 4) { 
		  if(http.status==200) { 
				var results=http.responseText;
				try{
					if(results!=""){
							document.getElementById("showKeyCode").innerHTML = results;
						//	$("err_veriflyN").style.display="none";
					//		$('verification').value="";
					}
				
				}catch(e){}
		}
	} 
 } 
function GetSessKey() { 
	var ChsValue=document.getElementById("SessRand").value;
	
	http.open("GET", urlGetKeyCode + escape(ChsValue), true); 
	http.onreadystatechange = handleHttpResponseGKey; 
	http.send(null); 
} 


var urlGetidC = "classes/class_link.php?idHs="; 
function Httpsidcss() {    
	if (http.readyState == 4) { 
		  if(http.status==200) { 
				var results=http.responseText;
				try{
					if(results!=""){
						//alert(results);
						document.getElementById("subidC").innerHTML = results;
						//	$("err_veriflyN").style.display="none";
					//		$('verification').value="";
					}
				
				}catch(e){}
		}
	} 
 } 
function getidC() { 
	var ChsValue=document.getElementById("LCats").value;
	
	http.open("GET", urlGetidC + escape(ChsValue), true); 
	http.onreadystatechange = Httpsidcss; 
	http.send(null); 
} 


function getHTTPObject() { 
  var xmlhttp; 

  if(window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest(); 
  } 
  else if (window.ActiveXObject){ 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    
} 
  return xmlhttp;  
} 
var http = getHTTPObject(); 


function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function CheckAlls(){
	if(document.getElementById("CAll").checked==true){
		document.getElementById("CSpecial").checked=true;
		document.getElementById("CGolf").checked=true;
		document.getElementById("CSpa").checked=true;
		document.getElementById("CWedding").checked=true;
		document.getElementById("CTour").checked=true;
	}
	else{
		document.getElementById("CSpecial").checked=false;
		document.getElementById("CGolf").checked=false;
		document.getElementById("CSpa").checked=false;
		document.getElementById("CWedding").checked=false;
		document.getElementById("CTour").checked=false;
	}
}


function getHTTPObject() { 
  var xmlhttp; 

  if(window.XMLHttpRequest){ 
    xmlhttp = new XMLHttpRequest(); 
  } 
  else if (window.ActiveXObject){ 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    if (!xmlhttp){ 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    
} 
  return xmlhttp;  
} 
function Ltrim(textinput) {
	while('' + textinput.charAt(0)==' ')
	   textinput=textinput.substring(1,textinput.length);
	return textinput;
}

function Rtrim(textinput) {
	while('' + textinput.charAt(textinput.length-1)==' ')
	   textinput=textinput.substring(0,textinput.length-1);
	return textinput;
}
function trimText(textinput){
	return Ltrim(Rtrim(textinput));
}

var http = getHTTPObject(); 
//================= get key code 
var urlGetKeyCode = "runimage.php?ChrsKeyCode="; 
function handleHttpResponseGKey() {    
	if (http.readyState == 4) { 
		  if(http.status==200) { 
				var results=http.responseText;
					if(results!=""){
						//alert(results);
							document.getElementById("showKeyCode").innerHTML = results;
					}
				
				}
		}
	} 

function GetSessKey() { 
	var ChsValue="";
	
	http.open("GET", urlGetKeyCode + escape(ChsValue), true); 
	http.onreadystatechange = handleHttpResponseGKey; 
	http.send(null); 
} 

function SubmitSite(){
		
}

function SubmitYes(){
	if(document.getElementById("LEx1").checked==true)
		document.getElementById("hiddSub").style.display="";
	if(document.getElementById("LEx2").checked==true)
		document.getElementById("hiddSub").style.display="none";
}


