var chk2;
var browser='';
browser=navigator.appName;

if(browser=='Netscape'){
is_moz=true;
}else{
is_moz=false;
}

function trim(text) {
	return text.replace(/^\s+|\s+$/g,"");
}

function ajaxFunction(username,check) {
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)
        {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert('ss'+response+'11');
        if(response=='true'){
		document.getElementById('notavailable').style.display='none';
		document.getElementById('available').style.display='block';
		document.getElementById('available').innerHTML='User Name is available!';
		check.value='ok';
		}else if(response=='invalid'){
		document.getElementById('available').style.display='none';
		document.getElementById('notavailable').style.display='block';
		document.getElementById('notavailable').innerHTML='Invalid User Name !';
		check.value='';
			
		}else if(response=='false'){
		document.getElementById('available').style.display='none';
		document.getElementById('notavailable').style.display='block';
		document.getElementById('notavailable').innerHTML='User Name is not available!';
		check.value='';
		}
		
        }
      }
	  
	  url="checkuser.php?user=";
	  url=url+username+"&rand="+calcRand();
	  
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
	
	if(username==''){
	check.value='';	
	}
  }
  
  function ajaxcall1(){
	  

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('alert').innerHTML=xmlHttp.responseText;
	

		
		
        }
      }
	
	 
	 url="alert2.php?rand="+calcRand();
	 
  
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 


	////////////////////// second request
	
	var xmlHttp2;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp2=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }


xmlHttp2.onreadystatechange=function()
      {
      if(xmlHttp2.readyState==4)
        {
			
		update = xmlHttp2.responseText.split('|');
		
		if(update[1]!=''){

if(!document.getElementById('emsound')){
 var embed = document.createElement('embed');
 embed.setAttribute('src','wmpaud7.wav');
 embed.setAttribute('hidden','true');
 embed.setAttribute('autostart','true');
 embed.setAttribute('loop','true');
 embed.setAttribute('id','emsound');
 
  var insertHere = document.getElementById('sound');
	insertHere.appendChild(embed);

}


var agree=confirm(update[0]);



		if(agree){
		document.updatealertform.id.value=update[1];
		document.updatealertform.submit();
		

 em=document.getElementById('emsound');
	insertHere.removeChild(em);

		
		}else{}
		}
	
		
        }
      }
	
	 
	 url2="alert.php?rand="+calcRand();
	 
  
    xmlHttp2.open("GET",url2,true);
    xmlHttp2.send(null); 

	////////////////////// second request end

  }
  
  
  
  function calcRand() {

date=new Date().getTime();
retVal = Math.floor(Math.random() * 1001);
retVal += Math.floor(Math.random() * date);
  return retVal;

}


function ajaxcall2(){
	  

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)
        {
			
        alert(xmlHttp.responseText);
		
        }
      }
	
	 
	 url="alert2.php?rand="+calcRand();
	 
  
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 


  }
  
function checkdate(dtfield,hours,minutes,format,timezone,check,button){

var programLen=document.scheduleform.program.length;
var chkEdit='';

if(document.scheduleform.edit){
chkEdit=document.scheduleform.edit.value;
}

var program='';

for(var i=0;i<programLen;i++){
if(document.scheduleform.program[i].checked==true){
	program=document.scheduleform.program[i].value;
} }

/* condtion for editschedule.php*/
if(program==''){
	program=document.scheduleform.program.value;
}
/* condtion for editschedule.php*/

var arr=dtfield.split('-');
var dtmonth=arr[0];
var dtday=arr[1];
var dtyear=arr[2];
var chk1=performCheck('scheduleform', rules, 'classic');
if(chk1==false){
return false;
}
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)    {
	
	var response=xmlHttp.responseText;
	response=trim(response);
//alert('ss'+response+'911');
//alert(response);return;

var arr2=response.split('|');

if(arr2[0]=='true'){
check.value='ok';
chk2=true;
}else{
alert('Please schedule your session 24 hour prior to your current time');
check.value='';
}

if(arr2[1]=='false'){
alert('Please select your session date before your package expiry date');
return false;
}

if(chkEdit!='true'){
if(arr2[2]=='true'){
alert('Please purchase more sessions before scheduling');
return false;
} }

if((chk1==true)&&(chk2==true)){
document.scheduleform.submit();
button.disabled='disabled';
} } }

