// JavaScript Document

//function for popup window
function popupmenus(url)
{
	width=screen.width;
	//height=screen.height;
	center=width/2;
	//center1=height/2;
	leftpos=center-244;
	//toppos=center1-150;
	newwindow=window.open(url,'ImageDisplay','height=700,width=500,left='+leftpos+',top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

var lists=new Array();
var lists1=new Array();
var centers=new Array();
var tutlev=new Array();
var tutsublev=new Array();
var tutsubject=new Array();
var emptycenters=new Array();
emptycenters[0]	= new Array('Choose','Choose');


function emptyList(box) 
{
	while (box.options.length) box.options[0] = null;
}

function fillList( box, arr ) 
{
	//alert(arr);
	for ( i = 0; i < arr[0].length; i++ ) 
	{
		opton = new Option( arr[0][i], arr[0][i+1] );
		box.options[box.length] = opton;
		i=i+1;
	}
	box.selectedIndex=0;
}



function changeList(box) 
{
	//alert(box);
	list = lists[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.sublevel);
		fillList(box.form.sublevel, list );
	
		emptyList(box.form.subject);

		fillList(box.form.subject, emptycenters );
	}
	
}



function changeListstud1(box) 
{
	//alert(box);
	list = lists[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.stud1sublevel);
		fillList(box.form.stud1sublevel, list );
	
		emptyList(box.form.stud1subject);

		fillList(box.form.stud1subject, emptycenters );
	}
	
}




function changesublevelstud1(box) 
{

	//alert(lists[box.options[box.selectedIndex].value]);
	cty = lists1[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.stud1subject);
		fillList(box.form.stud1subject, cty );
	}

}


function changeListstud2(box) 
{
	//alert(box);
	list = lists[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.stud2sublevel);
		fillList(box.form.stud2sublevel, list );
	
		emptyList(box.form.stud2subject);

		fillList(box.form.stud2subject, emptycenters );
	}
	
}



function changesublevelstud2(box) 
{

	//alert(lists[box.options[box.selectedIndex].value]);
	cty = lists1[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.stud2subject);
		fillList(box.form.stud2subject, cty );
	}

}


function changeListstud3(box) 
{
	//alert(box);
	list = lists[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.stud3sublevel);
		fillList(box.form.stud3sublevel, list );
	
		emptyList(box.form.stud3subject);

		fillList(box.form.stud3subject, emptycenters );
	}
	
}

function changesublevelstud3(box) 
{

	//alert(lists[box.options[box.selectedIndex].value]);
	cty = lists1[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.stud3subject);
		fillList(box.form.stud3subject, cty );
	}

}


/*function changeList1(selval) 
{
	alert(selval);
	delistyle=document.getElementById("checklast");
	if(delistyle)
	{
		delistyle.style.display="block";
		delistyle.style.visibility="visible";
		newimg=document.createElement('img');
    		newimg.src=tutlev[selval][0][0];
    		//newimg.alt=previewalternative;
    		newimg.className=previewimageclass;
    		delistyle.appendChild(newimg);
		
		
	}
}
*/

/*
var tutor = new Array();
function changeimage()
{
alert ("hai");
alert ("length "+tutor.length);
for (var i = 0; i < tutor.length; i++)
{
var img = new Image();
alert (tutor[i][0]);
img.src = tutor[i][0];
tutor[i][0] = img;
}
var imageIndex = parseInt(Math.random() * (tutor.length - 1));
function rotateImage()
{
imageIndex = (imageIndex + 1) % tutor.length;
document.getElementById('dynimage').src = tutor[imageIndex][0];
}
window.setInterval("rotateImage()", 10000);
}
*/
/***************/
//echo "var ImgNum = 0;


var ImgNum=0;
var tutor=new Array();
var first=0;
//var ImgLen =tutor.length;
//var ImgLength = tutor.length - 1;

//Time delay between Slides in milliseconds

var delay = 5000;
var lock = false;
var run;

function chgImg(direction) 
{
	if (document.images)
	{
		ImgNum = ImgNum + direction;
		if (ImgNum > tutor.length - 1) 
		{
			ImgNum = 0;
		}
		if (ImgNum < 0)
		{
			ImgNum = ImgLength;
		}
		document.dynimage.style.visibility='visible';
		document.dynimage.src = tutor[ImgNum][0];
		//im=ImgNum+1;
	if (document.getElementById)
	{
		//document.getElementById('CaptionBox').innerHTML= im+' of '+ImgLen;

		document.getElementById('NewTitle').innerHTML= tutor[ImgNum][2];

	}
   }

}

/*function gotoshow(){

window.location=NewLink[ImgNum]

}*/

