/* bolly motion validation  */
var homepath="/";
var COURSE_CONTENT_PATH="/home/";
var VIEW_DATA_LOGIN_ERROR='Enter your email address';

function disableFirbug(){
	//alert(window.console);
	if (! ("console" in window) || !("firebug" in console)) {
		var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group"
		, "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
		window.console = {};
		for (var i = 0; i <names.length; ++i) window.console[names[i]] = function() {alert("dd");};
	}	
}

function Pause() {
timer = setTimeout("endpause()",3000); // 3 secs
}
function endpause() {
document.getElementById('subContainer1').style.display="block";	 
document.getElementById('subContainer2').style.display="none";
document.getElementById('subContainer2').innerHTML = "";
}
function chkValidateEmail(){
	var count = 0;
	var errorMsg = Array();	
	if($F('emailBox')==''){
		errorMsg[count]=CHK_VALIDATE_EMAIL_ERROE_1;
		 count++;
	}
	if($F('emailBox')!=''){
		if(!validateEmail($F('emailBox'),1,1)){
			errorMsg[count]=CHK_VALIDATE_EMAIL_ERROE_2;
		 	count++;
		}
	}
	
	if(errorMsg.length > 0){
		document.getElementById("errorDiv").style.display='block';
		document.getElementById("errorDiv").style.visibility='visible';
		showErrorMsg = document.getElementById("errorInnerDiv");
		showErrorMsg.style.display='block';
		showErrorMsg.innerHTML = "";
		for(i=0;i<errorMsg.length;i++){
			showErrorMsg.innerHTML += '<div class="errorList">'+errorMsg[i]+'</div>';
		}
		window.scroll(0,0);
		setTimeout("sleepTimeOutDisplay('errorDiv')",20000);
		return false;
	}else{
			var url = homepath+'instructor_teachingassistant_operation.php';
			var rand = Math.random(9999);
			var params = 'email_id='+$F('emailBox')+'&mode=ChECkEmAiLExIsT&rand='+rand;	
			var myAjax = new Ajax.Request(url, {method: 'post', 
												parameters: params, 
												onSuccess: function(transport){	
													//alert(transport.status);
													responseCheck(transport.status);
												   if(transport.responseText){	
												   		var getEcho =transport.responseText.split(',');
														
														if(trim(getEcho[0])=='newUser'){
															//changeTechAss($F('emailBox'));
															showLoad();
															updateTeachAssistant('',$F('emailBox'));															
														}		
														if(trim(getEcho[0])=='alreadyUser'){
															GetPermissionTeachAssDetails(getEcho[2],getEcho[1],$F('emailBox'));
															$('emailBox').value='';
															$('emailTxtDiv').style.display='none';
														}
														if(trim(getEcho[0])=='taUser'){
															GetPermissionTeachAssDetails(getEcho[2],getEcho[1],$F('emailBox'));
															$('emailBox').value='';
															$('emailTxtDiv').style.display='none';
														}
														if(trim(getEcho[0])=='student'){
															   //alertStudentCheck(getEcho[1],getEcho[2]);
															   document.getElementById("errorDiv").style.display='block';
																document.getElementById("errorDiv").style.visibility='visible';
																showErrorMsg = document.getElementById("errorInnerDiv");
																showErrorMsg.style.display='block';
																showErrorMsg.innerHTML = "";
																showErrorMsg.innerHTML += '<div class="errorList">'+CHK_VALIDATE_EMAIL_ERROE_4+'</div>';
																window.scroll(0,0);
																setTimeout("sleepTimeOutDisplay('errorDiv')",20000);
																return false;
														}
														if(getEcho[0]=='instructor'){															
															    document.getElementById("errorDiv").style.display='block';
																document.getElementById("errorDiv").style.visibility='visible';
																showErrorMsg = document.getElementById("errorInnerDiv");
																showErrorMsg.style.display='block';
																showErrorMsg.innerHTML = "";
																showErrorMsg.innerHTML += '<div class="errorList">'+CHK_VALIDATE_EMAIL_ERROE_3+'</div>';
																window.scroll(0,0);
																setTimeout("sleepTimeOutDisplay('errorDiv')",20000);
																return false;														
														}
												 	}
											  	}
												}
										 	 ); 	
	}
}

