 var hiddenValue = "";
var hiddenCounter =0;
 var toApplyJobIds= new Array();
 var totalChecked =0;
var checkedValue ="";
var adtypeChecked="";

 function submitSearchLatestJobLink(){	
	document.getElementById('location').value="";
	document.getElementById('category').value="";	
	document.getElementById('typeOfSearchIndex').value="LatestJob";
	document.indexForm.action=contextPath+"/faces/jsp/searchResult.jsp";
	document.indexForm.submit();
}

function submitKeySearch(){	
	var key= document.getElementById('indexKeyword').value;	
	/*if(key == 'Eg:Position Title,Company Name' || key == '')
	{
		alert("Please Enter Keyword");
		document.getElementById('indexKeyword').focus();
		return;
	}*/
	document.getElementById('typeOfSearchIndex').value="keywordSearch";	
	document.indexForm.action=contextPath+"/faces/jsp/searchResult.jsp";
	document.indexForm.submit();
}

//ADDED BY AR
function submitIndexKeySearch(){	
	var key= document.getElementById('indexKeyword').value;
	document.getElementById('typeOfSearchIndex').value="keywordSearch";
	document.indexForm.action=contextPath+"/faces/jsp/searchResult.jsp";
	document.indexForm.submit();
}
//Added by Manish
function submitIndexKeySearch(encodedUrl){	
	
	//var key= document.getElementById('indexKeyword').value;
	document.getElementById('typeOfSearchIndex').value="keywordSearch";
	//document.indexForm.action=encodedUrl;
	//document.indexForm.submit();
}

function submitSearchLocationLink(obj){	
	document.getElementById('location').value=obj;
	document.getElementById('category').value="";	
	document.getElementById('typeOfSearchIndex').value="indexSearch";
	document.indexForm.action=contextPath+"/faces/jsp/searchResult.jsp";
	document.indexForm.submit();
}

function submitSearchCategoryLink(obj){
	document.getElementById('category').value=obj;
	document.getElementById('location').value="";	
	document.getElementById('typeOfSearchIndex').value="indexSearch";
	document.indexForm.action=contextPath+"/faces/jsp/searchResult.jsp";
	document.indexForm.submit();
}

function refineLocationLink(obj){		
	document.getElementById('location').value=obj;
	document.getElementById('typeOfSearch').value="refineByLoc";
}


function searchFrmHeader(){
	var keyword =  document.getElementById('keyword').value;

	if(keyword == 'Eg:Position Title,Company Name' || keyword == ''){
		alert("Please enter Keyword");
		document.getElementById('keyword').focus();
		return;
	}
	
	document.getElementById('headerKeyword').value = keyword;
	document.getElementById('typeOfSearch').value = "keywordSearch";
	document.forms[0].action=contextPath+"/faces/jsp/searchResult.jsp";
	document.forms[0].submit();
}

function searchFrmPanel(){
	var keyword = ltrim(document.getElementById('panelKeyword').value);
		if(keyword == 'Eg:Position Title,Company Name' || keyword == ''){
		alert("Please enter Keyword");
		document.getElementById('panelKeyword').focus();
		return;
	}
	
	document.getElementById('headerKeyword').value = keyword;
	document.getElementById('typeOfSearch').value = "keywordSearch";
	keyword = keyword.replace("&","+%26+");
	//alert('keyword after-->' + keyword)
	document.forms[0].action=contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&typeOfSearch="+"keywordSearch";
	window.location = contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&typeOfSearch="+"keywordSearch";
	//document.forms[0].submit();
	//alert('submiting form');	
	return true;
}
//Added By Sourabh
function searchFrmPanelForAdvanceSearch(){
	var keyword =  document.getElementById('panelKeyword').value;
	/*if(keyword == 'Eg:Position Title,Company Name' || keyword == ''){
		alert("Please enter Keyword");
		document.getElementById('panelKeyword').focus();
		return;
	}*/
	
	document.getElementById('headerKeyword').value = keyword;
	document.getElementById('typeOfSearch').value = "keywordSearch";
	var locationAutoSuggest = document.getElementById('frmAdvert:locationAutoSuggest').value ;
	var indexClarify = document.getElementById('indexClarify').value ;
	var jobCat = document.getElementById('frmAdvert:jobCat').value ;
	keyword = keyword.replace("&","+%26+");
	document.forms[0].action=contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	window.location = contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	return true;
}