function auto() {
if (first==0 && lock==false)
{
	document.dynimage.src = tutor[0][0];
	document.getElementById('NewTitle').innerHTML= tutor[0][2];
	first=1;
}
if (lock == true) {

lock = false;

window.clearInterval(run);

}

else if (lock == false) {

//lock = true;
//run = setInterval('chgImg(1)', delay);
setInterval('chgImg(1)', delay);

 }

}

/***************/

var first1=0;
var lock1 = false;
var run;
var ImgNum1=tutor.length-1;


function chgImg1(direction) 
{
	if (document.images)
	{
		ImgNum1 = ImgNum1 - direction;
	
	
		 if (ImgNum1 < 0)
		{
			ImgNum1 = tutor.length - 1;
		}
		/* not displaying same tutor name in above and below image start */
		var temp_tut1=" ";
		temp_tut1		=" "+tutor[ImgNum1];
		var  temp_tut1_array =temp_tut1.split(",");	
		var temp_tut=" ";
		temp_tut		=" "+tutor[ImgNum];
		var  temp_tut_array =temp_tut.split(",");	
		if(temp_tut1_array[0]==temp_tut_array[0])
		{
			if (ImgNum1 < 0)
			{
				ImgNum1 = tutor.length - 1;
			}
			else
			{
				ImgNum1 = ImgNum1 - direction;
			}
		}
		/*not displaying same tutor name in above and below image  end */
			
		document.dynimage1.style.visibility='visible';
		document.dynimage1.src = tutor[ImgNum1][0];
		//im=ImgNum+1;
	if (document.getElementById)
	{
		//document.getElementById('CaptionBox').innerHTML= im+' of '+ImgLen;

		document.getElementById('NewTitle1').innerHTML= tutor[ImgNum1][2];

	}
   }

}


/*
function chgImg1(direction) 
{
	if (document.images)
	{
		ImgNum1 = ImgNum1 - direction;
					
		if (ImgNum1 < 0)
		{
			ImgNum1 = tutor.length - 1;
		}
		document.dynimage1.style.visibility='visible';
		document.dynimage1.src = tutor[ImgNum1][0];
		//im=ImgNum+1;
	if (document.getElementById)
	{
		//document.getElementById('CaptionBox').innerHTML= im+' of '+ImgLen;

		document.getElementById('NewTitle1').innerHTML= tutor[ImgNum1][2]+"    "+ tutor[ImgNum][2];

	}
   }

}
*/

function auto1() {
if (first1==0 && lock1==false)
{
	var last=tutor.length-1;
	document.dynimage1.src = tutor[last][0];
	document.getElementById('NewTitle1').innerHTML= tutor[last][2];
	first1=1;
}
if (lock1 == true) {

lock = false;

window.clearInterval(run);

}

else if (lock1 == false) {

//lock = true;
//run = setInterval('chgImg(1)', delay);
setInterval('chgImg1(1)', delay);

 }

}

/***************/
function changeList1(selval) 
{
	for(i=0;i<5;i++)
	{
		var imgname='img'+i;
		newimg=document.getElementById(imgname);
		if(newimg)
		{
    			if(tutlev[selval][i][0]!="")
			{
				newimg.src=tutlev[selval][i][0];
			}
			else
			{
				newimg.src="images/rate_pri_lower[1].gif";
			}
		}
	}
	
}

function changeList2(selsubval) 
{
	for(i=0;i<5;i++)
	{
		//alert(tutsublev[selsubval][i][0]);
		var imgname='img'+i;
		newimg=document.getElementById(imgname);
		if(newimg)
		{
    			if(tutsublev[selsubval][i][0]!="")
			{
				newimg.src=tutsublev[selsubval][i][0];
			}
			else
			{
				newimg.src="images/rate_pri_lower[1].gif";
			}
		}
	}
	
}

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

/*function changeList3(selsubjectval) 
{
      var len=document.frm_match.subject.length;
      var selected = new Array();
      var index = 0;
      var subid=0;
      var content1="";
      for (var intLoop=0; intLoop < len; intLoop++) 
      {
	 if (document.frm_match.subject[intLoop].selected)
	 {
        	// alert(document.frm_match.subject[intLoop].value);
		subid=document.frm_match.subject[intLoop].value;
		 content1 = content1+" varSubject LIKE '%_"+subid+"% AND";		
         }
      }
      if (content!="")
      {
	var content="SELECT * FROM tbl_edupoint_tutor WHERE "+trim(content1," AND");
      	alert (content);
	
      }
}*/