url="checkdate.php?dtmonth="+dtmonth+"&dtday="+dtday+"&dtyear="+dtyear+"&hours="+hours+"&minutes="+minutes+"&format="+format+"&timezone="+timezone+"&program="+program+"&rand="+calcRand();
xmlHttp.open("GET",url,true);
xmlHttp.send(null); 

}

function showdetail(id,file){
hf=screen.height/4;
hf2=screen.width/4;
if(!file){
file="showdetail.php";
}
window.open(file+"?id="+id,null,"top="+hf+",left="+hf2+",height=300,width=400,status=yes,toolbar=no,menubar=no,location=no");
}

function showother(id,selectbox){
	
if(selectbox.value=="Others"){
document.getElementById(id).style.display="block";
}else{
document.getElementById(id).style.display="none";
} }

function showother2(id,checkbox){
if(checkbox.checked==true)
{
document.getElementById(id).style.display="block";
}else{
document.getElementById(id).style.display="none";
}
}


function checkuser(field){
if(field.value==''){
alert('Please provide a valid, minimum 5 character Username');
return false;
}else{
return true;
}
}


function validatedemoform(dtfield,hours,minutes,format,timezone,check,button){

var chk1=performCheck('demoform', rules2, 'classic');
var chk3=checkuser(document.demoform.checkuser);
var chk4=phonecheck();
var chk5=ajaxFunction(document.demoform.username.value,document.demoform.checkuser);

if((chk1==true)&&(chk3==true)&&(chk4==true)){

//////////////////////////////////////////////////calling ajax
var arr=dtfield.split('-');

dtmonth=arr[0];
dtday=arr[1];
dtyear=arr[2];


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	

//alert('ss'+response+'911');
//alert(response);
var arr=response.split('|');

if(arr[0]=='true'){
check.value='ok';
comchk=true;
}else{
alert('Please schedule your session after current time');
check.value='';
comchk='';
}

if(comchk==true){
document.demoform.submit();
button.disabled='disabled';
} } }

url="checkdate.php?dtmonth="+dtmonth+"&dtday="+dtday+"&dtyear="+dtyear+"&hours="+hours+"&minutes="+minutes+"&format="+format+"&timezone="+timezone+"&rand="+calcRand()+"&curtime=true";

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax
}

}


function phonecheck(){
phone1=document.demoform.phone1.value.length;
phone2=document.demoform.phone2.value.length;
phone3=document.demoform.phone3.value.length;
total=phone1+phone2+phone3;

if(total<10){
alert('Please provide your valid phone number along with area code(e.g.,xxx xxx xxxx)');
return false;
}
else{
return true;
} }



function validatedemoform2(dtfield,hours,minutes,format,timezone,check,button){
var chk1=performCheck('demoform', rules2, 'classic');

if(chk1==true){
var arr=dtfield.split('-');
dtmonth=arr[0];
dtday=arr[1];
dtyear=arr[2];
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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	

//alert('ss'+response+'911');
//alert(response);
var arr=response.split('|');
if(arr[0]=='true'){
check.value='ok';
comchk=true;
}else{
alert('Please schedule your session after current time');
check.value='';
comchk='';
}

if(comchk==true){
document.demoform.submit();
button.disabled='disabled';
} } }
	  
url="checkdate.php?dtmonth="+dtmonth+"&dtday="+dtday+"&dtyear="+dtyear+"&hours="+hours+"&minutes="+minutes+"&format="+format+"&timezone="+timezone+"&rand="+calcRand()+"&curtime=true";

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
//----------------------------------calling ajax-------------//
} }

function dosubmit(formn,form){
var chk1=performCheck(formn, rules, 'classic');
	if(chk1==true){
		form.submit();
	}
}

function addprogramsubmit(formn,form){
//	alert(form.protype.value)
var chk1=performCheck(formn, rules, 'classic');

	if(chk1==true){
		form.submit();
	}
}