//Added by Manish
function searchFrmSearchResultPage(){
	var keyword =  document.getElementById('panelKeyword').value;
	
	document.getElementById('headerKeyword').value = keyword;
	document.getElementById('typeOfSearch').value = "keywordSearch";
	/*var locationAutoSuggest = document.getElementById('frmAdvert:locationAutoSuggest').value ;
	var indexClarify = document.getElementById('indexClarify').value ;
	var jobCat = document.getElementById('frmAdvert:jobCat').value ;
	keyword = keyword.replace("&","+%26+");
	document.forms[0].action=contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	window.location = contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	*/
	//return true;
}


function searchResultForJobFunctionandLocation(keyword111,LocationForSearch,jobFunction,search){
	var keyword =  document.getElementById('panelKeyword').value;
	/*if(keyword == 'Eg:Position Title,Company Name' || keyword == ''){
		alert("Please enter Keyword");
		document.getElementById('panelKeyword').focus();
		return;
	}*/
	
	document.getElementById('headerKeyword').value = keyword;
	document.getElementById('typeOfSearch').value = "keywordSearch";
	var locationAutoSuggest = LocationForSearch;
	var indexClarify = "indexClarify" ;
	var jobCat = jobFunction;
	if(search=='keywordSearch'){
	keyword = keyword.replace("&","+%26+");
	document.forms[0].action=contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	window.location = contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	}else if(search=='advanceSearch')
	{
	
	//keyword = keyword.replace("&","+%26+");
	keyword ="";
	var indexClarify = "advanceindexClarify" ;
	document.forms[0].action=contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+search+"&indexClarify="+indexClarify+" ";
	window.location = contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+search+"&indexClarify="+indexClarify+" ";
	}
	return true;
}

//Add By Sourabh Malviya
function searchFrmPanelFormyJobDescription(){
	var keyword =  document.getElementById('panelKeyword').value;
	/*if(keyword == 'Eg:Position Title,Company Name' || keyword == ''){
		alert("Please enter Keyword");
		document.getElementById('panelKeyword').focus();
		return;
	}*/
	
	document.getElementById('headerKeyword').value = keyword;
	document.getElementById('typeOfSearch').value = "keywordSearch";
	var locationAutoSuggest = document.getElementById('jobDescForm:locationAutoSuggest').value ;
	var indexClarify = document.getElementById('indexClarify').value ;
	var jobCat = document.getElementById('jobDescForm:jobCat').value ;
	keyword = keyword.replace("&","+%26+");
	document.forms[0].action=contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	window.location = contextPath+"/faces/jsp/searchResult.jsp?indexKeyword="+keyword+"&locationAutoSuggest="+locationAutoSuggest+"&jobCat="+jobCat+"&typeOfSearch="+"keywordSearch&indexClarify="+indexClarify+" ";
	return true;
}
//Ends By Sourabh Malviya

function selectJob(obj,jobId){	
	
		if(obj.checked)
		  {
			toApplyJobIds[toApplyJobIds.length] = jobId;
		  }
		else
			{
					var temp = new Array();

					for(i=0;i<toApplyJobIds.length;i++){

						if(toApplyJobIds[i] != jobId)
							temp[temp.length] = toApplyJobIds[i];
					}
					toApplyJobIds = temp;
		   }

}


function disableChkFields(){
	var theElement=document.getElementById('mainPanelDiv').childNodes;
	
	for(var z=0; z<theElement.length;z++)
		{
			if(theElement[z].type == 'checkbox') {
					theElement[z].checked = false;
			 }		
		}
} 

function validateSelectedJobs(){
	

		if(toApplyJobIds.length == 0){
			alert("Please select a job to apply");
			return false;
		}
		var temp='';

		for(i=0;i<toApplyJobIds.length;i++){
				if(temp!='')
					temp+=',';
			temp+=toApplyJobIds[i] ;
		}
		document.getElementById('selectedJobs').value = temp;
		return true;
}