function changesublevel(box) 
{

	//alert(lists[box.options[box.selectedIndex].value]);
	cty = lists1[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "select" && box.options[box.selectedIndex].value != "Choose")
	{
		emptyList(box.form.subject);
		fillList(box.form.subject, cty );
	}

}



//Function for Show the Field depends upon Trip selection
function OnewayTripClicked(){
	rad = document.getElementById("returndate");
	rad.style.visibility="hidden";
	rad = document.getElementById("jolly");
	rad.style.visibility="visible";
	rad = document.getElementById("two");
	rad.style.display="block";
	rad = document.getElementById("one");
	rad.style.display="none";
}
function RoundTripClicked(){
	rad = document.getElementById("returndate");
	rad.style.visibility="visible";
	rad = document.getElementById("jolly");
	rad.style.visibility="visible";
	rad = document.getElementById("two");
	rad.style.display="block";
	rad = document.getElementById("one");
	rad.style.display="none";
}
function JollyTripClicked(){
	rad = document.getElementById("jolly");
	rad.style.visibility="hidden";
	rad = document.getElementById("returndate");
	rad.style.visibility="hidden";
	rad = document.getElementById("two");
	rad.style.display="none";
	rad = document.getElementById("one");
	rad.style.display="block";
	
}


function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}
	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}


// Function to move one list box to another

<!--
     function MoveOption(objSourceElement, objTargetElement)
     {
   var aryTempSourceOptions = new Array();
   var aryTempTargetOptions = new Array();
   var x = 0;
   
   //looping through source element to find selected options
   for (var i = 0; i < objSourceElement.length; i++) {
    if (objSourceElement.options[i].selected) {
     //need to move this option to target element
     var intTargetLen = objTargetElement.length++;
     objTargetElement.options[intTargetLen].text = objSourceElement.options[i].text;
     objTargetElement.options[intTargetLen].value = objSourceElement.options[i].value;
    }
    else {
     //storing options that stay to recreate select element
     var objTempValues = new Object();
     objTempValues.text = objSourceElement.options[i].text;
     objTempValues.value = objSourceElement.options[i].value;
     aryTempSourceOptions[x] = objTempValues;
     x++;
    }
   }

   //sorting and refilling target list
   for (var i = 0; i < objTargetElement.length; i++) {
    var objTempValues = new Object();
    objTempValues.text = objTargetElement.options[i].text;
    objTempValues.value = objTargetElement.options[i].value;
    aryTempTargetOptions[i] = objTempValues;
   }

   aryTempTargetOptions.sort(sortByText);

   for (var i = 0; i < objTargetElement.length; i++) {
    objTargetElement.options[i].text = aryTempTargetOptions[i].text;
    objTargetElement.options[i].value = aryTempTargetOptions[i].value;
    objTargetElement.options[i].selected = false;
   }
   
   //resetting length of source
   objSourceElement.length = aryTempSourceOptions.length;
   //looping through temp array to recreate source select element
   for (var i = 0; i < aryTempSourceOptions.length; i++) {
    objSourceElement.options[i].text = aryTempSourceOptions[i].text;
    objSourceElement.options[i].value = aryTempSourceOptions[i].value;
    objSourceElement.options[i].selected = false;
   }
     }

     function sortByText(a, b)
     {
   if (a.text < b.text) {return -1}
   if (a.text > b.text) {return 1}
   return 0;
     }

	function selectAll(objTargetElement)
	{
		for (var i = 0; i < objTargetElement.length; i++) 
		{
			objTargetElement.options[i].selected = true;
		}
		return false;
	}

	function deselectAll(objTargetElement)
	{
		for (var i = 0; i < objTargetElement.length; i++) 
		{
			objTargetElement.options[i].selected = false;
		}
		return false;
	}

  //-->
function checkCheckbox(field)
{
	$Flag	=	"false";
	len = field.length;
	var Counter = 0;

	if(document.message_frm.chkCall.checked == true)
		$Flag	=	"true";

	for (i = 0; i < len; i++) 
	{
		if(field[i].checked == true)
		{
			$Flag	=	"true";
			Counter = Counter +1;
		}
	}
	if($Flag == "false")
	{
		alert("Select atleast Anyone Message");
		return false;
	}

}

// this Script is Used for Checkall Checkbox
var checkflag = "false";
function check(field,value) 
{
	var checkflag = value;
	len = field.length;
	if (checkflag == "on") 
	{
		if(len==null)
		{
			field.checked=true;
		}
		else
		{
			for (i = 0; i < len; i++) 
			{
				var chkname	=	field[i].name;
					field[i].checked = true;
			}
		}
		checkflag = "off";
		return "off"; 
	}
	else 
	{
		if(len==null)
		{
			field.checked=false;
		}
		else
		{
			for (i = 0; i < len; i++) 
			{
				var chkname	=	field[i].name;
				field[i].checked = false; 
			}
		}
		checkflag = "on";
		return "on"; 
	}
}//  End -->



