function chgpass_candi()
{		
		if(document.cp.oldpass.value == "")
		{
		
			alert("Please enter your Existing Password...");
			document.cp.oldpass.focus();
			return false;
		}
		else if(!charsOccurIn(document.cp.oldpass.value, "abcdefghijklmnopqrstuvwxyz0123456789_"))
		{
			alert("Please enter your Valid Password...!");
			document.cp.oldpass.focus();
			return false;
		}
		else if(document.cp.txtpass.value == "")
		{
		
			alert("Please enter your New Password...");
			document.cp.txtpass.focus();
			return false;
		}
		else if(!charsOccurIn(document.cp.txtpass.value, "abcdefghijklmnopqrstuvwxyz0123456789_"))
		{
			alert("Only AlphaNumeric Characters with ( _ ) allowed for Password...!");
			document.cp.txtpass.focus();
			return false;
		}
		else if(document.cp.txtpass.value.length < 6 )
		{
			alert("Please enter Password between 6 - 12 Characters...");
			document.cp.txtpass.focus();
			return false;
		}
		else if(document.cp.txtpass.value != document.cp.txtcpass.value)
		{
			alert("Password Mismatch....");
			document.cp.txtcpass.focus();
			return false;
		}
}



function move(fbox, tbox,a) 
{
	if(a=="n" || a=="nl") 
		nav=""
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) 
		{
			if(a=="n" || a=="nl")
				nav=""

			arrLookup[tbox.options[i].text] = tbox.options[i].value;
			arrTbox[i] = tbox.options[i].text;
		}	
	var fLength = 0;
	var tLength = arrTbox.length;
	
	for(i = 0; i < fbox.options.length; i++) 
		{
			if(a=="n" || a=="nl")
				nav=""
		
			arrLookup[fbox.options[i].text] = fbox.options[i].value;

			if (fbox.options[i].selected && fbox.options[i].value != "") 
				{
					arrTbox[tLength] = fbox.options[i].text;
					tLength++;
				}
			else 
				{
					arrFbox[fLength] = fbox.options[i].text;
					fLength++;
				}
		}

		arrFbox.sort();
		arrTbox.sort();
		fbox.length = 0;
		tbox.length = 0;
		var c;
	for(c = 0; c < arrFbox.length; c++) 
		{
			var no = new Option();
			no.value = arrLookup[arrFbox[c]];
			no.text = arrFbox[c];
			if(a=="nl" )
				nav=nav+no.value+", "

				fbox[c] = no;
		}
	for(c = 0; c < arrTbox.length; c++) 
		{
			var no = new Option();
			no.value = arrLookup[arrTbox[c]];
			no.text = arrTbox[c];
			tbox[c] = no;
			if(a=="n" )
				nav=nav+no.value+", "
		}
}

function chk_email()
{
apos=document.can_email.txtemail.value.indexOf("@"); 
dotpos=document.can_email.txtemail.value.lastIndexOf(".");
lastpos=document.can_email.txtemail.value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>4 || lastpos-dotpos<2) 
	{	
		alert("Please enter your valid Email Address...!")
		document.can_email.txtemail.focus()
		return false;
	}
	else 
	{
	return validEmail()
	}

	return true;	

} 


function validEmail()
{

var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@._";
for (var i=0; i < document.can_email.txtemail.value.length; i++)
	 {
    var letter = document.can_email.txtemail.value.charAt(i).toLowerCase();
	if (validchars.indexOf(letter) != -1)
	continue;
	else
    alert("Invalid character: " + letter + " used in Email Address");
    return false;   
  }
}


function textCounter(maxlimit,frmfield) 
{
if (frmfield.value.length > maxlimit)
{
//alert(frmfield.substr(0, maxlimit))
frmfield.value = frmfield.value.substring(0,maxlimit) ;
}
}
function compareDates(value1, value2) 
{
   var date1, date2;
   var month1, month2;
   var year1, year2;

   d1 = value1.substring (0, value1.indexOf ("/"));
   m1 = value1.substring (value1.indexOf ("/")+1, value1.lastIndexOf ("/"));
   y1 = value1.substring (value1.lastIndexOf ("/")+1, value1.length);

   d2 = value2.substring (0, value2.indexOf ("/"));
   m2 = value2.substring (value2.indexOf ("/")+1, value2.lastIndexOf ("/"));
   y2 = value2.substring (value2.lastIndexOf ("/")+1, value2.length);
   
   month1 = parseInt(m1);
   date1  = parseInt(d1);
   year1  = parseInt(y1);

   month2 = parseInt(m2) ;
   date2  = parseInt(d2) ;
   year2  = parseInt(y2) ;

   if(year1 > year2) 
	{
		return -1;
	}	
	else if(year1 < year2) 
	{
		return 1;
	}		
   else 
	{ 	
		if(month1 > month2)
			{				
				return -1;
			}
		else if(month1 < month2)
			{
				return 1;
			}			
		else 
			{			
				if(date1 > date2)
					{
						 return -1;
					}					 
				else if (date1 < date2)
					{
						 return 1;
					}
				else
					{
						return 0;
					}	    		 
		    }	
	}   
} 


function charsOccurIn(frmfield, validChars)
{ 
		var i;
		for (i = 0; i < frmfield.length; i++)
		{ 
				var letter = frmfield.charAt(i).toLowerCase();
		if (validChars.indexOf(letter) == -1) 
			return false;
		}
		return true;
}



