﻿ function Search()
        {
            var strname=document.getElementById("StrName").value;
            if(strname=="请输入小区名或位置" || strname=="请输入经纪人姓名") strname="";
            if(document.getElementById("searchtype").value == "p")
                window.location.href = "Search.aspx?Key=" +escape(strname) ;
            else
                window.location.href = host+"CommonInfo/Member/BrokerList.aspx?SeaType=30&Title=" + escape(strname) ;
        }   	
        //评论的添加处理
        function PostComment(fm)
        {
           var content = fm.CommentContent.value;
            if (content.length < 1)
            {
              alert('评论字数至少保证1字以上,请重试;');
              return false;
            }
            if (content.length > 400){
              alert('字数超过最大限制,请减少字数;');
              return false;
            }
        }
        //图片播放器
        function ShowPic(imglist)
        {
            var player = new myFlash('http://lib.homevcache.com/player/picplayer/picplayer.swf',"455","362","9")
            player.addParam("allowScriptAccess","sameDomain");
            player.addParam("bgcolor","#ffffff");
            player.addVars("imgUrl",PhotoList);
            player.addVars("maskTime",3);
            player.addVars("showBar",false);
            player.addVars("musicUrl","");
            player.addVars("autoStart","true");
            player.addParam("wmode", "transparent");
            player.toObject("HouseVideo");
            document.getElementById("spn_VideoName").innerHTML= "相册";
        }
        function showvideo(pid, vid, img, des, flv, index) {

//            document.getElementById("HouseVideo").innerHTML = '<img width="455" height="362" src="' + img + '" />';
//            return;
            var player = new myFlash("http://lib.homevcache.com/player/utflvp/flvp_yNet.swf", "455", "362", "9");
            var videoindex = 0;
            player.addAttrib("id","player_video_cont");
            player.addAttrib("name","player_video_cont");
            player.addParam("allowScriptAccess", "always");
            player.addParam("bgcolor", "#ffffff");
            player.addParam("allowFullScreen", "true");
            player.addVars("showBar", true);
            player.addVars("loopType", false);
            player.addParam("wmode", "transparent");
            if (flv) {
                player.addVars("videoUrlType", 0);
                player.addVars("Vurl", flv);
            } else {
                player.addVars("videoUrlType", 1);
                player.addVars("host", Nurl);
                player.addVars("parentId", pid);
                player.addVars("videoId", vid);
            }
            player.addVars("previewImgUrl", img);
            player.addVars("VHttpUrl", encodeURIComponent("http://video.ynet.com/player.php?pid="+pid+"&vid="+vid+"&host="+Nurl+"&title="+des+"&thumb="+img+"&detail="+Nurl+pid+".vhtml"));
            player.toObject("HouseVideo");
            document.getElementById("spn_VideoName").innerHTML = des;

        }

        var haveshowrent=0;
        function chanagelist(type)
        {
            if(type==1){
                if(haveshowrent==0){getContent("Rent",0);haveshowrent=1;}
                document.getElementById("psale").className="d";
                document.getElementById("prent").className="c";
                document.getElementById("salelistdiv").style.display="none";
                document.getElementById("rentlistdiv").style.display="";
            }
            else{
                document.getElementById("psale").className="c";
                document.getElementById("prent").className="d";
                document.getElementById("salelistdiv").style.display="";
                document.getElementById("rentlistdiv").style.display="none";
            }
        }
        function GetCB(cbname)
        {
            var o = document.getElementsByName(cbname);
            var str = "";
            var compcount=0;
            for(var i=0;i<o.length;i++){
                if (o[i].checked)
                {
                   str = str.concat("," + o[i].value);
                   compcount ++;
                   if(compcount>5){
                      alert("请不要超过5条房源进行对比");
                      return "";
                   }
                   if(compcount<1){
                      alert("至少要2条房源才能对比");
                      return "";
                   }
                }
            }
            if (str.length > 0)
              str = str.substr(1);
            else{
                alert("请选择你要进行对比的的房源");
                return "";
            }
            return str;
        }
        function do_comp(url,cbname)
        {
            url += "?pid="+pid+"&pname="+pname+"&ids=";
            var ids = GetCB(cbname);
            if(ids.length>0)
                window.open(url+ids);
        }
function SelectChanel()
{
    //判断频道
    var chanelvalue = document.getElementById('searchtype').value;
    var obj = document.getElementById('StrName');
    if(chanelvalue=="p")
    {
        if(obj.value=='' || obj.value=='请输入经纪人姓名')
            obj.value='请输入小区名或位置';
    }
    if(chanelvalue=="b")
    {
        if(obj.value=='' || obj.value=='请输入小区名或位置')
            obj.value='请输入经纪人姓名';
    }
}
function checkblur(obj)
{
    var chanelvalue = document.getElementById('searchtype').value;
    if (obj.value == ''){
        if(chanelvalue=="p") obj.value='请输入小区名或位置';
        if(chanelvalue=="b") obj.value='请输入经纪人姓名';
    }
}
function checkfocus(obj)
{    
    var chanelvalue = document.getElementById('searchtype').value;
    if(chanelvalue=="p" && obj.value == '请输入小区名或位置') obj.value='';
    if(chanelvalue=="b" && obj.value == '请输入经纪人姓名') obj.value='';
} 

//图片
   
 function max(numlist)
    {
        var arr = numlist.split(",");
        var maxnum = -1000000;
        for(var i=0;i<arr.length;i++)
        {
	        if(maxnum<parseInt(arr[i]))
	        {
		        maxnum = arr[i];
	        }
        }
        return maxnum;
    }
    var zhu_temp ="";
    for(var i=0;i<=5;i++)
    {
        var isint="undefined";
        eval("isint = typeof(xl_"+i+");");
        if(isint!="undefined")
        {
            eval('zhu_temp += xl_'+i+'+",";');
        }
    }
    if(zhu_temp!="") zhu_temp=zhu_temp.substr(0,zhu_temp.length-1);
    var maxint = max(zhu_temp);
    if(maxint>0)
    {
        for(var i=0;i<=5;i++)
        {
            var obj = document.getElementById('xl_zhu'+i);
            if(typeof(obj)!="undefined")
            {
                var imgwidth = 0;
                isint="undefined";
                eval("isint = typeof(xl_"+i+");");
                if(isint!="undefined")
                {
                    eval("imgwidth = parseInt(xl_"+i+")/parseInt(maxint) ;");
                    imgwidth *= 81;
                    obj.style.width=imgwidth+"px";
                }
            }
        }
    }
 
    
    function ShowVideo(userid,videourl, img, cityseed,divplayer) {
        var hotnews = new myFlash('http://lib.homevcache.com/player/preview_mini/miniplayer_preview.swf', 135, 100, "9.0")
        hotnews.addAttrib("id", "flash_prev");
        hotnews.addParam("allowScriptAccess", "always");
        hotnews.addParam("bgcolor", "#ffffff");
        hotnews.addParam("allowFullScreen", "true");
        hotnews.addParam("wmode", "transparent");
        hotnews.addVars("videoUrlType", 0);
        hotnews.addVars("videoUrl", videourl);
        hotnews.addVars("previewImgUrl", img);
        hotnews.addVars("navUrl", "http://" + cityseed + ".homev.cn/shop/broker" + userid);
        hotnews.toObject(divplayer); 
    }
