﻿// JScript 文件
function  iframe_resizeFor()
{

 document.getElementById("Fun").style.height= Fun.document.body.scrollHeight;   //  IE7 和Firefox  都可以
  document.getElementById("Fun").style.width = Fun.document.body.scrollWidth;   //  IE7 和Firefox  都可以
  if(document.getElementById("tdAD")!=null){
    document.getElementById("tdAD").style.height="470";
    if(parseFloat(document.getElementById("Fun").style.height)>=parseFloat("491")){
    document.getElementById("tdAD").style.height=parseInt(document.getElementById("tdAD").clientHeight);}
  }

}



function  iframe_resize()
{

   document.getElementById("fundetail").style.height= fundetail.document.body.scrollHeight;   //  IE7 和Firefox  都可以
  document.getElementById("fundetail").style.width = fundetail.document.body.scrollWidth;   //  IE7 和Firefox  都可以
  if(document.getElementById("tdAD")!=null){
    document.getElementById("tdAD").style.height="470";
    if(parseFloat(document.getElementById("fundetail").style.height)>=parseFloat("491")){
    document.getElementById("tdAD").style.height=parseInt(document.getElementById("tdAD").clientHeight);}
  }


}

function  iframe_resizebak(obj)
{
 var frameheight=window.frames[obj.name].document.body.scrollHeight;
  if(frameheight>1300)
{
   document.getElementById(obj.id).style.height=window.frames[obj.name].document.body.scrollHeight;   //  IE7 和Firefox  都可以
  document.getElementById(obj.id).style.width =window.frames[obj.name].document.body.scrollWidth;   //  IE7 和Firefox  都可以
 

} 
  if(frameheight<1300)
{
        document.getElementById(obj.id).style.height=1300;   //  IE7 和Firefox  都可以
     document.getElementById(obj.id).style.width =window.frames[obj.name].document.body.scrollWidth;   //  IE7 和Firefox  都可以

} 

}

//精选房源列表搜索
function getChoseHouseList(Type,userid){
var HouseType=document.getElementById("ddlHousetype").options[document.getElementById("ddlHousetype").selectedIndex].value;
  var HousePrice=document.getElementById("ddlHousePrice").options[document.getElementById("ddlHousePrice").selectedIndex].value;
  var HouseName=document.getElementById("xiaoqu").value;
  var HouseNumber=document.getElementById("bianhao").value;
  if(HouseName=="输入小区名称或地址"){HouseName="";}
  if(HouseNumber=="输入房源编号"){HouseNumber="";}
 if(Type=="J"){
   if(HouseNumber.length==0){
     alert("请输入房源编号.");
     document.getElementById("bianhao").focus();
   }
   else{
    top.frames["Fun"].location="ChoseHouseList.aspx?PageType=" + Type + "&HouseRoom1=" + HouseType + "&HousePrice=" + HousePrice + "&HouseName=" + HouseName + "&HouseNumber=" +  HouseNumber+"&empid="+userid;

   }
 }
 else{
  top.frames["Fun"].location="ChoseHouseList.aspx?PageType=" + Type + "&HouseRoom1=" + HouseType + "&HousePrice=" + HousePrice + "&HouseName=" + HouseName + "&HouseNumber=" +  HouseNumber+ "&empid="+userid;
 }
  
  
  
  return false;
}
//二手房
function getSecondHouseList(Type){
var HouseType=document.getElementById("ddlHousetype").options[document.getElementById("ddlHousetype").selectedIndex].value;
  var HousePrice=document.getElementById("ddlHousePrice").options[document.getElementById("ddlHousePrice").selectedIndex].value;
  var HouseName=document.getElementById("xiaoqu").value;
  var HouseNumber=document.getElementById("bianhao").value;
  if(HouseName=="输入小区名称或地址"){HouseName="";}
  if(HouseNumber=="输入房源编号"){HouseNumber="";}
 if(Type=="J"){
   if(HouseNumber.length==0){
     alert("请输入房源编号.");
     document.getElementById("bianhao").focus();
   }
   else{
    top.frames["Fun"].location="SecondHouse.aspx?PageType=" + Type + "&HouseRoom1=" + HouseType + "&HousePrice=" + HousePrice + "&HouseName=" + HouseName + "&HouseNumber=" +  HouseNumber;

   }
 }
 else{
  top.frames["Fun"].location="SecondHouse.aspx?PageType=" + Type + "&HouseRoom1=" + HouseType + "&HousePrice=" + HousePrice + "&HouseName=" + HouseName + "&HouseNumber=" +  HouseNumber;
 }
  
  
  
  return false;
}