function checkValue(evt,val) {
  var count	=	0;	
  evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
				if (charCode > 31 && (charCode < 97 || charCode > 122) && (charCode < 65 || charCode > 90) && charCode!=32) {
										return false;
						}
				if(val.length==0 && charCode==32){
									return false;
				}
   /*if(charCode==32){     
	       	for(i=0;i<val.length;i++){
	        if(val.charCodeAt(i)==46){
		      count++
			   }
			}
	}
	if(count > 0){
	   return false
	}*/
	return true;

}
function characterPassValue(evt) {
  evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
   //alert(charCode)
  if (charCode > 31 && (charCode < 97 || charCode > 122) && (charCode < 65 || charCode > 90) && (charCode < 48 || charCode > 57)) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
	return true;

}
function IsNumeric(strString){
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;
   if (strString.length == 0) return false;
   for (i = 0; i < strString.length && blnResult == true; i++){
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1){
         blnResult = false;
      }
   }
   return blnResult;
}
function openpopup(url,name,options,fullscreen) {
  fullurl = homepath + url;
  windowobj = window.open(fullurl,name,options);
  if (fullscreen) {
     windowobj.moveTo(0,0);
     windowobj.resizeTo(screen.availWidth,screen.availHeight);
  }
  windowobj.focus();
  return false;
}

function isValidEmail(str) {
	if(!(/^[^a-zA-Z]/.test(str)) && (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str))) {
		return true
	} else {
		return false
	}
 }
 
 function numericValue(evt) {
	
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));	
	
    if (charCode > 31 && (charCode < 48 || charCode > 57) || charCode==46) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
}

function phoneValue(evt) {
	//alert(evt);
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
	
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=45) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
}


function zipValue(evt) {
		evt = (evt) ? evt : event;
		var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
			((evt.which) ? evt.which : 0));
		 if(eval($('nCntryId')) && $('nCntryId').value=='ca'){
			 // && charCode!=45;
	      if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 97 || charCode > 122) && (charCode < 65 || charCode > 90)) {
			   return false;
		    }
		    return true;
		}else{
		   if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=45) {
			   return false;
		    }
		    return true;
		
		}
	
}

function floatValue(evt) {////46 for DOT(.)
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=46) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
} 

function isValidString(str){
		var result	=	true;
		var iChars = "`~!@#$%^&*()+=[]\\\';,./{}|\":<>";
		
		//if string is NULL return false;
		if(str.length == 0) return false;
		for (var i = 0; i < str.length; i++) {
			if (iChars.indexOf(str.charAt(i)) != -1) {
				result	=	false;
			}
		}

	 return result;
	}
	
	function isValidStringCharacter(str){
		var result	=	true;
		var iChars = "`~!@#$%^&*()+=[]\\\';,./{}|\":<>_-";
		
		//if string is NULL return false;
		if(str.length == 0) return false;
		for (var i = 0; i < str.length; i++) {
			if (iChars.indexOf(str.charAt(i)) != -1) {
				result	=	false;
			}
			
		}

	 return result;
	}
function isValidZip(strString)
//  check for valid numeric strings	
{
var strValidChars = "0123456789";
var strChar;
var blnResult = true;

if (strString.length == 0) return false;
if(strString.length!=5) return false;
var totalValue	=	0;
//  test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
  {
  strChar = strString.charAt(i);
  totalValue	+=	parseInt(strString.charAt(i));
	
  if (strValidChars.indexOf(strChar) == -1)
	 {
	 blnResult = false;
	 }

  }
if(totalValue==0) return false;
return blnResult;
}

function isValidPhone(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
   if(strString.length<10) return false;
	var totalValue	=	0;
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
    strChar = strString.charAt(i);
	totalValue	+=	parseInt(strString.charAt(i));
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
		
	if(totalValue==0) return false;
   return blnResult;
   }
   
   
 function isValidStringonly(strString, $length)
   //  check for valid numeric strings	
   {
   var strValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
   if(strString.length<length) return false;
	var totalValue	=	0;
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
    strChar = strString.charAt(i);
	totalValue	+=	parseInt(strString.charAt(i));
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
		
	if(totalValue==0) return false;
   return blnResult;
   }  
   