//==========Function For Personal Details=================//	



function checkcanform()
{
		if(document.canstep1.txtpass.value == "")
		{
		
			alert("Please enter your Password...");
			document.canstep1.txtpass.focus();
			return false;
		}
		else if(!charsOccurIn(document.canstep1.txtpass.value, "abcdefghijklmnopqrstuvwxyz0123456789_"))
		{
			alert("Only AlphaNumeric Characters with ( _ ) allowed for Password...!");
			document.canstep1.txtpass.focus();
			return false;
		}
		else if(document.canstep1.txtpass.value.length < 6 )
		{
			alert("Please enter Password between 6 - 12 Characters...");
			document.canstep1.txtpass.focus();
			return false;
		}
		else if(document.canstep1.txtpass.value != document.canstep1.txtcpass.value)
		{
			alert("Password Mismatch....");
			document.canstep1.txtcpass.focus();
			return false;
		}
		else if(document.canstep1.txtfname.value == "") 
		{
		alert("Please enter your First Name...!");
		document.canstep1.txtfname.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtfname.value, "abcdefghijklmnopqrstuvwxyz"))
		{
			alert("Please Enter your valid Name...!");
			document.canstep1.txtfname.focus();
			return false;
		}
		else if(document.canstep1.txtlname.value == "") 
		{
		alert("Please enter your Last Name...!");
		document.canstep1.txtlname.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtlname.value, "abcdefghijklmnopqrstuvwxyz "))
		{
			alert("Please Enter your valid Name...!");
			document.canstep1.txtlname.focus();
			return false;
		}
		else if(document.canstep1.txtlname.value == "") 
		{
		alert("Please enter your Last Name...!");
		document.canstep1.txtlname.focus();
		return false;
		}
		else if(document.canstep1.dob.value == "")
		{
		alert("Please select your Date of Birth ..!");
		return false;
		}
		else if(document.canstep1.txtcity.value == "") 
		{
		alert("Please enter your City...!");
		document.canstep1.txtcity.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtcity.value, "abcdefghijklmnopqrstuvwxyz -."))
		{
			alert("Please Enter your valid City Name...!");
			document.canstep1.txtcity.focus();
			return false;
		}
		else if(document.canstep1.txtstate.value == "") 
		{
		alert("Please enter your State...!");
		document.canstep1.txtstate.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtstate.value, "abcdefghijklmnopqrstuvwxyz -."))
		{
			alert("Please Enter your valid State Name...!");
			document.canstep1.txtstate.focus();
			return false;
		}
		else if(document.canstep1.txtzip.value == "") 
		{
		alert("Please enter your Zip Code...!");
		document.canstep1.txtzip.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtzip.value, "0123456789 "))
		{
			alert("Please Enter your valid Zip Code...!");
			document.canstep1.txtzip.focus();
			return false;
		}
		else if((document.canstep1.txtadd.value == "") ||(document.canstep1.txtadd.value.length < 15))
		{
		alert("Please enter your Complete Permanent Address ...!");
		document.canstep1.txtadd.focus();
		return false;
		}
		else if(document.canstep1.txtisd1.value == "") 
		{
		alert("Please enter  your ISD Code [Phone No. I]...!");
		document.canstep1.txtisd1.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtisd1.value, "1234567890"))
		{
		alert("Only Numerics allowed for Country Code [Phone No.I]...!");
		document.canstep1.txtisd1.focus();
		return false;
		}
		else if(document.canstep1.txtstd1.value == "") 
		{
		alert("Please enter your STD Code [Phone No. I]...!");
		document.canstep1.txtstd1.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtstd1.value, "1234567890"))
		{
		alert("Only Numerics allowed for State Code [Phone No.I]...!");
		document.canstep1.txtstd1.focus();
		return false;
		}
		else if(document.canstep1.txtphone1.value == "") 
		{
		alert("Please enter your Phone No...!");
		document.canstep1.txtphone1.focus();
		return false;
		}
		else if(!charsOccurIn(document.canstep1.txtphone1.value, "1234567890"))
		{
		alert("Only Numerics allowed for Phone No. [Phone No.I]...!");
		document.canstep1.txtphone1.focus();
		return false;
		}
		
		else if(document.canstep1.txtphone2.value != "" && document.canstep1.txtisd2.value == "" && document.canstep1.txtstd2.value == "")
		{
			alert("Please complete Phone No. II...!");
			document.canstep1.txtphone2.focus()
			return false;
		}
		else if(document.canstep1.txtisd2.value != "" && document.canstep1.txtphone2.value == "" && document.canstep1.txtstd2.value == "")
		{
			alert("Please complete Phone No. II...!");
			document.canstep1.txtisd2.focus()
			return false;
		}
		else if(document.canstep1.txtstd2.value != "" && document.canstep1.txtphone2.value == "" && document.canstep1.txtisd2.value == "")
		{
			alert("Please complete Phone No. II...!");
			document.canstep1.txtstd2.focus()
			return false;
		}
		else if(!charsOccurIn(document.canstep1.txtmobileno.value, "1234567890"))
	{
	alert("Only Numerics allowed for Mobile No...!");
	document.canstep1.txtmobileno.focus();
	return false;
	}
	else if(document.canstep1.txtnationality.value == "") 
	{
		alert("please enter your Nationality");
		document.canstep1.txtnationality.focus();
		return false;
	}
	else if(!charsOccurIn(document.canstep1.txtnationality.value, "abcdefghijklmnopqrstuvwxyz"))
	{
	alert("Please enter your valid Nationality...!");
	document.canstep1.txtnationality.focus();
	return false;
	}
	
	else
	{
			return true;
	}


}
//===================End of Function For Personal Details=============//
//==================function for Verification Details=================//

