function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

	function validateExam1()
	{
	var error="";

	if (window.document.getElementById("fname").value == "")
	  {
	   error += "- First Name (Prenom)\n";
	  }
	if (window.document.getElementById("lname").value == "")
	  {
	   error += "- Last Name (Nom)\n";
	  }
	if (trim(window.document.getElementById("empnum").value) != trim(window.document.getElementById("empnum2").value))
	  {
	   error += "- Employee # does not match (Numéro d'employé ne correspond pas)\n";
	  }
	if ((window.document.getElementById("region")) && window.document.getElementById("region").value == "")
	  {
	   error += "- Region\n";
	  }
	if (window.document.getElementById("tlocation") && window.document.getElementById("tlocation").value == "")
	  {
	   error += "- Training Location\n";
	  }
	if (error == "")
	{
	   return true;
	} else {
	    error="The following items are mandatory.\n\n"+error;
	    alert(error);
	    return false;
	       }
	}

	function validateExam1b()
	{
	var error="";

	if (window.document.getElementById("location").value == "")
	  {
	   error += "- Location\n";
	  }
	if (error == "")
	{
	   return true;
	} else {
	    error="The following items are mandatory.\n\n"+error;
	    alert(error);
	    return false;
	       }
	}
	
	
	function validateQuestion(l)
	{
	var error="";

	if (window.document.getElementById("answer").value == "")
	  {
	   error += "- Location\n";
	  }
	if (error == "")
	{
	   return true;
	} else {
	if(l=="fr")
	{
	    error="Continuer sans avoir à répondre ?";
	}
	else if(l=="sp")
	{
	    error="¿Continúe sin respuesta?";
	}
	else
	{
	    error="Continue without answering?";	
	}
	return confirm(error);
	    }
	}
	
	function companyCheck_bk()
	{
	   input1 = window.document.getElementById("co").value;
	   input1 = input1.toLowerCase();
	   if(input1=="tra")
	   {
		window.document.getElementById("co").value="TransCanada";
	   }
	   if(input1=="syn")
	   {
	   	window.document.getElementById("co").value="Syncrude";
	   }

	   if(input1=="can")
	   {
		window.document.getElementById("co").value="Canada Training Group";
	   }
	   if(input1=="con")
	   {
		window.document.getElementById("co").value="Consumers' Co-operative Refinery";
	   }
	   if(input1=="mea")
	   {
		window.document.getElementById("co").value="Meadow Lake Mechanical Pulp Ltd.";
	   }
	   if(input1=="tor")
	   {
		window.document.getElementById("co").value="Toronto Transit Commission";
	   }
  
	}

		function validate_ser_form()
		{
			if (document.ser_form.T1.value=="")
			{
				alert("Please enter text for search ..!")	
				document.ser_form.T1.focus();
				return false;
			}
			
		}



		function clear_field(x)
		{
			if (x=="Name")	
			{
				document.eml.textfield.value="";	
			}
			
			
			if (x=="Email")	
			{
				document.eml.textfield2.value="";	
			}			

			if (x=="Postal/Zip Code")	
			{
				document.eml.T1.value="";	
			}			

			if (x=="phone")	
			{
				document.eml.T2.value="";	
			}			

			if (x=="city")	
			{
				document.eml.T3.value="";	
			}			

		}


		function show_buttons(x)
		{
			
			if (document.getElementById('C1_1').checked==true)
			{
				if (x=="C")
				{
				document.getElementById('pay_but').disabled=false;
				}
			document.getElementById('contin').style.visibility="visible";
			document.getElementById('contin').style.display="";
			}
			else
			{
				if (x=="C")
				{				
				document.getElementById('pay_but').disabled=true;
				}
			document.getElementById('contin').style.visibility="hidden";
			document.getElementById('contin').style.display="none";			
			}
		}	



		function check_user_form()
		{
			var obj = document.getElementsByName('T1[]');			
			
			if (obj.length>1)
				{
					for (i=0;i<obj.length;i++)
					{
						
						if (document.user_form.T1[i].value=="")	
						{
							alert("Please enter full name");	
							document.user_form.T1[i].focus();
							return false;
						}				
		
						if (document.user_form.T2[i].value=="")	
						{
							alert("Please enter email id");	
							document.user_form.T2[i].focus();
							return false;
						}				
						
						if (document.user_form.T3[i].value=="")	
						{
							alert("Please enter emergency phone");	
							document.user_form.T3[i].focus();
							return false;
						}								
					}
				}
				else
				{
						if (document.user_form.T1.value=="")	
						{
							alert("Please enter full name");	
							document.user_form.T1.focus();
							return false;
						}				
		
						if (document.user_form.T2.value=="")	
						{
							alert("Please enter email id");	
							document.user_form.T2.focus();
							return false;
						}				
						
						if (document.user_form.T3.value=="")	
						{
							alert("Please enter emergency phone");	
							document.user_form.T3.focus();
							return false;
						}													
				}	
			

			
			if (document.user_form.T4.value=="")	
			{
				alert("Please enter first name...!")
				document.user_form.T4.focus();
				return false;
			}						

			if (document.user_form.T5.value=="")	
			{
				alert("Please enter last name...!")
				document.user_form.T5.focus();
				return false;
			}									

			if (document.user_form.T6.value=="")	
			{
				alert("Please enter company name...!")
				document.user_form.T6.focus();
				return false;
			}												

			if (document.user_form.T7.value=="")	
			{
				alert("Please enter company address...!")
				document.user_form.T7.focus();
				return false;
			}												

			if (document.user_form.T8.value=="")	
			{
				alert("Please enter city...!")
				document.user_form.T8.focus();
				return false;
			}												

			if (document.user_form.T9.value=="")	
			{
				alert("Please select state...!")
				document.user_form.T9.focus();
				return false;
			}												

			if (document.user_form.T10.value=="")	
			{
				alert("Please enter zip...!")
				document.user_form.T10.focus();
				return false;
			}															
			

			if (document.user_form.T11.value=="")	
			{
				alert("Please enter phone...!")
				document.user_form.T11.focus();
				return false;
			}																		

                                if(!validateEmail(user_form.T13.value))
                                        {                                                                       
                                        alert("Please enter a valid email id"); 
                                        user_form.T13.focus();
                                        user_form.T13.select();                                      
                                        return false;
                                        }                       			
		}


                function check_dis_coup()
                {
                        ccode=document.disc_form.c_code.value;      
                        ccodeid=document.disc_form.cup_id.value;                                                        
                        
                                        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(a)
      {   
        
        if(xmlHttp.readyState==4)
        {                 
                        if (xmlHttp.responseText)
                                {
                                document.getElementById('ans_here').innerHTML="Discount Coupon Approved.";
                                document.getElementById('ans').style.visibility="visible";       
                                document.getElementById('ans').style.display="";                                                                   

				document.disc_form.submit();	

                                //document.getElementById('bean_main').style.visibility="visible";       
                                //document.getElementById('bean_main').style.display="";                                                                                                   
                                
                                }
                                else
                                {
                                document.getElementById('ans_here').innerHTML="Invalid Coupon ID. Please try again....!";
                                document.getElementById('ans').style.visibility="visible";       
                                document.getElementById('ans').style.display="";                                                                                                   	
                                }
                                
                                                
        
        }
      }             
       
                var URL="check_disc_code.php";  
                URL=URL+"?q="+ccode+"&ccodeid="+ccodeid;                                                                                        
                                //alert(URL)
                xmlHttp.open("GET",URL,true);
                xmlHttp.send(null); 
                }       
                
                
                
                


                function show_disc_str(x)
                {
                        if (x=="Y")
                        {
                                document.getElementById('disc_y').style.visibility="visible";   
                                document.getElementById('disc_y').style.display="";     

                                document.getElementById('disc_y2').style.visibility="visible";  
                                document.getElementById('disc_y2').style.display="";                                    

                                document.getElementById('bean_main').style.visibility="hidden"; 
                                document.getElementById('bean_main').style.display="none";                                                                                                                                              
                        }
                        else
                        {
                                document.getElementById('disc_y').style.visibility="hidden";    
                                document.getElementById('disc_y').style.display="none"; 

                                document.getElementById('disc_y2').style.visibility="hidden";   
                                document.getElementById('disc_y2').style.display="none";        

                                document.getElementById('bean_main').style.visibility="visible";        
                                document.getElementById('bean_main').style.display="";                                                                                                          
                        }
                
                }




                function validate_bean()
                {                                               
                        if (document.beanform.trnCardOwner.value=="")   
                        {
                        alert("Please enter name as printed on the card.")      
                        document.beanform.trnCardOwner.focus();
                        return false;           
                        }

                        if (document.beanform.trnCardOwner.value.length<=4)     
                        {
                        alert("Please enter your complete name as printed on the card.")        
                        document.beanform.trnCardOwner.focus();
                        return false;           
                        }

                        if (document.beanform.trnCardNumber.value=="")  
                        {
                        alert("Please enter card number.")   
                        document.beanform.trnCardNumber.focus();
                        return false;           
                        }                       

                                if(!validateEmail(beanform.ordEmailAddress.value))
                                        {                                                                       
                                        alert("Please enter valid email id"); 
                                        beanform.ordEmailAddress.focus();
                                        beanform.ordEmailAddress.select();                                      
                                        return false;
                                        }                       

                        //if (document.beanform.ordPhoneNumber.value=="") 
                        //{
                        //alert("Please enter phone number.")  
                        //document.beanform.ordPhoneNumber.focus();
                        //return false;           
                        //}                       

                        //if (isNaN(document.beanform.ordPhoneNumber.value))      
                        //{
                        //alert("Please enter a valid phone number...!")  
                        //document.beanform.ordPhoneNumber.focus();
                        //document.beanform.ordPhoneNumber.select();
                        //return false;           
                        //}             
                        
                        if (document.beanform.ordCity.value=="")        
                        {
                        alert("Please enter city ...!") 
                        document.beanform.ordCity.focus();
                        return false;           
                        }   
			if (document.getElementById('C1_1').checked == false)        
                        {
                        alert("You must accept the terms & conditions.") 
                        //document.getElementById('C1_1').focus();
                        return false;           
                        }                           
                }       


                function validate_payment()
                {                                               
                        if (document.payment.C1.value=="")   
                        {
                        alert("Please enter the contact's full name.")      
                        document.payment.trnCardOwner.focus();
                        return false;           
                        }

                        if (document.payment.C6.value.length<=4)     
                        {
                        alert("Please enter address.")        
                        document.payment.trnCardOwner.focus();
                        return false;           
                        }

                        if (document.payment.C4.value=="")  
                        {
                        alert("Please enter phone number.")   
                        document.payment.trnCardNumber.focus();
                        return false;           
                        }                       

                                if(!validateEmail(payment.C3.value))
                                        {                                                                       
                                        alert("Please enter valid email id"); 
                                        payment.ordEmailAddress.focus();
                                        payment.ordEmailAddress.select();                                      
                                        return false;
                                        }                       

			if (document.getElementById('C1_1').checked == false)        
                        {
                        alert("You must accept the terms & conditions.") 
                        //document.getElementById('C1_1').focus();
                        return false;           
                        }                           
                }       
                
                function submit_addl_course()
                {                                       
                        if (document.payment1.C1.checked==false)
                        {
                        alert("Please select course combination checkbox...! ") 
                        return false;
                        }
                        else
                        {
                        document.payment1.call.value="add_addl";        
                        document.payment1.submit();                             
                        }                       
                
                }



                function submit_form()
                {
                        if (document.payment1.C1.checked==true)
                        {
                                alert("Please click 'I Need Discount'") 
                        }
                        else
                        {
                        document.payment1.call.value="payment_type";    
                        document.payment1.submit();
                        }
                }



