//CopyRight by Myliving.cn 2005 created by Marcy



// setFloat&static&absolute
function writeCookieF(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}


function setfloat(fco){
 writeCookieF("floatCookie", fco, 48);
	if(fco=='static'){
	document.getElementById('searchRight').className='searchRight_22';
	document.form2.chk001.checked ="true";
	}
	if(fco=='absolute'){
	document.getElementById('searchRight').className='searchRight_11';
	}

 }




//最近浏览过的楼盘

function addcookies(cookname,id,i)
{
	if (i=1)
	{
	writeCookie(cookname,id,24);
	}
	//alert(readCookie(cookname));


}

		
		
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 36000000);
    expire = "; expires=" + expire.toGMTString();
  }
 //document.cookie = name + "="+"";
 var newvalue;
 newvalue="";
 var myarr=new Array();
 myarr=readCookie(name).split("|");
 var k;
var j;
j=0;
 //alert(myarr.length);

 
 

	if (myarr.length<5)
	{

		for (i=0;i<myarr.length-1;i++) 
		{

				if (value!=myarr[i])
				{
					newvalue=newvalue + myarr[i] + "|";
				
				}
				
			}
	}
	else
	{
 		for (i=0;i<4;i++) 
		{
			
				if (value!=myarr[j])
				{
					newvalue=newvalue + myarr[j] + "|";
					
				}
				else
				{
				i=i-1;
				
				}
				j=j+1;
				
			}
	}



document.cookie = name + "="+ escape(value)+"|"+newvalue + expire;
}


function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}








function openWin0(URL, width, height) {
var OpenedWin = window.open(URL, "", "width="+width+",height="+height+",status=no,menubar=no,location=no,toolbar=no,directories=no,scrollbars=no ");
var NewX = (screen.availWidth/2)-(width/2);
var NewY = (screen.availHeight/2)-(height/2);
OpenedWin.moveTo(NewX, NewY);
}



function openWin1(URL, width, height) {
var OpenedWin = window.open(URL, "", "width="+width+",height="+height+",status=no,menubar=no,location=no,toolbar=no,directories=no,scrollbars=yes ");
var NewX = (screen.availWidth/2)-(width/2);
var NewY = (screen.availHeight/2)-(height/2);
OpenedWin.moveTo(NewX, NewY);
}

 
function openWin(URL, width, height) {
var OpenedWin = window.open(URL, "", "width="+width+",height="+height+",status=no,menubar=no,location=no,toolbar=no,directories=no,scrollbars=yes ");
var NewX = (screen.availWidth/2)-(width/2);
var NewY = (screen.availHeight/2)-(height/2);
OpenedWin.moveTo(NewX, NewY);
}

//推荐给朋友
function showHref(o)
{
window.open('','popwin', 'height=490,width=480,toolbar=no,location=no,status=yes,menubar=no');
}
//纠错
function showHrefError(o)
{
window.open('','popwinError', 'height=580,width=760,toolbar=no,location=no,status=yes,menubar=no');
}
//收藏
function showFav(o){
window.open('','popwinFav', 'height=570,width=480,toolbar=no,location=no,status=yes,menubar=no');
}	
 


//openWindow
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//Hidden layout
function hiddenBox(hid){
	document.getElementById(hid).style.display = "none";
	}

//调整图像到页面中央
function adjust_popup()
{
        var w, h, fixedW, fixedH, diffW, diffH;

        if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
        }
        w = fixedW + diffW;
        h = fixedH + diffH;
        if (h >= screen.availHeight) w += 16;
        if (w >= screen.availWidth)  h += 16;
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}
//调整图像到页面中央TEST
function htm_load(){
	var tablewid=window.document.all["table1"].clientWidth+1
	var tablehei=window.document.all["table1"].clientHeight+1
	window.resizeTo(tablewid,tablehei)
}


//print subBody

function preview() { 
bdhtml=window.document.body.innerHTML; 
sprnstr="<!--startprint-->"; 
eprnstr="<!--endprint-->"; 
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); 
copyhtml="<div style='margin-bottom:3px;margin-top:5px;'><img src='/image/footer/mini_logo.gif' alt='捷讯.租售情报网'><span style='margin-left:40px;'><a href='javascript:window.location.reload();'>返回</a></span></div>";
urlhtml='打印来源：'+ window.location.href;
window.document.body.innerHTML=prnhtml+urlhtml+copyhtml; 
window.print(); 
}


 


//访问统计
//document.write('<script language="javascript" src="/counter/count.htm" type="text/javascript"><\/script>'+ '');
//document.write("<iframe src=/counter/count.aspx"+ " width=\"0\" height=\"0\"><\/iframe>"); 



//member alert
function Showh(divid) { 
divid.filters.revealTrans.apply(); 
divid.style.visibility = "visible"; 
divid.filters.revealTrans.play(); 
} 
function Hideh(divid) { 
divid.filters.revealTrans.apply(); 
divid.style.visibility = "hidden"; 
divid.filters.revealTrans.play(); 
} 




function OpenWindow( url, width, height, options, name ) {
  if ( ! width ) width = 640;
  if ( ! height ) height = 420;
  if ( ! options ) options = "scrollbars=yes,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes";
  if ( ! name ) name = "outsideSiteWindow";
  var newWin = window.open( url, name, "width=" + width + ",height=" + height + "," + options );
}

function OpenWindowOpener (currentWindow,url,width,height,options,name) {
  if (currentWindow.opener && currentWindow.opener.closed == false) {
    currentWindow.opener.location=url;
  }
  else {
    OpenWindow ( url, width, height, options, name );
  }
}

function urlMenu(that) {
  theURL = that.options[that.selectedIndex].value;

  if (theURL) {
    window.location = theURL;
  }
}


function ChangeForCheck(b)
{
var con=event.srcElement;
var obj=document.getElementById(b);
	if(con.checked==true)
	{
		obj.disabled="";
		obj.style.background='#ffffff';
	}
	else
	{
		obj.disabled="disabled";
		obj.style.background='#cccccc';
	}
}
function ChangeForRadio(id1,id2)
{
var con=event.srcElement;
var obj2=document.getElementById(id2);
	if(con.id==id1)
	{
		obj2.disabled="";
		obj2.style.background='#ffffff';
	}
	else
	{
		obj2.disabled="disabled";
		obj2.style.background='#cccccc';
	}
}