function selectAllJobs(obj){

var theElement=document.forms['frmAdvert'];
 var tempId=new Array();
	if(obj.checked== true){
	for(var z=0; z<theElement.length;z++)
		{	
			if(theElement[z].type == "checkbox") {
					if(theElement[z].name!=''){			
						if(theElement[z].name.indexOf('searchMainPanel:dataTable')!= -1){
							var index = theElement[z].name.lastIndexOf(":");						
							var id = theElement[z].name.substring(0,index)+':hiddenIdValue';					
							tempId[tempId.length] = document.getElementById(id).value;
							
							theElement[z].checked= true;
						}else if(theElement[z].name.indexOf('_panel_chk_box')!= -1){
							theElement[z].checked= true;
						}	
					}
			 }		
		}
		toApplyJobIds = tempId;
	}
	else{
		for(var z=0; z<theElement.length;z++)
		{
			if(theElement[z].type == 'checkbox') {				
					if(theElement[z].name!=''){
						if(theElement[z].name.indexOf('searchMainPanel:dataTable')!= -1){
							var index = theElement[z].name.lastIndexOf(":");
							var id = theElement[z].name.substring(0,index)+':hiddenIdValue';					
							theElement[z].checked= false;
						}else if(theElement[z].name.indexOf('_panel_chk_box')!= -1){
							theElement[z].checked= false;
						}
					}
			 }		
		}
		toApplyJobIds = tempId;
	}
}

var locId =0;

function checkNoOfSelected2(el,no){
	locId=0;
	var objList = document.getElementsByName(el.name);
	var c = 0;
	 
	var errAry2 = new Array();
	for (var x=0; (x < objList.length ) ;x++ ){
		if(objList[x].checked) 	{
			c++;
			locId++;
			if(c == 4)
			{
				alert("Cannot select more than 3");
				objList[x].checked=false;
				return;
			}
		}
	}

		
}



var jobCatTextList="";
var industryTextList="";
var editionTextList="";


function checkNoOfSelected4(el,no){
	locId=0;
	var objList = document.getElementsByName(el);
	var c = 0;
	 jobCatTextList="";
	industryTextList="";
	editionTextList="";

	 
	var errAry2 = new Array();
	var displayText="";		
	for (var x=0; (x < objList.length ) ;x++ ){
		if(objList[x].checked) 	{
				var innerHTML = objList[x].parentNode.innerHTML;
				var index = innerHTML.indexOf("&nbsp;");					
				c++;
				locId++;
				/*if(c == 4)
				{
					alert("Cannot select more than 3");
					objList[x].checked=false;
					return;
				}*/
				displayText=innerHTML.substring(index+6,innerHTML.length);
				if(el=="frmSearch:jobCat"){
					if(jobCatTextList!="")
						jobCatTextList+=",";						
						jobCatTextList+=displayText;
						if(jobCatTextList!="")
								document.getElementById("jobCatgList").innerHTML=jobCatTextList;
						else
								document.getElementById("jobCatgList").innerHTML="-Select Job Function-";

				}
				else if(el=="frmSearch:industry"){
					if(industryTextList!="")
						industryTextList+=",";						
						industryTextList+=displayText;
						if(industryTextList!="")
							document.getElementById("indusList").innerHTML=industryTextList;
						else
							document.getElementById("indusList").innerHTML="-Select Industry-";
				}
				else{
					if(editionTextList!="")
						editionTextList+=",";					
						editionTextList+=displayText;
						if(editionTextList!="")
							document.getElementById("editionList").innerHTML=editionTextList;
						else
							document.getElementById("editionList").innerHTML="-Select Edition-";
				}
		}
		else{
			var innerHTML = objList[x].parentNode.innerHTML;
				var index = innerHTML.indexOf("&nbsp;");			
			displayText=innerHTML.substring(index+6,innerHTML.length);
			if(el=="frmSearch:jobCat"){
					if(jobCatTextList.indexOf(displayText+",")!=-1)
						jobCatTextList = jobCatTextList.replace(displayText+",","");						
						if(jobCatTextList!="")
								document.getElementById("jobCatgList").innerHTML=jobCatTextList;
						else
								document.getElementById("jobCatgList").innerHTML="-Select Job Function-";

				}
				else if(el=="frmSearch:industry"){
					if(industryTextList.indexOf(displayText+",")!=-1)
						industryTextList = industryTextList.replace(displayText+",","");
						if(industryTextList!="")
							document.getElementById("indusList").innerHTML=industryTextList;
						else
							document.getElementById("indusList").innerHTML="-Select Industry-";
				}
				else{
				if(editionTextList.indexOf(displayText+",")!=-1)
						editionTextList = editionTextList.replace(displayText+",","");	
						if(editionTextList!="")
							document.getElementById("editionList").innerHTML=editionTextList;
						else
							document.getElementById("editionList").innerHTML="-Select Edition-";
				}

		}
	}
	/*if(jobCatTextList!="" || industryTextList!="" ||editionTextList!=""){
			totalChecked++;
			//alert("Final totalChecked>>>>"+totalChecked);
	}*/
}



