// Ad Popup
var gAdvPopups=new Array();

function gAdvPopup(name) {

gAdvPopups[name]=this;

this.name=name;
this.screenWidth=0;
this.screenHeiht=0;
this.adTime=0;
this.today = new Date();
this.expiry = new Date(today.getTime()+(1 * 60 * 60 * 1000));

this.setScreenWidth=function(width) {
	this.screenWidth=width;
}

this.setScreenHeight=function(height) {
	this.screenHeight=height;
}

this.setadTime=function(sec) {
//	this.adTime=sec;
	this.adTime=20000;
}

this.close=function() {
	this.setCookie('adv_popup', 1);
	document.getElementById(this.name+"_popup").style.display="none";
}

this.show=function() {

//automatische Position des Popups

	popupleft=Math.random()*this.screenWidth;
	popuptop=Math.random()*this.screenHeight;

//Popup über den nächsten Fotoshootings

// popupleft=166;
	popuptop=100;

// popupleft=0;
// popuptop=0;

// Beliebige Position
// popupleft=0;
// popuptop=0;

	document.getElementById(this.name+"_popup").style.top=Math.round(popuptop)+'px';
	document.getElementById(this.name+"_popup").style.left=Math.round(popupleft)+'px';
	
	advCookie=this.getCookie('adv_popup');
	
	if (advCookie!=1) 
		document.getElementById(this.name+"_popup").style.display="block";
	
	setTimeout('gAdvPopups["' + this.name + '"].close()', this.adTime);
}

this.getCookie=function (name) {
	var re = new RegExp(name + "=([^;]+)");
	var value = re.exec(document.cookie);
	return (value != null) ? unescape(value[1]) : null;
}

this.setCookie=function(name, value) {
	//document.cookie=name + "=" + escape(value) + "; expires=" + this.expiry.toGMTString();
	document.cookie=name + "=" + escape(value) + "; path=/";
}
	
}