function sleepTimeOutDisplay(divId){
$(divId).style.display	=	'none';

}
function showResponse(serverResponse){		
	 $('load').style.display = 'none';		 
	 var showTplMsg = $("dataContainer");
	 showTplMsg.innerHTML = "";
	 showTplMsg.innerHTML = serverResponse.responseText; 
}

function HoverIn(id1, id2)
{	
	document.getElementById(id1).style.color = '#FFFFFF';
	document.getElementById(id2).style.color = '#FFFFFF';
}
function HoverOut(id1, id2)
{	
	document.getElementById(id1).style.color = '#0099FF';
	document.getElementById(id2).style.color = '#000000';
}

function showLoad () {
	$('load').style.display = 'block';
	//alert($('load').style.display);
	
}
function hideLoad () {
	$('load').style.display = 'none';
	$('load').hide();
	//alert($('load').style.display);
	
}
/*----------------------------------------*/
function sendRedirectAjaxHandler(page){
	//$('grid').style.visibility='hidden';
	window.location.href=page;	
}
function disableBackkey(e) {
	var k =	document.layers ? e.which :	document.all ? event.keyCode :	$ ? e.keyCode : 0;
	if (k==8) { //alert('back disabled');
		return false;
	}
}
function newLogocss(){
	$('img_logo').className = 'logo_new';
}

function getUsernameFocus(){
 if(eval($('strLogin')) && $('strLogin').value==''){
  $('strLogin').focus();
 }
}
function changeDisplayLebel(id){
	 $(id).style.color = "#3C3737";
}