function check_payment()
        {               
                       
                        if (document.payment.C1.value=="")      
                                {
                                alert("Please enter contact full name...!")     
                                document.payment.C1.focus();
                                return false;
                                }


                                if(!validateEmail(payment.C3.value))
                                        {                                                                       
                                        alert("Please enter valid email id"); 
                                        payment.C3.focus();
                                        payment.C3.select();                                    
                                        return false;
                                        }               

                        if (document.payment.C4.value=="")      
                                {
                                alert("Please enter phone number...!")  
                                document.payment.C4.focus();
                                return false;
                                }                                       


                        if (document.payment.C6.value=="")      
                                {
                                alert("Please enter mailing address...!")       
                                document.payment.C6.focus();
                                return false;
                                }
                
        }

        
        function show_BEAN(x)
        {        	
                if (x=="V1")
                {
                        document.getElementById('accnt_deptt').style.visibility="hidden";
                        document.getElementById('accnt_deptt').style.display="none";
                        
                        document.getElementById('bean').style.visibility="visible";
                        document.getElementById('bean').style.display="";       

                }
                else
                {
                        document.getElementById('accnt_deptt').style.visibility="visible";
                        document.getElementById('accnt_deptt').style.display="";        
                                
                        document.getElementById('bean').style.visibility="hidden";
                        document.getElementById('bean').style.display="none";                   
                        
                }
        }
        
        
        
 function show_menu(x)
 {      
        if (x=="V1")
                {
                        document.getElementById('tech').style.visibility="visible"; 
                        document.getElementById('tech').style.display=""; 
                        
                        document.getElementById('safe').style.visibility="hidden"; 
                        document.getElementById('safe').style.display="none";                   

                        document.getElementById('not').style.visibility="hidden"; 
                        document.getElementById('not').style.display="none";                    

                                document.getElementById('mul1').style.visibility="hidden";
                                document.getElementById('mul1').style.display="none";                   

                                document.getElementById('mul2').style.visibility="hidden";
                                document.getElementById('mul2').style.display="none";                                                                                                                   
                }

        if (x=="V2")
                {
                        document.getElementById('safe').style.visibility="visible"; 
                        document.getElementById('safe').style.display=""; 
                        
                        document.getElementById('tech').style.visibility="hidden"; 
                        document.getElementById('tech').style.display="none";                   

                        document.getElementById('not').style.visibility="hidden"; 
                        document.getElementById('not').style.display="none";                                            

                                document.getElementById('mul1').style.visibility="hidden";
                                document.getElementById('mul1').style.display="none";                   

                                document.getElementById('mul2').style.visibility="hidden";
                                document.getElementById('mul2').style.display="none";                                                                                                                   
                }               
 }      
        
        
        function show_not()
        {
                        document.getElementById('not').style.visibility="visible"; 
                        document.getElementById('not').style.display="";                
        }
        
        function show_multi(xx)
        {
                if (xx>7)
                        {
                                document.getElementById('mul1').style.visibility="visible";
                                document.getElementById('mul1').style.display="";                       

                                document.getElementById('mul2').style.visibility="visible";
                                document.getElementById('mul2').style.display="";                                                       
                        }
                        else
                                {
                                document.getElementById('mul1').style.visibility="hidden";
                                document.getElementById('mul1').style.display="none";                   

                                document.getElementById('mul2').style.visibility="hidden";
                                document.getElementById('mul2').style.display="none";                                                                                           
                                }
        }
        
        
        function check_form_o()
        {       
              

                if (document.mn.T1.value=="")
                        {
                                alert("Please enter first name .....!")
                                document.mn.T1.focus();                                	
                                return false;
                        }
                        

                if (document.mn.T2.value=="")
                        {
                                alert("Please enter last name .....!")
                                document.mn.T2.focus();                                
                                return false;
                        }                                       
                        
                        

                                if(!validateEmail(mn.T4.value))
                                        {                                                                       
                                        alert("Please enter valid email id"); 
                                        mn.T4.focus();
                                        mn.T4.select();                                        	
                                        return false;
                                        }
                                        
                                        

                if (document.mn.T5.value=="")
                        {
                                alert("Please enter company name .....!")
                                document.mn.T5.focus();                                
                                return false;
                        }                                       


                if (document.mn.T7.value=="")
                        {
                                alert("Please enter city .....!")
                                document.mn.T7.focus();                                
                                return false;
                        }                                                               
                                                        

        }
        
                        function show_bill_addr()
                        {
                                
                                if (document.mn.bill_c.checked==true)
                                        {
                                                document.getElementById('bl1').style.visibility="visible";                                              
                                                document.getElementById('bl1').style.display="";                                                

                                                document.getElementById('bl2').style.visibility="visible";                                              
                                                document.getElementById('bl2').style.display="";                                                

                                                document.getElementById('bl3').style.visibility="visible";                                              
                                                document.getElementById('bl3').style.display="";                                                                                                                                                

                                                document.getElementById('bl4').style.visibility="visible";                                              
                                                document.getElementById('bl4').style.display="";                                                                                                                                                                                                
                                        }
                                        else
                                                {
                                                document.getElementById('bl1').style.visibility="hidden";                                               
                                                document.getElementById('bl1').style.display="none";                                            

                                                document.getElementById('bl2').style.visibility="hidden";                                               
                                                document.getElementById('bl2').style.display="none";                                            

                                                document.getElementById('bl3').style.visibility="hidden";                                               
                                                document.getElementById('bl3').style.display="none";                                                                                                                                            

                                                document.getElementById('bl4').style.visibility="hidden";                                               
                                                document.getElementById('bl4').style.display="none";                                                                                                                                                                                            
                                                }
                        }
        
        
        
                        function validateEmail(email)
                        {
                                                        if (email == "")
                                                        {
                                                                return false;
                                                        }
                                                        
                                                        
                                                        badStuff = ";:/,' \"\\";
                                                        
                                                        for (i=0; i<badStuff.length; i++)
                                                        {
                                                        badCheck = badStuff.charAt(i)
                                                        if (email.indexOf(badCheck,0) != -1){return false;}
                                                        }
                                                        
                                                        posOfAtSign = email.indexOf("@",1)
                                                        if (posOfAtSign == -1){return false;}
                                                        
                                                        
                                                        if (email.indexOf("@",posOfAtSign+1) != -1){return false;}
                                                        
                                                        posOfPeriod = email.indexOf(".", posOfAtSign)
                                                        if (posOfPeriod == -1){return false;}
                                                        
                                                        if (posOfPeriod+2 > email.length){return false;}
                                                        
                                                        return true;
                                        }

                        function show_phone()
                        {
                                if (document.mn.T11.checked==true)
                                        {
                                                document.getElementById('fx').style.visibility="visible";                                               
                                                document.getElementById('fx').style.display="";                                         
                                        }
                                        else
                                                {
                                                document.getElementById('fx').style.visibility="hidden";                                                
                                                document.getElementById('fx').style.display="none";                                             
                                                }
                        }
                                
