/*********************************************************************************************************************
.js file for the Search, containing the following functions.
	
	1.  jsChangeDay					- 
	2.  jsShowImage					- 
	3.  jsArchives					- 
	4.  jsShowBorder				- 
	5.  jsSlideShow					- 
	6.  jsASSearch					- 
	7.  jsAdvanceSearch				-
	8.	jsReset						-
	9.	jsASNext					-	
	10.	jsASPrevious				-
	11.	jsSearch					-
	12. jsNewSearch					-
	13.	jsShowNext					-
	14.	jsShowPrevious				-
**********************************************************************************************************************/
/*function jsShowImage(ImageType,ImageName,ImageWidth ,ImageHeight){
	if (ImageType == 'picture') openArticle("ArticleImageEx.aspx",ImageName,ImageWidth,ImageHeight,2)
	else openArticle("ArticleImageEx.aspx",ImageName,ImageWidth,ImageHeight,1)
}*/
//Ravi for Image Opening in archives
function jsShowImage(ImageType,ImageName,ImageWidth ,ImageHeight,mode){
          
	if (ImageType == 'picture') openArticle("ArticleImageEx.aspx",ImageName,ImageWidth,ImageHeight,2,mode)
	else openArticle("ArticleImageEx.aspx",ImageName,ImageWidth,ImageHeight,1,mode)
}
function jsArchives(){
	alert("Archives Coming soon...");
}
function jsShowBorder(ctl,status){
	 if (status == 1)
		ctl.border=1
	else if (status ==0)
		ctl.border=0
}
function jsSlideShow(ShowFor,SearchDate,SearchToDate,mode){
	window.open("viewslideshow.aspx?SlideShowFor=" + ShowFor + "&CurrentDay=" + sCurrentPage + "&SearchStDate=" + SearchDate + "&SearchEndDate=" + SearchToDate + "&mode=" + mode,"vss","fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,height=700,width=650");
}
//Archives For Search August 7 th
function jsASSearch1(SearchFor,sNPQS) {
	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	var iSearch = 0;
	var sKeyWord = "";
	var sAuthor="";
	var sPageNumber="";
	var sLocation="";
	var sColumnTitle="";
	var sStartDate="";
	var sEndDate="";
	var perUrl="";
		
	//validate the control and send the search
	if (sNPQS == undefined)
		sNPQS="";
		
	if (document.getElementById('rdAll').checked == true)
		iSearch = 0;
	else
		iSearch = 1;
			
	sKeyWord = document.getElementById('txtASKeyWord').value;
	//alert(SearchFor);
	sAuthor=document.getElementById('txtASAuthor').value;
	sPageNumber=document.getElementById('txtASPageNumber').value;
	sLocation=document.getElementById('txtASLocation').value;
	sColumnTitle =document.getElementById('txtASColumnTitle').value;
	//sStartDate=document.getElementById('selFrom').options[document.getElementById('selFrom').selectedIndex].value;
	//---------sStartDate=document.getElementById('selFrom').value;
	//sEndDate=document.getElementById('selTo').options[document.getElementById('selTo').selectedIndex].value;
	//----------sEndDate=document.getElementById('selTo').value;
	
	sStartDate=document.getElementById('txtStartDate').value;
	//sEndDate=document.getElementById('selTo').options[document.getElementById('selTo').selectedIndex].value;

	sEndDate=document.getElementById('txtEndDate').value;
	
		
	if (sKeyWord=="" && sAuthor=="" && sPageNumber=="" && sLocation=="" && sColumnTitle=="" && sStartDate=="" && sEndDate=="") {
		alert("Enter one or more search options");
		return;
	}
		
	if (SearchFor == 'article'){
		perUrl = "AdvanceSearch.aspx?Show=RESULT&SearchFor=" + SearchFor + "&KeyWords=" + sKeyWord + "&Author=" + sAuthor 
			+ "&PageNumber=" + sPageNumber + "&Location=" + sLocation + "&ColumnTitle=" + sColumnTitle + "&StartDate=" + sStartDate
			+ "&EndDate=" + sEndDate + "&SearchType=" + iSearch + sNPQS + "&t=" + Math.random();
	}
	//alert(perUrl);
	displayLoading();
	jsRemoteCall(perUrl);
}
/*for Archive Search Article/picture/advertisement*/ 
function jsSearchArch(SearchFor,remotPage,sPage,pType) {

	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	var sKeyword="";	
	if (SearchFor == "article")	{
		//sKeyword = document.getElementById('txtArticleKeyword').value;	
		//common text box for article,ads,picture
         if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
			
		if (sKeyword == ""){
			alert("Enter a keyword to seach");
			return;
		}
	}
	else if (SearchFor == "picture"){	
		//sKeyword = document.getElementById('txtArticleKeyword').value;
		 if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		if (sKeyword == ""){
			alert("Enter a keyword to seach");
			return;
		}
	}
	else if (SearchFor == "picturegallrey"){
		document.getElementById('txtArticleKeyword').value="";	
		sKeyword ="";
	}
	else if (SearchFor == 'advertisement'){
		//sKeyword = document.getElementById('txtArticleKeyword').value;
		 if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		if (sKeyword == ""){
			alert("Enter a keyword to seach");
			return;
		}
	}
	else if (SearchFor == "advertismentgallery"){
		document.getElementById('txtArticleKeyword').value="";
		sKeyword="";
	}
	if (sPage == "")
		sPage = sCurrentPage;
	var perUrl =   remotPage + "?keyWords=" + sKeyword + "&SearchDate=" + sPage + "&mode=" + pType+ "&t=" + Math.random();
	
	
	displayLoading();
	jsRemoteCall(perUrl);
}
// for Archive Advance search functionality
//September 7th 2007 bye ravishankar
function jsASSearchArch(SearchFor,sNPQS,mode) {
	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	var iSearch = 0;
	var sKeyWord = "";
	var sAuthor="";
	var sPageNumber="";
	var sLocation="";
	var sColumnTitle="";
	var sStartDate="";
	var sEndDate="";
	var perUrl="";
		
	//validate the control and send the search
	if (sNPQS == undefined)
		sNPQS="";
		
	if (document.getElementById('rdAll').checked == true)
		iSearch = 0;
	else
		iSearch = 1;
	   if(document.getElementById('txtASKeyWord').value!=null)
		 sKeyWord = document.getElementById('txtASKeyWord').value;
	 if(document.getElementById('txtASAuthor').value!=null) 
		sAuthor=document.getElementById('txtASAuthor').value;
	 if(document.getElementById('txtASPageNumber').value!=null) 
		sPageNumber=document.getElementById('txtASPageNumber').value;
	if(document.getElementById('txtASLocation').value!=null) 
			sLocation=document.getElementById('txtASLocation').value;
	if(document.getElementById('txtASColumnTitle').value!=null) 
			sColumnTitle =document.getElementById('txtASColumnTitle').value
			sStartDate=document.getElementById('txtStartDate').value;
			sEndDate=document.getElementById('txtEndDate').value;
			
			
	
	if (sKeyWord=="" && sAuthor=="" && sPageNumber=="" && sLocation=="" && sColumnTitle=="" && sStartDate=="" && sEndDate=="") {
		alert("Enter one or more search options");
		return;
	}
	
	if (SearchFor == 'article'){
		perUrl = "AdvanceSearch.aspx?Show=RESULT&SearchFor=" + SearchFor + "&KeyWords=" + sKeyWord + "&Author=" + sAuthor 
			+ "&PageNumber=" + sPageNumber + "&Location=" + sLocation + "&ColumnTitle=" + sColumnTitle + "&StartDate=" + sStartDate
			+ "&EndDate=" + sEndDate + "&SearchType=" + iSearch + sNPQS + "&mode=" + mode + "&t=" + Math.random();
	}
	displayLoading();
	
	jsRemoteCall(perUrl);
}
	
