// STOERER POPUP

closetime = 0;

function openPopUp(url, w, h) {
	createCookie('stoerer','1');
	windowprops = "fullscreen=no,toolbar=no,location=no,directories=no,status=no,copyhistory=no,scrollbars=no,resizable=no,left=50,top=50,width="+w+",height="+h;
	preview = window.open(url, "stoerer", windowprops);
	if (!preview.opener) { preview.opener = self;}
	if (closetime) setTimeout("stoerer.close();", closetime*1000);
}

function initStoerer(url) {

	if (document.cookie) {
		stoerer_flag = readCookie('stoerer');
		//alert (stoerer_flag);
		if (stoerer_flag==null) {
			startPopUp(url);
		}
	} else {
		startPopUp(url);
	}

}

function startPopUp(url) {
	//url = "http://www.seacloud.com/index.php?id=211";
	width = 500;
	height = 500;
	delay = 10;
	timer = setTimeout("openPopUp('"+url+"', width, height)", delay*1000);
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