function isZip(s) 
{

     // Check for correct zip code
     reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);

     if (!reZip.test(s)) {
          alert("Zip Code Is Not Valid");
          return false;
     }

	return true;
}

function validZip(zip)
{
if (zip.match(/^[0-9]{5}$/)) {
return true;
}
zip=zip.toUpperCase();
if (zip.match(/^[A-Z][0-9][A-Z][0-9][A-Z][0-9]$/)) {
return true;
}
if (zip.match(/^[A-Z][0-9][A-Z].[0-9][A-Z][0-9]$/)) {
return true;
}
return false;
} 

                function chek_eml()
                {
                		if (document.eml.textfield.value=="Name")
                                        {
                                                alert("Please enter your name.")
                                                document.eml.textfield.value="";
                                                document.eml.textfield.focus();                                         
                                                return false;
                                        }

                                if (document.eml.textfield.value=="")
                                        {
                                                alert("Please enter your name.")
                                                document.eml.textfield.focus();
                                                document.eml.textfield.select();
                                                return false;
                                        }                                       
                        
                        
                                if(!validateEmail(eml.textfield2.value))
                                        {
                                         alert("Please enter a valid email address."); 
                                         document.eml.textfield2.value="";
                                         eml.textfield2.focus();
                                         eml.textfield2.select();                                        
                                         return false;
                                        }                       

                                if (document.eml.T1.value=="Postal/Zip Code")
                                        {
                                                alert("Please enter a postal/zip code.")
                                                document.eml.T1.value="";
                                                document.eml.T1.focus();                                         
                                                return false;
                                        }
                                if (!validZip(document.eml.T1.value))
                                        {
                                                alert("Please enter a valid postal/zip code.")
                                                document.eml.T1.value="";
                                                document.eml.T1.focus();                                         
                                                return false;
                                        }
                 	return true;
                 	
                }
        
        
 function show_menu(x)
 {              
        if (x=="V1")
                {
                        type="Technical";                                                                                                                       
                }

        if (x=="V2")
                {
                        type="Safety";                                                                                                                                          
                }       

                                        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(a)
      {   
        
        if(xmlHttp.readyState==4)
        { 
                        if (xmlHttp.responseText)
                                {
                                document.getElementById('show_menu_here').innerHTML=xmlHttp.responseText;
                                document.getElementById('not').style.visibility="hidden";       
                                document.getElementById('not').style.display="none";    
                                document.getElementById('mul1').style.visibility="hidden";      
                                document.getElementById('mul1').style.display="none";   
                                document.getElementById('mul2').style.visibility="hidden";      
                                document.getElementById('mul2').style.display="none";                                                                   
                                
                                }
                                                
        
        }
      }             
       
                var URL="show_course.php";  
                URL=URL+"?q="+type;                                                                                     
    xmlHttp.open("GET",URL,true);
    xmlHttp.send(null);      

 }      
        
        
        function show_not()
        {
                        document.getElementById('not').style.visibility="visible"; 
                        document.getElementById('not').style.display="";                
        }
        
        function show_multi(xx)
        {
                if (xx>7)
                        {
                                document.getElementById('mul1').style.visibility="visible";
                                document.getElementById('mul1').style.display="";                       

                                document.getElementById('mul2').style.visibility="visible";
                                document.getElementById('mul2').style.display="";                                                       
                        }
                        else
                                {
                                document.getElementById('mul1').style.visibility="hidden";
                                document.getElementById('mul1').style.display="none";                   

                                document.getElementById('mul2').style.visibility="hidden";
                                document.getElementById('mul2').style.display="none";                                                                                           
                                }
        }
        
        
        function check_form()
        {       
                var yes=0;
                mylan=document.mn.R1.length;                            
                for(i=0 ; i <  mylan ; i++)
                {
                                        if(document.mn.R1[i].checked)
                                        {
                                                yes=1;
                                                break;
                                        }                                                                       
                }
                
                if(yes==0)
                {
                        alert("Please select Curriculum Type ....!");                   
                        return false;
                }
                
                if (document.mn.T1.value=="")
                        {
                                alert("Please enter first name .....!")
                                document.mn.T1.focus();
                                return false;
                        }

                if (document.mn.T2.value=="")
                        {
                                alert("Please enter last name .....!")
                                document.mn.T2.focus();
                                return false;
                        }               


        if(!validateEmail(mn.T4.value))
                                                                {
                                                                 alert("Please enter valid email id"); 
                                                                 mn.T4.focus();
                                                                 mn.T4.select();
                                                                 return false;
                                                                }

                if (document.mn.T5.value=="")
                        {
                                alert("Please enter company name .....!")
                                document.mn.T5.focus();
                                return false;
                        }               

                if (document.mn.T7.value=="")
                        {
                                alert("Please enter city .....!")
                                document.mn.T7.focus();
                                return false;
                        }               
        }
        
                        function show_fax()
                        {
                                if (document.mn.T11.checked==true)
                                        {
                                                document.getElementById('fx').style.visibility="visible";                                               
                                                document.getElementById('fx').style.display="";                                         
                                        }
                                        else
                                                {
                                                document.getElementById('fx').style.visibility="hidden";                                                
                                                document.getElementById('fx').style.display="none";                                             
                                                }
                        }
        
        
        
                        function validateEmail(email)
                        {
                                                        if (email == "")
                                                        {
                                                                return false;
                                                        }
                                                        
                                                        
                                                        badStuff = ";:/,' \"\\";
                                                        
                                                        for (i=0; i<badStuff.length; i++)
                                                        {
                                                        badCheck = badStuff.charAt(i)
                                                        if (email.indexOf(badCheck,0) != -1){return false;}
                                                        }
                                                        
                                                        posOfAtSign = email.indexOf("@",1)
                                                        if (posOfAtSign == -1){return false;}
                                                        
                                                        
                                                        if (email.indexOf("@",posOfAtSign+1) != -1){return false;}
                                                        
                                                        posOfPeriod = email.indexOf(".", posOfAtSign)
                                                        if (posOfPeriod == -1){return false;}
                                                        
                                                        if (posOfPeriod+2 > email.length){return false;}
                                                        
                                                        return true;
                                        }



                function show_next_drop()
                {
                        document.getElementById('not').style.visibility="visible";      
                        document.getElementById('not').style.display="";        
                }



                function show_sch(x)
                {               
                a=x.split("+")                                  
                        document.mn.T1.value=a[0];
                        document.mn.T2_Amm.value=a[1];                  
                }



