var mapht=680;
var mapwd =1000; //screen.availWidth-15;
var browser=navigator.appName;
var mapwinfeature = "height="+screen.availHeight+","+"width="+screen.availWidth +",left=1,top=1" +",resizable=1 ";
if(browser == 'Netscape'){
mapwinfeature = mapwinfeature+",scrollbars=2";
}

var maprptflag=false;
var winmapreport;

/* for report window height*/
var ht =screen.availHeight-10;
var wd =screen.availWidth-15;
 
var winfeature = "height="+ht+","+"width="+wd +",left=1,top=1" +",resizable=1,scrollbars=0";
var rptflag=false;
var win;

/*end*/

function show_image(mlsnum,num,imagecnt,sysid)
{
if ((mlsnum == null) || (mlsnum == "") ) {
     alert("There is no mlnum available");
     return false ;
 }
if(document.forms[0].membersessionId){
	membersessionId = document.forms[0].membersessionId.value;
}
  var loc = "/mlsreports/pages/media/highresmedia.jsp?mlnum=" + mlsnum + "&num=" + num + "&res=highres&imagecnt="+imagecnt+"&sysid="+sysid+"&membersessionId="+membersessionId;
 document.location= loc;
} // end of show_image

function show_report(sysid,link_type)
{
	  if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
if (link_type == 'AGENT') {
    if(sysid == null) {
     alert("There is no agentid available");
     return false ;
	 }
  
	 
 win =window.open("/mlsreports/runProfileReport.do?method=getAgentProfileReport&selectedPubId="+sysid+"&membersessionId="+membersessionId,"MEDIA"+membersessionId,winfeature);
win.focus();
}
else if (link_type == 'OFFICE') {
 var officeid = sysid ;
    if(sysid == null) {
     alert("There is no officeid available");
     return false ;
	 }
//var ht =screen.availHeight-10;
//var wd =screen.availWidth-15;
//var winfeature = "height="+ht+","+"width="+wd +"left=1,top=5";
	 
win =window.open("/mlsreports/runProfileReport.do?method=getOfficeProfileReport&selectedOfficeId="+sysid+"&membersessionId="+membersessionId,"MEDIA"+membersessionId,winfeature);
win.focus();
}

} // end of show_report

function show_highres_image(mlsnum,num,imagecnt,sysid,pubId,servername)
{
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
if ((mlsnum == null) || (mlsnum == "") ) {
     alert("There is no mlnum available");
     return false ;
 }
 //var loc = "/mlsreports/pages/media/highres.jsp?mlnum=" + mlsnum + "&num=" + num + "&res=highres&imagecnt="+imagecnt+"&sysid="+sysid+"&pubid="+pubId+"&servername="+servername;
 var loc = "/mlsreports/media.do?method=gethighresolution&mlnum=" + mlsnum + "&num=" + num + "&res=highres&imagecnt="+imagecnt+"&sysid="+sysid+"&pubid="+pubId+"&servername="+servername+"&membersessionId="+membersessionId;
  document.location= loc;
} //end of show_highres_image


function show_image(mlsnum,num,imagecnt,sysid,pubId)
{
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
if ((mlsnum == null) || (mlsnum == "") ) {
     alert("There is no mlnum available");
     return false ;
 }
  var loc = "/mlsreports/pages/media/highresmedia.jsp?mlnum=" + mlsnum + "&num=" + num + "&res=highres&imagecnt="+imagecnt+"&sysid="+sysid+"&pubid="+pubId+"&membersessionId="+membersessionId;
 document.location= loc;
} //emd of showimage

function show_highres_media(num,sysid,pubId,imagecount)
{
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
 if(imagecount != 0){
	var currcntval = sysid+"currentcnt";
	if(document.all(currcntval) != null){
		var currcnt =  document.all(currcntval).value;
		if(currcnt != 'null'){
			num = currcnt ;
		}
	}
	win =window.open("/mlsreports/media.do?method=gethigresmedia&num=" + num + "&sysid="+sysid+"&pubid="+pubId+"&membersessionId="+membersessionId ,"MEDIA"+membersessionId,winfeature);
	win.focus();
 }
} 

function open_link_office(sysid,ptype)
{
		 //alert(1);
		if(sysid == null){
    		 alert("There is no sysid available");
    		 return false ;
		 }
		//var cntr = parent.document.pageForm.inside_report_counter.value ;
		//cntr++;
		parent.document.pageForm.check.value = 'Map';
		// alert(parent.document.pageForm.check.value );
		//var location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype="+ptype+"&report=" + ptype+"_media"
		 var location="/mapping/getMap.do&sysid=" +sysid + "&ptype="+ptype+ "&check="+check;
		 // alert("location-->>"+location);
		parent.document.frames["report"].location="/mapping/getMap.do&sysid=" +sysid + "&ptype="+ptype+ "&check="+check;
		//parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype="+ptype+"&report=" + ptype+"_media" ;

}
//////
function open_link_bus(sysid,link_type)
{
if (link_type == "MAP") {
    if(sysid == null){
     alert("There is no sysid available");
     return false ;
	 }
		/*var cntr = parent.document.pageForm.inside_report_counter.value ;
		cntr++;
		parent.document.pageForm.inside_report_counter.value = cntr;
		parent.document.frames["report"].location="/member/common/blank2.jsp?req=/mapping/getMap.do&sysid=" +sysid + "&ptype=BUS" ;
		*/
	alert("This function is no more used");
 } // do if the user wants to see the map

if (link_type == 'MEDIA') {
    if(sysid == null) {
     alert("There is no sysid available");
     return false ;
	 }
		var cntr = parent.document.pageForm.inside_report_counter.value ;
		cntr++;
		parent.document.pageForm.inside_report_counter.value = cntr;
		parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype=BUS&noadd=T&report=" + 'BUS_media' ;
                       } // do if the user wants to see the map

if (link_type == 'AGENT') {
    if(sysid == null) {
     alert("There is no agentid available");
     return false ;
	 }
		var cntr = parent.document.pageForm.inside_report_counter.value ;
		cntr++;
		parent.document.pageForm.inside_report_counter.value = cntr;
		parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runOfficeReport.rpt&report=AG_PROFILE&sysid='" + sysid + "'";
                       } // do if the user wants to see the map

} // end of open_link_bus