function confirmMsg(msg)
{
	if(!confirm(msg))
	 {
		 return false;
	 }
	 else
	 {
		window.location.href="login.php";
		return false;
	 }
}
function schedule_select(id)
{
	window.location.href="schedule.php";
}

function delconfirmMsg(msg)
{
	if(!confirm(msg))
	 {
		 return false;
	 }
	 else
	 {
		return true;
	 }
}


// ****  CANCELLATION PAGE  ****
function cancellation()
{
	
	 var TicketNo = document.cancelfrm.TicketNo.value;
	 if (TicketNo == "" )
	 { 
	 alert ("Please enter Your Ticket Number");
	 document.cancelfrm.TicketNo.focus();
	 return false;
	 }
	 var date = document.cancelfrm.depdate.value;
	 if (date == "" )
	 { 
	 alert ("Please enter the Date");
	 document.cancelfrm.depdate.focus();
	 return false;
	 }
	var FirstName1 = document.cancelfrm.FirstName.value; 
	 if (FirstName1 == "")
	 { 
	 alert ("Please enter the First Name");
	 document.cancelfrm.FirstName.focus();
	 return false;
	 }
	 var LastName1 = document.cancelfrm.LastName.value;
	 if (LastName1 == "" )
	 { 
	 alert ("Please enter the Last Name");
	 document.cancelfrm.LastName.focus();
	 return false;
	 }
	 var Email = document.cancelfrm.varEmail.value; 
	 if (Email == "")
	 { 
	 alert ("Please enter Your Email Address ");
	 document.cancelfrm.varEmail.focus();
	 return false;
	 }
	 if (!validateEmail(document.cancelfrm.varEmail.value,1,1)) 
	 	{
		 document.cancelfrm.varEmail.focus();
		 return false;
		 }
	 
	 var ContNumber = document.cancelfrm.ContNumber.value;
	 if (ContNumber == "" )
	 { 
	 alert ("Please enter Your Contact Number");
	 document.cancelfrm.ContNumber.focus();
	 return false;
	 }
	 var NoofTicket = document.cancelfrm.seats.value;
	 if (NoofTicket == "" )
	 { 
	 alert ("Please enter no.of seats to be cancel");
	 document.cancelfrm.seats.focus();
	 return false;
	 }
	 /*if (isNaN(document.cancelfrm.ContNumber.value))
	 { 
	 alert ("Phone Number must be numeric");
	 document.cancelfrm.ContNumber.focus();
	 return false;
	 }
	 alert("fine");
	 window.open("canceldetails.php");
	 newwindow=window.open("canceldetails.php",'Cancel','height=200,width=150');
	 if (window.focus) {newwindow.focus()}   */
}