function calculate(session,months,typeid,price,planid,debug,planidval,viewprice,emailaquestion){

//following condition is for validating email a question program
if(emailaquestion=='true'){
	if(document.priceform6.planid.value==''){
		alert('Please select your plan');
		return false;
	}else{
		planidval=document.priceform6.planid.value;
	}
}

//above condition is for validating email a question program

if(session==''){
	alert('Please provide the number of sessions');
	return false;
}
session=parseInt(session);
months=parseInt(months);
typeid=parseInt(typeid);



if(typeid==1){
if(session>14){
	alert('Please select Unlimited tutoring Plan');
	price.value='';
	return false;
}
}


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert(response);

//alert('ss'+response+'911');
if(debug=='true'){
	document.getElementById('queryview').innerHTML=response;
}else{
arr=response.split("|");

price.value=parseInt(arr[0]);
planid.value=arr[1];
if(viewprice=='hidden'){
	document.getElementById('viewprice').style.display='block';
}
if(typeid==2){
	price.value=parseInt(arr[0])+parseInt(arr[2]);
}


}

}
}
	  
url="calculate.php?session="+session+"&months="+months+"&typeid="+typeid+"&rand="+calcRand()+"&debug="+debug+"&planidval="+planidval;

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax

}
function calculateNew(session,months,typeid,price,planid,debug,planidval,viewprice,emailaquestion){

//following condition is for validating email a question program
if(emailaquestion=='true'){
	if(document.priceform6.planid.value==''){
		alert('Please select your plan');
		return false;
	}else{
		planidval=document.priceform6.planid.value;
	}
}

//above condition is for validating email a question program

if(session==''){
	session=0;
}
session=parseInt(session);
months=parseInt(months);
typeid=parseInt(typeid);



if(typeid==1){
if(session>14){
	alert('Please select Unlimited tutoring Plan');
	price.value='';
	return false;
}
}


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert(response);

//alert('ss'+response+'911');
if(debug=='true')
{
	document.getElementById('queryview').innerHTML=response;
}
else
{
	if(trim(response)!="")
	{
		arr=response.split("|");
		price.value=parseInt(arr[0]);
		planid.value=arr[1];
		if(viewprice=='hidden')
		{
			document.getElementById('viewprice').style.display='block';
		}
		if(typeid==2)
		{
			price.value=parseInt(arr[0])+parseInt(arr[2]);
		}
	}

}

}
}
	  
url="calculate.php?session="+session+"&months="+months+"&typeid="+typeid+"&rand="+calcRand()+"&debug="+debug+"&planidval="+planidval;

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax

}

function priceformsubmit(price,form,button){
	if(price.value==''){
		alert('Please calculate your price before proceeding');
		return false;
	}else{
//		alert(document.getElementById('recurring').innerHTML);
		form.submit();
		button.disabled='disabled';
	}
	
}
function priceformsubmitNew(hours,price,form,button)
{	
	if(hours=='' || hours==0)
	{
		alert('Please provide the number of hours (or sessions)');
		return false;
	}
	else if(price.value=='' || price.value==0)
	{
		alert('Please make sure that price is greater than 0 before proceeding');
		return false;
	}
	else
	{
//		alert(document.getElementById('recurring').innerHTML);
		form.submit();
		button.disabled='disabled';
	}
	
}

function setdateformsubmit(purchaseid){
//		alert(document.getElementById('recurring').innerHTML);
	document.dateupdateform.purchasedid.value = purchaseid;
  document.dateupdateform.submit();
	
}
function sethoursformsubmit(purchaseid, hrs)
{
	newhrs=document.getElementById('sethrs'+purchaseid).value;
	
	document.hoursupdateform.purchasedid.value = purchaseid;
	if(newhrs<hrs)
	{
    	document.hoursupdateform.submit();	
	}
	else if(newhrs>hrs)
	{
		alert("You can not increase the number of hours");
	}
	else
	{
		alert("Please decrease the number of hours")
	}
}

function radiocheck(id){
	var chk=document.getElementById(id);
//	chk.checked=!chk.checked;
chk.click();
len=document.progselform.plan.length;1

for(i=0;i<len;i++){
	if(document.progselform.plan[i].checked==true){
	document.progselform.plan[i].parentNode.parentNode.style.background="#FFFDE1";	
	}else{
	document.progselform.plan[i].parentNode.parentNode.style.background="#FFFFFF";
	}
}
}


var phone = "0123456789";
function res(t,v){
var w = "";
for (i=0; i < t.value.length; i++) {
x = t.value.charAt(i);
if (v.indexOf(x,0) != -1)
w += x;
}
t.value = w;
}