function checkcanform2()
{
var certtype=document.can_reg.txtcerttype.value.length;

if(document.can_reg.issauth.value == "0")
{
		alert("Please select your Competancy Certificate Issuing Authority...!");
		document.can_reg.issauth.focus();
		return false;
}
else if(certtype==0)
{
	
		var agree=confirm("Please Select Your Certificate Type.\n If you have a valid Certificate,  Registration Will be Free For you.\n Other wise You have to pay the registration fees to get your registrtion validated.\n\n\n DO YOU WANT TO CONTINUE WITH OUT ENTERING CERTIFICATE DETAILS ?")
		if (agree=="1")
		{
			if((document.can_reg.seaexp.value == "-")||(document.can_reg.seaexp.value < "5"))
			{
				var agreeN=confirm("Please Select Your Sea Experience.\n If you have Minimum 5 Sail Experience the Registration Will be Free For you.\n Other wise You have to pay the registration fees to get your registrtion validated.\n\n\n DO YOU WANT TO CONTINUE WITH OUT ENTERING SAIL EXPERIENCE DETAILS ?")
				if (agreeN=="1")
				{
				
				}
				else
				{
					return false;
				}
			}
		}
		else
		{
			return false;
		}
}

else if (document.can_reg.expdate1.value == "")
{
		alert("Please select your Certificate Expiry Date...!");
		document.can_reg.expdate1.focus();
		return false;
}
else if (document.can_reg.txtcerttype.value == "")
{
		alert("Please enter your Certificate Type");
		document.can_reg.txtcerttype.focus();
		return false;
}
else if (document.can_reg.seaexp.value == "-")
{
		alert("Please select your Years of Experience...!");
		document.can_reg.seaexp.focus();
		return false;
}
else
{
	return true;
}
}

//=====================end of Function For Verification Details============//

//===================function For Passport and Visa Details================//
function checkcanform3()
{
if(document.canstep3.txtpassno.value == "") 
	{
		alert("Please enter  your Passport Number...!");
		document.canstep3.txtpassno.focus();
		return false;
	}
	else if(!charsOccurIn(document.canstep3.txtpassno.value, "abcdefghijklmnopqrstuvwxyz0123456789 -"))
		{
			alert("Please Enter your valid Passport No...!");
			document.canstep3.txtpassno.focus();
			return false;
		}
	else if(document.canstep3.txtpassi.value == "") 
	{
		alert("Please enter Passport Place of Issue...!");
		document.canstep3.txtpassi.focus();
		return false;
	}
	else if(!charsOccurIn(document.canstep3.txtpassi.value, "abcdefghijklmnopqrstuvwxyz -"))
		{
			alert("Please Enter valid Passport Place of Issue...!");
			document.canstep3.txtpassi.focus();
			return false;
		}
	else if(document.canstep3.expdate.value == "") 
	{
		alert("Please select your Passport Expiry Date...!");
		document.canstep3.expdate.focus();
		return false;
	}
	else
	{
	return true;
	}
}





function canstep3Init()
{
document.canstep3.txtpassno.focus()
}

function disText()
{
if (document.canstep3_1.cmbvisatype.value =="Others")
{
	document.canstep3_1.txtothers.disabled = false;
	document.canstep3_1.txtothers.focus();
}
else
{
	document.canstep3_1.txtothers.value ="";
	document.canstep3_1.txtothers.disabled = true;
}
} 
  
//==============End of Function Passport and Visa Details========//
function othstep4()
{
var c = document.other_course.other2.length;
if (c != "0" )
{
var i;
var x = "";
var course = new Array();
for(i= 0; i< c;i++)
{
course[i] = document.other_course.other2.options[i].value;
x = x+document.other_course.other2.options[i].value+" , ";
}
document.other_course.hidecourse.value  = x;
}
else
{
alert("Please Select a Course...!!")
return false;
}

}

function checkcanst3_1()
{
 if(document.canstep3_1.cmbvisatype.value == "") 
	{
		alert("Please select your Visa Type...!");
		document.canstep3_1.cmbvisatype.focus();
		return false;
	}
	else if(document.canstep3_1.cmbvisatype.value == "Others" && document.canstep3_1.txtothers.value =="") 
	{
		alert("Please enter your Visa Type...!");
		document.canstep3_1.txtothers.focus();
		return false;
	}
	else if(!charsOccurIn(document.canstep3_1.txtothers.value, "abcdefghijklmnopqrstuvwxyz0123456789 -"))
		{
			alert("Please Enter a valid Visa Type...!");
			document.canstep3_1.txtothers.focus();
			return false;
		}
	else if(document.canstep3_1.expdatev.value == "") 
	{
		alert("Please select your Visa Expiry Date...!");
		document.canstep3_1.expdatev.focus();
		return false;
	}
	
	}
	
	
	