function agent_validation()
{
	/*var user = document.agent.AgencyIdno.value;
	 if (user == "" )
	 { 
	 alert ("Please enter the Agency ID Number");
	 document.agent.AgencyIdno.focus();
	 return false;
	 }
	 
	 var pass = document.agent.Agencypwd.value;
	 if (pass == "" )
	 { 
	 alert ("Please enter the Password");
	 document.agent.Agencypwd.focus();
	 return false;
	 }*/
	 var TravelAgency = document.agent.AgencyId.value;
	 if (TravelAgency == "" )
	 { 
	 alert ("Please enter the Travel Agency ID");
	 document.agent.AgencyId.focus();
	 return false;
	 }
	 if (isNaN(document.agent.AgencyId.value))
	 { 
	 alert ("Agency Id Number must be numeric");
	 document.agent.AgencyId.focus();
	 return false;
	 }	
	  var AgencyName = document.agent.AgencyName.value;
	 if (AgencyName == "" )
	 { 
	 alert ("Please enter the Agency Name");
	 document.agent.AgencyName.focus();
	 return false;
	 }
	 var Manager = document.agent.Manager.value; 
	 if (Manager == "")
	 { 
	 alert ("Please enter the Manager Name");
	 document.agent.Manager.focus();
	 return false;
	 }
	  var prepass = document.agent.Pre_pwd.value;
	 if (prepass == "" )
	 { 
	 alert ("Please enter the Password");
	 document.agent.Pre_pwd.focus();
	 return false;
	 }
	  var Confirmpwd = document.agent.Confirmpwd.value;
	 if (Confirmpwd == "" )
	 { 
	 alert ("Please enter the Confrim Password");
	 document.agent.Confirmpwd.focus();
	 return false;
	 }
	   if(document.agent.Pre_pwd.value !== document.agent.Confirmpwd.value)
	 	{
			 alert ("Please enter the correct Password");
			 document.agent.Confirmpwd.focus();
			 return false;			
		}
	 var address1 = document.agent.Addrsline1.value;
	 if (address1 == "" )
	 { 
	 alert ("Please enter the Address");
	 document.agent.Addrsline1.focus();
	 return false;
	 }
	 var ddlCity = document.agent.Cityortown.value;
	 if (ddlCity == "")
	 { 
	 alert ("Please enter the City or Town Name");
	 document.agent.Cityortown.focus();
	 return false;
	 }
	 var StateorZip = document.agent.StateorZip.value;
	 if (StateorZip == "" )
	 { 
	 alert ("Please enter the State Name or Post Code");
	 document.agent.StateorZip.focus();
	 return false;
	 }	
	 var Country=document.agent.Country.value;
	 if (Country=="" )
	 { 
	 alert ("Please enter the Country Name");
	 document.agent.Country.focus();
	 return false;
	 }	
	 var phoneno = document.agent.Bus_phone.value;
	 if (phoneno == "")
	 { 
	 alert ("Please enter the Phone Number");
	 document.agent.Bus_phone.focus();
	 return false;
	 }	
	 if (isNaN(document.agent.Bus_phone.value))
	 { 
	 alert ("Phone Number must be numeric");
	 document.agent.Bus_phone.focus();
	 return false;
	 }	
	 var fax = document.agent.Agencyfax.value;
	 if (fax == "")
	 { 
	 alert ("Please enter the Fax Number");
	 document.agent.Agencyfax.focus();
	 return false;
	 }		  
	 var Agencyemail = document.agent.Agencyemail.value;
	 if (Agencyemail == "")
	 { 
	 alert ("Please enter the Email Address");
	 document.agent.Agencyemail.focus();
	 return false;
	 }
	 if (!validateEmail(document.agent.Agencyemail.value,1,1)) 
	 {
		 document.agent.Agencyemail.focus();
		 return false;
	 }
	 
}


// ****  ONLINE BOOKING PAGE VALIDATION   ****