function calculate2(hours,typeid,price,planid,debug){

if(hours==''){
	alert('Please provide the number of hours');
	return false;
}
session=parseInt(hours);
typeid=parseInt(typeid);
selected='';

len=document.progselform.plan.length;

for(i=0;i<len;i++){
	if(document.progselform.plan[i].checked==true){
selected=document.progselform.plan[i].value;
	}
}
if(selected==''){
	alert('Please select one of the plan');
	return false;
}
planid.value=selected;

/*if(typeid==1){
if(session>14){
	alert('Please opt for the recurring plan');
	price.value='';
	return false;
}
}*/


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert(response);

//alert('ss'+response+'911');
if(debug=='true'){
	document.getElementById('queryview').innerHTML=response;
}else{
arr=response.split("|");
price.value=parseInt(arr[0]);
}

}
}
	  
url="calculate2.php?hours="+hours+"&planid="+selected+"&rand="+calcRand()+"&debug="+debug;

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax

}

function calculate2New(hours,typeid,plan,price,planid,debug){

if(hours==''){
	//alert('Please provide the number of hours');
	hours=0;
	//return false;
}
session=parseInt(hours);
typeid=parseInt(typeid);
selected=parseInt(plan);


planid.value=selected;

/*if(typeid==1){
if(session>14){
	alert('Please opt for the recurring plan');
	price.value='';
	return false;
}
}*/


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert(response);

//alert('ss'+response+'911');
if(debug=='true'){
	document.getElementById('queryview').innerHTML=response;
}else{
	if(trim(response)!="")
	{
		arr=response.split("|");
		price.value=parseInt(arr[0]);
	}
}

}
}
	  
url="calculate2.php?hours="+hours+"&planid="+selected+"&rand="+calcRand()+"&debug="+debug;

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax

}

function calculate3(hours,typeid,price,debug){
//planid_val=document.progselform.plan.value;
planid_val=48;
if(planid_val==''){
	alert('Please select your plan');
	return false;
}

planid=planid_val;

if(hours==''){
	alert('Please provide the number of hours');
	return false;
}
session=parseInt(hours);
typeid=parseInt(typeid);
/*if(typeid==1){
if(session>14){
	alert('Please opt for the recurring plan');
	price.value='';
	return false;
}
}*/
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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
		
//alert(response);

//alert('ss'+response+'911');
if(debug=='true'){
	document.getElementById('queryview').innerHTML=response;
}else{
arr=response.split("|");
price.value=parseInt(arr[0]);
document.progselform.planid.value=planid;
}

}
}
url="calculate2.php?hours="+hours+"&planid="+planid+"&rand="+calcRand()+"&debug="+debug;
xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax
}

function calculate3New(hours,typeid,price,debug){
//planid_val=document.progselform.plan.value;
planid_val=48;
if(planid_val==''){
	alert('Please select your plan');
	return false;
}

planid=planid_val;
//alert(hours);
if(hours==''){
	//alert('Please provide the number of hours');
	//return false;
	hours=0;
}
session=parseInt(hours);
typeid=parseInt(typeid);
/*if(typeid==1){
if(session>14){
	alert('Please opt for the recurring plan');
	price.value='';
	return false;
}
}*/
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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
		
//alert(response);

//alert('ss'+response+'911');
if(debug=='true')
{
	document.getElementById('queryview').innerHTML=response;
}
else
{
	if(trim(response)!="")
	{
		arr=response.split("|");
		//alert(arr);
		price.value=parseInt(arr[0]);
		if(typeid==50)
		{
			document.progselform1.planid.value=planid;
		}
		else if(typeid==51)
		{
			document.progselform2.planid.value=planid;	
		}
	}
}

}
}
url="calculate2.php?hours="+hours+"&planid="+planid+"&rand="+calcRand()+"&debug="+debug;
//alert(url);
xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax
}
function monthlyplanformsubmit(form,button){
	len=form.planid.length;
	selected='';
	for(i=0;i<len;i++){
		if(form.planid[i].checked){
			selected=form.planid[i].value
		}
	}
	
if(selected==''){
alert('Please select one of the plan');	
return false;
}
//planid.value=selected;
form.submit();
button.disabled='disabled';
	
}