function formvalidate(frm){  //               Common Java Script Files   
	
	var cntError = 0;
	var errorMsg = Array();
	var errorField = Array();
	
    if($('fname').value==""){
			errorMsg[cntError] = 'Please enter your first name.';
			errorField[cntError] = 'fname';
			$('fname_label').style.color = "Red"
			cntError++;
    	}else{
		    $('fname_label').style.color = "#3C3737";
	   }
		
       if($('lname').value==""){
			errorMsg[cntError] = 'Please enter your Last name';
			errorField[cntError] = 'lname';
			$('lname_label').style.color = "Red"
			cntError++;
    	}else{
		  $('lname_label').style.color = "#3C3737";
	   }
	   if($('email').value==""){
			errorMsg[cntError] = 'Please enter your Email Address.';
			errorField[cntError] = 'email';
			$('email_label').style.color = "Red"
			cntError++;
    	}else{
		    $('email_label').style.color = "#3C3737";
	   }
	    if(!isValidEmail($('email').value)){
			errorMsg[cntError] = 'Please enter valid email address.';
			errorField[cntError] = 'email';
			$('email_label').style.color = "Red"
			cntError++;
    	}else{
		    $('email_label').style.color = "#3C3737";
	   }
	 	if($('password').value==""){
		errorMsg[cntError] = 'Please enter your Password';
		errorField[cntError] = 'password';
		$('password_label').style.color = "Red"
		cntError++;
	}else{
	 $('password_label').style.color = "#3C3737";
	}
   
	if($('cpassword').value==""){
		errorMsg[cntError] = 'Please enter your confirm Password';
		errorField[cntError] = 'cpassword';
		$('cpassword_label').style.color = "Red"
		cntError++;
	}else{
	 $('cpassword_label').style.color = "#3C3737";
	}
	if($('password').value!="" && $('cpassword').value!=""){
		        
                   if($('password').value!=""){	
				    	var pass=$('password').value;
					    var a=pass.length;
					    if(pass.length>="16" || pass.length<= "4"){
										
							errorMsg[cntError] = 'The length of password should be between 5 and 16 character.';
					       $('password_label').style.color = "Red"
					
							
						 }
						  else
						  {
						 $('password_label').style.color = "#3C3737";
						  }
				    }
				    if($('cpassword').value!=""){	
						var pass=$('cpassword').value;
						var a=pass.length;
						
						if(pass.length>="16" || pass.length<= "4"){
								errorMsg[cntError] = 'The length of Confirm password should be between 5 and 16 character.';
							   $('cpassword_label').style.color = "Red"
						
								
						 }
						  else
						  {
						 $('cpassword_label').style.color = "#3C3737";
						  }
				   }
	              if($('password').value!=$('cpassword').value){
			//alert($('password').value
					//errorMsg[cntError] = 'confirmpass';
					errorMsg[cntError] = 'Password and confirm password should be matched.';
					$('cpassword_label').style.color = "Red"
				
					//errorMsg[cntError] = 'newpass';
					//errorField[cntError] = 'Password and confirm password should be matched.';
					//$('cpassword_label').style.color = "Red"
					
					
	            }
			  else
			   {
				$('password_label').style.color = "#3C3737"
				$('cpassword_label').style.color = "#3C3737"
		       }
           }
	/*if($('city').value==""){
		errorMsg[cntError] = 'Please enter your City.';
		errorField[cntError] = 'city';
		$('city_label').style.color = "Red"
		cntError++;
	}else{
		$('city_label').style.color = "#036";
	}
	
	 if($('zipcode').value==""){
		errorMsg[cntError] = 'Please enter your Zip Code.';
		errorField[cntError] = 'zipcode';
		$('zipcode_label').style.color = "Red"
		cntError++;
	}else{
		$('zipcode_label').style.color = "#036";
	}*/
	 
	/* if($('selectstate').style.display=="block"){		
	    if($('strSelect').value=="no"){	
			errorMsg[cntError] = 'strState';
			errorField[cntError] = 'strState';
			$('strState_label').style.color = "Red"
			cntError++;
           }else{
		    $('strState_label').style.color = "#036";
	      }
	 }
	
	if($('textstate').style.display=="block"){		
	    if($('strState').value==""){	
			errorMsg[cntError] = 'strState';
			errorField[cntError] = 'strState';
			$('strState_label').style.color = "Red"
			cntError++;
           }else{
		    $('strState_label').style.color = "#036";
	      }
	 }
	if($('nCntryId').value=='US'){
		if($('strZip').value=="" || $('strZip').value.length<="4" || $('strZip').value.length=="6" ){
			errorMsg[cntError] = 'strZip';
			errorField[cntError] = 'strZip';
			$('strZip_label').style.color = "Red"
			cntError++;
		}else{
			$('strZip_label').style.color = "#036";
		}
    }
	if($('nCntryId').value=='ca'){
		if($('strZip').value=="" || $('strZip').value.length<="4"){
			errorMsg[cntError] = 'strZip';
			errorField[cntError] = 'strZip';
			$('strZip_label').style.color = "Red"
			cntError++;
		}else{
			$('strZip_label').style.color = "#036";
		}
    }
	
	if(errorMsg.length == 0)
	 {
		   if($('strEmail').value!=""){
				   if(!validateEmail($('strEmail').value,1,1)){
					errorMsg[cntError] = 'Email is not in Proper format';
					errorField[cntError] = 'strEmail';
					$('strEmail_label').style.color = "Red"
					cntError++;
								var Output2 = "<strong>Please enter a valid email address.</strong>";
								//$('correct_label').style.display ='none';
								$("errorDiv").innerHTML = Output2;
								return false;      
				   }    
				  else
				   {
					$('strEmail_label').style.color = "#036";
				   }
		  }*/
	
		   
	
	
	if(errorMsg.length > 0){
		
		document.getElementById("errorDiv").style.display='block';
		showErrorMsg = document.getElementById("errorInnerDiv");
		showErrorMsg.style.display='block';
		showErrorMsg.innerHTML = "";
		for(i=0;i<errorMsg.length;i++){
			//alert(errorMsg[i]);
			showErrorMsg.innerHTML += '<li>'+errorMsg[i]+'</li>';
		}
		
		setTimeout("sleepTimeOutDisplay('errorDiv')",3000);
		setTimeout("changeDisplayLebel('fname_label')",3000);
		setTimeout("changeDisplayLebel('lname_label')",3000);
		setTimeout("changeDisplayLebel('email_label')",3000);
		setTimeout("changeDisplayLebel('password_label')",3000);
		setTimeout("changeDisplayLebel('cpassword_label')",3000);

	}else{
             var email = $('email').value;
            var url = "check_email.php";
            var params = "email="+email;
            var myAjax = new Ajax.Request(url, {method: 'post', 
                                                parameters: params, 
                                                onComplete: function(transport){    
                                                  // alert(transport.responseText);return false;
                                                         if(transport.responseText=='present') {
                                                                   //alert('nikhil');  
                                                            errorMsg1 = 'Email address already exist.';
                                                            $('email_label').style.color = "Red"  
                                                            document.getElementById("errorDiv").style.display='block';
                                                            showErrorMsg = document.getElementById("errorInnerDiv");
                                                            showErrorMsg.style.display='block';
                                                            showErrorMsg.innerHTML = "";
                                                            showErrorMsg.innerHTML += '<li>'+errorMsg1+'</li>';
                                                            setTimeout("sleepTimeOutDisplay('errorDiv')",3000); 
                                                            setTimeout("changeDisplayLebel('email_label')",3000);  
                                                             //ValidEmail = false;  
                                                              return false;
                                                              } else{
                                                              frm.postData.value='Processing...';
															  frm.postData.disabled=true;
															  frm.submit();                                         
                                                           }}}); 
	}
}
function checksubsription(thisform){
			
			var cntError = 0;
			var errorMsg = Array();
			var errorField = Array();
			// place any other field validations that you require here
		// validate myradiobuttons
		document.getElementById("errorDiv").style.display='none';
		myOption = -1;
		for (i=thisform.access.length-1; i > -1; i--) {
		if (thisform.access[i].checked) {
		myOption = i; i = -1;
		}
		}
		if (myOption == -1) {
				errorMsg[cntError] = 'Please select subscription';
				errorField[cntError] = 'Please select subscription ';
				//$('zipcode_label').style.color = "Red"
				cntError++;
		}
		if(errorMsg.length > 0){
		/*var Output2 = 'Please select your subscription.';
		document.getElementById("errorDiv").style.display='block';
		$("errorDiv").innerHTML = Output2;
		setTimeout("sleepTimeOutDisplay('errorDiv')",3000);*/
		document.getElementById("errorDiv").style.display='block';
		showErrorMsg = document.getElementById("errorInnerDiv");
		showErrorMsg.style.display='block';
		showErrorMsg.innerHTML = "";
		for(i=0;i<errorMsg.length;i++){
			//alert(errorMsg[i]);
			showErrorMsg.innerHTML += '<li>'+errorMsg[i]+'</li>';
		}
		//$("errorDiv").innerHTML = Output2;
		setTimeout("sleepTimeOutDisplay('errorDiv')",3000);
		//setTimeout("changeDisplayLebel('myOption')",3000);
        
		return false;
		}else{
		thisform.subscription.value='Processing...';
		thisform.subscription.disabled=true;
		thisform.submit(); //	
		}
}
function state(id){
		var comboDivBox	=	document.getElementById('strStateselect');
		
		if(eval($('zipcode'))){
				$('zipcode').value="";
						}
				if(eval($('zipcode')) && id=='ca'){		   
							$('zipcode').maxLength='6';
						
						}
							if(eval($('zipcode')) && id=='US'){
					$('zipcode').maxLength='5';
				}
		var new_opt= new Option("Loading...","");
		comboDivBox.options[0]=new_opt;
		var url = "proccess_signup.php";
		var rand = Math.random(9999);
		var params = 'state_id='+id+'&rand='+rand;	
        var myAjax = new Ajax.Request(url, {method: 'post', 
											parameters: params,	
											onComplete: state_Change//alert(transport.responseText);return false;
										  });
		return true;

}
 function state_Change(serverResponse)
	{	
	      document.getElementById("selectstate").style.display='block';
			document.getElementById("selectstatetxt").style.display='none';
	  if (serverResponse.responseText!= "no")
	   { 
		  var stateinfo = serverResponse.responseText;
		  var datalist = Array();
		  datalist = stateinfo.split(':');
					$('strStateselect').remove(0);
		 
					for( i=0; i < datalist.length; i++)
						{		
					var	dataChunk	=	Array();
					dataChunk	=	datalist[i].split('||'); //splict entire string from response
					var selectedCheckValueModel	=	document.getElementById('selectedstate').value;
					var new_opt= new Option(dataChunk[1],dataChunk[0]);
					
					document.getElementById('strStateselect').options[i]=new_opt;
						}
		 }else{
			if(document.getElementById('strStateselect').options.length!=1){
								for(i=document.getElementById('strStateselect').options.length-1;i>=0;i--)
						{	
							$('strStateselect').remove(i);
						}
					}
			document.getElementById("selectstate").style.display='none';
			document.getElementById("selectstatetxt").style.display='block';
			document.getElementById("strStateselect1").value='';
				var new_opt= new Option("Select State","no");
				document.getElementById('strStateselect').options[0]=new_opt;
		}
	}
	
	