function onlinebooking1()
{	
 
	 var firstname = document.onlinebooking.FirstName1.value;
	 if (firstname == "" )
	 { 
	 alert ("Please enter the First Name");
	 document.onlinebooking.FirstName1.focus();
	 return false;
	 }
	 var lastname = document.onlinebooking.FamilyName1.value; 
	 if (lastname == "")
	 { 
	 alert ("Please enter the Last Name");
	 document.onlinebooking.FamilyName1.focus();
	 return false;
	 }

//Contact Details
	 var contactfirstname = document.onlinebooking.ContactFirstName.value;
	 if (contactfirstname == "" )
	 { 
	 alert ("Please enter the First Name for Contact");
	 document.onlinebooking.ContactFirstName.focus();
	 return false;
	 }
	 var contactlastname = document.onlinebooking.ContactLastName.value; 
	 if (contactlastname == "")
	 { 
	 alert ("Please enter the Last Name for Contact");
	 document.onlinebooking.ContactLastName.focus();
	 return false;
	 }
	 var phoneno = document.onlinebooking.txtPhoneNumber1.value;
	 if (phoneno == "")
	 { 
	 alert ("Please enter the Phone Number");
	 document.onlinebooking.txtPhoneNumber1.focus();
	 return false;
	 }	
	 if (isNaN(document.onlinebooking.txtPhoneNumber1.value))
	 { 
	 alert ("Phone Number must be numeric");
	 document.onlinebooking.txtPhoneNumber1.focus();
	 return false;
	 }	
	 	  
	 var txtEmailAddress1 = document.onlinebooking.txtEmailAddress1.value;
	 if (txtEmailAddress1 == "")
	 { 
	 alert ("Please enter the Email Address");
	 document.onlinebooking.txtEmailAddress1.focus();
	 return false;
	 }
	 if (!validateEmail(document.onlinebooking.txtEmailAddress1.value,1,1)) 
	 {
		 document.onlinebooking.txtEmailAddress1.focus();
		 return false;
	 }
		 
	/* var address1 = document.onlinebooking.txtAddress1.value;
	 if (address1 == "" )
	 { 
	 alert ("Please enter the Address");
	 document.onlinebooking.txtAddress1.focus();
	 return false;
	 }
	 
	  var ddlCity = document.onlinebooking.ddlCity.value;
	 if (ddlCity == "")
	 { 
	 alert ("Please enter the City Name");
	 document.onlinebooking.ddlCity.focus();
	 return false;
	 }
	 var zipcode = document.onlinebooking.txtPostCode.value;
	 if (zipcode == "" )
	 { 
	 alert ("Please enter the Post Code");
	 document.onlinebooking.txtPostCode.focus();
	 return false;
	 }	
	 if (isNaN(document.onlinebooking.txtPostCode.value))
	 { 
	 alert ("Post Code must be numeric");
	 document.onlinebooking.txtPostCode.focus();
	 return false;
	 }	
	 var txtState=document.onlinebooking.txtState.value;
	 if (txtState=="" )
	 { 
	 alert ("Please enter the State Name");
	 document.onlinebooking.txtState.focus();
	 return false;
	 }
	
	 var Country=document.onlinebooking.ddlCountry.value;
	 if (Country=="" )
	 { 
	 alert ("Please enter the Country Name");
	 document.onlinebooking.ddlCountry.focus();
	 return false;
	 }
	 
	 
	
	 
	 var  CreditcardType= document.onlinebooking.CreditcardType.value;
	 if (CreditcardType == "type")
	 { 
	 alert ("Please enter the Credit Card Type");
	 document.onlinebooking.CreditcardType.focus();
	 return false;
	 }	
	 var  txtCardHolderFirstName= document.onlinebooking.txtCardHolderFirstName.value;
	 if (txtCardHolderFirstName == "")
	 { 
	 alert ("Please enter the Card Holder FirstName");
	 document.onlinebooking.txtCardHolderFirstName.focus();
	 return false;
	 }	
	 var  txtCardHolderLastName= document.onlinebooking.txtCardHolderLastName.value;
	 if (txtCardHolderLastName == "")
	 { 
	 alert ("Please enter the Card Holder LastName");
	 document.onlinebooking.txtCardHolderLastName.focus();
	 return false;
	 }	
	 var  CreditCardNumber= document.onlinebooking.CreditCardNumber.value;
	 if (CreditCardNumber == "")
	 { 
	 alert ("Please enter the Credit Card Number");
	 document.onlinebooking.CreditCardNumber.focus();
	 return false;
	 }
	 if (isNaN(document.onlinebooking.CreditCardNumber.value))
	 { 
	 alert ("Credit Card Number must be numeric");
	 document.onlinebooking.CreditCardNumber.focus();
	 return false;
	 }	
	 var  CreditCardExpiryMonth= document.onlinebooking.CreditCardExpiryMonth.value;
	 if (CreditCardExpiryMonth == "MM")
	 { 
	 alert ("Please enter the Expiry Date");
	 document.onlinebooking.CreditCardExpiryMonth.focus();
	 return false;
	 }
	 var  CreditCardExpiryYear= document.onlinebooking.CreditCardExpiryYear.value;
	 if (CreditCardExpiryYear == "YY")
	 { 
	 alert ("Please enter the Expiry Date");
	 document.onlinebooking.CreditCardExpiryYear.focus();
	 return false;
	 }
	  var  txtIssuingBank= document.onlinebooking.txtIssuingBank.value;
	 if (txtIssuingBank == "")
	 { 
	 alert ("Please enter the Name of the Bank");
	 document.onlinebooking.txtIssuingBank.focus();
	 return false;
	 }*/
	  var  agree= document.onlinebooking.agree.checked;
	 if (agree ==false)
	 { 
	 alert("You Must agree the terms and conditions");
	 document.onlinebooking.agree.focus();
	 return false;
	 }
	 document.onlinebooking.action="onlinebooking.php";
	 document.onlinebooking.submit();
	 return true;
}


