// JavaScript Document
function writeFlash(src, w, h) {  //输出flash
	var w = w;
	var h = h;
	var flash = "<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 + "'><param name='movie' value='" + src + "' /><param name='wmode' value='opaque'><param name='quality' value='high' /><embed src='" + src + "' quality='high' wmode='opaque' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + w + "' height='" + h + "'></embed></object>";
	document.write(flash);
}

function proportionImgs(parentTarget,w,h){

    var element1 = document.getElementById(parentTarget); // "parentTarget" is id property for Tag
    var elementArray = element1.getElementsByTagName("img");
    for(var i=0;i<elementArray.length;i++){
       proportionImg(elementArray[i],w,h);
    }
    
}

function proportionImg(imgo,w,h){

	var imgObj = new Image();
	imgObj.src= imgo.src;
    if(imgObj.width>w){
        imgObj.height= (w/imgObj.width)*imgObj.height;
        imgObj.width=w;
    }
    if(imgObj.height>h){
        imgObj.width = (h/imgObj.height)*imgObj.width;
        imgObj.height = h;
    }
    //alert(imgObj.width);
   imgo.width=imgObj.width;
   imgo.height = imgObj.height;

}

function addfavorite(){ //加为收藏
var url = location.href; 
var title =document.title;
var desc ="豪宅别墅信息网";
if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
{ 
    window.sidebar.addPanel(title,url,desc);
    }
else //IE 
    {
    window.external.AddFavorite(url,title);
    }

}

function setIndex(){ //设为首页
//this.style.behavior='url(#default#homepage)';
//this.setHomePage('http://www.hzvillas.com');
	
	}

function b1(){
	if(document.getElementById("a1").value==""){
	alert("请至少选择一项");
	return false;
	}	else {
		document.getElementById("poll").action="/addpoll.do";
document.getElementById("poll").submit();
		return true;
	}
}
function b2(){
		document.getElementById("poll").action="/showpoll.do";
document.getElementById("poll").submit();
		
}