function loginValidationMain(frm){
	//alert(1);
    var cntError = 0;
	var errorMsg = Array();	
	var errorField = Array();
	var frm=frm;
    var mail=frm.strLogin.value;
	document.getElementById('popDiv1').style.display='none';
	if(frm.strLogin.value=="Enter your email address"){
		document.getElementById('strLogin').className ='errortdfield';
		errorField[cntError] = 'Please provide a valid email</li>';
	    cntError++;
		
		}
	else if(!isValidEmail(frm.strLogin.value)){
		document.getElementById('strLogin').className ='errortdfield';
		errorField[cntError] = 'Please provide a valid email.';
	    cntError++;
		
		}else{

			
			document.getElementById('strLogin').className ='';
			
		}
	if(frm.strPassword1.value=="" || frm.strPassword1.value=="password" ){
		document.getElementById('strPassword1').className ='errortdfield';
		errorField[cntError] = 'Please provide the password';
	    cntError++;
		
		}else{
			document.getElementById('strPassword1').className ='';
		}
		
		if(errorField.length > 0){
			document.getElementById('popDiv1').style.display='block';
			document.getElementById('error_div1').innerHTML='';
			for(i=0;i<errorField.length;i++){
			document.getElementById('error_div1').innerHTML += '<li>'+errorField[i]+'</li>';
			}
								setTimeout("sleepTimeOutDisplay('popDiv1')",3000);

			return false;

		}else{
		//chekmail(frm);
		frm.submit();
		return true;
		//return false;
		}
	}
	
	function openPassPop(){
        $('popDiv').style.display='block'; 
	}

	function passwordValidation(frm){
	var Email    = frm.emailid;
	//alert(Username);
    var cntError = 0;
	var errorMsg = Array();	
	
	if(!isValidEmail(Email.value,1,1)){
		
		 var Output = "Please enter your valid email id";
        		$("successMessageDiv_pop").innerHTML = Output;
				$("errorDiv_pop").style.display='none';
				$("successMessageDiv_pop").style.display="block";
				$('successMessageDiv_pop').style.color='#FF0000';
				
				//$('label_mailadd').style.color='#FF0000';
		
				Email.focus();
				//return false;
	}else {	
		$('label_mailadd').style.color='';
		
		var file = 'forget_pass_process.php';
		//alert(file);
	 	var myAjax = new Ajax.Request(file, 
                                   {method: 'post', parameters: $(frm).serialize(), 
                                   onComplete:
                                        function(transport){
                                            if(transport.responseText=='send'){
                                                $('errorDiv_pop').style.display    =    'none';
                                                $("successMessageDiv_pop").style.display="block";
                                                $('successMessageDiv_pop').style.color='#000000'; 
                                                $('successMessageDiv_pop').innerHTML= 'Your login password has been sent on your email address.';
                                                setTimeout("sleepTimeOutDisplay('successMessageDiv_pop')",10000);
                                                frm.reset();   
                                            }else{
                                                $('errorDiv_pop').style.display    =    'none';
                                                $("successMessageDiv_pop").style.display="block";
                                                $('successMessageDiv_pop').innerHTML= 'Email address does not exist.';
                                                $('successMessageDiv_pop').style.color='#FF0000';
                                                setTimeout("sleepTimeOutDisplay('successMessageDiv_pop')",10000);
                                                frm.reset();     
                                                
                                            }
                                            
                                        }
                                   });
		
	}
 }

