Event.observe(window, 'load', resize_divs);
Event.observe(window, 'resize', resize_divs);

function resize_divs()
{
	x=getWindowSize()[0]-348-20;
	y=getWindowSize()[1]-230;
	if(x<100) x=100;
	if(y<100) y=100;
	if((x*0.75)<y)
	{
		img_x=x-130;
		img_y=img_x*0.75;
	}
	else
	{
		img_x=y*1.3333333333;
		if((x-img_x)<120)
		{
			img_x=x-130;
		}
		img_y=img_x*0.75;
	}
	img_x-=30;
	img_y-=30;
	$$(".property_image").each(function(p)
	{
		p.setStyle("width:" + img_x + "px;height:" + img_y + "px")
	});
	$$(".property_image_plans").each(function(p)
	{
		p.setStyle("width:" + img_x + "px;height:" + (img_y-20) + "px")
	});
	$$(".span_content_imagenes").each(function(p)
	{
		p.setStyle("width:" + img_x + "px;height:" + img_y + "px")
	});
	$$(".property_image_controls").each(function(p)
	{
		p.setStyle("margin-top:" + ((img_y/2)-15) + "px;");
	});
	$$(".property_image_controls_right").each(function(p)
	{
		p.setStyle("margin-left:" + (img_x-68) + "px;");
	});
	if($("content_images_tdBig")!=null) $("content_images_tdBig").setStyle("width:" + img_x + "px;height:" + img_y + "px")
	if($("index_right_content")!=null) {
		$("index_right_content").setStyle({height: (y+55)+"px"});
		$("index_right_content").setStyle({width: (x)+"px"});
	}
	if($("items")!=null) $("items").setStyle({height: (y-10)+"px"});
	if($("items_bookmark")!=null) $("items_bookmark").setStyle({height: (y-10-bookmark_difference) + "px"});
	if($("property_image_thumbs")!=null){
		$("property_image_thumbs").setStyle("width:" + (x-img_x-30) + "px;height:" + (y-12) + "px");
	}
	if($("tab_images")!=null) $("tab_images").setStyle({height: y+"px"});
	if($("tab_plans")!=null) $("tab_plans").setStyle({height: y+"px"});
	if($("tab_details")!=null) $("tab_details").setStyle({height: y+"px"});
	if($("tab_location")!=null) $("tab_location").setStyle({height: y+"px"});
	if($("content_images")!=null) $("content_images").setStyle({height: y+"px"});
	if($("content_planta")!=null) $("content_planta").setStyle({height: y+"px"});
	if($("content_detalles")!=null) $("content_detalles").setStyle({height: y+"px"});
	if($("content_ubicacion")!=null) $("content_ubicacion").setStyle({height: y+"px"});
}