function completepackage(hours,price,planid,planfield,hoursfield,pricefield){
hoursfield.value=hours;
pricefield.value=price;
planfield.value=planid;
} 

function onhover(tr){
	tr.style.background='#FFFCCE';	
}
function onout(tr){
	tr.style.background='#F5F5F5';	
}

function showdesc(id){
document.getElementById(id).style.display='block';
}

function hidedesc(id){
document.getElementById(id).style.display='none';
}

function validateform(formname,form,button){
for(i=0;i<=form.elements.length;i++){

	if(form.elements[i]){
		if(form.elements[i].type=="checkbox"){
if(form.elements[i].checked==true){
	form.subject.value='true';
	}
	}
	}
}

value=1;
for(i=0;i<=form.elements.length;i++){

	if(form.elements[i]){
		if(form.elements[i].type=="checkbox"){
if(form.elements[i].checked==false){
value++;
	}
	}
	}
}
if(value==7){
	form.subject.value='';
}
var chk=performCheck(formname,rules,'classic');
if(chk==true){
	button.disabled='disabled';
	form.submit();
}
}

function displaytab(id,self){

if(document.getElementById(id).style.display=='none'){
	document.getElementById(id).style.display='block';
	self.innerHTML='&nbsp;&nbsp;<strong>-</strong>&nbsp;&nbsp;';
}else{
	document.getElementById(id).style.display='none';
	self.innerHTML='&nbsp;<strong>+</strong>&nbsp;';
}
}

function showtr(chkbox,id){

browser=navigator.appName;
	if(browser=='Netscape'){

if(chkbox.checked==true){
	document.getElementById('duration').style.display='none';
	document.priceform1.session.value='';
	document.priceform1.session.disabled='disabled';
	document.getElementById(id).style.display='table-row';
	document.priceform1.price.value='';
	document.getElementById('viewprice').style.display='none';
	
}else{
	document.getElementById('duration').style.display='table-row';
	document.getElementById(id).style.display='none';
	document.priceform1.session.disabled='';
	document.priceform1.price.value='';
	document.getElementById('viewprice').style.display='none';
	document.priceform1.seltype.value='';
}
	}else{
if(chkbox.checked==true){
	document.getElementById('duration').style.display='none';
	document.priceform1.session.value='';
	document.priceform1.session.disabled='disabled';
	document.getElementById(id).style.display='block';
	document.priceform1.price.value='';
	document.getElementById('viewprice').style.display='none';
}else{
	document.getElementById('duration').style.display='block';
	document.getElementById(id).style.display='none';
	document.priceform1.session.disabled='';
	document.priceform1.price.value='';
	document.getElementById('viewprice').style.display='none';
	document.priceform1.seltype.value='';
}
	}
}



function calculate1(session,months,typeid,price,planid,debug,planidval,viewprice){

if(session==''){
	alert('Please provide the number of sessions');
	return false;
}

session=parseInt(session);
months=parseInt(months);
typeid=parseInt(typeid);




if(typeid==1){
if(session>14){
	alert('Please select Unlimited tutoring Plan');
	price.value='';
	return false;
}
}


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert(response);

//alert('ss'+response+'911');
if(debug=='true'){
	document.getElementById('queryview').innerHTML=response;
}else{
arr=response.split("|");

price.value=parseInt(arr[0]);
planid.value=arr[1];
document.priceform1.priceval.value=price.value;

priceval=document.priceform1.priceval.value;
selectbox=document.priceform1.months;

if(selectbox.value==1){

value=priceval;
}
if(selectbox.value==2){

price.value=priceval*2;
}
if(selectbox.value==3){

price.value=priceval*3;
}
if(selectbox.value==4){

price.value=priceval*4;
}
if(selectbox.value==5){

price.value=priceval*5;
}


if(viewprice=='hidden'){
	document.getElementById('viewprice').style.display='block';
}
if(typeid==2){
	price.value=parseInt(arr[0])+parseInt(arr[2]);
}

	if(document.priceform1.price.value!=''){
	document.priceform1.button2.disabled='';
	}else{
	document.priceform1.button2.disabled='disabled';				
	}


}

}
}
	  
url="calculate.php?session="+session+"&months="+months+"&typeid="+typeid+"&rand="+calcRand()+"&debug="+debug+"&planidval="+planidval;

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax

}