function checkNoOfSelected(el,no,inputId,defaultValue,buttonId,defaultId){
	var _id =el.id;
	var hiddenId = _id.substring(0,_id.indexOf(":cgSelected")) +":cgName";	
	var hiddenId1 = _id.substring(0,_id.indexOf(":cgSelected")) +":cgRfnum";		
	var checkedCode= document.getElementById(hiddenId1).value;
	var status = document.getElementById(_id).checked;	

		if(status) 	{		
			
					totalChecked++;

					/*if(totalChecked>=4){
						alert("You can select maximum of three.");
						totalChecked--;
						document.getElementById(_id).checked=false;
						return;
					}*/

					if(checkedValue!=""){
					checkedValue =checkedValue+ ","+checkedCode;
					}else{
					checkedValue =checkedCode;
					}
					
					if(hiddenValue!=""){
						hiddenValue = hiddenValue +"," + document.getElementById(hiddenId).innerHTML;
						hiddenCounter =hiddenCounter +1;
					}else{
						hiddenValue = document.getElementById(hiddenId).innerHTML;
						hiddenCounter =hiddenCounter +1;
					}

			}else{
				totalChecked--;
			

				if(hiddenValue!="" && hiddenValue.indexOf(document.getElementById(hiddenId).innerHTML +",")!=-1){
					hiddenCounter =hiddenCounter -1;			
					hiddenValue = hiddenValue.replace(document.getElementById(hiddenId).innerHTML+",","");	
					checkedValue = checkedValue.replace(checkedCode+",","");
				}else if(hiddenValue!="" && hiddenValue.indexOf(","+document.getElementById(hiddenId).innerHTML)!=-1){
					hiddenCounter =hiddenCounter -1;
					hiddenValue = hiddenValue.replace(","+document.getElementById(hiddenId).innerHTML,"");	
					checkedValue = checkedValue.replace(","+checkedCode,"");
				}
				else if(hiddenValue!="" && hiddenValue.indexOf(document.getElementById(hiddenId).innerHTML)!=-1){
					hiddenCounter =hiddenCounter -1;
					hiddenValue = hiddenValue.replace(document.getElementById(hiddenId).innerHTML,"");	
					checkedValue = checkedValue.replace(checkedCode,"");
				}
			
	}
	if(hiddenValue!="" && hiddenCounter > 0){
		
		document.getElementById(defaultId).innerHTML =hiddenValue;
		document.getElementById(buttonId).style.display ="block";
	}else{
		hiddenCounter =0;
		document.getElementById(defaultId).innerHTML =defaultValue;
		document.getElementById(buttonId).style.display ="block";
	}
	return;
}




function getCheckValue(id){
	var _id =id;
	var hiddenId = _id.substring(0,_id.indexOf(":cgSelected")) +":cgRfnum";
	var hiddenValue = document.getElementById(hiddenId).value;
	
	var status = document.getElementById(id).checked;
	if(status){
			totalChecked =totalChecked + 1;
			if(checkedValue!=""){
			checkedValue =checkedValue+ ","+hiddenValue;
			}else{
			checkedValue =hiddenValue;
			}
	}else{
		totalChecked =totalChecked - 1;
		checkedValue = checkedValue.replace(hiddenValue,"");
	}
	if(totalChecked > 3){
		document.getElementById(id).checked =false;
		totalChecked =totalChecked - 1;
		checkedValue = checkedValue.replace(hiddenValue,"");
		alert("You can select maximum of three.");

	}
}

function checkSelected(el){
	var objList = document.getElementsByName(el.name);
	 locId=0;
	 for (var x=0; (x < objList.length ) ;x++ ){
		if(objList[x].checked) 	{
			locId++;		
			adtypeChecked="checked";
		}
	 }

	 if(locId<1)
		adtypeChecked="";
}



function deselectAll(listDivId,checkStatus){
	var objStatus = checkStatus;
	var listDivObj = document.getElementById(listDivId);
	var listObj = listDivObj.getElementsByTagName('input')
		
	for (var x=0;x<listObj.length ;x++ ){
		if (listObj[x].type != "checkbox") continue;
		listObj[x].checked = objStatus;
	}
	totalChecked=0;
	checkedValue="";
	document.getElementById('locationSelect').innerHTML ="-Select Location-";
	hiddenValue="";
}