function ClearOptions(OptionList) {

   // Always clear an option list from the last entry to the first
   for (x = OptionList.length; x >= 0; x = x - 1) {
      OptionList[x] = null;
   }
}

function sel_can()
						{
							selbox = document.getElementById("prov_1");
							ClearOptions(selbox);
							var provinces = [ "Alberta","British Columbia","Manitoba",
												 "New Brunswick", "Newfoundland and Labrador",
												 "Northwest Territories", "Nova Scotia","Nunavut",
												 "Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon" ];
							var pr = ["AB","BC","MB","NB","NL","NT","NS","NU","ON","PE","QC","SK","YT" ];
							for(i=0;i<provinces.length;i++)
							{
   								selbox[selbox.length] = new Option(provinces[i], pr[i]);
							}
						}

						function sel_us()
						{
							selbox = document.getElementById("prov_1");
							ClearOptions(selbox);
							var states = [
									  "Alaska","Alabama","Arkansas","Arizona","California","Colorado",
									  "Connecticut","District of Columbia","Delaware","Florida","Georgia","Guam",
									  "Hawaii","Iowa","Idaho","Illinois","Indiana","Kansas","Kentucky","Louisiana",
									  "Massachusetts","Maryland","Maine","Michigan","Minnesota","Missouri","Mississippi",
									  "Montana","North Carolina","North Dakota","Nebraska","New Hampshire","New Jersey",
									  "New Mexico","Nevada","New York","Ohio","Oklahoma","Oregon","Pennsylvania",
									  "Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas",
									  "Utah","Virginia","Virgin Islands","Vermont","Washington","Wisconsin",
									  "West Virginia","Wyoming"];
									var st = ["AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","GU","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","PR","RI","SC","SD","TN","TX","UT","VA","VI","VT","WA","WI","WV","WY"];
							for(i=0;i<states.length;i++)
							{
   								selbox[selbox.length] = new Option(states[i], st[i]);
							}
						}
						function populate_prov()
						{

							country = document.user_form.T15;
							if (country[country.selectedIndex].value == "CA") {
								prov_box = document.getElementById('prov_2');
        						prov_box.style.visibility = 'hidden';
								prov_box2 = document.getElementById('prov_1');
        						prov_box2.style.visibility = 'visible';
        						prov_label = document.getElementById('prov_label');
        						prov_label.innerHTML = "State/Province:";
								sel_can();
							}
							if (country[country.selectedIndex].value == "US") {
								prov_box = document.getElementById('prov_2');
        						prov_box.style.visibility = 'hidden';
								prov_box2 = document.getElementById('prov_1');
        						prov_box2.style.visibility = 'visible';
        						prov_label = document.getElementById('prov_label');
        						prov_label.innerHTML = "State/Province:";
								sel_us();
							}
							if (country[country.selectedIndex].value == "OT") {
								prov_box = document.getElementById('prov_1');
        						prov_box.style.visibility = 'hidden';
								prov_box2 = document.getElementById('prov_2');
        						prov_box2.style.visibility = 'visible';
        						prov_label = document.getElementById('prov_label');
        						prov_label.innerHTML = "Country Name:";
							}

						}