// Advance search BEGIN
/* Advance search article - called on the submit button	*/
function jsASSearch(SearchFor,sNPQS) {//alert(document.getElementById('txtASKeyWord').value);
	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	
	var iSearch = 0;
	var sKeyWord = "";
	var sAuthor="";
	var sPageNumber="";
	var sLocation="";
	var sColumnTitle="";
	var sStartDate="";
	var sEndDate="";
	var perUrl="";
		
	//validate the control and send the search
	if (sNPQS == undefined)
		sNPQS="";
		
	if (document.getElementById('rdAll').checked == true)
		iSearch = 0;
	else
		iSearch = 1;
		//alert(document.getElementById('txtASKeyWord').value);
			//if (document.getElementById('txtASKeyWord').value == ""){
			//alert("Enter a keyword to seach");
			//alert("fader alert in adv serach");
			//Ex3.fader.fadeIn();
			//Ex3.isHalted = true;
			//return;}
	
	   if(document.getElementById('txtASKeyWord').value!=null)
		 sKeyWord = document.getElementById('txtASKeyWord').value;
	 if(document.getElementById('txtASAuthor').value!=null) 
		sAuthor=document.getElementById('txtASAuthor').value;
	 if(document.getElementById('txtASPageNumber').value!=null) 
		sPageNumber=document.getElementById('txtASPageNumber').value;
	if(document.getElementById('txtASLocation').value!=null) 
			sLocation=document.getElementById('txtASLocation').value;
	if(document.getElementById('txtASColumnTitle').value!=null) 
			sColumnTitle =document.getElementById('txtASColumnTitle').value
			sStartDate=document.getElementById('txtStartDate').value;
			sEndDate=document.getElementById('txtEndDate').value;
		
	
	if (sKeyWord=="" && sAuthor=="" && sPageNumber=="" && sLocation=="" && sColumnTitle=="" && sStartDate=="" && sEndDate=="") {
		alert("Enter one or more search options");
		return;
	}
	
	if (SearchFor == 'article'){
		perUrl = "AdvanceSearch.aspx?Show=RESULT&SearchFor=" + SearchFor + "&KeyWords=" + sKeyWord + "&Author=" + sAuthor 
			+ "&PageNumber=" + sPageNumber + "&Location=" + sLocation + "&ColumnTitle=" + sColumnTitle + "&StartDate=" + sStartDate
			+ "&EndDate=" + sEndDate + "&SearchType=" + iSearch + sNPQS + "&t=" + Math.random();
	}
	displayLoading();
	//alert(perUrl);
	jsRemoteCall(perUrl);
}
	