function open_link_com(sysid,link_type)
{
if (link_type == "MAP") {
    if(sysid == null){
     alert("There is no sysid available");
     return false ;
	 }
	/*var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/mapping/getMap.do&sysid=" +sysid + "&ptype=COM" ;
	*/
	alert("This function is no more used");
                       } // do if the user wants to see the map

if (link_type == 'MEDIA') {
    if(sysid == null) {
     alert("There is no sysid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype=COM&noadd=T&report=" + 'COM_media' ;
                       } // do if the user wants to see the map

if (link_type == 'AGENT') {
    if(sysid == null) {
     alert("There is no agentid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runOfficeReport.rpt&report=AG_PROFILE&sysid='" + sysid + "'";
                       } // do if the user wants to see the map

} // end of open_link_com

function open_link_lnd(sysid,link_type)
{
if (link_type == "MAP")  {
    if(sysid == null){
     alert("There is no sysid available");
     return false ;
	 }
	/*var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/mapping/getMap.do&sysid=" +sysid + "&ptype=LND" ;
	*/
	alert("This function is no more used");
                       } // do if the user wants to see the map

if (link_type == 'MEDIA')  {
    if(sysid == null) {
     alert("There is no sysid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype=LND&noadd=T&report=" + 'lnd_media' ;
                       } // do if the user wants to see the map

if (link_type == 'AGENT')  {
    if(sysid == null) {
     alert("There is no agentid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runOfficeReport.rpt&report=AG_PROFILE&sysid='" + sysid + "'";
                       } // do if the user wants to see the map

} // end of open_link_lnd


function open_link_mul(sysid,link_type)
{
if (link_type == "MAP")  {
    if(sysid == null){
     alert("There is no sysid available");
     return false ;
	 }
	/*var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
    parent.document.frames["report"].location="/member/common/blank2.jsp?req=/mapping/getMap.do&sysid=" +sysid + "&ptype=MUL" ;
    */
   	alert("This function is no more used");
 } // do if the user wants to see the map

if (link_type == 'MEDIA')  {
    if(sysid == null) {
     alert("There is no sysid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
    parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype=MUL&noadd=T&report=" + 'mul_media' ;
                       } // do if the user wants to see the map

if (link_type == 'AGENT')  {
    if(sysid == null) {
     alert("There is no agentid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runOfficeReport.rpt&report=AG_PROFILE&sysid='" + sysid + "'";
                       } // do if the user wants to see the map

} // end of open_link_mul


function open_link_rnt(sysid,link_type)
{
if (link_type == "MAP")  {
    if(sysid == null){
     alert("There is no sysid available");
     return false ;
	 }
	/*var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
    parent.document.frames["report"].location="/member/common/blank2.jsp?req=/mapping/getMap.do&sysid=" +sysid + "&ptype=RNT" ;
    */
    	alert("This function is no more used");
} // do if the user wants to see the map

if (link_type == 'MEDIA')  {
    if(sysid == null) {
     alert("There is no sysid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
    parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype=RNT&noadd=T&report=" + 'rnt_media' ;
                       } // do if the user wants to see the map

if (link_type == 'AGENT')  {
    if(sysid == null) {
     alert("There is no agentid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runOfficeReport.rpt&report=AG_PROFILE&sysid='" + sysid + "'";
                       } // do if the user wants to see the map

} // end of open_link_rnt

function open_media(sysid,link_type,ptype,pubId){
if (link_type == "MEDIA")  {
    if(sysid == null){
     alert("There is no sysid available");
     return  ;
	 }
//var ht =screen.availHeight-10;
//var wd =screen.availWidth-15;
//var winfeature = "height="+ht+","+"width="+wd +"left=1,top=5";
//window.open ("","REPORTWORKAREA",winfeature) ;
    if(document.forms[0].membersessionId){
		membersessionId = document.forms[0].membersessionId.value;
	}
 win =window.open("/mlsreports/mainListingReport.do?method=getMainListingReport&sysIds="+sysid+"&selectedReport=media&pType="+ptype+"&customSelectedReport="+""+"&pubId="+pubId+"&membersessionId="+membersessionId ,"MEDIA"+membersessionId,winfeature);
win.focus();
}
}

function open_map_link(mlsId, link_type,listingsysid,reporttype){
//	alert("inside open_map_link "+mlsId+","+ link_type+","+listingsysid+","+reporttype);
	if (link_type == "MAP")  {
		//	alert("open_map_link"+mlsId+"link_type"+link_type);
		if(mlsId == null || mlsId == ""){
		 alert("There is no MLS #  available");
		 return  ;
		 }
	// alert("calling :open_map_app"+sysid);
	 open_map_app(mlsId,link_type,reporttype);
	 // openmapwdw("/mlsreports/get_rslt_map_body.do?method=resultMapBody&sysId="+listingsysid);
	}
}


function open_map_link_prductivity(mlsId,pubid,listingsysid,proptype){
//	alert("inside open_map_link "+mlsId+","+ link_type+","+listingsysid+","+reporttype);
		if(mlsId == null || mlsId == ""){
		 alert("There is no MLS #  available");
		 return  ;
		 }
	 open_map_app_productivity(mlsId,pubid,listingsysid,proptype);

}
function open_link_res(sysid,link_type)
{
	//alert("open_link_res");
if (link_type == "MAP")  {
    if(sysid == null){
     alert("There is no sysid available");
     return false ;
	 }
	openmapwdw("/mlsreports/get_rslt_map_body.do?method=resultMapBody&sysId="+sysid);
	//open_map_app(sysid,link_type);
		alert("This function is no more used");
 } // do if the user wants to see the map

if (link_type == 'MEDIA')  {
    if(sysid == null) {
     alert("There is no sysid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runReport.rpt&sysid=" + sysid +  "&ptype=RES&noadd=T&report=" + 'res_media' ;
                       } // do if the user wants to see the map

if (link_type == 'AGENT')  {
    if(sysid == null) {
     alert("There is no agentid available");
     return false ;
	 }
	var cntr = parent.document.pageForm.inside_report_counter.value ;
	cntr++;
	parent.document.pageForm.inside_report_counter.value = cntr;
	parent.document.frames["report"].location="/member/common/blank2.jsp?req=/reports/runOfficeReport.rpt&report=AG_PROFILE&sysid='" + sysid + "'";
                       } // do if the user wants to see the map

} // end of open_link_res
function openmapwdw(url) 
{
 params  = 'width=580';
 params += ', height=540';
 params += ', top=150, left=150';
 

 newwin=window.open(url,'mapreport', params);
 if (window.focus) {newwin.focus()}
 return false;
}
  function disableOpener() {

        if (this.winmapreport != null &&  this.winmapreport.open && !this.winmapreport.closed){
			
			alert("Map window is open . Please close the Map window to resume work here ");
			this.winmapreport.opener = null;
			this.winmapreport.focus();

      }
 }
 
 
 
 function open_map_app(mlsnum,link_type,reporttype)
{
		
if (link_type == "MAP")  {
//	var actioname = "/mlsreports/get_rslt_map_body.do?method=resultMapBody&sysId="+sysid;
	
    if(mlsnum == null){
     alert("There is no mlsnum available");
     return false ;
	 }
	
	try{
		//alert(maprptflag);
	
		xmlHttp = GetXmlHttpObject();
		

		currentSysId = mlsnum;
		customereports = "";
		if(document.forms[0].customereports){
		customereports = document.forms[0].customereports.value;
		}
		if(document.forms[0].systemreports){
			sysreports = document.forms[0].systemreports.value;
			proptype = document.forms[0].pType.value;
		}
		if(document.forms[0].pType){
			proptype = document.forms[0].pType.value;
		}

		if(document.forms[0].membersessionId){
			membersessionId = document.forms[0].membersessionId.value;
		}
		if (xmlHttp==null)
		  {
			 alert ("Your browser does not support AJAX!");
		  return;
		  }
		
		if(maprptflag==false){
			
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			winmapreport.focus();
			if(winmapreport.opener==self){
				//alert("self")
			 //do nothing
			}else {	 
							//	alert("not self")
			winmapreport.close();
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			 winmapreport.focus();
			 
			}
		maprptflag=true;
		}else {
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			winmapreport.focus();
		}

	    xmlHttp.onreadystatechange = openMapApplication;
		
		xmlHttp.open("POST","/mlsreports/mainListingReport.do?method=updateMappingInfo&sysIds="+mlsnum+"&customereports="+customereports+"&sysreports="+reporttype+"&proptype="+proptype+"&membersessionId="+membersessionId,true); 
		 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlHttp.send("");
	
	}catch(err){
		//alert(err);
	}

 } // do if the user wants to see the map

} // end of open_map_app


function open_map_app_productivity(mlsnum,pubid,lstngsysid,proptype)
{
	
    if(mlsnum == null){
     alert("There is no mlsnum available");
     return false ;
	 }
	
	try{
		//alert(maprptflag);
		if(document.forms[0].membersessionId){
			membersessionId = document.forms[0].membersessionId.value;
		}
		xmlHttp = GetXmlHttpObject();
		

		currentSysId = mlsnum;
		
		if (xmlHttp==null)
		  {
			 alert ("Your browser does not support AJAX!");
		  return;
		  }
		

		if(maprptflag==false){
			
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			winmapreport.focus();
			if(winmapreport.opener==self){
				//alert("self")
			 //do nothing
			}else {	 
							//	alert("not self")
			winmapreport.close();
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			 winmapreport.focus();
			 
			}
		maprptflag=true;
		}else {
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			winmapreport.focus();
		}
	
	    xmlHttp.onreadystatechange = openMapApplication;
		
		xmlHttp.open("POST","/mlsreports/runProductivityInventoryReport.do?method=updateMappingInfo&sysIds="+mlsnum+"&proptype="+proptype+"&pubid="+pubid+"&membersessionId="+membersessionId,true); 
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlHttp.send("");
	
	}catch(err){
		//alert(err);
	}



} // end of open_map_app



function open_map_single(mlsnum,proptype,reporttype,pubid){

//	var actioname = "/mlsreports/get_rslt_map_body.do?method=resultMapBody&sysId="+sysid;
	
    if(mlsnum == null){
     alert("There is no mlsnum available");
     return false ;
	 }
	
	try{
		//alert(maprptflag);
		
		xmlHttp = GetXmlHttpObject();
		
		if(document.forms[0].membersessionId){
			membersessionId = document.forms[0].membersessionId.value;
		}
		
	
		if (xmlHttp==null)
		  {
			 alert ("Your browser does not support AJAX!");
		  return;
		  }
		

		if(maprptflag==false){
			
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			winmapreport.focus();
			if(winmapreport.opener==self){
				//alert("self")
			 //do nothing
			}else {	 
							//	alert("not self")
			winmapreport.close();
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			 winmapreport.focus();
			 
			}
		maprptflag=true;
		}else {
			winmapreport=window.open ("","MAPREPORTWORKAREA"+membersessionId,mapwinfeature) ;
			winmapreport.focus();
		}
		
	    xmlHttp.onreadystatechange = openMapApplication;
		
		xmlHttp.open("POST","/mlsreports/mainListingReport.do?method=updateMappingInfo&sysIds="+mlsnum+"&sysreports="+reporttype+"&proptype="+proptype+"&membersessionId="+membersessionId,true); 
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   		xmlHttp.send("");
	
	}catch(err){
		//alert(err);
	}

}
function openMapApplication(){
if (xmlHttp.readyState==4)	{ 
	var mapresponse = xmlHttp.responseText;
	//alert(mapresponse);
	try{
		if((mapresponse.indexOf("Y") != -1)){
			istart = mapresponse.indexOf ("|");
			ipos = mapresponse.indexOf ("@");
		//	alert(istart +","+ipos);
			seqno = mapresponse.substring(istart+1,ipos);
			var end = mapresponse.indexOf (")");
			var endpubid = mapresponse.indexOf ("#");
			var mapurl = mapresponse.substring(ipos+1,end);
			var pubid = mapresponse.substring(end+1,endpubid);
			var end_inst = mapresponse.indexOf (">");
			 memberinstid=mapresponse.substring(endpubid+1,end_inst)
			//openmap(mapurl+"//maprslt.do?method=openMapSingle&single="+seqno+"&pubid="+pubid);
			openmap("/mlsreports/mainListingReport.do?method=getOneLinerReport&single="+seqno+"&pubid="+pubid+"&membersessionid="+memberinstid,memberinstid);
		}
		else{
		winmapreport.close();
		if(mapresponse.indexOf("#")  != -1){
				alert("Sorry but we are unable to map this property.");
		}else{
			alert("Problem opening map application");
			}
		}
		
	}catch(e){
	}
}
}
function openmap(seqno,memberinstid){

var actioname =seqno ;
//var actioname = "http://tax.gsmls.com/";
	if(maprptflag==false){
			
			winmapreport=window.open (actioname,"MAPREPORTWORKAREA"+memberinstid,mapwinfeature) ;
			winmapreport.focus();
			if(winmapreport.opener==self){
				//alert("self")
			 //do nothing
			}else {	 
							//	alert("not self")
			winmapreport.close();
			winmapreport=window.open (actioname,"MAPREPORTWORKAREA"+memberinstid,mapwinfeature) ;
			 winmapreport.focus();
			 
			}
		maprptflag=true;
		}else {
			winmapreport=window.open (actioname,"MAPREPORTWORKAREA"+memberinstid,mapwinfeature) ;
			winmapreport.focus();
		}

}

 function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
	
  return xmlHttp;
}


function disableOpener() {
	
  /*if (winmapreport != null ){
	try{  

		  if(winmapreport && winmapreport.open && !winmapreport.closed){
				
				alert("Map window is open . Please close the Map window to resume work here ");
				winmapreport.opener = null;
				winmapreport.focus();
	
	      }
      }catch(err){
     	 //winmapreport = null;
      }
     }
  
    */ 
    
       
  }

var fetchlowres = false;
  var xmlHttp;
  var browser=navigator.appName;
  function moveright(currentnum, lstngsysid, pubid,moveflg){
		 
	var lstng = document.all('currlstng').value;
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}

	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowresright;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			
			moverightwithdata("R");
		}
  }

  function moveleft(currentnum, lstngsysid, pubid,moveflg){

	var lstng = document.all('currlstng').value;
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowres;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			moverightwithdata("L");
		}
  }

  function moverightwithdata(moveflg){
	var lstng = document.all('currlstng').value;
	var currcntval = lstng+"currentcnt";
	var tocnt = lstng+"tocnt";
    var currcnt =  document.all(currcntval).value;
    var spanid=lstng+"titledesc";
    if(document.forms[0].membersessionId){
    	membersessionId = document.forms[0].membersessionId.value;
    }
    if(moveflg == 'R'){
		currcnt = eval(currcnt)+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined'){
			if(document.all(currval).value != "null"){
				imageid = lstng+"lowresimage";
				document.all(currcntval).value = currcnt;				
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}else{
				imageid = lstng+"lowresimage";
				currcnt = 0;
				currval = lstng+"imageurl"+currcnt;
				currtd = lstng+"imagetitledesc"+currcnt;
				document.all(currcntval).value = currcnt;
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}
		}
	}else{
		currcnt = eval(currcnt)-1;
		document.all(tocnt).innerHTML = currcnt+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined' && document.all(currval) != null){
			if(document.all(currval).value != "null"){
				document.all(currcntval).value = currcnt;
				imageid = lstng+"lowresimage";
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				return;
			}
		}else{
			imageid = lstng+"imagecnt";
			currcnt = eval(document.all(imageid).value)-1;
			document.all(tocnt).innerHTML = currcnt+1;
			currval = lstng+"imageurl"+currcnt;
			currtd = lstng+"imagetitledesc"+currcnt;
			imageid = lstng+"lowresimage";
			document.getElementById(imageid).src=document.all(currval).value;
			document.getElementById(spanid).innerHTML=document.all(currtd).value;
			document.all(currcntval).value = currcnt;
			return;
		}
	}
  }

  function  setlowresright(){
		if (xmlHttp.readyState==4)
		 { 

			fetchlowres = true;
			var lstng = document.all('currlstng').value;
			var divname = lstng+ "lowresid";
			document.getElementById(divname).innerHTML="";
			document.getElementById(divname).innerHTML=xmlHttp.responseText;
			divname = lstng+ "leftimage";
			document.all(divname).style.display = 'block';
			var tocnt = lstng+"tocnt";
			var currcntval = lstng+"imagecnt";		
			var spanid=lstng+"titledesc";
			var currtd = lstng+"imagetitledesc"+1;
			document.getElementById(spanid).innerHTML=document.all(currtd).value;
			//if(document.all(tocnt).innerHTML == document.all(currcntval).value){
			//	var spaname = lstng+"rightimage";
			//	document.all(spaname).style.display = 'none';
		//	}
		 }
	}
function setlowres(){
	if (xmlHttp.readyState==4)
	 { 

		fetchlowres = true;
		var lstng = document.all('currlstng').value;
		var divname = lstng+ "lowresid";
		document.getElementById(divname).innerHTML="";
		document.getElementById(divname).innerHTML=xmlHttp.responseText;
		divname = lstng+ "leftimage";
		document.all(divname).style.display = 'block';
		var tocnt = lstng+"tocnt";
		var currcntval = lstng+"imagecnt";		
		var spanid=lstng+"titledesc";
		var currcnt = eval(document.all(currcntval).value)-1;
		var currtd = lstng+"imagetitledesc"+currcnt;
		document.getElementById(spanid).innerHTML=document.all(currtd).value;

		//if(document.all(tocnt).innerHTML == document.all(currcntval).value){
		//	var spaname = lstng+"rightimage";
		//	document.all(spaname).style.display = 'none';
	//	}
	 }	
}

function moverightflyer(currentnum, lstngsysid, pubid,moveflg){
	var lstng = document.all('currlstng').value;
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowresflyerright;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&flyerflg=true&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&flyerflg=true&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			moverightwithdataflyer("R");
		}
  }

  function moveleftflyer(currentnum, lstngsysid, pubid,moveflg){
	var lstng = document.all('currlstng').value;
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowresflyer;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&flyerflg=true&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&flyerflg=true&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			moverightwithdataflyer("L");
		}
  }

  function moverightwithdataflyer(moveflg){
	  if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	var lstng = document.all('currlstng').value;
	var currcntval = lstng+"currentcnt";
	var tocnt = lstng+"tocnt";
    var currcnt =  document.all(currcntval).value;
    var spanid=lstng+"titledesc";
    if(moveflg == 'R'){
		currcnt = eval(currcnt)+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined'){
			if(document.all(currval).value != "null"){
				imageid = lstng+"lowresimage";
				document.all(currcntval).value = currcnt;
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}else{
				imageid = lstng+"lowresimage";
				currcnt = 0;
				currval = lstng+"imageurl"+currcnt;
				currtd = lstng+"imagetitledesc"+currcnt;
				document.all(currcntval).value = currcnt;
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}
		}
	}else{
		currcnt = eval(currcnt)-1;
		document.all(tocnt).innerHTML = currcnt+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined' && document.all(currval) != null){
			if(document.all(currval).value != "null"){
				document.all(currcntval).value = currcnt;
				imageid = lstng+"lowresimage";
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				return;
			}
		}else{
			imageid = lstng+"imagecnt";
			currcnt = eval(document.getElementById(imageid).value)-1;
			document.all(tocnt).innerHTML = currcnt+1;
			currval = lstng+"imageurl"+currcnt;
			imageid = lstng+"lowresimage";
			currtd = lstng+"imagetitledesc"+currcnt;
			document.getElementById(imageid).src=document.all(currval).value;
			document.getElementById(spanid).innerHTML=document.all(currtd).value;
			document.all(currcntval).value = currcnt;
			return;
		}
	}
  }


function setlowresflyer(){
	if (xmlHttp.readyState==4)
	 { 
		fetchlowres = true;
		var lstng = document.all('currlstng').value;
		var divname = lstng+ "lowresid";
		document.getElementById(divname).innerHTML="";
		document.getElementById(divname).innerHTML=xmlHttp.responseText;
		divname = lstng+ "leftimage";
		document.all(divname).style.display = 'block';
		var tocnt = lstng+"tocnt";
		var currcntval = lstng+"imagecnt";
		var spanid=lstng+"titledesc";
		var currcnt = eval(document.all(currcntval).value)-1;
		var currtd = lstng+"imagetitledesc"+currcnt;
		document.getElementById(spanid).innerHTML=document.all(currtd).value;


		//if(document.all(tocnt).innerHTML == document.all(currcntval).value){
			//var spaname = lstng+"rightimage";
			//document.all(spaname).style.display = 'none';
		//}
	 }	
}
function setlowresflyerright(){
	if (xmlHttp.readyState==4)
	 { 
		fetchlowres = true;
		var lstng = document.all('currlstng').value;
		var divname = lstng+ "lowresid";
		document.getElementById(divname).innerHTML="";
		document.getElementById(divname).innerHTML=xmlHttp.responseText;
		divname = lstng+ "leftimage";
		document.all(divname).style.display = 'block';
		var tocnt = lstng+"tocnt";
		var currcntval = lstng+"imagecnt";
		var spanid=lstng+"titledesc";
		var currtd = lstng+"imagetitledesc"+1;
		document.getElementById(spanid).innerHTML=document.all(currtd).value;

		//if(document.all(tocnt).innerHTML == document.all(currcntval).value){
			//var spaname = lstng+"rightimage";
			//document.all(spaname).style.display = 'none';
		//}
	 }
}

function moverightagent2up(currentnum, lstngsysid, pubid,moveflg){
	var membersessionId="";
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	var lstng = document.all('currlstng').value;
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowresagent2upright;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent2up=true&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent2up=true&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			moverightwithdataagent2up("R");
		}
  }

  function moveleftagent2up(currentnum, lstngsysid, pubid,moveflg){
	var lstng = document.all('currlstng').value;
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowresagent2up;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent2up=true&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent2up=true&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			moverightwithdataagent2up("L");
		}
  }

  function moverightwithdataagent2up(moveflg){
	
	var lstng = document.all('currlstng').value;
	var currcntval = lstng+"currentcnt";
	var tocnt = lstng+"tocnt";
    var currcnt =  document.all(currcntval).value;
    var spanid=lstng+"titledesc";
    if(document.forms[0].membersessionId){
    	membersessionId = document.forms[0].membersessionId.value;
    }
    if(moveflg == 'R'){
		currcnt = eval(currcnt)+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined'){
			if(document.all(currval).value != "null"){
				imageid = lstng+"lowresimage";
				document.all(currcntval).value = currcnt;
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}else{
				imageid = lstng+"lowresimage";
				currcnt = 0;
				currval = lstng+"imageurl"+currcnt;
				currtd = lstng+"imagetitledesc"+currcnt;
				document.all(currcntval).value = currcnt;
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}
		}
	}else{
		currcnt = eval(currcnt)-1;
		document.all(tocnt).innerHTML = currcnt+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined' && document.all(currval) != null){
			if(document.all(currval).value != "null"){
				document.all(currcntval).value = currcnt;
				imageid = lstng+"lowresimage";
				document.getElementById(imageid).src=document.all(currval).value;
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				return;
			}
		}else{
			imageid = lstng+"imagecnt";
			currcnt = eval(document.getElementById(imageid).value)-1;
			document.all(tocnt).innerHTML = currcnt+1;
			currval = lstng+"imageurl"+currcnt;
			imageid = lstng+"lowresimage";
			currtd = lstng+"imagetitledesc"+currcnt;
			document.getElementById(imageid).src=document.all(currval).value;
			document.getElementById(spanid).innerHTML=document.all(currtd).value;
			document.all(currcntval).value = currcnt;
			return;
		}
	}
  }	
  
  function setlowresagent2upright(){
		if (xmlHttp.readyState==4)
		 { 
			fetchlowres = true;
			var lstng = document.all('currlstng').value;
			var divname = lstng+ "lowresid";
			document.getElementById(divname).innerHTML="";
			document.getElementById(divname).innerHTML=xmlHttp.responseText;
			divname = lstng+ "leftimage";
			document.all(divname).style.display = 'block';
			var tocnt = lstng+"tocnt";
			var currcntval = lstng+"imagecnt";
			var spanid=lstng+"titledesc";
			var currtd = lstng+"imagetitledesc"+1;
			document.getElementById(spanid).innerHTML=document.all(currtd).value;
			//if(document.all(tocnt).innerHTML == document.all(currcntval).value){
				//var spaname = lstng+"rightimage";
				//document.all(spaname).style.display = 'none';
			//}
		 }
	}



function setlowresagent2up(){
	if (xmlHttp.readyState==4)
	 { 
		fetchlowres = true;
		var lstng = document.all('currlstng').value;
		var divname = lstng+ "lowresid";
		document.getElementById(divname).innerHTML="";
		document.getElementById(divname).innerHTML=xmlHttp.responseText;
		divname = lstng+ "leftimage";
		document.all(divname).style.display = 'block';
		var tocnt = lstng+"tocnt";
		var currcntval = lstng+"imagecnt";
		var spanid=lstng+"titledesc";
		var currcnt = eval(document.all(currcntval).value)-1;
		var currtd = lstng+"imagetitledesc"+currcnt;
		document.getElementById(spanid).innerHTML=document.all(currtd).value;

		//if(document.all(tocnt).innerHTML == document.all(currcntval).value){
			//var spaname = lstng+"rightimage";
			//document.all(spaname).style.display = 'none';
		//}
	 }
	
}

function moverightagent4up(currentnum, lstngsysid, pubid,moveflg,opnhssysid){
	var lstng = document.all('currlstng').value;
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowresagent4up;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent4up=true&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent4up=true&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			moverightwithdataagent4up("R");
		}
  }

  function moveleftagent4up(currentnum, lstngsysid, pubid,moveflg,opnhssysid){
	var lstng = document.all('currlstng').value;
	 if(document.forms[0].membersessionId){
	    	membersessionId = document.forms[0].membersessionId.value;
	    }
	if(lstng != lstngsysid){
		fetchlowres = false;
		document.all('currlstng').value = lstngsysid;
		document.all('currlstng').value = lstngsysid;
		var currcntval = lstngsysid+"currentcnt";
	    var currcnt =  document.all(currcntval).value;
		if(currcnt != "null"){
			currentnum = currcnt;
		}
	}
	if(fetchlowres == false){
	    xmlHttp=GetXmlHttpObject();
		  if (xmlHttp==null)
		 {
			 alert ("Your browser does not support AJAX!");
			 return;
		  }
		  xmlHttp.onreadystatechange = setlowresagent4up;
		  if(browser == 'Netscape'){
			   xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent4up=true&membersessionId="+membersessionId,true); 
		  }else{
			xmlHttp.open("POST","/mlsreports/media.do?method=getlowresnextprevious&shownum="+currentnum+"&pubid="+pubid+"&sysid="+lstngsysid+"&moveflg="+moveflg+"&agent4up=true&membersessionId="+membersessionId,false); 
		  }
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
			xmlHttp.send("");
		}else{
			moverightwithdataagent4up("L");
		}
  }

  function moverightwithdataagent4up(moveflg){
	  try{
	
	var lstng = document.all('currlstng').value;
	var currcntval = lstng+"currentcnt";
	var tocnt = lstng+"tocnt";
    var currcnt =  document.all(currcntval).value;
    var spanid=lstng+"titledesc";
    if(document.forms[0].membersessionId){
    	membersessionId = document.forms[0].membersessionId.value;
    }
    if(moveflg == 'R'){
		currcnt = eval(currcnt)+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined'){
			if(document.all(currval).value != "null"){
				imageid = lstng+"lowresimage";
				document.all(currcntval).value = currcnt;
				document.getElementById(imageid).src=document.all(currval).value;
				try{
					document.getElementById(spanid).innerHTML=document.all(currtd).value;
				}catch(err){}
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}else{
				imageid = lstng+"lowresimage";
				currcnt = 0;
				currval = lstng+"imageurl"+currcnt;
				document.all(currcntval).value = currcnt;
				document.getElementById(imageid).src=document.all(currval).value;
				try{
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
				}catch(err){}
				document.all(tocnt).innerHTML = currcnt+1;
				imageid = lstng+"imagecnt";
				return;
			}
		}
	}else{
		currcnt = eval(currcnt)-1;
		document.all(tocnt).innerHTML = currcnt+1;
		var currval = lstng+"imageurl"+currcnt;
		var currtd = lstng+"imagetitledesc"+currcnt;
		if(document.all(currval) != 'undefined' && document.all(currval) != null){
			if(document.all(currval).value != "null"){
				document.all(currcntval).value = currcnt;
				imageid = lstng+"lowresimage";
				document.getElementById(imageid).src=document.all(currval).value;
				try{
					document.getElementById(spanid).innerHTML=document.all(currtd).value;
				}catch(err){}
				return;
			}
		}else{
			imageid = lstng+"imagecnt";
			currcnt = eval(document.getElementById(imageid).value)-1;
			document.all(tocnt).innerHTML = currcnt+1;
			currval = lstng+"imageurl"+currcnt;
			imageid = lstng+"lowresimage";
			document.getElementById(imageid).src=document.all(currval).value;
			try{
				document.getElementById(spanid).innerHTML=document.all(currtd).value;
			}catch(err){}
			document.all(currcntval).value = currcnt;
			return;
		}
	}
   }catch(err){}
  }


function setlowresagent4up(){
	if (xmlHttp.readyState==4)
	 { 
		fetchlowres = true;
		var lstng = document.all('currlstng').value;
		var divname = lstng+ "lowresid";
		document.getElementById(divname).innerHTML="";
		document.getElementById(divname).innerHTML=xmlHttp.responseText;
		divname = lstng+ "leftimage";
		document.all(divname).style.display = 'block';
		var tocnt = lstng+"tocnt";
		var currcntval = lstng+"imagecnt";
		//if(document.all(tocnt).innerHTML == document.all(currcntval).value){
			//var spaname = lstng+"rightimage";
			//document.all(spaname).style.display = 'none';
		//}
	 }
}

function showtaxreport(taxid,pubId){
	if(document.forms[0].membersessionId){
		membersessionId = document.forms[0].membersessionId.value;
	}

 win =window.open("/mlsreports/mainListingReport.do?method=getMainListingReport&sysIds="+taxid+"&selectedReport=taxfull&pType=TAX&customSelectedReport="+""+"&pubId="+pubId+"&membersessionId="+membersessionId ,"TAXREPORT"+membersessionId,winfeature);
 win.focus();
}

function showarchivereport(taxid,pubId){
	if(document.forms[0].membersessionId){
		membersessionId = document.forms[0].membersessionId.value;
	}
win =window.open("/mlsreports/mainListingReport.do?method=getMainListingReport&sysIds="+taxid+"&selectedReport=listingarchive&pType=XPY&customSelectedReport="+""+"&pubId="+pubId+"&membersessionId="+membersessionId ,"TAXREPORT"+membersessionId,winfeature);
 win.focus();
}

function buildarchive(lstngsysid,pubId){
	if(document.forms[0].membersessionId){
		membersessionId = document.forms[0].membersessionId.value;
	}
win =window.open("/mlsreports/mainListingReport.do?method=getMainListingReport&sysIds="+lstngsysid+"&selectedReport=archivehistory&pType=XPY&customSelectedReport="+""+"&pubId="+pubId+"&membersessionId="+membersessionId ,"TAXREPORT"+membersessionId,winfeature);
 win.focus();
}

function showopenhousereport(lstngsysid,pubId){
	if(document.forms[0].membersessionId){
		membersessionId = document.forms[0].membersessionId.value;
	}
	win =window.open("/mlsreports/mainListingReport.do?method=getMainListingReport&sysIds="+lstngsysid+"&selectedReport=opnhsagent2up&pType=XPY&customSelectedReport="+""+"&pubId="+pubId+"&calledFrom=search"+"&membersessionId="+membersessionId ,"TAXREPORT"+membersessionId,winfeature);
 	win.focus();
}

function openonelinerw(lsysid,ptype,pubid){
	if(document.forms[0].membersessionId){
		membersessionId = document.forms[0].membersessionId.value;
	}
	if(document.forms['onelinerw'].length == 1){
		document.forms['onelinerw'].action= "/mlsreports/runReport.do?method=getClientfullonelinerData&sysid="+lsysid+"&ptype="+ptype+"&pubid="+pubid+"&membersessionId="+membersessionId;
		document.forms['onelinerw'].target='aaa'+membersessionId;
		document.forms['onelinerw'].submit();
	}else{
		document.forms['onelinerw'][0].action= "/mlsreports/runReport.do?method=getClientfullonelinerData&sysid="+lsysid+"&ptype="+ptype+"&pubid="+pubid+"&membersessionId="+membersessionId;
		document.forms['onelinerw'][0].target='aaa'+membersessionId;
		document.forms['onelinerw'][0].submit();

	}
		
}



function showlistingonelinerw(nextprev,currsysid){
	var st_sysids = document.all['st_sysids'].value;
	if(document.forms[0].membersessionId){
		membersessionId = document.forms[0].membersessionId.value;
	}
	if(st_sysids.split(",").length == 1){
		alert("No more records.")
		return;
	}
	var newsysid = "";
	var newsysidindex = "";
	var arr_sysids = st_sysids.split(",");
	for(i =0 ; i <arr_sysids.length;i++){
		if(eval(currsysid) == eval(arr_sysids[i])){
			newsysidindex = i;
			if(i == 0 && nextprev == "prev"){
				alert("This is the first record.")
				return;
			}
			if(i == eval(arr_sysids.length-1) && nextprev == "next"){
				alert("This is the last record.")
				return;
			}
		}
	}
	if(nextprev == "next"){
		newsysid = arr_sysids[(newsysidindex+1)];
	}
	if(nextprev == "prev"){
			newsysid = arr_sysids[(newsysidindex-1)];
	}
	var ptype =document.all['ptype'].value;
	var pubid=document.all['pubid'].value;

	if(document.forms['onelinerw'].length == 1){
		document.forms['onelinerw'].action= "/mlsreports/runReport.do?method=getClientfullonelinerData&sysid="+newsysid+"&ptype="+ptype+"&pubid="+pubid+"&membersessionId="+membersessionId;
		document.forms['onelinerw'].target='aaa'+membersessionId;
		document.forms['onelinerw'].submit();
	}else{
		document.forms['onelinerw'][0].action= "/mlsreports/runReport.do?method=getClientfullonelinerData&sysid="+newsysid+"&membersessionId="+membersessionId;
		document.forms['onelinerw'][0].target='aaa'+membersessionId;
		document.forms['onelinerw'][0].submit();

	}
	

} 

function showfema(){
	var win = window.open("http://www.fema.gov/hazard/map/index.shtm","new");
}


function shownextpremlnum(selectedsysId,rowid){

	var membersessionid = document.forms[0].membersessionId.value;
	var pType = document.forms[0].pType.value;
	var winname= "REPORTWORKAREA1"+membersessionid;
	var sysIds= document.getElementById("innersysIds").value;

	if(rptflag==false){
		winreport=window.open ("",winname,winfeature) ;
		if(winreport.opener==self){
		 //do nothing
		}else {	 
		winreport.close();
		winreport=window.open ("",winname,winfeature) ;
		 
		}
	rptflag=true;
	}else {
		winreport=window.open ("",winname,winfeature) ;
	}
	document.forms[0].action= "/mlsreports/mainListingReport.do?method=getMainMLSListingReport&membersessionid="+membersessionid+"&selectedsysId="+selectedsysId+"&row="+eval(rowid)+"&innersysIds="+sysIds+"&selectedReport="+document.forms[0].systemreports.value+"&selectedInnerReport="+document.forms[0].systemreports.value+"&calledFrom=search";
	document.forms[0].target=winname;
	document.forms[0].submit();
}

function showkeyboxsettingsrep(mlsnum){
	//var winurl ="/member/pages/inventory/assignlockbox.jsp?ids="+mlsnum+"&instance_name="+document.forms[0].instance_name.value;
	    
		if(document.forms[0].membersessionId){
			membersessionId = document.forms[0].membersessionId.value;
		}
		winname="settingsreportform"+membersessionId;
		win =window.open("/mlsreports/pages/suprarep/keyboxsettingsreport.jsp?ids="+mlsnum+"&membersessionId="+membersessionId ,winname,winfeature);
		win.focus();
	}

function SearchAndReplace(Content, SearchFor, ReplaceWith) {

	   var tmpContent = Content;
	   var tmpBefore = new String();
	   var tmpAfter = new String();
	   var tmpOutput = new String();
	   var intBefore = 0;
	   var intAfter = 0;

	   if (SearchFor.length == 0)
	      return;


	   while (tmpContent.indexOf(SearchFor) > -1) {

	      // Get all content before the match
	      intBefore = tmpContent.indexOf(SearchFor);
	      tmpBefore = tmpContent.substring(0, intBefore);
	      tmpOutput = tmpOutput + tmpBefore;

	      // Get the string to replace
	      tmpOutput = tmpOutput + ReplaceWith;


	      // Get the rest of the content after the match until
	      // the next match or the end of the content
	      intAfter = tmpContent.length - SearchFor.length + 1;
	      tmpContent = tmpContent.substring(intBefore + SearchFor.length);

	   }

	   return tmpOutput + tmpContent;

	}
