function validsubmit()
{
	
		var err="";
		if(document.formmain.clspostjob_postby.selectedIndex==0) err+="Select one option from \'you are a:\' listbox\n";
		
		if(ValidatorTrim(document.formmain.clspostjob_orgname.value)=="") err+="Organization name is required field.\n";
		var desclength = document.formmain.clspostjob_jobdesc.value.length;
		if(document.formmain.clspostjob_jobdesc.value != "")
		{
		 if(desclength < 100)
		  err+="Job Description should be minimum 100 characters.\n";
		}  
		
		//if(ValidatorTrim(document.formmain.clspostjob_location.value)=="") err+="Location is required field.\n";
		
		//if(ValidatorTrim(document.formmain.clspostjob_url.value)=="") err+="Url is required field.\n";
		
		/*var firmtypeflag=false;
		for(i = 0; i < document.formmain.elements.length; i++)
		{
			if(document.formmain.elements[i].name=="clspostjob_firmtype")
			{
			  oElement=document.formmain.elements[i];
				if(oElement.value!=-1)	
				 firmtypeflag=true;
			}
		}
		
		if(firmtypeflag==false) err += "Organization Type is required\n";
				
		var jobtypeflag=false;
		for(i = 0; i < document.formmain.elements.length; i++)
		{
			if(document.formmain.elements[i].name=="clspostjob_jobtype")
			{
			  oElement=document.formmain.elements[i];
				if(oElement.value!=-1)
				  jobtypeflag=true;
			}
		}
		if(jobtypeflag==false) err += "Job Type is required\n";
		
		var employmenttypeflag=false;
		for(i = 0; i < document.formmain.elements.length; i++)
		{
			if(document.formmain.elements[i].name=="clspostjob_employmenttype")
			{
			  oElement=document.formmain.elements[i];
				if(oElement.value!=-1)
				  employmenttypeflag=true;
			}
		}
		if(employmenttypeflag==false) err += "Employment Type is required\n"; */
		var employmenttypeflag=false;		
		 for(i = 0; i < document.formmain.elements.length; i++)
		{		
		 if(document.formmain.elements[i].name=="clspostjob_employmenttype_mandatory[]" && document.formmain.elements[i].type == "checkbox" && document.formmain.elements[i].checked)
			{
				 employmenttypeflag=true;
			}
		}	
		if(employmenttypeflag==false) err += "Employment Type is required\n";
		if(ValidatorTrim(document.formmain.clspostjob_jobtitle.value)=="") err+="Job Title is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_jobdesc.value)=="") err+="Job Description is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_contactzip.value)=="") err+="Zip Code is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_contactfirstname.value)=="") err+="Contact name is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_contactaddress1.value)=="") err+="Contact Address is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_contactstateregionid.value)=="0") err+="Contact State is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_contactcityregionid.value)=="") err+="Contact City is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_jobstateregionid.value)=="0") err+="Job State is required field.\n";
		if(ValidatorTrim(document.formmain.clspostjob_jobcityregionid.value)=="") err+="Job City is required field.\n";
		
		if((ValidatorTrim(document.formmain.clspostjob_contactphone.value)) == "" && 
		                           (ValidatorTrim(document.formmain.clspostjob_contactfax.value)) == "")
		  err+="Please select atleast one option from phone and fax \n";
		
		if(ValidatorTrim(document.formmain.clspostjob_contactemail.value)=="")
			err+="Contact email is required field \n";
		else
			err += checkEmail(document.formmain.clspostjob_contactemail.value);
		//if(ValidatorTrim(document.formmain.clspostjob_contactemail.value)!=ValidatorTrim(document.formmain.clspostjob_contactconfirmemail.value))
		//	err+="Both the e-mail must be same.\n";
		
		var flg=false;
		for(i = 0; i < document.formmain.elements.length; i++)
		{
			if(document.formmain.elements[i].name=="clspostjob_recieveapplication[]" && document.formmain.elements[i].type == "checkbox" && document.formmain.elements[i].checked)
			{		
				flg=true;
				if(document.formmain.elements[i].value==3)
				{
					if(ValidatorTrim(document.formmain.clspostjob_contactfax.value)=="") err+="Contact Fax is required field.\n";
				}
				if(document.formmain.elements[i].value==4)
				{
					if(ValidatorTrim(document.formmain.clspostjob_applyonlinelink.value)=="") err+="Apply Online Link is required field.\n";
				}
			}
		}
		/* - COMMENTED BY ANANT ON 2008-08-19 AS NOW THESE FIELDS ARE NOT MANDATORY
		if(!flg)
			err+="Select atleast one option from\n how to receive applications?\n";
		*/
		
			close_year=parseInt(document.formmain.clspostjob_closeyear.value);							
			open_year=parseInt(document.formmain.clspostjob_openyear.value);
			close_month=parseInt(document.formmain.clspostjob_closemonth.value);
			open_month=parseInt(document.formmain.clspostjob_openmonth.value);
			close_day=parseInt(document.formmain.clspostjob_closeday.value);
			open_day=parseInt(document.formmain.clspostjob_openday.value);
			
			if(isNaN(open_year))
			{
				if(!isNaN(open_month) || !isNaN(open_day))
				{
					err+="Please Enter Valid Job Opening Date\n";
				}
			}
			else if(isNaN(open_month))
			{
				if(!isNaN(open_day))
				{
					err+="Please Enter Valid Job Opening Date\n";
				}
			}
			if(isNaN(close_year))
			{
				if(!isNaN(close_month) || !isNaN(close_day))
				{
					err+="Please Enter Valid Job Closing Date\n";
				}
			}
			else if(isNaN(close_month))
			{
				if(!isNaN(close_day))
				{
					err+="Please Enter Valid Job Closing Date\n";
				}
			}
			if(close_year<open_year)
			{
				err+="Please Enter valid Job Closing Date\n";
			}
			else if(close_year==open_year)
			{
				if(close_month<open_month)
				 {
					err+="Please Enter valid Job Closing Date\n";
				 }
			 else if(close_month==open_month)
				{
					if(close_day<open_day)
					{
						err+="Please Enter valid Job Closing Date\n";
					}
				} 
			}
		//if(ValidatorTrim(document.formmain.clspostjob_contactaddress1.value)=="") err+="Contact Address is required field.\n";		
		
		/*
		var practiceareaflag=false;
		for(i = 0; i < document.formmain.elements.length; i++)
		{
			if(document.formmain.elements[i].name=="clspostjob_arrparameters[]" && document.formmain.elements[i].type == "checkbox" && document.formmain.elements[i].checked)
			{
				practiceareaflag=true;
			}
		}
		if(practiceareaflag==false) err += "Practice Areas is required\n";
		*/
		
		//alert("Hi");
		if(err!=""){
			alert(err);
			return false;
			}
		else
			{
				document.formmain.clspostjob_hdnsubmited.value='1';
			}
}
function validateuploadcsv()
{
	var err="";
	if(document.formmain1.clspostjob_postby.selectedIndex==0) err+="Select one option from \'you are a:\' listbox\n";
	
	if(ValidatorTrim(document.formmain1.clspostjob_contactfirstname.value)=="")
		err+="First name is required field \n";
	
	if(ValidatorTrim(document.formmain1.clspostjob_contactlastname.value)=="")
		err+="Last name is required field \n";
		
	if(ValidatorTrim(document.formmain1.clspostjob_contactemail.value)=="")
		err+="Contact email is required field \n";
	else
		err += checkEmail(document.formmain1.clspostjob_contactemail.value);
	if(!document.formmain1.clspostjob_usercsvfile.value.match(/\.csv$/i))
	{
		err+="File must be of CSV type \n";
	}
	
	if(document.formmain1.clspostjob_usercsvfile.value == "") err+="Please select CSV file to post jobs";
	if(err!="")
	{
		alert(err);
		return false;
	}
	else
	{
		document.formmain1.clspostjob_hdnsubmited.value='1';
		document.formmain1.clspostjob_hdnaction.value="";
		document.formmain1.clspostjob_hdncsvupload.value="Upload File";
		document.formmain1.submit();
	}
}
function download(path)
{
	document.formmain1.clspostjob_hdnsubmited.value='1';
	document.formmain1.clspostjob_hdnaction.value="downloadfile";
	document.formmain1.submit();
}

