
function ShowTab(id,obj)
{
    document.getElementById('ctl00_ContentPlaceHolder1_divNJ').style.display='none';
    document.getElementById('ctl00_ContentPlaceHolder1_divNY').style.display='none';
    document.getElementById('ctl00_ContentPlaceHolder1_divLI').style.display='none';
    document.getElementById('tbNY').className='Tab Rollout';
    document.getElementById('tbNJ').className='Tab1 Rollout';
    document.getElementById('tbLI').className='Tab1 Rollout';
    document.getElementById('tbNY').onmouseout=function(){this.className='Tab Rollout'};
    document.getElementById('tbNJ').onmouseout=function(){this.className='Tab1 Rollout'};
    document.getElementById('tbLI').onmouseout=function(){this.className='Tab1 Rollout'};
    document.getElementById('tbNY').onmouseover=function(){this.className='Tab Rollover'};
    document.getElementById('tbNJ').onmouseover=function(){this.className='Tab1 Rollover'};
    document.getElementById('tbLI').onmouseover=function(){this.className='Tab1 Rollover'};
    
    document.getElementById(id).style.display = '';
    //alert(obj.id);
    if (obj.id == 'tbNJ') {
        obj.className = 'Tab1 Rollover';
        obj.onmouseout = function() { this.className = 'Tab1 Rollover' };
    }
    else if (obj.id == 'tbNY') {
        obj.className = 'Tab Rollover';
        obj.onmouseout = function() { this.className = 'Tab Rollover' };
    }
    else if (obj.id == 'tbLI') {
        obj.className = 'Tab1 Rollover';
        obj.onmouseout = function() { this.className = 'Tab1 Rollover' };
    }   
    //obj.className='Tab Rollover';
    //obj.onmouseout=function(){this.className='Tab Rollover'};
    //obj.onmouseover=function(){this.className='Tab Rollout'};
    
    }


 function ShowList(path)
  {
        var args='width=825,height=600,left=100,top=275,toolbar=0,'; 
        args+='location=0,status=0,menubar=0,taskbar=0,resizable=1,scrollbars=1';         
        window.open(path,'Linsting',args);   
        return true;
  }
  
  function ShowPreView(path)
  {
        var args='width=995,height=600,left=100,top=275,toolbar=0,'; 
        args+='location=0,status=0,menubar=1,taskbar=0,resizable=1,scrollbars=1';         
        window.open(path,'Linsting',args);
        return true;
  }
  
   function isNumberKey(evt)
   {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57) )
            return false;

        return true;
   }
  
    var Set=0;
  function SearchZAG()
  {
	  var txtSearch=document.getElementById('txtSearchZAG');
	  var id=txtSearch.value;
	 
	  if(id.length<7)
	  {
	       alert('Enter Correct ZAG#');
	       txtSearch.focus();
	       return false;
	  }
	  else
	  {	  
	        Zaglist.Website.webservices_z.bannerprovider.IsPropertyExists(id,SearchResult);  
	        return true;
	        
	  }
 }
 
 function  SetEnter(id)
 {
    if(event.which || event.keyCode)
    {
        if((event.which == 13) || (event.keyCode == 13))
        {
            document.getElementById(id).click();
            return false;
        }
        else
        {
           return true;
        }
     }
 }
 
function pause(numberMillis) 
{
    if(Set>0)
    {          
        alert(Set);    
        return;
    }
    else
    {
        setTimeout('pause()',numberMillis);
    }
} 

 
 function Check()
 {
    
    if(Set>0)
    {
        
        var args='width=825,height=600,left=100,top=275,toolbar=0,'; 
        args+='location=0,status=0,menubar=0,taskbar=0,resizable=1,scrollbars=1';         
        window.open('PrintView.aspx?pid='+Set,'Linsting',args);
        return;
    }
    else
    {
        alert(Set);
    }
    
    
 }
 

	