function check_form_sign()
        {       
                        
                if (document.mn.T1.value=="")
                        {
                                alert("Please enter course code .....!")
                                document.mn.T1.focus();
                                document.getElementById('f1').style.color="#FF0101";
                                return false;
                        }
                        else
                        {
                                document.getElementById('f1').style.color="#737373";    
                        }

                if (document.mn.T3.value=="")
                        {
                                alert("Please enter full name .....!")
                                document.mn.T3.focus();
                                document.getElementById('f2').style.color="#FF0101";
                                return false;
                        }
                        else
                        {
                                document.getElementById('f2').style.color="#737373";    
                        }                                       

                if (document.mn.T5.value=="")
                        {
                                alert("Please enter city .....!")
                                document.mn.T5.focus();
                                document.getElementById('f3').style.color="#FF0101";
                                return false;
                        }                                       
                        else
                        {
                                document.getElementById('f3').style.color="#737373";    
                        }                                       

        if (document.mn.T6.value=="")
                        {
                                alert("Please enter Phone .....!")
                                document.mn.T6.focus();
                                document.getElementById('f4').style.color="#FF0101";
                                return false;
                        }                                       
                        else
                        {
                                document.getElementById('f4').style.color="#737373";    
                        }

        
                                                

                                if(!validateEmail(mn.T7.value))
                                        {                                                                       
                                        alert("Please enter valid email id"); 
                                        mn.T7.focus();
                                        mn.T7.select();
                                        document.getElementById('f5').style.color="#FF0101";
                                        return false;
                                        }
                                        else
                                        {
                                        document.getElementById('f5').style.color="#737373";            
                                        }

        }