function calculate1New(session,months,typeid,price,planid,debug,planidval,viewprice){

if(session==''){
	session=0;
}

session=parseInt(session);
months=parseInt(months);
typeid=parseInt(typeid);




if(typeid==1){
if(session>14){
	alert('Please select Unlimited tutoring Plan');
	price.value='';
	return false;
}
}


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert(response);

//alert('ss'+response+'911');
if(debug=='true'){
	document.getElementById('queryview').innerHTML=response;
}else if(trim(response)!=""){
arr=response.split("|");

price.value=parseInt(arr[0]);
planid.value=arr[1];
document.priceform1.priceval.value=price.value;

priceval=document.priceform1.priceval.value;
selectbox=document.priceform1.months;

if(selectbox.value==1){

value=priceval;
}
if(selectbox.value==2){

price.value=priceval*2;
}
if(selectbox.value==3){

price.value=priceval*3;
}
if(selectbox.value==4){

price.value=priceval*4;
}
if(selectbox.value==5){

price.value=priceval*5;
}


if(viewprice=='hidden'){
	document.getElementById('viewprice').style.display='block';
}
if(typeid==2){
	price.value=parseInt(arr[0])+parseInt(arr[2]);
}

	if(document.priceform1.price.value!=''){
	document.priceform1.button2.disabled='';
	}else{
	document.priceform1.button2.disabled='disabled';				
	}


}

}
}
	  
url="calculate.php?session="+session+"&months="+months+"&typeid="+typeid+"&rand="+calcRand()+"&debug="+debug+"&planidval="+planidval;

xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax

}
function setids(selectbox,form){
if(selectbox.value==1){
form.typeid.value=4;
form.planid.value=14;
form.price.value=45;
}
if(selectbox.value==2){
form.typeid.value=4;
form.planid.value=14;
form.price.value=90;
}
if(selectbox.value==3){
form.typeid.value=4;
form.planid.value=14;
form.price.value=135;
}
if(selectbox.value==4){
form.typeid.value=6;
form.planid.value=26;
form.price.value=149;
}
if(selectbox.value==5){
form.typeid.value=6;
form.planid.value=29;
form.price.value=399;
}
if(selectbox.value==6){
form.typeid.value=6;
form.planid.value=27;
form.price.value=749;
}
if(selectbox.value==7){
form.typeid.value=6;
form.planid.value=28;
form.price.value=1049;
}

}

function setmonths(selectbox,form){

price=form.priceval.value;
if(selectbox.value==1){

form.price.value=price;
}
if(selectbox.value==2){

form.price.value=price*2;
}
if(selectbox.value==3){

form.price.value=price*3;
}
if(selectbox.value==4){

form.price.value=price*4;
}
if(selectbox.value==5){

form.price.value=price*5;
}

if(selectbox.value==6){
form.typeid.value=6;
form.planid.value=27;
form.price.value=751;
}

}


function formsubmit(formn,form,button){

var chk1=performCheck(formn, rules, 'classic');

	if(chk1==true){
		form.submit();
		button.disabled='disabled';
	}
	
}


function loadtestcategory(){
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)
        {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	
//alert('ss'+response+'11')
  
  if(response=='success'){
			alert('Added')
		}
		
        }
      }
	  
duration=form.duration.value;
category=form.category.value;
rand=calcRand();

url="ajaxaddduration.php?duration="+duration+"&category="+category+"&rand="+rand;
xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
}



function state_exam_calc(formn){
form=eval('document.'+formn);
var plan=form.plan.value;
var hours=form.hours.value;
var other=form.other.value;
if(plan==''){
	alert('Please select your exam');
	return false;
}
if(plan=='other'&&other==''){
	alert('Please specify your exam');
	return false;
}

form.planid.value=plan;
if(hours==''){
	alert('Please provide the number of hours');
	return false;
}
price=parseInt(hours)*20;
form.price.value=price;
}

function state_exam_calcNew(formn){
form=eval('document.'+formn);
var plan=form.plan.value;
var hours=form.hours.value;
var other=form.other.value;
if(plan==''){
	alert('Please select your exam');
	return false;
}
if(plan=='other'&&other==''){
	alert('Please specify your exam');
	return false;
}

form.planid.value=plan;
if(hours==''){
	hours=0;
}
price=parseInt(hours)*20;
form.price.value=price;
}

