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 submitsearch()
{
	err=checkvalid();
	if(err!="")
	{
		alert(err);
		return false;
	}
	else
	{
		document.formmain.clsjobalert_hdnsubmited.value="1";
		document.formmain.clsjobalert_hdnaction.value="DS";
		return true;
	}
}
function submitsavesearch()
{
	
	err=checkvalid();
	if(ValidatorTrim(document.formmain.clsjobalert_janame.value)=="") err+="You must name your Saved Search.";
	if(err!="")
	{
		alert(err);
		return false;
	}
	else
	{
		document.formmain.clsjobalert_hdnsubmited.value="1";
		document.formmain.clsjobalert_hdnaction.value="S";
		return true;
	}
	
}

function editjobalert(jaid)
{
	document.formmain.clsjobalert_jaid.value=jaid;
	document.formmain.action="lcjsadvancesearch.php";
	document.formmain.submit();
}

function searchjobalert(jaid)
{
	document.formmain.clsjobalert_jaid.value=jaid;
	document.formmain.action="lcjssearchresults.php";
	document.formmain.submit();
}

function deletejobalertad(jaid)
{
	if(confirm("Are you sure want to delete job alert"))
	{
		document.formmain.clsjobalert_arrayjaid.value=jaid;
		document.formmain.clsjobalert_hdnaction.value="D";
		document.formmain.clsjobalert_hdnsubmited.value="1";
		document.formmain.submit();
	}
}
function checkvalid()
{
	var err="";
	return err;
}
function whatsthiszipradiussearch()
{
	OpenWin = this.open("lczip_radiussearchpopup.php", "PopupWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=300,height=300,top=100,left=100");
}

function getlocation(cid,usid) {
	var getstate = document.getElementById('selectstate');
	var getcity = document.getElementById('selectcity');
	if(parseInt(cid)==parseInt(usid))
	{
		getstate.disabled = false;
		getcity.disabled = false;
	}
	else
	{
		getstate.disabled = true;
		getcity.disabled = true;
	}
}