function SearchResult(result)
{
	    if(result==0)
	    {
	       var txtSearch=document.getElementById('txtSearchZAG');
           var id=txtSearch.value;
	       location.href='/noResult.aspx?sv='+id ;
	    }   
	    else
	    {	
	        Set=result;	
	        var args='width=825,height=600,left=100,top=275,toolbar=0,'; 
            args+='location=0,status=0,menubar=1,taskbar=0,resizable=1,scrollbars=1';         
            window.open('/PrintView.aspx?sc=1&pid='+result,'Linsting',args);     
            return true;
	    }
	        
}

function isSplChar(strToSearch)
{
     // declare which special chars to validate
     var illegalChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";

     for (var i = 0; i < strToSearch.length; i++)
     {
          if (illegalChars.indexOf(strToSearch.charAt(i)) != -1)
          {
              alert ("Please do not enter any of the following character:\n" + strToSearch.charAt(i) + "\nThese are not allowed.\nPlease remove them and try again.");
              return false;
          }
     }
     return true;
}




/* Scroll image for size 350 for single listing page */
var timeoutID;
var scrollNext=0;
function MoveNext()
{
    var div=document.getElementById('ctl00_ContentPlaceHolder1_divImg');    
    
     if(scrollNext==350)
     { 
        scrollNext=0;
        document.getElementById('spnImageIndex').innerHTML=parseInt(div.scrollLeft/350)+1;
        
      }
      else
      {
       
       // scrollNext+=1;       //for slow transition        
          scrollNext+=350;     // for flip        
              
      //  div.scrollLeft=div.scrollLeft+1;      //for slow transition     
          div.scrollLeft=div.scrollLeft+350;    // for flip    
        MoveNext();
        return false;
      }
   
    
}
var scrollPre=350;
function MovePre()
{
    var div=document.getElementById('ctl00_ContentPlaceHolder1_divImg');   
    
     if(scrollPre==0)
     { 
         scrollPre=350;
         document.getElementById('spnImageIndex').innerHTML=parseInt(div.scrollLeft/350)+1;
      }
      else
      {
       // scrollPre-=1;
        scrollPre-=350;
      //  div.scrollLeft=div.scrollLeft-1;       
        div.scrollLeft=div.scrollLeft-350;       
        MovePre();
        return false;
      }  
    
    
}



/* Scroll image for size 350 for multiple listing page */
function MoveNew(id)
{
    
    if(id.indexOf('nex')>-1)
    {
         var _divid=id.replace('nex','divImg');  
         
         var _spanId=id.replace('nex','spnImageIndex'); 
         var _action='Next';     
         m1=new Move(_divid,_spanId,_action)
         m1.MoveNex();      
     
    }
    else
    {
         var _divid=id.replace('pre','divImg');  
         var _spanId=id.replace('pre','spnImageIndex'); 
         var _action='Pre';     
         m1=new Move(_divid,_spanId,_action)
         m1.MovePr();
         
    }
    return false;
}

function Move(divId,spanid,action)
{
    this.div=document.getElementById(divId);
    
    this.span=document.getElementById(spanid);
    this.action=action;
    this.scrollPre=350;  // div width
    this.scrollNext=0;  
    this.MoveNex=MoveNex;
    this.MovePr=MovePr;    
   
}

function MoveNex()
{
    
     if(this.scrollNext==350)
     { 
      
        this.scrollNext=0;
        this.span.innerHTML=parseInt(this.div.scrollLeft/350)+1;       
        return false;
      }
      else
      {
       // this.scrollNext+=1;     // for slow transition     
        this.scrollNext+=350    // for flip
        //this.div.scrollLeft=this.div.scrollLeft+1;    // for slow transition     
        this.div.scrollLeft=this.div.scrollLeft+350;   // for flip;
        this.MoveNex();
      }   
    
}
function MovePr()
{
    
     if(this.scrollPre==0)
     { 
        
        this.scrollPre=350;
        this.span.innerHTML=parseInt(this.div.scrollLeft/350)+1;        
        return false;;
        
      }
      else
      {
       // this.scrollPre-=1;      // for slow transition    
        this.scrollPre-=350;      // for flip
        //this.div.scrollLeft=this.div.scrollLeft-1;        // for slow transition  
        this.div.scrollLeft=this.div.scrollLeft-350;        // for flip  
        this.MovePr();        
      }  
    
}