function act_submit(formn){
	form=eval('document.'+formn);
	chkbx=form.knowledge.checked;
	if(chkbx==true){
		form.dosubmit.disabled=false;
	}else{
		form.dosubmit.disabled=true;
	}
}

function set_exp(formn){
	form=eval('document.'+formn);
	selbox=form.prior_exp.value;
	id='exp';
	if(selbox=='yes'){
		if(is_moz==true){
			document.getElementById(id).style.display='table-row';
		}else{
			document.getElementById(id).style.display='block';
		}
		rules[25]='yes_exp|required|Please provide, Experience Details.';	
	}else{
		document.getElementById(id).style.display='none';		
		rules[25]='';	
	}
}

function do_submit(formn){
form=eval('document.'+formn);

var chk1=performCheck(formn, rules, 'classic');

	if(chk1==true){
		form.submit();
		form.dosubmit.disabled=true;
	}
	
}

function chkdemo2(formn){
var chk1=performCheck(formn, rules2, 'classic');
form=eval('document.'+formn);
dtfield=form.date.value
hours=form.hours.value
minutes=form.minutes.value
format=form.format.value
timezone=form.timezone.value
check=form.checkdate

if(chk1==true){
//////////////////////////////////////////////////calling ajax
var arr=dtfield.split('-');

dtmonth=arr[0];
dtday=arr[1];
dtyear=arr[2];


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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
	

//alert('ss'+response+'911');
//alert(response);
var arr=response.split('|');
if(arr[0]=='true'){
check.value='ok';
comchk=true;
}else{
alert('Please schedule your session at least according to current time');
check.value='';
comchk='';
}
if(comchk==true){
form.submit();
form.update_but.disabled=true;
}

}

}
url="checkdate.php?dtmonth="+dtmonth+"&dtday="+dtday+"&dtyear="+dtyear+"&hours="+hours+"&minutes="+minutes+"&format="+format+"&timezone="+timezone+"&rand="+calcRand()+"&curtime=true";
xmlHttp.open("GET",url,true);
xmlHttp.send(null); 
////////////////////////////////calling ajax
}

}


function chkdemo3(formn)
{
	var chk1=performCheck(formn, rules2, 'classic');
	form=eval('document.'+formn);
	timezone=form.timezone.value
	if(chk1==true)
	{
		form.submit();
		form.update_but.disabled=true;	
	}
}


function do_delete(id){
var form=document.delete_form;
var agree=confirm('Are you sure ?');
if(agree==true){
form.id.value=id;
form.submit();
}

}

function gmat_cal(){
var form=document.progselform;
var hours=form.hours.value;
var price=form.price;
if(hours==''){
alert('Please provide the hours');
}else{
price.value=hours*25;
}

}

function gmat_cal_new(){ 
var form=document.progselform3;
var hours=form.hours.value;
var price=form.price;
if(hours==''){
//alert('Please provide the hours');
price.value=0;
}else{
price.value=hours*25;
}

}
function gre_cal(){
var form=document.progselform;
var hours=form.hours.value;
var price=form.price;
if(hours==''){
alert('Please provide the hours');
}else{
price.value=hours*20;
}

}
function gre_cal_new(){
var form=document.progselform4;
var hours=form.hours.value;
var price=form.price;
if(hours==''){
//alert('Please provide the hours');
price.value=0;
}else{
price.value=hours*20;
}

}



var js_func={
check_min:function(chkbx){
var form=document.scheduleform;	
var id=chkbx.value;
var test=eval("form.minutes_"+id);
if(test){
rules[29]='max_mins|required|Please select your minutes.';
rules[30]='max_mins|numrange|1-'+test.value+'|Please provide a correct scheduling minutes';
if(is_moz){
document.getElementById('max_min').style.display='table-row';
}else{
document.getElementById('max_min').style.display='block';
}
}else{
rules[29]='';
rules[30]='';
document.getElementById('max_min').style.display='none';	
}

},
make_req:function(url,params,js_response){
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (req) {
req.onreadystatechange = function() {
eval(js_response);
};
}
req.open('get',url+'?rand='+calcRand(), true);
req.send("");
},
max_mins_true:function(){
var form=document.scheduleform;	
form.minutes_chk.value='true';
}

};


