function addOnloadEvent(fnc)
{
	if(typeof window.addEventListener != "undefined")
		window.addEventListener( "load", fnc, false );
	else if(typeof window.attachEvent != "undefined") 
	{
		window.attachEvent("onload", fnc);
	}
	else 
	{
		if(window.onload != null) 
		{
			var oldOnload = window.onload;
			window.onload = function(e) 
							{
								oldOnload( e );
								window[fnc]();
							};
		}
		else
			window.onload = fnc;
	}
}

function resizeDiv()
{
	//settings
	//alert("ldsfgslòtgbòa");
	var larghezzaMin = 1024; //larghezza del div per uno scherzo 1024x768
	var classDiv = 'resizeableDiv';
	var classDivDW = 'link_dw';
	var classDivText = 'text_div';
	var classDivImg = 'text_img';
	
	var myDiv = document.getElementById('resizeableDiv');
	var DivDw = document.getElementById('link_dw');
	var DivTx = document.getElementById('text_div');
	var DivImg = document.getElementById('text_img');
	
	var viewportwidth;
	var viewportheight;
	 if (typeof window.innerWidth != 'undefined')
	 {
		  viewportwidth = window.innerWidth,
		  viewportheight = window.innerHeight
	 }
	 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	
	 else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
	 {
		   viewportwidth = document.documentElement.clientWidth,
		   viewportheight = document.documentElement.clientHeight
	 }
	 
	 // older versions of IE
	 
	 else
	 {
		   viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		   viewportheight = document.getElementsByTagName('body')[0].clientHeight
	 }

	//alert(viewportheight);
	
	if(viewportwidth <= 1024)
	{
		if(myDiv)
		{
			myDiv.style.width = larghezzaMin + 'px';
		}
		if(DivDw)
		{
			DivDw.style.width = larghezzaMin + 'px';
		}
	}
	else
	{
		if(myDiv)
		{
			myDiv.style.width = '100%';
		}
		if(DivDw)
		{
			DivDw.style.width = '100%';
		}
	}
//alert(viewportheight);	
	if(viewportheight < 580)
	{
		if(DivTx)
		{
			DivTx.style.height = 90 + 'px';
			//alert("piccolo");
		}
		if(DivImg)
		{
			DivImg.style.backgroundImage= 'url("immagini/sf-testi-small.png")';
		}
	}
	else
	{
		if(DivTx)
		{
			DivTx.style.height = 177 + 'px';
			//alert("grande");
		}
		if(DivImg)
		{
			DivImg.style.backgroundImage = 'url("immagini/sf-testi.png")';
			
		}
	}
}

addOnloadEvent(resizeDiv);
window.onresize=resizeDiv;
