var lstShw="";
var over="";
var overa="";
var hide=1;

var larr="L0";
var rarr="R0";

function arr(act){
  h=window.innerHeight*0.97;
  w=window.innerWidth*0.99;
  cbar=window.innerHeight-200;
  
  if(act!=0){
	if(larr=="L0"){
	  larr="L1";
	  document.getElementById("la").src="images/hideR.gif";
	  document.getElementById("leftbar").className="leftclose";
	  //document.getElementById("larr").style.left=0+"px";
	} else {
	  larr="L0";
	  document.getElementById("la").src="images/hideL.gif";
	  document.getElementById("leftbar").className="leftopen";
	  //document.getElementById("larr").style.left=150+"px";
	} 
  } else {
	if(rarr=="R0"){
	  rarr="R1";
	  document.getElementById("ra").src="images/hideL.gif";
	  document.getElementById("rightbar").className="rightclose";
	  document.getElementById("rightbar").style.left=(w-150)+"px";
	  document.getElementById("rightbar").style.left=((window.innerWidth*0.99)-0)+"px";
	  //document.getElementById("rarr").style.left=document.getElementById("rightbar").style.left;
	  //document.getElementById("rarr").style.left=((window.innerWidth*0.99)-20)+"px";
	} else {
	  rarr="R0";
	  document.getElementById("ra").src="images/hideR.gif";
	  document.getElementById("rightbar").className="rightopen";
	  document.getElementById("rightbar").style.left=((window.innerWidth*0.99)-150)+"px";
	  //document.getElementById("rarr").style.left=document.getElementById("rightbar").style.left;
	  //document.getElementById("rarr").style.left=((window.innerWidth*0.99)-165)+"px";
	}
  }
  
  if(larr=="L0"){
	  //alert(larr+"    "+rarr+"    "+document.getElementById("content").style.left);
    if(rarr=="RO"){
	  document.getElementById("content").style.width=(w-300)+"px";
	  document.getElementById("content").style.left=(150)+"px";
	}else {
		document.getElementById("content").style.width=(w-150)+"px";
	  document.getElementById("content").style.left=(150)+"px";
	}
  }else if(rarr=="RO"){
	  document.getElementById("content").style.width=(w-150)+"px";
	  document.getElementById("content").style.left=(0)+"px";
	}else {
	  document.getElementById("content").style.width=(w-0)+"px";
	  document.getElementById("content").style.left=(0)+"px";
  }
	//alert(larr+"    "+rarr+"    "+document.getElementById("content").style.left);
}

// Menu Start
function sdiv(nameof){ //Menu Open
if(over!=""){ document.getElementById(over).className='menuhide'; }

document.getElementById(nameof).className='menushow';
over=nameof;
}

function hdiv(nameof){ //Menu Open
if(over!=""){ document.getElementById(over).className='menuhide'; over="";}
}


function img_act(imgName)  //listing image change
{

document.getElementById("picture").src = imgName;

}

var sdivH="";
var sdivHb="";
var mouseov=0;

function adivs(nameof) //del_time show
{
  hide=0;
  if(sdivH!=""){ document.getElementById(sdivH).style.visibility='hidden';  }
  if(sdivHb!="") { 
    document.getElementById(sdivHb).style.visibility='hidden';
    sdivHb="";
  }
  sdivH=nameof;
  document.getElementById(nameof).style.visibility='visible';
  test="img"+nameof.substr(1,(nameof.length)-2);
  test2=test.replace(/%20/g,"");

  if(document.getElementById(test).src="noImg.gif")document.getElementById(test).src="/CGI-BIN/address/"+test2.substr(3)+"M_th.jpg";
  else if(document.getElementById(test).src="noImg2.gif")document.getElementById(test).src="/CGI-BIN/address/"+test2.substr(3)+"M.jpg";


}

function bdivs(nameof) //del_time show
{
  if(sdivH!=""){ document.getElementById(sdivH).style.visibility='hidden';  sdivH=""}
}

function det_time(){  // Random Listing Rotate
  if(mouseov==0){
    test=0;
    address= new Array(test);
    lastadd=0;
    thisadd=0;
    collection = document.body.getElementsByTagName("DIV");

    for (i=0;i<collection.length;i++){
      if (collection[i].id.substring(1,2)>=0 && collection[i].id.substring(1,2)<=9 && collection[i].id.substring(0,1)!="" && collection[i].id.charAt(collection[i].id.length-1)=="b") test++;
    }
    if(test>0){
      for (i=0,spot=0;i<collection.length;i++){
      if (collection[i].id.substring(1,2)>=0 && collection[i].id.substring(1,2)<=9 && collection[i].id.substring(0,1)!="" && collection[i].id.charAt(collection[i].id.length-1)=="b")
        {
          address[spot++]=collection[i].id;
        } 
      }
      for(i=0;thisadd==lastadd &&i<100;i++){
        var ran_number=Math.round(Math.random()*(test-1));
        thisadd=ran_number;
      }
      //adivs(document.getElementById(address[thisadd]).id);
	  nameof=address[thisadd];
	  test=nameof.substr(1,(nameof.length)-2);
	  
      test2=test.replace(/%20/g,"");
	  test3=test.replace(/%20/g," ");
	  //html="<a href='dbshow.asp?address="+test+"'>"+"<img src='/CGI-BIN/address/"+test2.substr(3)+"M_th.jpg' alt='"+test3+"'></a>";
	
	  //html="dbshow.asp?address="+test+;
	
  test="img"+nameof.substr(1,(nameof.length)-2);
  test2=test.replace(/%20/g,"");
  test=nameof.substr(1,(nameof.length)-2);

	  document.getElementById("listL").href="dbshow.asp?address="+test;
	  document.getElementById("listL").innerHTML=test3;
	  //alert(document.getElementById("listL").innerHTML);
	  //document.getElementById("listImg").src="/CGI-BIN/address/"+test2.substr(3)+"M.jpg";


  //if(document.getElementById(test).src="noImg.gif")document.getElementById("listImg").src="/CGI-BIN/address/"+test2.substr(3)+"M_th.jpg";
  //else if(document.getElementById(test).src="noImg2.gif")document.getElementById("listImg").src="/CGI-BIN/address/"+test2.substr(3)+"M.jpg";
document.getElementById("listImg").src="/CGI-BIN/address/"+test2.substr(3)+"M_th.jpg";

	  //document.getElementById("listL").href=html;
    }
  }
  //document.getElementById("listImg")
  //alert("done");
}

function ld(){ //Load
h=window.innerHeight*0.97;
w=window.innerWidth*0.99;

cbar=window.innerHeight-200;
if(cbar<600)cbar=800;
document.getElementById("display").style.height=(cbar+200)+"px";
document.getElementById("display").style.width=w+"px";
document.getElementById("display").style.background="#dddddd url(images/clouds1.jpg) center center repeat-x";
document.getElementById("cenbar").style.height=(cbar)+"px";
document.getElementById("content").style.width=(w-300)+"px";
document.getElementById("rightbar").style.left=((window.innerWidth*0.99)-150)+"px";
document.getElementById("rarr").style.left=document.getElementById("rightbar").style.left;

document.getElementById("listI").style.left=(w-150)+"px";

var theRules = new Array();
	if (document.styleSheets[0].cssRules) {
		theRules = document.styleSheets[0].cssRules;
	} else if (document.styleSheets[0].rules) {
		theRules = document.styleSheets[0].rules;
	}
	lt=((w-300)-462)/2;
	theRules[0].style.left = lt+"px";
	

det_time();
}

setInterval("det_time()", 8000);