function checkdate2(dtfield,hours,minutes,format,timezone,check,button){
	
var arr=dtfield.split('-');
dtmonth=arr[0];
dtday=arr[1];
dtyear=arr[2];
var chk1=performCheck('scheduleform', rules, 'classic');
if(chk1==false){
return false;
}
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)
      {
	
	var response=xmlHttp.responseText;
	response=trim(response);
//alert('ss'+response+'911');
//alert(response);
var arr=response.split('|');
if(arr[0]=='true'){
check.value='ok';
chk2=true;
}else{
alert('Please schedule your session according to your current time');
check.value='';
}
if((chk1==true)&&(chk2==true)){
document.scheduleform.submit();
button.disabled='disabled';
} } }

url="checkdate.php?dtmonth="+dtmonth+"&dtday="+dtday+"&dtyear="+dtyear+"&hours="+hours+"&minutes="+minutes+"&format="+format+"&timezone="+timezone+"&rand="+calcRand()+"&curtime=true";
xmlHttp.open("GET",url,true);
xmlHttp.send(null); 

}


function submitSel(id){
	var sel=document.getElementById(id);
	var url='worksheet.php?cat=';
	location.href=url+sel.value;
}

function submitSel2(id){
	var sel=document.getElementById(id);
	var url='onlinetest.php?';
	if(sel.value=='sat')
	location.href='sat_test.php?cid=101129';
	else
	location.href=url+sel.value;
}

function submitSel3(id){
	var sel=document.getElementById(id);
	var url='assessment_test.php?cat=';
	location.href=url+sel.value+"&catname="+sel.options[sel.selectedIndex].text;
}

function submitSel4(id){
	var sel=document.getElementById(id);
	var url='';
	location.href=url+sel.value;
}

function showPackages(id1,id2){
	document.getElementById(id1).style.display='block';
	document.getElementById(id2).style.display='none';
}

var addMoreSession={
	
display:function (action, progId){

if(action=='display'){
document.getElementById('moreSession').style.display='block';
document.priceform5.programId.value=progId;
}else{
document.getElementById('moreSession').style.display='none';
document.priceform5.programId.value='';
} },

calculate:function (form){
form=eval('document.'+form);
form.price.value=form.session.value*7;
}

}

function showPackageDesc(id,signid){
var div=document.getElementById(id);
var sign=document.getElementById(signid);

if(div.style.display=='block'){
div.style.display='none';
sign.innerHTML='+ ';
}else{
div.style.display='block';
sign.innerHTML='&ndash; ';
} }

function calculateUnlimited(){
if(document.priceform6.seltype.value==''){
alert('Please select your duration');	
}else{
document.getElementById('viewprice2').style.display='block';
if(document.priceform6.price.value!=''){
document.priceform6.button2.disabled='';
}else{
document.priceform6.button2.disabled='disabled';				
} } }

function calculateUnlimitedNew(){
if(document.priceform7.seltype.value==''){
alert('Please select your duration');	
}else{
document.getElementById('viewprice2').style.display='block';
if(document.priceform7.price.value!=''){
document.priceform7.button2.disabled='';
}else{
document.priceform7.button2.disabled='disabled';				
} } }

function load_childs(id, counter,catName){

if(id){
img='img_'+counter;
document.getElementById(img).style.visibility='visible';	
var params = "&catid="+id+"&counter="+counter+"&func=show_child&rand="+calcRand()+"&catName="+catName;
ahahscript.ahah("ajax_assessment.php", 'writer_root'+counter, '', 'post', params,img);
}else{
document.getElementById('img_'+counter).style.visibility='hidden';
document.getElementById('writer_root'+counter).innerHTML='';
}
}
function load_sat(id, counter,catName){

if(id){
img='img_'+counter;
document.getElementById(img).style.visibility='visible';	
var params = "&catid="+id+"&counter="+counter+"&func=show_sat&rand="+calcRand()+"&catName="+catName;
ahahscript.ahah("ajax_assessment.php", 'writer_root'+counter, '', 'post', params,img);
}else{
document.getElementById('img_'+counter).style.visibility='hidden';
document.getElementById('writer_root'+counter).innerHTML='';
}
}

function goAssessment(id){
	var sel=document.getElementById(id);
	var url='assessment_test.php?section=0&testids=';
	var href=url+sel.value;
	location.href=href;
}

