
// Function to adapt skyscraper size to the assigned window

function adapt_banners_to_new_size() {
	var w = 0;
	var full_width = 940;
	var skyscraper_width = 200;
	if(document.getElementById('cv-body')) {
		w = document.getElementById('cv-body').style.width;
	}
	else {
		w = document.body.clientWidth;
	}
	if(location.href.match(/index.htm/) || location.href.match(/compraventa.com\/?$/) ) {
		full_width = 940;
	}
	if(w<full_width) {
		if(document.getElementById("side_banner_div")) {
			document.getElementById("side_banner_div").style.width = 0;
			document.getElementById("side_banner_div").style.display = 'none';
		}
		if(document.getElementById("big_wrapper")) {
			document.getElementById("big_wrapper").style.width = full_width-skyscraper_width;
		}
	}
	else {
		if(document.getElementById("big_wrapper")) {
			document.getElementById("big_wrapper").style.width = full_width;
		}
		if(document.getElementById("side_banner_div")) {
			document.getElementById("side_banner_div").style.width=skyscraper_width;
			document.getElementById("side_banner_div").style.display='block';
		}
	}
	
	// Next lines taken from
	// http://www.televisionmind.com/_content/ticklemesafari/
	// and
	// http://www.quirksmode.org/bugreports/archives/2005/10/Safari_doesnt_redraw_page_on_content_resize.html
	
	// hack to fix safari's redraw bug
	// as mentioned on http://en.wikipedia.org/wiki/Wikipedia:Browser_notes#Mac_OS_X
	if (self.screenTop && self.screenX){
	    window.resizeTo(self.outerWidth + 1, self.outerHeight);
	    window.resizeTo(self.outerWidth - 1, self.outerHeight);
	}
}