function jsReset(){
      if(document.getElementById('txtASKeyWord').value!=null)
		 document.getElementById('txtASKeyWord').value = "";
	 if(document.getElementById('txtASAuthor').value!=null) 
		document.getElementById('txtASAuthor').value ="";
	 if(document.getElementById('txtASPageNumber').value!=null) 
		document.getElementById('txtASPageNumber').value="";
	if(document.getElementById('txtASLocation').value!=null) 
		document.getElementById('txtASLocation').value="";
	if(document.getElementById('txtASColumnTitle').value!=null) 
		document.getElementById('txtASColumnTitle').value="";
} 
/* function jsReset(){
    
       if(document.getElementById('txtASKeyWord').value!=null)
		 document.getElementById('txtASKeyWord').value = "";
	  if(document.getElementById('txtASAuthor').value!=null) 
		document.getElementById('txtASAuthor').value ="";
	  if(document.getElementById('txtASPageNumber').value!=null) 
		document.getElementById('txtASPageNumber').value="";
      if(document.getElementById('txtASLocation').value!=null) 
		document.getElementById('txtASLocation').value="";
	  if(document.getElementById('txtASColumnTitle').value!=null) 
		document.getElementById('txtASColumnTitle').value="";

} */
function jsASNext() {
	var iPrevious=0;
	var iNoOfRecords=0;
	var iLastEndID=0;
	var iLastStartID=0;
	var iStartID=0;
	var iRecShown=0;
	var iCurrentPage="0";
	if (document.getElementById('hidNoOfRecords'))
		iNoOfRecords=document.getElementById('hidNoOfRecords').value;
	if (document.getElementById('hidLastEndID'))
		iLastEndID=document.getElementById('hidLastEndID').value;			
	if (document.getElementById('hidLastStartID'))
		iLastStartID=document.getElementById('hidLastStartID').value;
	if (document.getElementById('hidStartID'))
		iStartID=document.getElementById('hidStartID').value;
	if (document.getElementById('hidRecsShown'))
		iRecShown = document.getElementById('hidRecsShown').value;
	if (iLastEndID.split(",").length == iRecShown){
		return;
	}
	if (document.getElementById('hidCurrentPage'))
		iCurrentPage = parseInt(document.getElementById('hidCurrentPage').value) + 1;	
	var QS =  "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&CurrentPage=" + iCurrentPage		
	jsASSearch('article',QS) ;
}
	