// **** DATE VALIDATION IN index.php
function DisplayMIGSCreditCardNotice(ccSelectionList)
{
	var ccCode = ccSelectionList.value;
	
	if (ccCode == "AX" || ccCode == "DC" || ccCode == "JB")
	{
		alert("Due to banking regulations, the fare displayed will be converted into Indian Rupees by applying the current applicable conversion rate. However, you will be billed in your local currency i.e. the local currency of the card issuing bank by using their conversion rate. Hence, there may be a difference between the final amount shown and the amount billed on your statement.");
	}
}
// JavaScript Document
function validation()
{

	var journy_date  = document.reservation.journy_date.value;
	var journy_month = document.reservation.journy_month.value;
	var journy_year  = document.reservation.journy_year.value;
	var return_date  = document.reservation.return_date.value;
	var return_month = document.reservation.return_month.value;
	var return_year  = document.reservation.return_year.value;
	
	var Start  = document.reservation.FirstDate.value;
	var End    = document.reservation.SecondDate.value;
	
	var StartSplit  = Start.split("-");
	var StartDay    = StartSplit[0];
	var StartMonth  = StartSplit[1];
	var StartYear   = StartSplit[2];
	
	var EndSplit  = End.split("-");
	var EndDay    = EndSplit[0];
	var EndMonth  = EndSplit[1];
	var EndYear   = EndSplit[2];
	 
	/*var Start1 = new Date(Start);
	var End1   = new Date(End);*/
	
	var Oneway = journy_date+"-"+journy_month+"-"+journy_year;
	var Return = return_date+"-"+return_month+"-"+return_year;
	
	/*var Oneway1 = new Date(Oneway);
	var Return1 = new Date(Return);
	alert(Start1);*/
	
	if(document.reservation.radio1[0].checked)
	{
		var firstname = document.reservation.Depart.value;
	    if (firstname == "" )
	    { 
		  alert ("Please enter the Departure city");
		  document.reservation.Depart.focus();
		  return false;
	    }
		var lastname = document.reservation.Return.value; 
		alert(lastname);
	    if (lastname == "" || lastname == "Select")
	    { 
		  alert ("Please enter the Arrival city");
		  document.reservation.Return.focus();
		  return false;
	    }
		if(firstname == lastname)
		{
			alert ("Please enter the different city");
		    document.reservation.Return.focus();
		    return false;
		}
		
		if (  journy_month =="" || journy_year =="" ||  journy_date =="" )	
		{
			alert("please select journy date");
			return false;
		}
	
		if (  return_month =="" || return_year =="" ||  return_date =="" )	
		{
			alert("please select return date");
			return false;
		}
		
		
	    //Start1 = database start 15-08-2007 
		//End1   = database end   30-10-2007
		
		if((StartYear > journy_year) || (EndYear < journy_year))
		{
			alert("Please Select Journey Year with in our Booking Period");
			return false;
		}
		if(StartYear == journy_year)
		{
			if((StartMonth > journy_month) || (EndMonth < journy_month))
			{
				alert("Please Select Journey Month with in our Booking Period");
			    return false;
			} 
			if(StartMonth == journy_month)
			{
				if(StartDay > journy_date)
				{
					alert("Please Select Journey Day with in our Booking Period");
			        return false;

				}
			}
		}
		
		if((StartYear > return_year) || (EndYear < return_year))
		{
			alert("Please Select Return Year with in our Booking Period");
			return false;
		}
		if(EndYear == return_year)
		{ 
			if((StartMonth > return_month) || (EndMonth < return_month))
			{
				alert("Please Select Return Month with in our Booking Period");
			    return false;
			} 
			if(EndMonth == return_month)
			{
				
				if(EndDay < return_date)
				{
					alert("Please Select Return Day with in our Booking Period");
			        return false;

				}
			}
		}
	    /*if(End1 > Return1)
		{
			alert("Please Select Return date with in our Booking Period");
			return false;
		}*/
		
		
	    
		if(journy_year < return_year)
		{
		return true;	
		}
		if(journy_year > return_year)
		{
			alert("journey year should be prior to Return year");
			document.reservation.return_year.focus();
			return false;
		}
		if(journy_year == return_year)
		{
			if(journy_month < return_month)
			{
				return true;
			}
			
			if(journy_month == return_month)
			{
				if(journy_date <= return_date)
				{
					if(journy_date == return_date)
					{
						var con=confirm("Do you want to return on same day");
						if(con==true)
						{
						  return true;
						}
						else
						{
						  document.reservation.return_date.focus();
						  return false;
						}
				    }
					else
					  return true;
			    }
				else 
				{
					alert("journey day should be prior to Return day");
					document.reservation.return_date.focus();
					return false;
				}
	
			}
			if(journy_month > return_month)
			{
				alert("journey month should be prior to Return month");
				document.reservation.return_month.focus();
				return false;
			}
	
		}
	
	}
	if(document.reservation.radio1[1].checked)
	{
		var firstname = document.reservation.Depart.value;
		if (firstname == "" )
		{ 
			alert ("Please enter the Departure city");
			document.reservation.Depart.focus();
			return false;
		}
		var lastname = document.reservation.Return.value;
		//alert(document.reservation.Return.value);
	    if (lastname == "" || lastname == "Select")
	    { 
		  alert ("Please enter the Arrival city");
		  document.reservation.Return.focus();
		  return false;
	    }
		if(firstname == lastname)
		{
			alert ("Please enter the different city");
		    document.reservation.Return.focus();
		    return false;
		}
		
	    if (  journy_month =="" || journy_year =="" ||  journy_date =="" )	
	    {
		  alert("please select journy date");
		  return false;
	    }
		if((StartYear > journy_year) || (EndYear < journy_year))
		{
			alert("Please Select Journey Year with in our Booking Period");
			return false;
		}
		if(StartYear == journy_year)
		{
			if((StartMonth > journy_month) || (EndMonth < journy_month))
			{
				alert("Please Select Journey Month with in our Booking Period");
			    return false;
			} 
			if(StartMonth == journy_month)
			{
				if(StartDay > journy_date)
				{
					alert("Please Select Journey Day with in our Booking Period");
			        return false;

				}
			}
		}
	}
	
	if(document.reservation.radio1[2].checked)
	{
	   
		var firstname = document.reservation.Depart1.value;
	if (firstname == "" )
	{ 
		alert ("Please enter the Departure city");
		document.reservation.Depart1.focus();
		return false;
	}	
    if (  journy_month =="" || journy_year =="" ||  journy_date =="" )	
	{
		alert("please select journy date");
		return false;
	}
	if((StartYear > journy_year) || (EndYear < journy_year))
	{
		alert("Please Select Journey Year with in our Booking Period");
		return false;
	}
	if(StartYear == journy_year)
	{
		if((StartMonth > journy_month) || (EndMonth < journy_month))
		{
			alert("Please Select Journey Month with in our Booking Period");
			return false;
		} 
		if(StartMonth == journy_month)
		{
			if(StartDay > journy_date)
			{
				alert("Please Select Journey Day with in our Booking Period");
				return false;

			}
		}
	}
	}

}