function showHideAnyBox(box_id){ //alert(1)
    var boxDivId    = document.getElementById(box_id);
    if(boxDivId.style.display=='block')
        boxDivId.style.display    ='none';
    else
        boxDivId.style.display    ='block';
    //alert(boxDivId.style.visibility);
}
function handleResponse(transport){
    //alert(transport.responseText);  return false;
    var showDiv    =    $('errorDiv_pop');
    showDiv.style.display='none';
    showDiv.innerHTML = transport.responseText;
    $('resultshere1').style.display    =    'none';
    //alert(transport.responseText);
    }
function EnterKey(e,frm)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13){
        loginValidationMain(frm);
            return false;
     }
     
}
function EnterKey1(e,frm)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13){
        passwordValidation(frm);
            return false;
     }
     
}
function state2(id){
	
		var comboDivBox	=	document.getElementById('strStateselect');
		if(eval($('zipcode'))){
			$('zipcode').value="";
					}
	 if(eval($('zipcode')) && id=='ca'){		   
		   $('zipcode').maxLength='6';
	   }
	 if(eval($('zipcode')) && id=='US'){
			$('zipcode').maxLength='5';
			}
		var new_opt= new Option("Loading...","");
		comboDivBox.options[0]=new_opt;
		var url = "proccess_signup.php";
		var rand = Math.random(9999);
		var params = 'state_id='+id+'&rand='+rand;	
        var myAjax = new Ajax.Request(url, {method: 'post', 
											parameters: params,	
											onComplete: state2_Change//alert(transport.responseText);return false;
										  });
			
		
  return true;

}

 function state2_Change(serverResponse)
	{	

	  document.getElementById("selectstate").style.display='block';
		document.getElementById("selectstatetxt").style.display='none';
	   if (serverResponse.responseText!= "no")
	   { 
	    
		  var stateinfo = serverResponse.responseText;
		  var datalist = Array();
		  datalist = stateinfo.split(':');
				$('strStateselect').remove(0);
				 var mySelect = document.getElementById('strStateselect') ;
       mySelect.options.length = 0;
		var new_opt= new Option("Select State","no");
		var new_opt= new Option("Loading...","");
		var output = [];
		
		 	for(i=0; i < datalist.length; i++)
						{
							
					
										var	dataChunk	=	Array();
										dataChunk	=	datalist[i].split('||'); //splict entire string from response
										//var selectedCheckValueModel	=	document.getElementById('selectedstate').value;
										var new_opt= new Option(dataChunk[1],dataChunk[0]);
										
										document.getElementById('strStateselect').options[i]=new_opt;
						}
						
					}else{
		document.getElementById("selectstate").style.display='none';
		document.getElementById("selectstatetxt").style.display='block';
		
			document.getElementById("strStateselect1").value='';
		  // $('strStateselect').remove(0);
		
	   }
	}
	/* Added for left.php - 26th july */

function showDefaultValue(type){
	//alert(type);
	if(type=='hide' && $('strLogin').value==VIEW_DATA_LOGIN_ERROR)
		$('strLogin').value="";
	else if(type=='show' && $('strLogin').value=="")
		$('strLogin').value=VIEW_DATA_LOGIN_ERROR;
		
		
}

function showDefaultPssValue(type){
	//alert(type);
	if(type=='hide' && $('strPassword1').value=='password')
		$('strPassword1').value="";
	else if(type=='show' && $('strPassword1').value=="")
		$('strPassword1').value='password';
}

/* Add other states - 28th july 2010 */
function disable(id)
{
	 if(id == 'Others'){
		 	 alert(id);
        document.frm.strStateselect.disabled = true;
		document.frm.strStateselect1.disabled = false;

	 }else if(id == 'US'){
		 		 	 alert(id);
        document.frm.strStateselect.disabled = false;
	 	document.frm.strStateselect1.disabled = true;

     }else if(id == 'ca'){
		  alert(id);
         document.frm.strStateselect.disabled = false;
	 	 document.frm.strStateselect1.disabled = true;
     }
	 return true;
}
function login_lms(frm){
   //alert(frm);
    frm.submit();
}

/* bolly motion validation ends here */

