// JavaScript Document

	function checkstate(cntry)
	{
		if (cntry == 1) 
		{
			document.getElementById("state").disabled = false;
		}
		else
		{
			document.getElementById("state").disabled = "disabled";
			document.getElementById("state").value="0";
		}
	}

function validate_required(field,alerttxt)
{
	with(field)
	{
		if(value==null||value=="")
		  {alert(alerttxt);return false}
		else {return true}
	}
}

function validate_form(thisform)
{
	var regexp_domain=/^[a-z\d]{6,10}$/i;
	with (thisform)
	{
		if (validate_required(email,"Please enter the email")==false)
		  {email.focus();return false}
		  
		if (validate_email(email,"Please enter the valid email")==false)
		  {email.focus();return false}  
		  
		if (validate_required(firstname,"Please enter the first name ")==false)
		  {firstname.focus();return false}
		  
		if (validate_IsFirstName(firstname.value,"Please enter the valid characters ")==false)
		  { firstname.focus();return false}
		  
    	if (validate_IsFirstName(lastname.value,"Please enter the valid characters ")==false)
		  { lastname.focus();return false}
		  
		if (validate_required(password,"Please enter the password")==false)
		  {password.focus();return false}  
		  
 	    if (password.value.length <=6)
		  { alert("Password must contain more than 6 characters"); password.focus();return false; }

		if (validate_required(confirm_password,"Please enter the confirm password")==false)
		  {confirm_password.focus();return false}
		  
		if (validate_password(password,confirm_password)==false)
		  {password.focus();return false} 
		  
			  
		if (isDDLEmpty(country,"Please select the country","int"))
  		  { return false}
		  
		if (country.value == 1)
		{
			//alert(state.value);
			if (isDDLEmpty(state,"Please select the state","int"))
				{ return false}
		}	
		
		if (validate_required(city,"Please enter the city")==false)
			{city.focus();return false}
			
		if (validate_IsFirstName(city.value,"Please enter the valid city name")==false)
			{city.focus();return false}	
			
	
		if (validate_required(zipcode,"Please enter the postal code")==false)
			{zipcode.focus();return false}
	
		if (validate_IsNumeric(zipcode.value,"Postal code must be valid number")==false)
			{zipcode.focus();return false}
	
		if (validate_required(month,"Please select the month")==false)
			{month.focus();return false}
	
		if (validate_required(day,"Please select the day")==false)
			{day.focus();return false}
			
		if (validate_required(year,"Please select the year")==false)
			{year.focus();return false}
	
		var ret=getCheckedValue(gend);
		if(ret==null||ret=="")
		  { alert("Select the gender");return false}
		if (chkbx.checked==false)
		  {alert("Please accept the terms and conditions");chkbx.focus();return false}	
}



function validate_email(field,alerttxt)

{

with (field)

{

apos=value.indexOf("@")

dotpos=value.lastIndexOf(".")

if (apos<1||dotpos-apos<2) 

  {alert(alerttxt);return false}

else {return true}

}

}

function validate_password(field1,field2)

{

if(field1.value!=field2.value){

	alert("Password mismatch");

	return false;

		}

		else{

			return true;

			

			}

		

		}

function getCheckedValue(radioObj) {

	if(!radioObj)

		return "";

	var radioLength = radioObj.length;

	if(radioLength == undefined)

		if(radioObj.checked)

			return radioObj.value;

		else

			return "";

	for(var i = 0; i < radioLength; i++) {

		if(radioObj[i].checked) {

			return radioObj[i].value;

		}

	}

	return "";

}	

}







var jplname,jprdname, jpltype,jplseltype,jplurl ;

var jjvsdate, jjvedate, jprmaterial;

var jplcdate, jplsdate, jpltext;



function yes(){

//var ch= document.getElementById("selpltype").value;

//alert(ch);

//alert(document.form.selpltype.value);

//alert(document.form.PLSR.value);

if (document.form.selpltype.value == "Sent"){

document.form.PLSR.value = "Proposal Sent Via"; }

if (document.form.selpltype.value == "Received"){

document.form.PLSR.value = "Proposal Received Via"; }

}



function getVal() {

//alert(jplname);

jplname = document.form.plname.value;

jprdname =document.form.prdname.value;

jpltype = document.form.selpltype.value;

jplseltype = document.form.selpltype1.value;

jplurl = document.form.plurl.value;

jjvsdate = document.form.stDate.value;

jjvedate = document.form.endDate.value;

jprmaterial = document.form.prmaterial.value;

jplcdate = document.form.plCrDate.value;

jplsdate = document.form.plSentDate.value;

jpltext = document.form.pltext.value;



//alert ( "jplname: " + jplname + " jprdname: " + jprdname + " jpltype: " + jpltype + " jplseltype: " + jplseltype + " jplurl: " + jplurl + " jjvsdate: " + jjvsdate + " jjvedate: " + jjvedate + " jprmaterial: " + jprmaterial + " jplcdate: " + jplcdate + " jplsdate: " + jplsdate + " jpltext: " + jpltext);

}



function ss(){



//alert ( "jplname: " + jplname + " jprdname: " + jprdname + " jpltype: " + jpltype + " jplseltype: " + jplseltype + " jplurl: " + jplurl + " jjvsdate: " + jjvsdate + " jjvedate: " + jjvedate + " jprmaterial: " + jprmaterial + " jplcdate: " + jplcdate + " jplsdate: " + jplsdate + " jpltext: " + jpltext);

}

function yesss() {



if ((MMDivR.style.visibility=='hidden') && (MMDivS.style.visibility == 'visible'))

{

MMDivR.style.visibility='visible';

MMDivS.style.visibility='hidden';

}

else

{

MMDivR.style.visibility='hidden';

MMDivS.style.visibility='visible';

}

}

//=====for checking numeric



function validate_IsNumeric_num(sText,alerttext)
{  
   var ValidChars = "0123456789.-+";

   var IsNumber=true;

    var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++) 

      { 

      Char = sText.charAt(i); 

      if (ValidChars.indexOf(Char) == -1) 

         {

			alert(alerttext); 

         IsNumber = false;

         }

      }

   return IsNumber;

   

}






function validate_IsNumeric(sText,alerttext)



{  



   var ValidChars = "0123456789.";

   var IsNumber=true;

    var Char;



 

   for (i = 0; i < sText.length && IsNumber == true; i++) 

      { 

      Char = sText.charAt(i); 

      if (ValidChars.indexOf(Char) == -1) 

         {

			alert(alerttext); 

         IsNumber = false;

         }

      }

   return IsNumber;

   

}

function validate_IsFirstName(sTxt,alerttxt)
{  
   var ValidLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
   var IsFirstName=true;
   var Letter;
   for (var i=0;i<sTxt.length;i++) 
   { 
      Letter = sTxt.charAt(i); 
      if (ValidLetters.indexOf(Letter) == -1) 
      {
			alert(alerttxt);
         	IsFirstName = false;break;
       }
    }	  
   return IsFirstName;
}

function isDDLEmpty(id, alerttxt, droptype)
{
    var dType="0";
    if (droptype == "str") dType = "";
    if (id.value == dType || id.value == null)
    {
        alert(alerttxt);id.focus();return true;
    }
    else
    {
        return false;
    }
}