// JavaScript Document
//Function Table for halleynet booking system v1.0

//Show hide rows script

function toggleHidden (childname) {
    element = document.getElementById(childname);
    element.style.display = (element.style.display == "none") ? "" : "none";
   // element = document.getElementById(childname+".line");
//    element.style.display = (element.style.display == "none") ? "" : "none";
}
/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
/*email validation form script*/
function ValidateForm(){
	var emailID=document.form1.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		emailID.focus()
		return true
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 /*AJAX http connector script*/
var xmlhttp = false;
//Check if we are using IE.
try {
//If the Javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
/*alert ("You are using Microsoft Internet Explorer.");*/
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using Internet Explorer.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
/*alert ("You are using Microsoft Internet Explorer");*/
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
/*alert ("You are not using Microsoft Internet Explorer");*/
}

 /*ajax http request script*/
 function makerequest(serverPage, objID) {
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
	document.getElementById("loading").style.visibility="hidden";
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
//loading function
with (document.getElementById("loading")){
	style.visibility = "visible";
	if (navigator.appname == "Microsoft Internet Explorer"){
		style.posLeft = document.body.clientWidth -75;
		//style.posTop = 450;
	}else{
		style.left = (window.innerWidth - 75) + "px";
		//style.top = "450px";
	}
 }
 //loading function end
}
function toggleVisible (childname) {
    element = document.getElementById(childname);
    element.style.display = (element.style.display == "block") ? "" : "block";
   // element = document.getElementById(childname+".line");
//    element.style.display = (element.style.display == "none") ? "" : "none";
}
function hideCode(id){
		var item = document.getElementById(id);
		item.style.display="none";
	}
