﻿var browser=navigator.userAgent,msies=/MSIE/.test(browser),msie8=/MSIE 8/.test(browser),msie7=/MSIE 7/.test(browser),msie6=/MSIE 6/.test(browser),firefox=/Firefox/.test(browser),chrome=/Chrome/.test(browser),opera=/Opera/.test(browser),cookie={get:function(){var c=document.cookie.split('; '),a=arguments;if(!c.length||!a.length)return'';var cs=[];for(var i=0;i<c.length;i++){var x=c[i].split('=');for(var j=0;j<a.length;j++){if(x[0].toLowerCase()==a[j].toLowerCase()){if(a.length==1){return decodeURIComponent(x[1]);}cs.push(decodeURIComponent(x[1]));}}};return cs;},set:function(names,values){var count=0;if(Object.prototype.toString.apply(names)=='[object String]'){count=1;}else{count=names.length;};for(var i=0;i<count;i++){var name,value;if(count==1){name=names;value=values;}else{name=names[i];value=values[i];};document.cookie=name+'='+escape(value)+'; expires=Fri, 31 Dec 2015 23:59:59 GMT; path=/';}},del:function(){var a=arguments;for(var i=0;i<a.length;i++){var c=cookie.get(a[i]);if(!c)continue;var d=new Date();d.setTime(d.getTime()-1);document.cookie=a[i]+'=; expires=Fri, 31 Dec 1999 23:59:59 GMT; path=/';}},all:function(){return cookie.get('userid','username','signincount','usergroups','priorities','gender','points');}}
function $(){var a=[],x=arguments;for(var i=0;i<x.length;i++){var b=x[i];if(typeof b=='string'){b=document.getElementById(b);}if(x.length==1){return b;}a.push(b);}return a;}
var uti={constructor:function(o){return Object.prototype.toString.apply(o);},isPermissions:function(powers){pris=cookie.get('priorities');if(powers.length>0&&pris&&pris.length>0){pris=pris.split(',');for(var i=0;i<powers.length;i++){if(/\d/.test(powers[i])){for(var j=0;j<pris.length;j++){if(/\d/.test(pris[j])){if(pris[j]==powers[i])return true;}}}}}return false;}}
var image={newSN:function(ig){if(typeof ig=='string'){ig=$(ig);}if(!ig)return;var src=ig.src;if(src.indexOf('?')>-1){src=src.split('?')[0];};ig.src=src+'?n='+Math.random();},resize:function(sef,fixedW,fixedH){var ig=new Image();ig.src=sef.src;var w=ig.width;var h=ig.height;if(w<1||h<1){return null;}if(w/h>= fixedW/fixedH){if(w>fixedW){sef.width=fixedW;sef.height=(h*fixedW)/w;}else{sef.width=w;sef.height=h;}}else{if(h>fixedH){sef.height=fixedH;sef.width=(w*fixedH)/h;}else{sef.width=w;sef.height=h;}}return sef;}}
var request={queryString:function(varName){var s='',url=document.URL.toString();if(document.all)url=decodeURIComponent(url);if(url.indexOf('?')>-1){var suffix=url.split('?')[1];if(suffix.indexOf('&')>-1){var a=suffix.split('&');for(var i=0;i<a.length;i++){s=request.processing(a[i],varName);if(s)break;}}else{s=request.processing(suffix,varName);}}return s;
    },processing:function(urlSuffix,varName){if(urlSuffix&&urlSuffix.indexOf('=')>-1){var a=urlSuffix.split('=');if(a[0].toLowerCase()==varName.toLowerCase()){return document.all?(a[1]):a[1];}}return'';}};var tools={setHomePage:function(){if(window.sidebar){alert('Sorry! Firefox never allowed set as your home page.\n\nPlease use about:config');}else{document.body.style.behavior='url(#default#homepage)';document.body.setHomePage(document.URL);};return false;
    },setBookmark:function(){var url=document.URL.toString(),tit=document.title;if(window.sidebar){window.sidebar.addPanel(tit,url,'');}else{window.external.AddFavorite(url,tit);}return false;},clock:function(a){a=$(a);if(!a)return;setInterval(function(){a.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay())},1000);},
    swf:function(src,w,h){return'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"><param name="movie" value="'+src+'" /><param name="wmode" value="transparent" /><param name="quality" value="high" /><embed src="'+src+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>';}}
function iframe_autoSize(o){o.height=o.document.body.scrollHeight;}
function drawImage(igSef,fixedW,fixedH){var ig=new Image();ig.src=igSef.src;var w=ig.width;var h=ig.height;if(w<1||h<1)return;if(w/h>= fixedW/fixedH){if(w>fixedW){igSef.width=fixedW;igSef.height=(h*fixedW)/w;}else{igSef.width=w;igSef.height=h;}}else{if(h>fixedH){igSef.height=fixedH;igSef.width=(w*fixedH)/h;}else{igSef.width=w;igSef.height=h;}}}
function wd_click(o){if(o.value==o.title)o.value='';o.style.color='';}
function find_click(o){location='/module/dat/?wd='+$('wd').values;}
function getOptionValue(o){return o.options[o.selectedIndex].value;}
function forget(){}
function goExeunt(){var o=new Ajax('act=logout&url='+document.URL,'/module/backroom','POST',null);o.queueUserWorkItem(function(){window.top.location='/';});}
function goSignUp(){location='/signup.html?done='+urlForSign();}
function goSignIn(){location='/signin.html?done='+urlForSign();}
function gomgmt(o){location='/_su';} function urlForSign(){return encodeURIComponent(document.URL.split(document.domain)[1]);}
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,'');}
String.prototype.clearHtml=function(){return this.replace(/<(?:.|\s)*?>/g,'');}
String.prototype.compiler=function(s){return((this)?decodeURIComponent(unescape(this)).replace(/\$/g,s):(''));}
String.prototype.truncate=function(n,symbol){var s=this;if(s.length>n){return s.substring(0,n)+symbol;}return s;}
function rowms(sef,aid,bid,cid,id){try{var o,a;if(id){o=new Image();o.src='/o/1/'+id+'.png';};o=sef,c='orangered';o.style.color=c;a=o.getElementsByTagName('A');
for(var i=0;i<a.length;i++)if(!a[i].style.color)a[i].style.color=c;if(!o.onmouseout){o.onmouseout=function(){o.style.color='';for(var i=0;i<a.length;i++)if(a[i].style.color)a[i].style.color='';}}
if(aid>0&&uti.isPermissions([1])){
    var s,x,y,p,u,q=o;switch(aid){case 1:s='realty';break;case 3:s='fleamarket';break;}
    x=0;y=q.offsetHeight;p=$('panelHideBox');u='/_su/?a='+aid+','+bid+','+cid+','+id;while(q.offsetParent){x+=q.offsetLeft;y+=q.offsetTop;q=q.offsetParent;}
    p.style.cssText='position:absolute;border:1px solid scrollbar;left:'+x+'px;top:'+y+'px;background:url(/ig/0/atv.gif) repeat-x;width:110px;height:30px;line-height:30px;text-align:center;';
    p.className='foreWhite';p.innerHTML='<a href="'+u+'" target="_blank">修改</a> | <a href="#" onclick="return confirm(\'确定删除吗\');">删除</a>';}}catch(e){}}