//租房
function getRentHouseList(Type){
var HouseType=document.getElementById("ddlHousetype").options[document.getElementById("ddlHousetype").selectedIndex].value;
  var HousePrice=document.getElementById("ddlHousePrice").options[document.getElementById("ddlHousePrice").selectedIndex].value;
  var HouseName=document.getElementById("xiaoqu").value;
  var HouseNumber=document.getElementById("bianhao").value;
  if(HouseName=="输入小区名称或地址"){HouseName="";}
  if(HouseNumber=="输入房源编号"){HouseNumber="";}
 if(Type=="J"){
   if(HouseNumber.length==0){
     alert("请输入房源编号.");
     document.getElementById("bianhao").focus();
   }
   else{
    top.frames["Fun"].location="RentHouse.aspx?PageType=" + Type + "&HouseRoom1=" + HouseType + "&HousePrice=" + HousePrice + "&HouseName=" + HouseName + "&HouseNumber=" +  HouseNumber;

   }
 }
 else{
  top.frames["Fun"].location="RentHouse.aspx?PageType=" + Type + "&HouseRoom1=" + HouseType + "&HousePrice=" + HousePrice + "&HouseName=" + HouseName + "&HouseNumber=" +  HouseNumber;
 }
  
  
  
  return false;
}
//显示照片
function ChangePhoto(objsmall,provideemployee,photodesc){

  document.getElementById("imgLarge").src=objsmall.src.substr(0,objsmall.src.lastIndexOf(".")-2)+ objsmall.src.substr(objsmall.src.length-4);
  document.getElementById("lblSupport").innerHTML="此图由<font color='blue'>" + provideemployee + "</font>提供"
  if(photodesc.length!=0){
  document.getElementById("lblSupport").innerHTML=document.getElementById("lblSupport").innerHTML + "<br>" + photodesc;
  }
//  if(document.body.scrollHeight>410){
//  parent.document.getElementById("Fun").style.height= document.body.scrollHeight; }  //  IE7 和Firefox  都可以
//  parent.document.getElementById("Fun").style.width = document.body.scrollWidth;   //  IE7 和Firefox  都可以

//parent.document.getElementById('divFram').style.height="0px";       
//        parent.document.getElementById('divFram').style.height = 10+document.body.scrollHeight + (typeof
//(document.body.clientTop)  == 'number' ? document.body.clientTop * 2 : 0) + 'px';

}

function resizediv(){
//  parent.document.getElementById('divFram').style.height="0px";       
//        parent.document.getElementById('divFram').style.height = 10+document.body.scrollHeight + (typeof
//(document.body.clientTop)  == 'number' ? document.body.clientTop * 2 : 0) + 'px';

  parent.document.getElementById("Fun").style.height= document.body.scrollHeight;    //  IE7 和Firefox  都可以
 parent.document.getElementById("Fun").style.width = document.body.scrollWidth; 
}


//超链接文字变色
function ChangeForeColor(objA,type){
  if(type=="O"){
   objA.style.color="#669922";
  }
  else{
   objA.style.color="#3366bb";
  }
}


//改变背景色
function ChangeBackColor(tableid){
   document.getElementById("tdp1").style.background="url(../images/generic-box_h2_bg.gif) repeat-x";
   document.getElementById("tdp2").style.background="url(../images/generic-box_h2_bg.gif) repeat-x";
   document.getElementById("tdp3").style.background="url(../images/generic-box_h2_bg.gif) repeat-x";
   
   document.getElementById(tableid).style.background="";
   document.getElementById(tableid).style.backgroundColor="#FFFFFF";
   
   if(tableid=="tdp1"){
  
   document.getElementById("fundetail").src="ChoseHouseContent.aspx?PageType=D&HouseNumber=" + document.getElementById("hdnHouseID").value;}
   else if(tableid=="tdp2"){
    document.getElementById("fundetail").src="ChoseHouseContent.aspx?PageType=H&HouseNumber=" + document.getElementById("hdnHouseID").value;}
   else{
     if(document.getElementById("hdnRollPhoto").value.length!=0){
    document.getElementById("fundetail").src=document.getElementById("hdnRollPhoto").value}
     else{
     document.getElementById("fundetail").src="../../RollPhoto.aspx";
     }
   }
  
}

//改变超链接颜色
function changeBackGround(nowNum,totalNum){
  for(var i=0;i<=totalNum;i++){
    document.getElementById("a" + i).style.background='#000000';
  
  }

document.getElementById("a" + nowNum).style.background='#FA8E43';
}


//页面自动刷新
function changeURL(){
var j;
var totalNum=document.getElementById("hdnButton").value;
if(totalNum==""){totalNum=0;}
 for(i=0;i<=totalNum;i++){
   if(document.getElementById("a" + i).style.background.toUpperCase()=='#FA8E43'){      

      if(i==totalNum){j=0;}
      else{
      j=i+1;
      }
      document.getElementById("a" + j).click();
      break;
   
   }
   
 }
  


}



function  iframe_resizeForAD()
{

 parent.document.getElementById("Iframe1").style.height= document.body.scrollHeight;   //  IE7 和Firefox  都可以
  parent.document.getElementById("Iframe1").style.width = document.body.scrollWidth;   //  IE7 和Firefox  都可以
 // parent.document.Iframe1.document.body.bgColor=document.body.bgColor
  /*if(document.getElementById("tdAD")!=null){
    document.getElementById("tdAD").style.height="410";
    if(parseFloat(document.getElementById("Fun").style.height)>=parseFloat("491")){
    document.getElementById("tdAD").style.height=parseInt(document.getElementById("tdAD").clientHeight);}
  }*/

}

function changeurl(houseroom,houseprice,userid,type)
{
if (type=1)
{
     document.getElementById("hidhouseprice").value=houseprice;
}
if (type=2)
{
 document.getElementById("hidhouseroom").value= houseroom;
}

    document.getElementById("Fun").location="ChoseHouseList.aspx?PageType=M&HousePrice="+document.getElementById("hidhouseprice").value+"&HouseRoom1="+document.getElementById("hidhouseroom").value+"&empid="+userid;
   
}


function gettxtcontent(){

			  if(document.getElementById('txtBlogName').value.length==0){
			    alert("请输入标题"); 
			    return false;
			  }
			  else{
			  document.getElementById('txthidden').value=document.getElementById('txtBlogName').value;
			  return true;
			  
			  }
			
			}
			
			
			
			