function isValidDateDuration(frmDate,toDate){
		var result = true;
		if(toDate!=null && frmDate!=null){
		var days =90;
		var d1=toDate$(frmDate,_dateServerToLocalFormat);
		var d2=	toDate$(toDate,_dateServerToLocalFormat);
	    var timeDiff = d2.getTime() - d1.getTime();

            var dayDiff = timeDiff / 1000 / 60 / 60 / 24;

         if(dayDiff>days) result = false;
		}

 		return result;

}






  function testing()
{
	var	dp_cals  = new Epoch('epoch_popup','popup',document.getElementById("frmSearch:fromDate"),document.getElementById('img3'));
	var	dp_cale  = new Epoch('epoch_popup','popup',document.getElementById("frmSearch:toDate"),document.getElementById('img4'));
	
}

function test(){
document.getElementById('locId').style.display='block';
document.getElementById('locId').style.visibility='visible';
document.getElementById('buttonsDiv').style.display='block';
document.getElementById('buttonsDiv').style.visibility='visible';

}


function getDateObject(dateString,dateSeperator)
	{
		//This function return a date object after accepting 
		//a date string ans dateseparator as arguments
		var curValue=dateString;
		var sepChar=dateSeperator;
		var curPos=0;
		var cDate,cMonth,cYear;

		//extract day portion
		curPos=dateString.indexOf(sepChar);
		cDate=dateString.substring(0,curPos);
	
		//extract month portion				
		endPos=dateString.indexOf(sepChar,curPos+1);			
		cMonth=dateString.substring(curPos+1,endPos);

		//extract year portion				
		curPos=endPos;
		endPos=curPos+5;			
		cYear=curValue.substring(curPos+1,endPos);
	
		//Create Date Object
		dtObject=new Date(cYear,cMonth,cDate);	
		return dtObject;
	}

function searchDateValidate()
{
        var toDate = document.getElementById("frmSearch:toDate").value;
	    var fromDate = document.getElementById("frmSearch:fromDate").value;
	    var keyword = document.getElementById("frmSearch:keyword").value;
	    var expFrm = document.getElementById("frmSearch:expFrm").value;
	    var expTo = document.getElementById("frmSearch:expTo").value;
	    var publication = document.getElementById("frmSearch:publication").value;
		var locationId =null ;
		var locationAutoSuggestValues =  document.getElementById("frmSearch:locationAutoSuggest").value;
	//	document.getElementById("frmSearch:locationListHidden").value =checkedValue;

		/*if(totalChecked ==0) {
			  locationId='';
		}*/


		if(keyword=='' && fromDate=='' && toDate=='' && expFrm=='' && expTo=='' && publication=='' && locationAutoSuggestValues=='' &&  (jobCatTextList=='' || jobCatTextList=='-Select Job Function-')
			 &&  (industryTextList=='' || industryTextList=='-Select Industry-') && (editionTextList=='' || editionTextList=='-Select Edition-') && adtypeChecked=="" ){
			alert("Please Select Any Value ");
			return false;
		}

		 if(expFrm !='' && expTo !='' && parseInt(expFrm) > parseInt(expTo)){
			alert("From experience can not be greater than To experience. ");
			return false;
			
		}

	   if((fromDate!='')&&(toDate!=''))
		{
			dt2=getDateObject(fromDate,"/");
			dt1=getDateObject(toDate,"/");
		if(dt1<dt2)
			{
				alert("Please Choose To Date greater than From Date");
				return false;
			}
		}
		
	   else 
	   return true;
}

function hideListDiv(){		  
document.getElementById('locId').style.display='none';
document.getElementById('locId').style.visibility='hidden';
document.getElementById('buttonsDiv').style.display='none';
document.getElementById('buttonsDiv').style.visibility='hidden';
}

 
function jobCatDiv(){
document.getElementById('jobCatId').style.display='block';
document.getElementById('jobCatId').style.visibility='visible';
hideIndustryDiv();
hideeditionDiv();
}


function hideJobCatDiv(){
document.getElementById('jobCatId').style.display='none';
document.getElementById('jobCatId').style.visibility='hidden';
}