function $(id)
{
     return document.getElementById(id);
}

function returnObjPosition(target)
{
	var x = 0;
	var y = 0;
	var tempObj = new Object();
	var obj = (typeof target == "object" ? target : returnObjById(target));
	while (obj.offsetParent != null) {
		x += obj.offsetLeft;
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	x += obj.offsetLeft;
	y += obj.offsetTop;
	tempObj.x = x;
	tempObj.y = y;
	
	return tempObj;
}


function ShowMenu(Obj,id,show)
{
      var divMenu=document.getElementById(id) 
    if(show=='')
    {
       //  alert("");
          var obj1=returnObjPosition(Obj);   
          divMenu.style.left=(obj1.x) + 'px';
          divMenu.style.top=(obj1.y+20) + 'px';
    }
       divMenu.style.display = show;  
   
}


/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/


//Contents for menu 1
var menu1=new Array()
menu1[0]='<strong><span style="text-align:center">&nbsp;&nbsp;For Sale</span></strong>'
menu1[1]='<a href="new-jersey/apartments-for-sale.html" title="Apartments For Sale NJ" class="Gray3">Apartments</a>'
menu1[2]='<a href="new-jersey/townhouses-for-sale.html" title="Townhouses For Sale NJ" class="Gray3">Townhouses</a>'
menu1[3]='<a href="new-jersey/houses-for-sale.html" title="Houses For Sale NJ" class="Gray3">Houses</a>'
menu1[4]='<strong><span style="text-align:center">&nbsp;&nbsp;For Rent</span></strong>'
menu1[5]='<a href="new-jersey/apartments-for-rent.html" title="Apartments For Rent NJ" class="Gray3">Apartments</a>'
menu1[6]='<a href="new-jersey/townhouses-for-rent.html" title="Townhouses For Rent NJ" class="Gray3">Townhouses</a>'
menu1[7]='<a href="new-jersey/houses-for-rent.html" title="Houses For Rent NJ" class="Gray3">Houses</a>'
//Contents for menu 2, and so on

var menu2=new Array()
menu2[0]='<strong><span style="text-align:center">&nbsp;&nbsp;For Sale</span></strong>'
menu2[1]='<a href="new-york-city/apartments-for-sale.html" title="Apartments For Sale NYC & LI" class="Gray3">Apartments</a>'
menu2[2]='<a href="new-york-city/townhouses-for-sale.html" title="Townhouses For Sale NYC & LI" class="Gray3">Townhouses</a>'
menu2[3]='<a href="new-york-city/houses-for-sale.html" title="Houses For Sale NYC & LI" class="Gray3">Houses</a>'
menu2[4]='<strong><span style="text-align:center">&nbsp;&nbsp;For Rent</span></strong>'
menu2[5]='<a href="new-york-city/apartments-for-rent.html" title="Apartments For Rent NYC & LI" class="Gray3">Apartments</a>'
menu2[6]='<a href="new-york-city/townhouses-for-rent.html" title="Townhouses For Rent NYC & LI" class="Gray3">Townhouses</a>'
menu2[7]='<a href="new-york-city/houses-for-rent.html" title="Houses For Rent NYC & LI" class="Gray3">Houses</a>'

	
var menuwidth='232px' //default menu width
var menubgcolor='#eff8ff'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype)
{
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null)
    {
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth)
{
    if (ie4||ns6)
    dropmenuobj.style.left=dropmenuobj.style.top="-500px"
    if (menuwidth!="")
    {
    dropmenuobj.widthobj=dropmenuobj.style
    dropmenuobj.widthobj.width=menuwidth
    }
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
    obj.visibility=visible
    else if (e.type=="click")
    obj.visibility=hidden
    }

function iecompattest()
{
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


function openMap(obj)
{
   if(obj=='true')
   document.getElementById('ctl00_ContentPlaceHolder1_divMap').style.display='block';
   else
   document.getElementById('ctl00_ContentPlaceHolder1_divMap').style.display='none';
}




    

 