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
		//ctl.style.cursor="hand"
		}
	else if (status ==0)
	{
	 	ctl.border=0
	 	//ctl.style.cursor="default"
		}	
}
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");
}
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="";
	if (sNPQS == undefined)
		sNPQS="";
		
	if (document.getElementById('rdAll').checked == true)
		iSearch = 0;
	else
		iSearch = 1;
			
	sKeyWord = document.getElementById('txtASKeyWord').value;
	sAuthor=document.getElementById('txtASAuthor').value;
	sPageNumber=document.getElementById('txtASPageNumber').value;
	sLocation=document.getElementById('txtASLocation').value;
	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();
	jsRemoteCall(perUrl);
}
function jsSearchArch(SearchFor,remotPage,sPage,pType) {
    
	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	var sKeyword="";	
	if (SearchFor == "article")	{	
         if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
			
		if (sKeyword == ""){
			alert("أدخل كلمة البحث");
			return;
		}
	}
	else if (SearchFor == "picture"){			
		 if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		if (sKeyword == ""){
			alert("أدخل كلمة البحث");
			return;
		}
	}
	else if (SearchFor == "picturegallrey"){
		document.getElementById('txtArticleKeyword').value="";	
		sKeyword ="";
	}
	else if (SearchFor == 'advertisement'){
		 if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		if (sKeyword == ""){
			alert("أدخل كلمة البحث");
			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);
}
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="";
	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);
}
function jsASSearch(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="";
	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('txtASStartDate').value;
			sEndDate=document.getElementById('txtASEndDate').value;
	
	if (sKeyWord=="" && sAuthor=="" && sPageNumber=="" && sLocation=="" && sColumnTitle=="" && sStartDate=="" && sEndDate=="") {
		alert("Enter one or more search options");
		return;
	}
	
	if (SearchFor == 'article'){
		perUrl = "AdvanceSearch.ashx?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();
	jsRemoteCall(perUrl);
}
	function jsReset1()//for dateformat 11August2009
 {
    var divs = document.getElementsByTagName('input'); 
    for (var i = 0; i < divs.length; i++)
    {                      
          var divname = divs[i].id; 
          if(divname  == 'txtASKeyWord')
          {   
              divs[i].value=''    
          } 
          
          if(divname  == 'txtASAuthor')
          {   
              divs[i].value=''    
          } 

          if(divname  == 'txtASPageNumber')
          {   
              divs[i].value=''    
          } 

          if(divname  == 'txtASLocation')
          {   
              divs[i].value=''    
          } 
          if(divname  == 'txtASColumnTitle')
          {   
              divs[i].value=''    
          } 
          if(divname  == 'txtASStartDate')
          {   
              divs[i].value=sDate
          } 
          if(divname  == 'txtASEndDate')
          {   
              divs[i].value=sDate
          } 
          
          
    } 
}


function jsReset(){
try
{

    //  if(document.getElementById('txtASKeyWord').value!=null)
		 document.getElementById('txtASKeyWord1').value = "";
	 //if(document.getElementById('txtASAuthor').value!=null) 
		document.getElementById('txtASAuthor1').value ="";
	 //if(document.getElementById('txtASPageNumber').value!=null) 
		document.getElementById('txtASPageNumber1').value="";
	//if(document.getElementById('txtASLocation').value!=null) 
		document.getElementById('txtASLocation1').value="";
	//if(document.getElementById('txtASColumnTitle').value!=null) 
		document.getElementById('txtASColumnTitle1').value="";
		document.getElementById('txtASStartDate1').value = sDate;
        document.getElementById('txtASEndDate1').value = sDate;

}catch(e)
{		
		// 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="";
		document.getElementById('txtASStartDate').value = sDate;
        document.getElementById('txtASEndDate').value = sDate;

	}	
} 



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) ;
}
function jsSearch(SearchFor_in,remotPage_in,sPage_in) {
    SearchFor=SearchFor_in
    remotPage=remotPage_in
    sPage=sPage_in    
	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	var sKeyword="";
	var StartDate="";
	var EndDate="";
	if (SearchFor == "article")	{
		sKeyword = document.getElementById('txtArticleKeyword').value;	
		if (sKeyword == ""){
			   alert("أدخل كلمة البحث");
				Ex2.fader.fadeIn();
				Ex2.isHalted = true;
			return;
		}
		else
		{
			Ex2.fader.fadeOut();
			Ex2.isHalted = false;
		}
	}
	else if (SearchFor == "picture"){	
		 if(sClickButton=="")
		 {
            if(document.getElementById('txtNewSearch'))
			    sKeyword =document.getElementById('txtNewSearch').value;		
		    else
			    sKeyword =document.getElementById('txtArticleKeyword').value;		
		}
		else
		{
		 	sKeyword =document.getElementById('txtArticleKeyword').value;		
		}
		if (sKeyword == ""){
		   
			alert("أدخل كلمة البحث");
			return;
		}
	}
	else if (SearchFor =='Galadvertisement'){
		    if(sClickButton=="")
		    {
             if(document.getElementById('txtNewSearch'))
			    sKeyword =document.getElementById('txtNewSearch').value;
		     else
			    sKeyword =document.getElementById('txtArticleKeyword').value;
			}
			else
			{
			    sKeyword =document.getElementById('txtArticleKeyword').value;
			}
		    StartDate=document.getElementById('txtStartDate').value;
			EndDate=document.getElementById('txtEndDate').value;
			if (sKeyword == ""){
			alert("أدخل كلمة البحث");
			return;
		}
	}
	else if (SearchFor =='Picadvertisement'){
	    if(sClickButton=="")
		 {
		 if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		}
		else
		{
		sKeyword =document.getElementById('txtArticleKeyword').value;
		}
	    StartDate=document.getElementById('txtStartDate').value;
		EndDate=document.getElementById('txtEndDate').value;	   
		if (sKeyword == ""){
		   alert("أدخل كلمة البحث");
		    return;
		}
	}
	else if (SearchFor == "picturegallrey"){
	    
		document.getElementById('txtArticleKeyword').value="";	
		sKeyword ="";
	}
	else if (SearchFor == 'advertisement'){
		sKeyword = document.getElementById('txtArticleKeyword').value;
		if (sKeyword == ""){
			alert("أدخل كلمة البحث");
			return;
		}
	}
	else if (SearchFor =='advertismentgallery'){
		document.getElementById('txtArticleKeyword').value="";
		sKeyword="";
	}
	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 cleartext()
{
}

function setPageToDisplay()
{}

function PicBasicSearch() {    
	if (chck == "False") {
		window.location.href = "Login.aspx"
		return false;
	}
	var sKeyword="";
	var StartDate="";
	var EndDate="";
	if (SearchFor == "article")	{
		sKeyword = document.getElementById('txtArticleKeyword').value;	
		if (sKeyword == ""){
			   alert("أدخل كلمة البحث");
				Ex2.fader.fadeIn();
				Ex2.isHalted = true;
			return;
		}
		else
		{
			Ex2.fader.fadeOut();
			Ex2.isHalted = false;
		}
	}
	else if (SearchFor == "picture"){			
         if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;		
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;		
		if (sKeyword == ""){
		   
			alert("أدخل كلمة البحث");
			return;
		}
	}
	else if (SearchFor =='Galadvertisement'){
         if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		StartDate=document.getElementById('txtStartDate').value;
		EndDate=document.getElementById('txtEndDate').value;
		if (sKeyword == ""){
			alert("أدخل كلمة البحث");
			return;
		}
		if(StartDate=="")
		{
		    alert("Select Start date")
		    return;
		}
		if(EndDate=="")
		{
		    alert("Select end date")
		    return;
		}
	}
	else if (SearchFor =='Picadvertisement'){
		 if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		StartDate=document.getElementById('txtStartDate').value;
		EndDate=document.getElementById('txtStartDate').value;
		if (sKeyword == ""){
			   alert("أدخل كلمة البحث");
			    return;
		}
		if(StartDate=="")
		{
		    alert("Select Start date")
		    return;
		}
		if(EndDate=="")
		{
		    alert("Select end date")
		    return;
		}
	}
	else if (SearchFor == "picturegallrey"){
	    
		document.getElementById('txtArticleKeyword').value="";	
		sKeyword ="";
	}
	else if (SearchFor == 'advertisement'){
		if(document.getElementById('txtNewSearch'))
			sKeyword =document.getElementById('txtNewSearch').value;
		 else
			sKeyword =document.getElementById('txtArticleKeyword').value;
		if (sKeyword == ""){
			alert("أدخل كلمة البحث");
			return;
		}
		StartDate=document.getElementById('txtStartDate').value;
		EndDate=document.getElementById('txtStartDate').value;
		if (sKeyword == ""){
			   alert("أدخل كلمة البحث");
			    return;
		}
		if(StartDate=="")
		{
		    alert("Select Start date")
		    return;
		}
		if(EndDate=="")
		{
		    alert("Select end date")
		    return;
		}
	}
	else if (SearchFor =='advertismentgallery'){
		document.getElementById('txtArticleKeyword').value="";
		sKeyword="";
	}
	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();
	 }		
	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;
	if(mode == "2") 
		perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + dSearchDate + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + dSearchDate + "&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=" + dSearchDate + "&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();	
	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="";
			
	if(SearchFor=="article")
	{
		sKeyword = document.getElementById('txtArticleKeyword').value;	
	}
	else
    {
		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=" + dSearchDate+ "&mode=" +mode;}
	else
	{  perUrl = remotePage + "?keyWords=" + sKeyword + "&NoOfRecords=" + iNoOfRecords + "&Previous=" + iPrevious + "&StartID=" + iStartID + "&RecsShown=" + iRecShown + "&LastEndID=" + iLastEndID + "&LastStartID=" + iLastStartID + "&SearchDate=" + dSearchDate + "&CurrentPage=" + iCurrentPage + "&SearchToDate=" + dSearchDate;	}
		
	
	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();
	
	jsRemoteCall(perUrl);
}