function checkcanst3_1a()
{
 if(document.canstep3_1.cmbvisatype.value == "Select") 
	{
		alert("Please select your Visa Type...!");
		document.canstep3_1.cmbvisatype.focus();
		return false;
	}
	else if(document.canstep3_1.cmbvisatype.value == "Others" && document.canstep3_1.txtothers.value == "")
	{
		alert("Please Enter your Visa Type...!");
		document.canstep3_1.txtothers.focus();
		return false;
	}
	else if(!charsOccurIn(document.canstep3_1.txtothers.value, "abcdefghijklmnopqrstuvwxyz0123456789 -"))
		{
			alert("Please Enter a valid Visa Type...!");
			document.canstep3_1.txtothers.focus();
			return false;
		}
	else if(document.canstep3_1.expdatev.value == "") 
	{
		alert("Please select your Visa Expiry Date...!");
		document.canstep3_1.expdatev.focus();
		return false;
	}
	
	}	
	

function checkcanst3_1b()
{
if(document.canstep3_1.txtothers.value == "") 
	{
		alert("Please Enter Visa Type...!");
		document.canstep3_1.txtothers.focus();
		return false;
	}
else if(!charsOccurIn(document.canstep3_1.txtothers.value, "abcdefghijklmnopqrstuvwxyz0123456789 -"))
		{
			alert("Please Enter a valid Visa Type...!");
			document.canstep3_1.txtothers.focus();
			return false;
		}
	else if(document.canstep3_1.expdatev.value == "") 
	{
		alert("Please select your Visa Expiry Date...!");
		document.canstep3_1.expdatev.focus();
		return false;
	}
	
	}		
//==end==//
//==============Function for Sea Experience Details=============//
function charsOccurIn(frmfield, validChars)
{ 
		var i;
		for (i = 0; i < frmfield.length; i++)
		{ 
				var letter = frmfield.charAt(i).toLowerCase();
		if (validChars.indexOf(letter) == -1) 
			return false;
		}
		return true;
}
function checkcanstep7()
{

if(document.canstep7.selrank.value == "select")
{
alert("Please Select your  Rank...!");
document.canstep7.selrank.focus()
return false;
}
else if(document.canstep7.selrank.value == "Others" && document.canstep7.txtrankoth.value == "")
{
alert("Please Enter your  Rank...!");
document.canstep7.txtrankoth.focus()
return false;
}
else if(document.canstep7.txtcompany.value == "")
{
alert("Please Enter Company Name...!");
document.canstep7.txtcompany.focus()
return false;
}
 else if(!charsOccurIn(document.canstep7.txtcompany.value, "abcdefghijklmnopqrstuvwxyz0123456789 (\-)/&."))
		{
			alert("Please Enter a valid Company Name..!");
			document.canstep7.txtcompany.focus();
			return false;
		}
else if(document.canstep7.seltypeship.value == "select")
{
alert("Please Select your Ship Type...!");
document.canstep7.seltypeship.focus()
return false;
}
else if(document.canstep7.seltypeship.value == "Others" && document.canstep7.txttypeshipoth.value == "")
{
alert("Please Enter your  Ship Type...!");
document.canstep7.txttypeshipoth.focus()
return false;
}
else if(document.canstep7.txttonnage.value=="") 
{
	alert("Please Enter Ship Tonnage...!");
	document.canstep7.txttonnage.focus();
	return false;
	
}
 else if(!charsOccurIn(document.canstep7.txttonnage.value, "0123456789."))
		{
			alert("Please Enter only Numeric value for Tonnage..!");
			document.canstep7.txttonnage.focus();
			return false;
		}
else if(document.canstep7.selme.value == "select" ) 
{
	alert("Please Select your Engine Type..!");
	document.canstep7.selme.focus();
	return false;
	
}
else if(document.canstep7.selme.value == "Others" && document.canstep7.txtmeoth.value == "") 
{
	alert("Please Enter your Engine Type..!");
	document.canstep7.txtmeoth.focus();
	return false;
	
}
else if(document.canstep7.txthp.value=="") 
{
	alert("Please Enter Ship HorsePower...!");
	document.canstep7.txthp.focus();
	return false;
	
}
else if(!charsOccurIn(document.canstep7.txthp.value, "0123456789."))
		{
			alert("Please Enter only Numeric value for HorsePower...!");
			document.canstep7.txthp.focus();
			return false;
		}
else if(document.canstep7.sondate.value == "")
{
alert("Please Enter Joining Date...!");
document.canstep7.sondate.focus()
return false;

}

else if(document.canstep7.soffdate.value == "")
{
alert("Please Enter Leaving Date...!");
document.canstep7.soffdate.focus()
return false;
}

else
{
return true;
}
}




function distext3()
{				
if(document.canstep7.selrank.value=="Others")
{
	
	document.canstep7.txtrankoth.disabled = false;
	document.canstep7.txtrankoth.value = "";
	document.canstep7.txtrankoth.focus();

}
else
{	
	document.canstep7.txtrankoth.disabled = "";
	document.canstep7.txtrankoth.disabled = true;
}
}

