var contentWidth = 884;
var minWinWidth = 904;

var staticLinksCount = 9; //anzahl links vor/ober der 2. navi-ebene

var myImages = new Array();

var suffix = "";

function calculateLeftmargin() {
	if(window.innerWidth) {
		width = window.innerWidth;		
	}
	else if(document.body) {
		width = document.body.offsetWidth;
	}
	
	if(width < minWinWidth) {
		width = minWinWidth;
	}
	leftmargin = (width-contentWidth)/2;		
	leftmargin -= 10; //scrollbar	
	return(leftmargin);
}

function setLeftmargin() {
	leftMargin = calculateLeftmargin();
	document.getElementById("mainbox").style.marginLeft = leftMargin+"px";
	document.getElementById("mainbox").style.display = "";
}


function getStyle(x, stylePropFF, stylePropIE) {
	if (x.currentStyle)
		var y = x.currentStyle[stylePropIE];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(stylePropFF);
	return y;
}

function resizeImprBox() {	
	document.getElementById("imprboxinner").style.width = totImprWidth;
}


function preloadImages() {
    for (i=0;i<preloadImages.arguments.length;i++) {
        myImages[i] = new Image();
        myImages[i].src = preloadImages.arguments[i];
    }
}

function bigImpr(filename) {
    imgWindow = window.open("bigimg.php?filename="+filename,"bigImgWin","width=20,height=20,top=50,left=100,scrollbars=no");
    imgWindow.focus();
}

function newsDetails(reference,lang) {
	referenceArray = reference.split("=");
	id = referenceArray[1];
	details = window.open("newsdetails.php?id="+id+"&lang="+lang,"newsDetailWin","width=500,height=330,top=50,left=100,scrollbars=yes");
    details.focus();
}

function referenzDetails(reference,lang) {
	referenceArray = reference.split("=");
	id = referenceArray[1];
	details = window.open("refdetails.php?id="+id+"&lang="+lang,"newsDetailWin","width=650,height=450,top=50,left=100,scrollbars=yes");
    details.focus();
}

function openDisclaimer() {
	disclaimer = window.open("/disclaimer.html","disclWin","width=650,height=450,top=50,left=100,scrollbars=yes");
    disclaimer.focus();
}

function popNewsletter(inout) {
	address = document.forms["optinout"].elements[0].value;
	if(address && (address!="Ihre eMail-Adresse")) {
		var url = "http://letters.popletter.com/cosmosgolf/optinout.php?inOut="+inout+"&address="+address;
		window.open(url,"optWin","width=300,height=180,top=50,left=100,scrollbars=no");
	}
	else {
		alert("Bitte geben Sie eine Adresse ein.");
	}
}

//NEWS:
function news(nr) {
    window.open("../news.php?nr="+nr,"news_win","width=350,height=250,top=50,left=100,scrollbars=yes");
}

//EVENTS:
function openEvent(id) {
    detailWindow = window.open("popEvents/event_details.php?elementID="+id,"eventWin","width=524,height=315,top=50,left=100,scrollbars=yes");
    detailWindow.focus();
}

function openImg(w,h,source) {
	disclaimer = window.open(source,"disclWin","width="+w+",height="+h+",top=0,left=100,scrollbars=yes");
    disclaimer.focus();
}


//MAGNA SWEETS:
function openMagna() {
	msgwindow=window.open('http://www.promotionsweets.de/de/index.php?customer=CosmosGolf','Popupfenster','toolbar=no,width=800,height=600,status=no,scrollbars=yes,resizable=yes,menubar=no');
	msgwindow.focus();
}

//ROEMER PRAESENTIDEEN:
function openPraesent() {
	msgwindow=window.open('http://www.promotionsweets.de/de/index.php?customer=CosmosGolf','Popupfenster','toolbar=no,width=800,height=600,status=no,scrollbars=yes,resizable=yes,menubar=no');
	msgwindow.focus();
}


//ROEMER PRAESENTIDEEN:
function openWellness() {
	msgwindow=window.open('http://www.promotionsweets.de/de/index.php?customer=CosmosGolf','Popupfenster','toolbar=no,width=800,height=600,status=no,scrollbars=yes,resizable=yes,menubar=no');
	msgwindow.focus();
}
