
var trigDivID ="wrapper1024";
var origW;
var origH;

//Prüft ob ein Stylesheet erfolgreich verknüpft ist
if (document.styleSheets[0].cssRules)//Moz
stylesheets = document.styleSheets[0].cssRules.length;
else if (document.styleSheets[0].rules)//IE
stylesheets = document.styleSheets[0].rules.length;
else alert("Diese Website wurde für eine höhere Browserversion optimiert.");
//End


function myWindowW () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) { //oder clientWidth?
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}
function myWindowH () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) { //oder clientHeight?
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}
function origStyles(){
	origW = document.getElementById(trigDivID).offsetWidth;
	origH = document.getElementById(trigDivID).offsetHeight;
	//alert(origW+" / "+origH);	
}
function wrappermove(){
	trigW = myWindowW();
	trigH = myWindowH();
	var wrapperW = document.getElementById(trigDivID).offsetWidth;
	var wrapperH = document.getElementById(trigDivID).offsetHeight;
	//alert("trigW: "+trigW+ ", trigH: "+trigH +", wrapperW: "+wrapperW+", wrapperH: "+wrapperH);
	if(trigW <= wrapperW && stylesheets>0){
		document.getElementById(trigDivID).style.left = "0px";
		document.getElementById(trigDivID).style.marginLeft = "1px";
	}
	else if(trigW > wrapperW && stylesheets>0){
		document.getElementById(trigDivID).style.left = "50%";
		document.getElementById(trigDivID).style.marginLeft = ((origW/2)*-1)+"px";
	}
	if(trigH <= wrapperH && stylesheets>0){
		document.getElementById(trigDivID).style.top = "0px";
		document.getElementById(trigDivID).style.marginTop = "1px";
	}
	else if(trigH > wrapperH && stylesheets>0){
		document.getElementById(trigDivID).style.top = "50%";
		document.getElementById(trigDivID).style.marginTop = ((origH/2)*-1)+"px";
	}
}