function check_csv()
{
        if(document.u_csv.T1.value=="") 
        {
                alert("Please enter your name")
                document.u_csv.T1.focus();
                return false;   
        }       

        if(document.u_csv.T2.value=="") 
        {
                alert("Please enter complete address")
                document.u_csv.T2.focus();
                return false;   
        }               

        if(document.u_csv.T3.value=="") 
        {
                alert("Please enter city")
                document.u_csv.T3.focus();
                return false;   
        }                       
        
                        if(!validateEmail(u_csv.T5.value))
                        {
                        alert("Please enter a valid email id"); 
                        u_csv.T5.focus();
                        u_csv.T5.select();                                       
                        return false;
                        }       
        
        if(document.u_csv.file1.value=="")      
        {
                alert("Please upload your csv")
                document.u_csv.file1.focus();
                return false;   
        }                       
        
}



                        function validateEmail(email)
                        {
                                                        if (email == "")
                                                        {
                                                                return false;
                                                        }
                                                        
                                                        
                                                        badStuff = ";:/,' \"\\";
                                                        
                                                        for (i=0; i<badStuff.length; i++)
                                                        {
                                                        badCheck = badStuff.charAt(i)
                                                        if (email.indexOf(badCheck,0) != -1){return false;}
                                                        }
                                                        
                                                        posOfAtSign = email.indexOf("@",1)
                                                        if (posOfAtSign == -1){return false;}
                                                        
                                                        
                                                        if (email.indexOf("@",posOfAtSign+1) != -1){return false;}
                                                        
                                                        posOfPeriod = email.indexOf(".", posOfAtSign)
                                                        if (posOfPeriod == -1){return false;}
                                                        
                                                        if (posOfPeriod+2 > email.length){return false;}
                                                        
                                                        return true;
                                        }               