if (playonce == true) {
  var runit = readCookie(spotid);
  if (runit!="yes") { 
      playpar="yes"; 
    } else {
      playpar="no";
    }
} else {
  var runit = "no";
  playpar = "yes";
} 
var x = GetWindowSize().width-180;
leftp = ((x-1024)/2)+leftpos; //absolute pozicionálás esetére kikommentezni, következő sort kommentezni
//leftp = leftpos;
var flvname=spotid+'.flv';
if (closebutton==true) { 
  spotHeightExtended = soptHeight+30;
} else {
  spotHeightExtended = soptHeight;
}

document.write('<div style="position: absolute; top: '+toppos+'px; left: '+leftp+'px; width: '+spotWidth+'px; height: '+spotHeightExtended+'px; z-index: 999; display:block;" id="spotPlayerDiv">');
if (closebutton==true) {
//  document.write('<div style="height: 30px; text-align:right"><a href="javascript:closeSpot();"><img src="'+bezarImg+'" border="0" alt="Bezár" align="right"></a></div>');
  document.write('<a href="javascript:closeSpot();"><img src="'+bezarImg+'" border="0" alt="Bezár" align="right"></a><br>');
}
document.write('  <embed id="spotPlayerObject" width="'+spotWidth+'" height="'+soptHeight+'" src="/SpotPlayer2.swf?flvfilename='+flvname+'&playit='+playpar+'&clickurl='+clickurl+'" quality="high" pluginspage="http://www.adobe.com/go/getflashplayer" flashvars="divID=spotPlayerDiv&amp;XMLURL=autoalkatreszwebaruhaz01.xml&amp;spotID=autoalkatreszwebaruhaz01&amp;swfObjectID=spotPlayerObject" align="middle" play="true" loop="true" scale="showall" wmode="transparent" devicefont="false" bgcolor="#ff0000" name="spotPlayerObject" menu="true" allowfullscreen="false" allowscriptaccess="always" salign="" type="application/x-shockwave-flash">');
document.write('</div>');
/* a lenti két sort absloute pozicionálás estére kikommentezni */
window.onresize = function() { reposSpot(leftpos); }
window.onscroll = function() { reposSpot(leftpos); }
if (runit!="yes") {
  if (playonce == true)	 {
    createCookie(spotid,"yes",1);
  }	
}

/*window.onbeforeunload = function() {
  eraseCookie(spotid);
} */

function GetWindowSize()
{
	var result = {width:0,height:0}
	if( typeof( window.innerWidth ) == 'number' ) { 
		result.width = window.innerWidth;
		result.height = window.innerHeight;
	} 
	else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		result.width = document.documentElement.clientWidth;
		result.height = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		result.width = document.body.clientWidth;
		result.height = document.body.clientHeight;
	}
	return result;
}
function reposSpot(lp) {
 	 x = GetWindowSize().width-180;
	 pos = ((x-1024)/2)+lp;
   document.getElementById('spotPlayerDiv').style.left=pos+"px";
}
function closeSpot() {
  document.getElementById('spotPlayerDiv').innerHTML = '';
}

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);
    }