/* blink beg */function blink(o){var dft=o.style.color;if(!dft)dft='#ffffff';window.timer=setInterval(function(){o.style.color=getColor();},255);if(o.onmouseout)return;o.onmouseout=function(){clearInterval(window.timer);o.style.color=dft;}}
function getColor(){var a=['deeppink','yellowgreen','lawngreen','magenta','greenyellow','coral','chartreuse'],n=a.length;for(var i=0;i<n;i++){if(i==parseInt(Math.random()*n)){return a[i];}}return a[0];}/* blink end */
function igZoom(o){var zoom=parseInt(o.style.zoom,10)||100;zoom+=event.wheelDelta/12;if(zoom>0)o.style.zoom=zoom+'%';return false;}
function e_igbt(o,u){o.src=o.src.replace(/Enabled/,'Active');if(o.onmousedown)return;
    o.onmousedown=function(){o.src=o.src.replace(/Active/,'Down');}
    o.onmouseup=function(){o.src=o.src.replace(/Down/,'Active');}
    o.onmouseout=function(){o.src=o.src.replace(/Active|Down/,'Enabled');}
    var a=o.parentNode;a.onclick=function(){u=!u?$('company_home'):$(u);var s=u.value.trim();if(!s)return false;this.href=s;}
};function menu_load(aid,trans,vague){
    if(!trans)trans=1;
    var o;
    switch(aid){
        case 1:if(trans>4)trans=4;break;
        case 3:if(trans>2)trans=1;break;
        case 4:o=$('a4t1');break;
        case 5:o=$('a5t1');break;
        case 7:o=$('a7t1');break;
    }
    if(!vague){
        $('home').className='';
        if(!o)o=$('a'+aid+'t'+trans);
        if(o)o.className='atv';
    }else{var a=$('menu').getElementsByTagName('B');for(var i=0;i<a.length;i++){if(!a[i])continue;a[i].className=(a[i].id=='a'+aid+'t'+trans)?'atv':'';}}}

