function getBrowserWidth(){
if (window.innerWidth){
return window.innerWidth;}
else if (document.documentElement && document.documentElement.clientWidth != 0){
return document.documentElement.clientWidth; }
else if (document.body){return document.body.clientWidth;}
return 0;
}

function getImageWidth(){
	return (document.getElementById("preview").getElementsByTagName("img")[0].width);
}

function setPreviewPosition(){
	if(document.getElementById("preview")!=null){
		if(document.getElementById("preview").getElementsByTagName("img")[0]!=null){
			if(getBrowserWidth()!=0){
				document.getElementById("preview").style.left=((getBrowserWidth()-getImageWidth())/2)+"px";
			}
			
		}else{
		document.getElementById("preview").style.display="none";
	   }
	}
}

function setContenutiPosition(){
	if(document.getElementById("contenuto")!=null){
	document.getElementById("contenuto").style.left=((getBrowserWidth()-((getBrowserWidth()*75)/100))/2)+"px";
	document.getElementById("contenuto").style.marginLeft=0;
}
}

document.onload=setContenutiPosition();
