function callAdvSrch(){
	var keyword=trim(document.getElementById('keyword').value);
	var bshead=trim(document.getElementById('bshead').value);
	var Author=trim(document.getElementById('Author').value);
	var Company=trim(document.getElementById('Company').value);
	var Industry=trim(document.getElementById('Industry').value);
	var Section=trim(document.getElementById('Section').value);
	var DateSearch=trim(document.getElementById('DateSearch').value);

	/*if(keyword==""){
		alert("Please enter keyword");
		document.getElementById('keyword').focus();
		return false();
	}else if(bshead==""){
		alert("Please enter headline");
		document.getElementById('bshead').focus();
		return false();
	}else if(Author==""){
		alert("Please enter author");
		document.getElementById('Author').focus();
		return false();
	}else if(Company==""){
		alert("Please enter Company");
		document.getElementById('Company').focus();
		return false();
	}else if(Industry==""){
		alert("Please enter Industry");
		document.getElementById('Industry').focus();
		return false();
	}else if(Section==""){
		alert("Please select Section");
		document.getElementById('Section').focus();
		return false();
	}else if(DateSearch==""){
		alert("Please select  DateSearch");
		document.getElementById('DateSearch').focus();
		return false();
	}*/
	
	if((keyword=="") &&( bshead=="") && (Author=="") && (Company=="") && (Industry=="") && (Section=="") && (DateSearch=="")){
		alert("Please Enter Any Input To Perform Search");
		document.getElementById('keyword').focus();
		return false;

	}else{
		var mainurl="/common/advance_searchlisting.php?";
		if(keyword!= "" && keyword != undefined)	{mainurl+="keyword="+keyword+"&";}
		if(bshead!= "" && bshead != undefined)	{mainurl+="bshead="+bshead+"&";}
		if(Author!= "" && Author != undefined)	{mainurl+="Author="+Author+"&";}
		if(Company!= "" && Company != undefined)	{mainurl+="Company="+Company+"&";}
		if(Industry!= "" && Industry != undefined)	{mainurl+="Industry="+Industry+"&";}
		if(Section!= "" && Section != undefined)	{mainurl+="Section="+Section+"&";}
		if(DateSearch=="betweenDates"){
			var frmdate=document.getElementById('fromdate').value;
			var todate=document.getElementById('todate').value;
			if(frmdate>todate){
				alert("From date should be less than Todate .Please select appropiate date.");
				return false;
			}else{
			mainurl+="fromdate="+frmdate+"&"+"todate="+todate+"&";
			}
		}else{
			
		if(DateSearch!= "" && DateSearch != undefined)	{mainurl+="fromdate="+DateSearch+"&";}
		}
		var finalurl = mainurl.substring(0, mainurl.length - 1);

		location.href=finalurl;
	}
	
}

function displayDateBox(){
	if(document.getElementById('DateSearch').value=="betweenDates"){
		document.getElementById('datebox').style.display="block";
	}else{
		document.getElementById('datebox').style.display="none";
	}
	

}
//FUNCTIONS USED FOR ADVANCE SEARCH
function ajax_advsrchResult(keyword,headlines,author,comp,industry,sec,todate,fromdate,totcnt,curpg,sector) {
		if(sector){
			var mainurl="/common/sectorNewsListing";
			if(totcnt!= "" && totcnt != undefined)	{mainurl+="-"+totcnt;}
			if(curpg!= "" && curpg != undefined)	{mainurl+="-"+curpg;}
			if(sector!= "" && sector != undefined)	{mainurl+="-"+sector;}
			location.href=mainurl+".htm";
				
		}else{
			var mainurl="/common/advance_searchlisting.php?";
			if(keyword!= "" && keyword != undefined)	{mainurl+="keyword="+keyword+"&";}
			if(headlines!= "" && headlines != undefined)	{mainurl+="bshead="+headlines+"&";}
			if(author!= "" && author != undefined)	{mainurl+="Author="+author+"&";}
			if(comp!= "" && comp != undefined)	{mainurl+="Company="+comp+"&";}
			if(industry!= "" && industry != undefined)	{mainurl+="industry="+industry+"&";}
			if(sec!= "" && sec != undefined)	{mainurl+="Section="+sec+"&";}
			if(todate!= "" && todate != undefined)	{mainurl+="todate="+todate+"&";}
			if(fromdate!= "" && fromdate != undefined)	{mainurl+="fromdate="+fromdate+"&";}
			if(totcnt!= "" && totcnt != undefined)	{mainurl+="totcnt="+totcnt+"&";}
			if(curpg!= "" && curpg != undefined)	{mainurl+="curpg="+curpg+"&";}
			var finalurl = mainurl.substring(0, mainurl.length - 1);
			location.href=finalurl;
		}
		
		

}


function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function setfDefaultFocus(){
	document.getElementById('keyword').focus();
	return false;
}