// SCHEDULE PAGE VALIDATION

function ScheduleAction()
{	
   //alert("OK");
		var total="";
		for(i=0;i<document.frmschedule.radiobutton.length;i++)
		{
			if(document.frmschedule.radiobutton[i].checked)
			
				total +=document.frmschedule.radiobutton[i].value+"\n"
				 /*alert("please select one Departing Flight");
				 return false;*/
			
		}
		if(total=="" && !document.frmschedule.radiobutton.checked)
		{
		 alert("please select one Departing Flight");
		 return false;
		}
	
		  
		if(document.frmschedule.trip.value == "Return")
		{
			
			var total1="";
	        for(i=0;i<document.frmschedule.radiobutton1.length;i++)
	        {
		      if(document.frmschedule.radiobutton1[i].checked)
		
			  total1 +=document.frmschedule.radiobutton1[i].value+"\n"
			 /*alert("please select one Departing Flight");
			 return false;*/
		
	        }
		 // if(!document.frmschedule.radiobutton1.checked)
		  if(total1=="" && !document.frmschedule.radiobutton1.checked)
		  {
			 alert("please select one Arrival Flight");
			 return false;
		  }
		}
	  
	
	document.frmschedule.action="onlinebooking.php";
	document.frmschedule.submit();
}
function ReturnToSchedule()
{
	document.backto.action="schedule.php";
	document.backto.submit();
}


//Script validation for displaying the submenu-category
/*var lists=new Array();
function emptyList(box) 
{
	 while (box.options.length ) box.options[0] = null;
}

function fillList( box, arr ) 
{
	for ( i = 0; i < arr[0].length; i++ ) 
	{
		option = new Option( arr[0][i], arr[0][i+1] );
		box.options[box.length] = option;
		i=i+1;
	}
	box.selectedIndex=0;
	box.options[box.selectedIndex].value="Select";
}

function changeList(box) 
{
	
	list = lists[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "")
	{
		
		emptyList(box.form.Return);
		fillList(box.form.Return,list );
	}
}
*/

function calendarCallback(date, month, year)
	{
		
		if(date<10) date="0"+date;
		if(month<10) month="0"+month;
		date = year + '-' + month + '-' + date;
		document.forms[0].depdate.value = date;
	}


function scheduledisable(time1)
{
    
	var timecount = document.frmschedule.timecount.value;
	//alert(timecount);
	if(timecount==1)
	{
	  var time2  = document.frmschedule.depname.value;
	  if(time1>=time2)
	    {
	      document.frmschedule.radiobutton1.disabled=true;
	    } 
	  else
	   {
		  document.frmschedule.radiobutton1.disabled=false;
		}  
	}
	if(timecount>1)
	{
	  //alert("");
	  for(var i=0; i<timecount; i++)
	  {
	    var time2  = document.frmschedule.depname[i].value;
		/*alert(time1);
		alert(time2);*/
	    if(time1>=time2)
	    {
		  
	      document.frmschedule.radiobutton1[i].disabled=true;
	    } 
		else
		{
		  document.frmschedule.radiobutton1[i].disabled=false;
		}
      }
	} 
  
}