function jsASPrevious() {
	var iPrevious=1;
	var iNoOfRecords=0;
	var iLastEndID=0;
	var iLastStartID=0;
	var iStartID=0;
	var iRecShown=0;
	var iCurrentPage="0";
		
	if (document.getElementById('hidNoOfRecords'))
			iNoOfRecords=document.getElementById('hidNoOfRecords').value;
	if (document.getElementById('hidLastEndID'))
			iLastEndID=document.getElementById('hidLastEndID').value;			
	if (document.getElementById('hidLastStartID'))
			iLastStartID=document.getElementById('hidLastStartID').value;
	if (document.getElementById('hidStartID'))
			iStartID=document.getElementById('hidStartID').value;
	if (document.getElementById('hidRecsShown'))
			iRecShown = document.getElementById('hidRecsShown').value;
	if (iLastEndID.split(",").length == 1)
		return;
	if (document.getElementById('hidCurrentPage'))
			iCurrentPage = document.getElementById('hidCurrentPage').value - 1;
	var QS =  "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&CurrentPage=" + iCurrentPage		
	jsASSearch('article',QS) ;
}
	
// Advance Search END

// General & New Search Begin 
function jsSearch(SearchFor,remotPage,sPage) {//alert('hi');
	//alert(SearchFor+"--:"+remotPage+"---"+sPage);
  // alert(document.getElementById('txtArticleKeyword').value);
	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	var sKeyword="";
	//*************Added for gallery search(between dates)*************
	var StartDate="";
	var EndDate="";
	//*******************End*******************************************
	if (SearchFor == "article")	{
		sKeyword = document.getElementById('txtArticleKeyword').value;	
		if (sKeyword == ""){
			   alert("Enter a keyword to seach");
			   //alert("fader alert in basic serach");
				Ex2.fader.fadeIn();
				Ex2.isHalted = true;
			return;
		}
		else
		{
			Ex2.fader.fadeOut();
			Ex2.isHalted = false;
		}
	}
	else if (SearchFor == "picture"){	
	     
		//common text box for article,ads,picture
		
         if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
			
		if (sKeyword == ""){
		   
			alert("Enter a keyword to seach");
			return;
		}
		
	}
	else if (SearchFor =='Galadvertisement'){
		
         if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		//**************Gallery search********************
		StartDate=document.getElementById('txtStartDate').value;
			EndDate=document.getElementById('txtEndDate').value;
		//**************End********************
			if (sKeyword == ""){
			alert("Enter a keyword to seach");
			return;
		}
	}
	else if (SearchFor =='Picadvertisement'){
		 if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		  //sKeyword =document.getElementById('txtArticleKeyword').value;
		  
		//**************pic search********************
		    StartDate=document.getElementById('txtStartDate').value;
			EndDate=document.getElementById('txtEndDate').value;
		//**************End********************
			if (sKeyword == ""){
			   alert("Enter a keyword to seach");
			    return;
		}
	}
	else if (SearchFor == "picturegallrey"){
	    
		document.getElementById('txtArticleKeyword').value="";	
		sKeyword ="";
	}
	else if (SearchFor == 'advertisement'){
		sKeyword = document.getElementById('txtArticleKeyword').value;
		if (sKeyword == ""){
			alert("Enter a keyword to seach");
			return;
		}
	}
	else if (SearchFor =='advertismentgallery'){
		document.getElementById('txtArticleKeyword').value="";
		sKeyword="";
	}
	
	///code to handle the date issue i.e if startdate is greater then the enddate
	//var start_day=(document.getElementById('txtStartDate').value.split("/",1));
	//var end_day=(document.getElementById('txtEndDate').value.split("/",1));
	//alert(start_day);
	//alert(end_day);
	//if(start_day>end_day){alert('StartDate should be less then the EndDate');return;}
	///////////////
	//***************added for gallery(Search between dates)********************
	if (SearchFor =='Picadvertisement')
	{
	    
		var perUrl =   remotPage + "?keyWords=" + sKeyword + "&SearchDate=" + StartDate +"&SearchToDate="+ EndDate + "&t=" + Math.random();
	}
	else if (SearchFor =='Galadvertisement')
	{
		var perUrl =   remotPage + "?keyWords=" + sKeyword + "&SearchDate=" + StartDate +"&SearchToDate="+ EndDate + "&t=" + Math.random();
		
	}
	else
	{
		if (sPage == "")
		sPage = sCurrentPage;
		var perUrl =   remotPage + "?keyWords=" + sKeyword + "&SearchDate=" + sPage + "&t=" + Math.random();
	 }		
	//alert(perUrl);	 
	displayLoading();
	jsRemoteCall(perUrl);
}

	
function jsShowNext(SearchFor,remotePage,mode){
	var iPrevious=0;
	var iNoOfRecords=0;
	var iLastEndID=0;
	var iLastStartID=0;
	var iStartID=0;
	var iRecShown=0;
	var iCurrentPage="0";
		
	var dSearchDate="";
	var dSearchToDate="";
	var sKeyword="";
	var perUrl="";

    sKeyword = document.getElementById('txtNewSearch').value;
	if (document.getElementById('hidNoOfRecords'))
		iNoOfRecords=document.getElementById('hidNoOfRecords').value;
			
	if (document.getElementById('hidStartID'))
		iStartID=document.getElementById('hidStartID').value;
			
	if (document.getElementById('hidLastStartID'))
		iLastStartID=document.getElementById('hidLastStartID').value;
			
	if (document.getElementById('hidLastEndID'))
		iLastEndID=document.getElementById('hidLastEndID').value;
			
	if (document.getElementById('hidRecsShown'))
		iRecShown = document.getElementById('hidRecsShown').value;
			
	if (document.getElementById('hidSearchDate'))
		dSearchDate=document.getElementById('hidSearchDate').value;
			
	if (iLastEndID.split(",").length == iRecShown){
		return;
	}
	if (document.getElementById('hidCurrentPage'))
		iCurrentPage = parseInt(document.getElementById('hidCurrentPage').value) + 1;
//	alert(mode);
	if(mode == "2") 
		perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + dSearchDate + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtStartDate').value + "&mode=" + mode + "&t=" + Math.random();
	else
		perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + dSearchDate + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtStartDate').value + "&t=" + Math.random();
			
	if ((SearchFor =='picture')||(SearchFor =='advertisement'))
	{ 
		if(mode == "2") 
		    perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + document.getElementById('txtStartDate').value + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtEndDate').value + "&mode=" + mode + "&t=" + Math.random();
		else
		    perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + document.getElementById('txtStartDate').value + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtEndDate').value + "&t=" + Math.random();
	}	
	displayLoading();
	//alert(perUrl);
	jsRemoteCall(perUrl);
			
}
	