function getSelectedStates(obj,hdnCSV)
	{
	  var lstState=document.getElementById(obj);
	  var selectedStates=document.getElementById(hdnCSV);	
	  selectedStates.value="";
	   if(lstState.options.length>0)
	   {
	   	 for(counter=0;counter<lstState.options.length;counter++)
	   	 {
	   	   if(lstState.options[counter].selected==1)	
	   	 	selectedStates.value+=lstState.options[counter].value+",";
	   	 }
	   }
	}
	function checkinitiaSelection(obj)
	{
		componant =document.getElementById(obj);
		if(componant.value =='')
		{
			
			componant.options[0].selected=true;
		}
			
	}
	
function getcitystatetext(idname,hiddenname)
{
	var combo1 = document.getElementById(idname);
	if(hiddenname == "clspostjob_jobdetailstate")
	document.formmain.clspostjob_jobdetailstate.value = combo1.options[combo1.selectedIndex].text;
	if(hiddenname == "clspostjob_jobdetailcity")
	document.formmain.clspostjob_jobdetailcity.value = combo1.options[combo1.selectedIndex].text;
	if(hiddenname == "clspostjob_contactstate")
	document.formmain.clspostjob_contactstate.value = combo1.options[combo1.selectedIndex].text;
	if(hiddenname == "clspostjob_contactcity")
	document.formmain.clspostjob_contactcity.value = combo1.options[combo1.selectedIndex].text;
}