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){
	
/*	alert(dtfield);
	alert(hours);
	alert(minutes);
	alert(format);
	return false;*/
  	
var arr=dtfield.split('-');

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

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

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);

if(response=='true'){
check.value='ok';
chk2=true;
}else{
alert('Please schedule your session at least 24 hours prior to the session 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();
	  
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
	


}

function showdetail(id){

hf=screen.height/4;
hf2=screen.width/4;

window.open("showdetail.php?id="+id,null,"top="+hf+",left="+hf2+",height=250,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();

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);

if(response=='true'){
check.value='ok';
comchk=true;
}else{
alert('Please schedule your session at least according to 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){

//////////////////////////////////////////////////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);

if(response=='true'){
check.value='ok';
comchk=true;
}else{
alert('Please schedule your session at least according to 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){
//	alert(form.protype.value)

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 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]);
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 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 calculate3(hours,typeid,price,debug){

planid_val=document.progselform.plan.value;

//alert(planid_val);

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 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(document.priceform1.chkbox.checked==true){
	if(document.priceform1.seltype.value==''){
	alert('Please select your duration');	
	}else{
	document.getElementById('viewprice').style.display='block';
	if(document.priceform1.price.value!=''){
	document.priceform1.button2.disabled='';
	}else{
	document.priceform1.button2.disabled='disabled';				
	}
	}
}else{
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 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]);
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=402;
}
if(selectbox.value==6){
form.typeid.value=6;
form.planid.value=27;
form.price.value=751;
}
if(selectbox.value==7){
form.typeid.value=6;
form.planid.value=28;
form.price.value=1059;
}

}

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);
plan=form.plan.value;
hours=form.hours.value;
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 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);

if(response=='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 uk_calculate1(){
var form=document.progselform;
var hr_radio=document.getElementById('hourly');
if(form.plan[0].checked==true){
form.price.value=39.99;
}else if(form.plan[1].checked==true){
form.price.value=69.99;
}else if(form.plan[2].checked==true){
form.price.value=99.99;
}else if(hr_radio.checked==true){
if(form.hours.value!=''){
hrs=parseInt(form.hours.value);
var cal_price=hrs*14.99;
form.price.value=cal_price;
}else{
alert('Please provide the hours');
}

}

}

function uk_calculate2(){
var price=document.progselform.price.value;
if(price==''){
alert('Please calculate the price before proceeding');
}else{
document.progselform.submit();
}

}

function uk_show_desc(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 uk_show_tr(){
var form=document.progselform;
var tr_hrs=document.getElementById('tr_hrs');
var hr_radio=document.getElementById('hourly');
form.price.value='';
if(hr_radio.checked==true){
if(is_moz){
tr_hrs.style.display='table-row';
}else{
tr_hrs.style.display='block';
}

}else{
tr_hrs.style.display='none';
}

}
