//
// auto popup player functions
//
function popPlayer() {
	if(readCookie('autoplay')) mode=readCookie('autoplay');
	if(!readCookie('autoplay') || mode == 0 ) {
		popWin('/data/shell/en/popup_player.php', 190, 340, 'MTM');
		createCookie('autoplay',1,1);
	}
}
function resetpopPlayer() { createCookie('autoplay',0,1); }

function popWin(url, width, height, name) {

	xPos = (screen.width / 2) - (width / 2);
	yPos = (screen.height / 2) - (height / 2);

	attr	= 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,'
			+ 'width=' + width + ','
			+ 'height=' + height + ','
			+ 'left=' + xPos + ','
			+ 'top=' + yPos;

	var win = window.open(url, name, attr);
	win.focus();

}

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;
}