function deselectJobCatAll(){
	var objList = document.getElementsByName("frmSearch:jobCat");
	 
	var errAry2 = new Array();
	for (var x=0; x < objList.length;x++ ){
		if(objList[x].checked) 	{
			objList[x].checked=false; 	
			locId--;
			}
		}
	document.getElementById("jobCatgList").innerHTML ="-Select Job Function-";
	jobCatTextList='';
}

 function industryDiv(){
document.getElementById('industryId').style.display='block';
document.getElementById('industryId').style.visibility='visible';
hideJobCatDiv();
hideeditionDiv();
}


function hideIndustryDiv(){
 document.getElementById('industryId').style.display='none';
document.getElementById('industryId').style.visibility='hidden';
}

function deselectIndustryAll(){
	var objList = document.getElementsByName("frmSearch:industry");
	 
	var errAry2 = new Array();
	for (var x=0; x < objList.length;x++ ){
		if(objList[x].checked) 	{
			objList[x].checked=false; 	
			locId--;
			}
		}
	document.getElementById("indusList").innerHTML ="-Select Industry-";
	industryTextList='';
}
 

function editionDiv(){
document.getElementById('editionId').style.display='block';
document.getElementById('editionId').style.visibility='visible';
hideJobCatDiv();
hideIndustryDiv();
}


function hideeditionDiv(){
document.getElementById('editionId').style.display='none';
document.getElementById('editionId').style.visibility='hidden';
}

function deselecteditionAll(){
	var objList = document.getElementsByName("frmSearch:edition");
	 
	var errAry2 = new Array();
	for (var x=0; x < objList.length;x++ ){
		if(objList[x].checked) 	{
			objList[x].checked=false; 
            locId--;		
			}
		}
	document.getElementById("editionList").innerHTML ="-Select Edition-";
	editionTextList='';
}

function divOpenWalkIn(divid, obj){
	var walkinString= obj.value;
	if(walkinString == "3"){
		if(document.getElementById('walkIndiv').style.display=='none'){
			document.getElementById('walkIndiv').style.display='block';
			document.getElementById('walkIndiv').style.visibility='visible';
		}else {
			document.getElementById('walkIndiv').style.display='none';
			document.getElementById('walkIndiv').style.visibility='hidden';
		}
	}
}

var starImageId="";

function getScore(id){

	starImageId = id.substring(0,id.lastIndexOf(':')+1)+"starImage";
	var hiddenPostId=	id.substring(0,id.lastIndexOf(':')+1)+"hiddenPostIdValue";
	var postJobIdValue=document.getElementById(hiddenPostId).value;
	var pathname = window.location.pathname;
	var contextPath = pathname.substring( 0, pathname.indexOf("/faces") );
	var ctrlURL;
	
	var url=contextPath + "/faces/GetScoreServlet";
	var params ="jobId="+postJobIdValue;
	var loginAjax = new myAjax(url, 'post', 'text', {'params':params,'callBack':'getScoreResponse'});
}

function getScoreResponse(response){
response = trim(response);
document.getElementById(starImageId).src = "../images/"+response+"stars.gif";
}

/* Vjay */
function expand(id){
	//alert('expand called-->' + id);
	collapseAll(id);
	var exp_var = document.getElementById('frmAdvert:'+id);
	exp_var.style.display ="block";	
}	
function collapseAll(id){
	//alert('collapsseAll called');
	for(var i = 0 ; i < 7 ; i++){
		var comp_id_c = 'frmAdvert:option_'+i+'_c'; // collapse
		var comp_id_x = 'frmAdvert:option_'+i+'_x'; // expand
		//alert(comp_id_c);
		//alert(comp_id_x);
		var current_id_c = document.getElementById(comp_id_c);
		var current_id_x = document.getElementById(comp_id_x);
		//alert(current_id_c);
		//alert(current_id_x);
		if(current_id_c != null){
			current_id_c.style.display ="block";			
		}
		if(current_id_x != null){
			current_id_x.style.display ="none";			
		}
		if(id.indexOf(i) != -1 ){
			current_id_c.style.display ="none";
		}	
	}
}
function collapse(id){
	var current_id_x = document.getElementById('frmAdvert:'+id);
	current_id_x.style.display ="none";
	var c_id = 'frmAdvert:'+id.substring(0,id.length-1)+'c';
	//alert('collapse id-->'+c_id+' from expand id-->'+id);
	document.getElementById(c_id).style.display ="block";	
}
function ltrim(stringToTrim) {
	 return stringToTrim.replace(/^\s+/,"");
	 }