function distext4a()
{				
if(document.canstep7.seltypeship.value=="Others")
{
	
	document.canstep7.txttypeshipoth.disabled = false;
	document.canstep7.txttypeshipoth.value = "";
	document.canstep7.txttypeshipoth.focus();

}
else
{	
	document.canstep7.txttypeshipoth.disabled = "";
	document.canstep7.txttypeshipoth.disabled = true;
}
}

function distext5()
{				
if(document.canstep7.selme.value=="Others")
{
	//alert("hallo");
	
	document.canstep7.txtmeoth.disabled = false;
	document.canstep7.txtmeoth.value = "";
	document.canstep7.txtmeoth.focus();
	//return false;
}
else
{	
	document.canstep7.txtmeoth.value = "";
	document.canstep7.txtmeoth.disabled = true;
}
}

//=============End of Function Sea Experience Details===//
//==============Function For Seamen Book Details=========//
function checkcanstep6()
{

if(document.canstep6.cmbiss_auth.value == "")
		{
			alert("Please Select The Issuing Authority...!");					
			document.canstep6.cmbiss_auth.focus();
			return false	
		}
	else if(document.canstep6.cmbiss_auth.value=="Others" && document.canstep6.txtiss_oth.value=="")
		{
			alert("Please Enter then Issuing Authority...!");					
			document.canstep6.txtiss_oth.focus();
			return false		
		}
		
else if(document.canstep6.cdcnum.value == "") 
{
alert("Please Enter Seamen Book Number...!");
document.canstep6.cdcnum.focus()
return false;
}
else if(!charsOccurIn(document.canstep6.cdcnum.value, "abcdefghijklmnopqrstuvwxyz0123456789 -\/;:"))
		{
			alert("Please Enter a Valid Seaman Book No...!");
			document.canstep6.cdcnum.focus();
			return false;
		}
else if(document.canstep6.cdcdate.value == "") 
{
alert("Please select Expiry Date...!");
document.canstep6.cdcdate.focus()
return false;
}
else
{
return true;
} 

}



function checkcanstep6_a()
{

if(document.canstep2.cmbiss_auth.value=="")
{
			alert("Please Select The Issuing Authority...!");					
			document.canstep2.cmbiss_auth.focus();
			return false	
		}
else if(document.canstep2.cmbiss_auth.value=="Others" && document.canstep2.txtiss_oth.value == "")
		{
			alert("Please Mention The Issuing Authority...!");					
			document.canstep2.txtiss_oth.focus();
			return false		
		}
else if(document.canstep2.cdcnum.value == "") 
{
alert("Please Enter Seamen Book Number...!");
document.canstep2.cdcnum.focus()
return false;
}
else if(document.canstep2.cdcdate.value == "") 
{
alert("Please Enter Expiry Date...!");
document.canstep2.cdcdate.focus()
return false;
}
}


function distext2()
{				
if(document.canstep6.cmbiss_auth.value=="Others")
{
	//alert("hallo");
	
	document.canstep6.txtiss_oth.disabled = false;
	document.canstep6.txtiss_oth.value = "";
	document.canstep6.txtiss_oth.focus();
	//return false;
}
else
{	
	document.canstep6.txtiss_oth.value = "";
	document.canstep6.txtiss_oth.disabled = true;
}
}