function jsShowPrevious(SearchFor,remotePage,mode){
	var iPrevious=1;
	var iNoOfRecords=0;
	var iLastEndID=0;
	var iLastStartID=0;
	var iStartID=0;
	var iRecShown=0;
	var iCurrentPage="0";
	var dSearchDate="";
	var sKeyword="";
	var perUrl="";
			
	sKeyword = document.getElementById('txtNewSearch').value;
			
	if (document.getElementById('hidNoOfRecords'))
		iNoOfRecords=document.getElementById('hidNoOfRecords').value;
			
	if (document.getElementById('hidStartID'))
		iStartID=document.getElementById('hidStartID').value;
			
	if (document.getElementById('hidLastStartID'))
		iLastStartID=document.getElementById('hidLastStartID').value;
			
	if (document.getElementById('hidLastEndID'))
		iLastEndID=document.getElementById('hidLastEndID').value;
			
	if (document.getElementById('hidRecsShown'))
		iRecShown = document.getElementById('hidRecsShown').value;
			
	if (document.getElementById('hidSearchDate'))
		dSearchDate=document.getElementById('hidSearchDate').value;
		
	if (iLastEndID.split(",").length == 1){
		return;
	}
	if (document.getElementById('hidCurrentPage'))
		iCurrentPage = document.getElementById('hidCurrentPage').value - 1;
	if (mode == "2") 
	{  perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + dSearchDate + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtStartDate').value+ "&mode=" +mode;}
	else
	{  perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + dSearchDate + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtStartDate').value;	}
		
	
	if((SearchFor =='picture')||(SearchFor =='advertisement'))
	{   if (mode == "2"){
			perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + document.getElementById('txtStartDate').value + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtEndDate').value+ "&mode=" + mode + "&t=" + Math.random();	
		}
		else
		{	perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + document.getElementById('txtStartDate').value + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + document.getElementById('txtEndDate').value + "&t=" + Math.random();
		}	
	}
	displayLoading();
	//alert(perUrl);
	jsRemoteCall(perUrl);
}


function cleartext(){
document.getElementById('txtNewSearch').value="";
}