
function isWhiteSpaces(S)
{
	var isNull
	if (S.length == 0 ) 
		isNull = true;
	else
	{
		for (I=0;I < S.length; I++ )
		{
			isNull = S.substring(I,I+1)==" "?true:false
			if (!isNull) break;
		}
	}
	return isNull;
}

function isAlpha(S)
{
	for (var i=0; i<S.length; i++) 
	{
		var ch = S.charAt(i);
		if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && (ch != ' ') && (ch <'0') && (ch >'9')) 
			return false;
	}
	return true;
}

function isNumeric(S)
{
	if (!isNaN(S))	
		return true;	
	return false;
}

function isEmail(email)
{
	var isNullEmail = isWhiteSpaces(email)
	var emailLength = email.length
	var isSPACEexists = email.indexOf(" ") + 1
	var isATexistsFirst = email.indexOf("@")
	var isATexistsLast = email.lastIndexOf("@")
	var isDOTexistsFirst = email.indexOf(".",isATexistsFirst+1)
	var isDOTexistsNext1 = email.indexOf(".",isATexistsFirst+1)
	var isDOTexistsNext2 
	var isDOTexistsLast = email.lastIndexOf(".")

	if ((emailLength < 8 ) || (isDOTexistsFirst < isATexistsFirst+3) || (isATexistsFirst < 2) ||
   	 	(isDOTexistsLast == emailLength-1) || (isATexistsLast == emailLength-1) ||
    	(isDOTexistsFirst == 0) || (isATexistsFirst == 0) || (isATexistsFirst == isDOTexistsFirst) ||
    	(isATexistsFirst != isATexistsLast) || isSPACEexists || isNullEmail)
	{
		return false;
	}

	while (isDOTexistsNext1 < isDOTexistsLast)
	{
		isDOTexistsNext2 = email.indexOf(".",isDOTexistsNext1+1)
		if (isDOTexistsNext1+1 == isDOTexistsNext2)
		{
			return false;
		}
		isDOTexistsNext1 = isDOTexistsNext2
	}

	return true;
}


function validate ()
	{
	
	if(isWhiteSpaces(document.form1.name.value))
	{
		alert("Please Enter Name......");
		document.form1.name.focus();
		return false;
	}
	if (isNumeric(document.form1.name.value))
	{
		alert ('Please Enter Alphabets Only......');
		document.form1.name.focus();
		return false;
	}
		
	if (document.form1.country.options[document.form1.country.options.selectedIndex].value == "")
       {
	   alert("Please Select Country");
	   document.form1.country.focus();
		return false;
	   }
	   
	if (isWhiteSpaces(document.form1.email.value))
	{
		alert ('Please Enter Email Id......');
		document.form1.email.focus();
		return false;
	}
	
	if (!isEmail(document.form1.email.value))
	{
		alert ("Please Enter Validat Email Id.......");
		document.form1.email.focus();
		return false;
	}
		if (isWhiteSpaces(document.form1.phone.value))
	{
		alert ('Please Enter Contact Number......');
		document.form1.phone.focus();
		return false;
	}
	if (document.form1.party.options[document.form1.party.options.selectedIndex].value == "")
     {
	   	alert("Select Party Type");
	   	document.form1.party.focus();
		return false;
	 }
	if (document.form1.nature.options[document.form1.nature.options.selectedIndex].value == "")
     {
	  	 alert("Select Appropriate Nature of Dispute");
	  	 document.form1.nature.focus();
	    	return false;
	 }
	 if (isWhiteSpaces(document.form1.description.value))
	{
		alert ('Please Enter Description......');
		document.form1.description.focus();
		return false;
	}
    /*if (isWhiteSpaces(document.form1.captchacode.value))
	{
		alert ('Please Enter Security Code......');
		document.form1.captchacode.focus();
		return false;
	}*/
}

function getdata()
{
		document.getElementById("nature2").value = document.getElementById("ddl_nature").value;
		var w = document.getElementById("ddl_nature").selectedIndex;
		document.getElementById("hdn_cunt").value = document.getElementById("ddl_nature").options[w].text;

}


function getlink()
{
	 var w = document.getElementById("ddl_nature").selectedIndex;
	 if(w==1)
	{
		window.open("nature_of_dispute.asp#Admiralty");
		//window.location="nature_of_dispute.asp#Admiralty";
		return;
	}
	else if(w==2)
	{
		window.open("nature_of_dispute.asp#Architectural");
		return;
	}
	
	else if(w==3)
	{
		window.open("nature_of_dispute.asp#Aviation");
		return;
	}
	else if(w==4)
	{
		window.open("nature_of_dispute.asp#bankingdisputes");
		return;
	}
	else if(w==5)
	{
		window.open("nature_of_dispute.asp#Commercial");
		return;
	}
		else if(w==6)
	{
		window.open("nature_of_dispute.asp#Communication");
		return;
	}
	
	else if(w==7)
	{
		window.open("nature_of_dispute.asp#Construction");
		return;
	}
		else if(w==8)
	{
		window.open("nature_of_dispute.asp#Contractor");
		return;
	}
	
	else if(w==9)
	{
		window.open("nature_of_dispute.asp#Contracts");
		return;
	}
		else if(w==10)
	{
		window.open("nature_of_dispute.asp#Corporations");
		return;
	}
	
	else if(w==11)
	{
		window.open("nature_of_dispute.asp#DebtorsCreditors");
		return;
	}
		else if(w==12)
	{
		window.open("nature_of_dispute.asp#EnergyRelated");
		return;
	}
	else if(w==13)
	{
		window.open("nature_of_dispute.asp#Entertainment");
		return;
	}
		else if(w==14)
	{
		window.open("nature_of_dispute.asp#Infrastructure");
		return;
	}
	
	else if(w==15)
	{
		window.open("nature_of_dispute.asp#Insurance");
		return;
	}
		else if(w==16)
	{
		window.open("nature_of_dispute.asp#Intellectual");
		return;
	}
	
	else if(w==17)
	{
		window.open("nature_of_dispute.asp#InternationalLaw");
		return;
	}
		else if(w==18)
	{
		window.open("nature_of_dispute.asp#InternationalLaw");
		return;
	}
	
	else if(w==19)
	{
		window.open("nature_of_dispute.asp#LegalMalpractice");
		return;
	}
		else if(w==20)
	{
		window.open("nature_of_dispute.asp#Malpractice");
		return;
	}
	else if(w==21)
	{
		window.open("nature_of_dispute.asp#MediaLaw");
		return;
	}
		else if(w==22)
	{
		window.open("nature_of_dispute.asp#Mergers");
		return;
	}
	
	else if(w==23)
	{
		window.open("nature_of_dispute.asp#Motor");
		return;
	}
		else if(w==24)
	{
		window.open("nature_of_dispute.asp#Negligent");
		return;
	}
	
	else if(w==25)
	{
		window.open("nature_of_dispute.asp#Partnership");
		return;
	}
		else if(w==26)
	{
		window.open("nature_of_dispute.asp#Securities");
		return;
	}
	
	else if(w==27)
	{
		window.open("nature_of_dispute.asp#Shareholders");
		return;
	}
		else if(w==28)
	{
		window.open("nature_of_dispute.asp#Sports");
		return;
	}
	else if(w==29)
	{
		window.open("nature_of_dispute.asp#SubContractor");
		return;
	}
		else if(w==30)
	{
		window.open("nature_of_dispute.asp#Torts");
		return;
	}
	
	else if(w==31)
	{
		window.open("nature_of_dispute.asp#Transportation");
		return;
	}

}