//================End of funtion For Seamen Book Details=============//
//=========Function For Course Details=================//
function checkcanstep4()
{

if(document.canstep4.txtcert.value !="")
	{	
		val_one=document.canstep4.coursedet1.value;
		//alert(val_one);
		
		if(document.canstep4.txtinst1.value =="" ||document.canstep4.txtinst1.value ==" ")	
			{
				alert("Please Fill The Institute Name For "+ val_one.toUpperCase() +" Course...!");
				document.canstep4.txtinst1.focus();
				return false;			
			}
		
			
			
	}
 if(document.canstep4.txtcert2.value != "")
	{
	val_one = document.canstep4.coursedet2.value;
	//alert(val_one);
			if(document.canstep4.txtinst2.value == "" || document.canstep4.txtinst2.value == " ")
			{
			alert("Please Fill the Institute Name For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtinst2.focus();
			return false;
			}
			
	}
	 if(document.canstep4.txtcert3.value != "")
	{
	val_one = document.canstep4.coursedet3.value;
	//alert(val_one);
			if(document.canstep4.txtinst3.value == "" || document.canstep4.txtinst3.value == " ")
			{
			alert("Please Fill the Institute Name For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtinst3.focus();
			return false;
			}
			
	}
	 if(document.canstep4.coursedet4.value != "" )
	{
	val_one = document.canstep4.coursedet4.value;
	//alert(val_one);
			if(document.canstep4.txtcert4.value == "" )
			{
			alert("Please Fill the Certificate No. For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtcert4.focus();
			return false;
			}
			
			if(document.canstep4.txtinst4.value == "" )
			{
			alert("Please Fill the Institute Name For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtinst4.focus();
			return false;
			}
			
	}
	 if(document.canstep4.coursedet5.value != "")
	{
	val_one = document.canstep4.coursedet5.value;
	//alert(val_one);
			if(document.canstep4.txtcert5.value == "" )
			{
			alert("Please Fill the Certificate No. For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtcert5.focus();
			return false;
			}
			
			if(document.canstep4.txtinst5.value == "" || document.canstep4.txtinst5.value == " ")
			{
			alert("Please Fill the Institute Name For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtinst5.focus();
			return false;
			}
			
	}
	 if(document.canstep4.coursedet6.value != "")
	{
	val_one = document.canstep4.coursedet6.value;
	//alert(val_one);
			if(document.canstep4.txtcert6.value == "" )
			{
			alert("Please Fill the Certificate No. For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtcert6.focus();
			return false;
			}
			if(document.canstep4.txtinst6.value == "" || document.canstep4.txtinst6.value == " ")
			{
			alert("Please Fill the Institute Name For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtinst6.focus();
			return false;
			}
			
	}
	 if(document.canstep4.coursedet7.value != "")
	{
	val_one = document.canstep4.coursedet7.value;
	//alert(val_one);
			if(document.canstep4.txtcert7.value == "" )
			{
			alert("Please Fill the Certificate No. For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtcert7.focus();
			return false;
			}
			if(document.canstep4.txtinst7.value == "" || document.canstep4.txtinst7.value == " ")
			{
			alert("Please Fill the Institute Name For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtinst7.focus();
			return false;
			}
			
	}
	 if(document.canstep4.coursedet8.value != "")
	{
	val_one = document.canstep4.coursedet8.value;
	//alert(val_one);
			if(document.canstep4.txtcert8.value == "" )
			{
			alert("Please Fill the Certificate No. For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtcert8.focus();
			return false;
			}
			if(document.canstep4.txtinst8.value == "" || document.canstep4.txtinst8.value == " ")
			{
			alert("Please Fill the Institute Name For "+val_one.toUpperCase()+" Course...!");
			document.canstep4.txtinst8.focus();
			return false;
			}
		
		else
		{
		return true;
		}
	}
}
//============End of Course Function===============//
//============Function For Certificate Details============//
function checkcanstep5()
{

if(document.canstep5.txtcert_no.value==""||document.canstep5.txtcert_no.value==" ")
				{
					alert("Please Enter The Certificate Number ...!");
					document.canstep5.txtcert_no.focus();
					return false;
				}
else if(!charsOccurIn(document.canstep5.txtcert_no.value, "abcdefghijklmnopqrstuvwxyz0123456789 \-/"))
		{
			alert("Please Enter a valid Certificate No...!");
			document.canstep5.txtcert_no.focus();
			return false;
		}	
				else if(document.canstep5.txtcert_type1.value == "")
				{
					alert("Please select your Certificate Type ...!");
					document.canstep5.txtcert_type1.focus();
					return false;
				}
				else if(document.canstep5.txtcert_type1.value == "Others" && document.canstep5.txtcert_oth.value =="")
				{
					alert("Please Enter your Certificate Type...!");
					document.canstep5.txtcert_oth.focus();
					return false;
				}
				else if(document.canstep5.txtissauth1.value == "")
				{
					alert("Please select your Certificate Issuing Authority ...!");
					document.canstep5.txtissauth1.focus();
					return false;
				}
			//	else if(document.canstep5.expdate.value == "")
			//	{
			//		alert("Please Enter Expiry Date ...!");
			//		document.canstep5.expdate.focus();
			//		return false;
			//	}
				else
				{
				return true;
				}
			
}


function checkcanstep5_a()
{

if(document.canstep5.txtcert_no.value==""||document.canstep5.txtcert_no.value==" ")
				{
					alert("Please Enter The Certificate Number ...!");
					document.canstep5.txtcert_no.focus();
					return false;
				}
else if(!charsOccurIn(document.canstep5.txtcert_no.value, "abcdefghijklmnopqrstuvwxyz0123456789 \-/"))
		{
			alert("Please Enter a valid Certificate No...!");
			document.canstep5.txtcert_no.focus();
			return false;
		}	
			else if(document.canstep5.txtcert_type1.value == "")
				{
					alert("Please select your Certificate Type ...!");
					document.canstep5.txtcert_type1.focus();
					return false;
				}
				else if(document.canstep5.txtissauth1.value == "")
				{
					alert("Please select your Certificate Issuing Authority ...!");
					document.canstep5.txtissauth1.focus();
					return false;
				}
				else if(document.canstep5.expdate.value == "")
				{
					alert("Please Enter Expiry Date ...!");
					document.canstep5.expdate.focus();
					return false;
				}
				else
				{
				return true;
				}		
}




function distext1()
{				
if(document.canstep5.txtcert_type1.value=="Others")
{
	document.canstep5.txtcert_oth.disabled = false;
	document.canstep5.txtcert_oth.value = "";
	document.canstep5.txtcert_oth.focus();

}
else
{	
	document.canstep5.txtcert_oth.value = "";
	document.canstep5.txtcert_oth.disabled = true;
}
}
///////+++++Code for communication address in Personal Details====
function checkaddchange(ival)
{
	if(document.canstep1.sameadd.checked==true)
	{
				document.canstep1.commadd.value=document.canstep1.txtadd.value;
				document.canstep1.hidadd.value=document.canstep1.txtadd.value;
				document.canstep1.commadd.disabled= true;
	}
	else
	{
		document.canstep1.commadd.disabled=false;
		document.canstep1.commadd.value="";
		document.canstep1.hidadd.value="";
	}

}


//========End =======================//
//============End Of Function for Certificate Detail======//

function checkcanstep8()
{
if(document.canreg8.selrank1.value != "" && (document.canreg8.mon1.value == "0" && document.canreg8.yer1.value == "0"))
	{
	rank = document.canreg8.selrank1.value;
	alert("Please Complete the Experience Details for "+rank+" ...!");
	return false;
	}
else if(document.canreg8.selrank2.value != "" && (document.canreg8.mon2.value == "0" && document.canreg8.yer2.value =="0"))
	{
	rank = document.canreg8.selrank2.value;
	alert("Please Complete the Experience Details for "+rank+" ...!");
	return false;
	}
else if(document.canreg8.selrank3.value != "" && (document.canreg8.mon3.value == "0" && document.canreg8.yer3.value == "0"))
	{
	rank = document.canreg8.selrank3.value;
	alert("Please Complete the Experience Details for "+rank+" ...!");
	return false;
	}		
	else
	{
	return true;
	}
}




function chkcanupd_per()
{
if(document.can_update_per.txtname.value == "") 
		{
		alert("Please Enter your First Name...!");
		document.can_update_per.txtname.focus();
		return false;
		}
		else if(!charsOccurIn(document.can_update_per.txtname.value, "abcdefghijklmnopqrstuvwxyz "))
		{
			alert("Please Enter your valid First Name...!");
			document.can_update_per.txtname.focus();
			return false;
		}
		else if(document.can_update_per.txtname2.value == "") 
		{
		alert("Please Enter your Last Name...!");
		document.can_update_per.txtname2.focus();
		return false;
		}
		else if(!charsOccurIn(document.can_update_per.txtname2.value, "abcdefghijklmnopqrstuvwxyz "))
		{
			alert("Please Enter your valid Last Name...!");
			document.can_update_per.txtname2.focus();
			return false;
		}
		else if(document.can_update_per.txtdob.value == "")
		{
		alert("Please Select your Date of Birth ..!");
		return false;
		}
		else
		{
		return true;
		}
}



function chkcanupd_cont()
{
	if(document.canupd_cont.txtcity.value == "") 
		{
		alert("Please enter your City...!");
		document.canupd_cont.txtcity.focus();
		return false;
		}
		else if(!charsOccurIn(document.canupd_cont.txtcity.value, "abcdefghijklmnopqrstuvwxyz -."))
		{
			alert("Please Enter your valid City Name...!");
			document.canupd_cont.txtcity.focus();
			return false;
		}
		else if(document.canupd_cont.txtstate.value == "") 
		{
		alert("Please enter your State...!");
		document.canupd_cont.txtstate.focus();
		return false;
		}
		else if(!charsOccurIn(document.canupd_cont.txtstate.value, "abcdefghijklmnopqrstuvwxyz -."))
		{
			alert("Please Enter your valid State Name...!");
			document.canupd_cont.txtstate.focus();
			return false;
		}
		else if(document.canupd_cont.txtzip.value == "") 
		{
		alert("Please enter your Zip Code...!");
		document.canupd_cont.txtzip.focus();
		return false;
		}
		else if(!charsOccurIn(document.canupd_cont.txtzip.value, "0123456789 "))
		{
			alert("Please Enter your valid Zip Code...!");
			document.canupd_cont.txtzip.focus();
			return false;
		}
		else if((document.canupd_cont.txtadd.value == "") ||(document.canupd_cont.txtadd.value.length < 15))
		
		{
		alert("Please Emter your Complete Permanent Address...!");
		document.canupd_cont.txtadd.focus();
		return false;
		}
		else if((document.canupd_cont.comadd.value == "") ||(document.canupd_cont.comadd.value.length < 15))
		{
		alert("Please Enter your Complete Communication Address...!");
		document.canupd_cont.commadd.focus();
		return false;
		}
		else if(document.canupd_cont.txtisd1.value == "") 
		{
		alert("Please Enter  your ISD Code [Phone No. I]...!");
		document.canupd_cont.txtisd1.focus();
		return false;
		}
		else if(!charsOccurIn(document.canupd_cont.txtisd1.value, "1234567890"))
		{
		alert("Only Numerics allowed for Country Code [Phone No.I]...!");
		document.canupd_cont.txtisd1.focus();
		return false;
		}
		else if(document.canupd_cont.txtstd1.value == "") 
		{
		alert("Please enter your STD Code [Phone No. I]...!");
		document.canupd_cont.txtstd1.focus();
		return false;
		}
		else if(!charsOccurIn(document.canupd_cont.txtstd1.value, "1234567890"))
		{
		alert("Only Numerics allowed for State Code [Phone No.I]...!");
		document.canupd_cont.txtstd1.focus();
		return false;
		}
		else if(document.canupd_cont.txtphone1.value == "") 
		{
		alert("Please enter your Phone No...!");
		document.canupd_cont.txtphone1.focus();
		return false;
		}
		
		
		else if(document.canupd_cont.txtphone2.value != "" && document.canupd_cont.txtisd2.value == "" && document.canupd_cont.txtstd2.value == "")
		{
			alert("Please complete Phone No. II...!");
			document.canupd_cont.txtphone2.focus()
			return false;
		}
	else if(!charsOccurIn(document.canupd_cont.txtmobileno.value, "1234567890"))
	{
	alert("Only Numerics allowed for Mobile No...!");
	document.canupd_cont.txtmobileno.focus();
	return false;
	}
	else if(document.canupd_cont.txtnationality.value == "") 
	{
		alert("please Select your Nationality...!");
		document.canupd_cont.txtnationality.focus();
		return false;
	}
		
	else
	{
			return true;
	}


}



function distext4()
{				
if(document.canstep6.cmbiss_auth.value=="Others")
{
	document.canstep6.txtiss_oth.disabled = false;
	document.canstep6.txtiss_oth.value = "";
	document.canstep6.txtiss_oth.focus();

}
else
{	
	document.canstep6.txtiss_oth.value = "";
	document.canstep6.txtiss_oth.disabled = true;
}
}



function checkcanstep6_a()
{

if(document.canstep6.issuing_aut.value == "")
		{
			alert("Please Enter The Issuing Authority...!");					
			document.canstep6.issuing_aut.focus();
			return false	
		}
else if(document.canstep6.cdcnum.value == "") 
{
alert("Please Enter Seamen Book Number...!");
document.canstep6.cdcnum.focus()
return false;
}
else if(!charsOccurIn(document.canstep6.cdcnum.value, "abcdefghijklmnopqrstuvwxyz0123456789 -\/;:"))
		{
			alert("Please Enter a Valid Seaman Book No...!");
			document.canstep6.cdcnum.focus();
			return false;
		}
else if(document.canstep6.cdcdate.value == "") 
{
alert("Please select Expiry Date...!");
document.canstep6.cdcdate.focus()
return false;
}
else
{
return true;
} 

}


function checkcanform4()
{
if(document.canstep4.c1.value == "") 
{
alert("Please Enter a Course Name...!");
document.canstep4.c1.focus()
return false;
}
else if(!charsOccurIn(document.canstep4.c1.value, "abcdefghijklmnopqrstuvwxyz0123456789 -\/&()"))
		{
			alert("Please Enter a Valid Course Name...!");
			document.canstep4.c1.focus();
			return false;
		}
else if(document.canstep4.c2.value == "") 
{
alert("Please Enter your Certificate Number...!");
document.canstep4.c2.focus()
return false;
}
else if(!charsOccurIn(document.canstep4.c2.value, "abcdefghijklmnopqrstuvwxyz0123456789 -\/"))
		{
			alert("Please Enter a Valid Certificate No...!");
			document.canstep4.c2.focus();
			return false;
		}	
else if(document.canstep4.c3.value == "") 
{
alert("Please Enter your Institute Name...!");
document.canstep4.c3.focus()
return false;
}
else if(!charsOccurIn(document.canstep4.c3.value, "abcdefghijklmnopqrstuvwxyz, -\/.'"))
		{
			alert("Please Enter a Valid Institute Name...!");
			document.canstep4.c3.focus();
			return false;
		}
						
else
{
return true;
} 
}



function distext6()
{				
if(document.canstep7.selrank.value=="Others")
{
	document.canstep7.txtrankoth.disabled = false;
	document.canstep7.txtrankoth.value = "";
	document.canstep7.txtrankoth.focus();

}
else
{	
	document.canstep7.txtrankoth.value = "";
	document.canstep7.txtrankoth.disabled = true;
}
}


function distext7()
{				
if(document.canstep7.seltypeship.value=="Others")
{
	document.canstep7.txttypeshipoth.disabled = false;
	document.canstep7.txttypeshipoth.value = "";
	document.canstep7.txttypeshipoth.focus();

}
else
{	
	document.canstep7.txttypeshipoth.value = "";
	document.canstep7.txttypeshipoth.disabled = true;
}
}

function distext8()
{				
if(document.canstep7.selme.value=="Others")
{
	document.canstep7.txtmeoth.disabled = false;
	document.canstep7.txtmeoth.value = "";
	document.canstep7.txtmeoth.focus();

}
else
{	
	document.canstep7.txtmeoth.value = "";
	document.canstep7.txtmeoth.disabled = true;
}
}



function chk_feedback()
{

	myOption = -1;
		for (i=0; i<document.feedback.comment_type.length; i++) 
		{
			if (document.feedback.comment_type[i].checked)
			 {
				myOption = i;
			 }
		}
			if (myOption == -1) 
			{
					alert("Please select the kind of Comment ");
					return false;
			}
			else if (document.feedback.comment_on.options[document.feedback.comment_on.selectedIndex].value=="")
			{
			alert("Please enter what you would like to Comment on...!");
			document.feedback.comment_on.focus();
			return false;
			}
		else if (document.feedback.comment_on.options[document.feedback.comment_on.selectedIndex].value == "Others"
 && document.feedback.comment_others.value =="")
		{
			alert("Please enter what you would like to Comment on...!");
			document.feedback.comment_others.focus();
			return false;
		}
		else if(document.feedback.comment.value == "" )
		{
		
			alert("Please enter your Comments...");
			document.feedback.comment.focus();
			return false;
		}
		
		else if (document.feedback.hear.options[document.feedback.hear.selectedIndex].value=="")
			{
			alert("Please select how did you come to know about us...!");
			document.feedback.hear.focus();
			return false;
			}
	
		else
		{
		return true;
		}
}


function sel_this()
{

if (document.feedback.comment_on.options[document.feedback.comment_on.selectedIndex].value == "Others")
{
document.feedback.comment_others.disabled =false;
document.feedback.comment_others.focus();
}
else
{
document.feedback.comment_others.value ="";
document.feedback.comment_others.disabled =true;
}
}
