// goAdverticum (goa) version 1.12
// Generated by Adverticum jsParser v1.5 at 2006. 06. 26. 14:09:04
// Copyright (c) Adverticum Rt. 2006





function Browser(){

var b=navigator.appName;

if(b=="Netscape")
this.b="ns";
else if((b=="Opera")||(navigator.userAgent.indexOf("Opera")>0))
this.b="opera";
else if(b=="Microsoft Internet Explorer")
this.b="ie";

this.version=navigator.appVersion;
this.v=parseInt(this.version);
this.ns=(this.b=="ns" && this.v>=4);
this.ns4=(this.b=="ns" && this.v==4);
this.ns6=(this.b=="ns" && this.v==5);
this.ie=(this.b=="ie" && this.v>=4);
this.ie4=(this.version.indexOf('MSIE 4')>0);
this.ie4up=(this.ie && this.v>=4);
this.ns5up=(this.ns && this.v>=5);
this.ie5=(this.version.indexOf('MSIE 5')>0);
this.ie5up=(this.ie5);
this.ie55=(this.version.indexOf('MSIE 5.5')>0);
this.opera=(this.b=="opera");
this.def=(this.ie||this.dom);var ua=navigator.userAgent.toLowerCase();
this.mac=(ua.indexOf("mac")!=-1);

if(ua.indexOf("win")>-1)
this.platform="win32";
else if(ua.indexOf("mac")>-1)
this.platform="mac";
else 
this.platform="other";
}

if(!window.goAdverticumDhtml){

goAdverticumZone=function(id,params){
if(!window.goAdverticumDhtml)
return;

this.goa=window.goAdverticumDhtml;
if(!id){
this.goa.Error({zone:null,msg:"Missing zoneID"});
return false;
}

this.id=id;

this.goa.Log({zone:this.id,msg:'zone added'});

this.mode="write";
this.addata={};
this.dhtml=false;
this._setParams(params);
this.creative="";
this.creativeHTML="";
this.cookieName="";
this.cookieSplitChar="-";
}

goAdverticumZone.prototype.useCookie=function(){
if(this.addata.maximumAVpT > 0)
return true;

return false;
}



goAdverticumZone.prototype.importDhtmlParams=function(dhtmlparams){
this.dhtml=true;

var default_dhtmlparams=this.default_dhtmlparams;

this.goa._importObject(default_dhtmlparams,this.addata);
this.goa._importObject(dhtmlparams,this.addata);

if(this.useCookie()===true){
this.cookieName=this.goa.getCreativeID(this.addata.banner_id);
}

if(!this.addata.closeImgSrc){
this.addata.closeImgSrc=this.addata.imghome+"/Hide.gif";
}

if(this.addata.layerWidth==null){
this.addata.layerWidth=this.addata.width;
}

if(this.addata.layerHeight==null){
this.addata.layerHeight=this.addata.height;
}

if(this.addata.flashCloseFunction !=null)
window[this.addata.flashCloseFunction]=Function("window.goAdverticumDhtml.closeLayer("+this.id+")");
}

goAdverticumZone.prototype.closeLayer=function(){
var b=document.getElementsByTagName("body")[0];
if(this.layer && b){
b.removeChild(this.layer);
this.goa.showObjects(this.hiddenObjects);
}
}



goAdverticumZone.prototype._isAVSession=function(){
var d=new Date();
if(!this.useCookie()){
return true;
}
else if(this.addata.maximumAVpT==0 ||((d.valueOf()- this._getLastAVTime())>=(this.addata.T /(this.addata.maximumAVpT)))){
this.goa.Log({zone:this.id,msg:"freq OK.("+this.addata.maximumAVpT+" times in "+this.addata.T/1000/60+" minutes)"});
return true;
}else{
this.goa.Log({zone:this.id,msg:"freq LIMIT("+this.addata.maximumAVpT+" times in "+this.addata.T/1000/60+" minutes)"});
return false;
}
}



goAdverticumZone.prototype._addAdView=function(){
if(this.useCookie()){
var data=new Array();
var s=new String;
if(s=this.goa.getCookie(this.cookieName)){
data=this._parseCookieData(s);
}else{
data=new Array(0,0);
}

var d=new Date();
data[0]=d.valueOf();
data[1]++;

var serialized=data.join(this.cookieSplitChar);
this.goa.setCookie(this.cookieName,serialized,(this.cookieExpire)?(this.cookieExpire):15724800000);
}
if(this.dhtml)
this.countAdView();
}

goAdverticumZone.prototype.countAdView=function(){
var d=document;
var b=d.getElementsByTagName("body")[0];

counter=d.createElement("iframe");
counter.id=this.addata.banner_id+"_popcounter";
counter.style.display="none";
counter.src=this.countUrl();
b.appendChild(counter);
}

goAdverticumZone.prototype.countUrl=function(){
if(this.viewed){
return this.goa.bannerhome+'/html.prm?zona='+this.id+"&kampany="+this.addata.kampany_id+"&banner="+this.addata.banner_id+"&v="+this.viewed+"&pop&ord="+this.goa.commonOrd;
}else{
return this.goa.bannerhome+'/html.prm?zona='+this.id+'&kampany=1&ord='+this.goa.commonOrd;
}
}



goAdverticumZone.prototype._parseCookieData=function(str){
var data=new Array();
var d=str.split(this.cookieSplitChar);

d[0]=Math.round(parseInt(d[0]));
d[1]=Math.round(parseInt(d[1]));

return d;
}



goAdverticumZone.prototype._getLastAVTime=function(){
var str=new String();
if(str=this.goa.getCookie(this.cookieName)){
return this._parseCookieData(str)[0];
}
return null;
}



goAdverticumZone.prototype._getTotalAV=function(){
var str=new String();
if(str=this.goa.getCookie(this.cookieName)){
return this._parseCookieData(str)[1];
}
return null;
}


goAdverticumZone.prototype._verify=function(){


if(this.displayOptions.mode=="dom")
if(!this.displayOptions.container || !document.getElementById(this.displayOptions.container)){
this.goa.Error({zone:this.id,msg:"Missing container"});
return false;
}


if(this.displayOptions.mode=="write")
if(document.closed){
this.goa.Error({zone:this.id,msg:"Document closed"});
return false;
}

return true;
}



goAdverticumZone.prototype._getInvocationUrl=function(){
var url=this.goa.bannerhome+'/ad.js?zona='+this.id+'&ord='+this.goa.commonOrd+'&re='+document.referrer;

for(var i in this.serverRequest)
url+='&'+i+'='+this.serverRequest[i];
var fwdParams='';
for(var i in this.fwdParams)
url+='&'+i+'='+this.fwdParams[i];

if(fwdParams.length > 0)
url+="&fwdParams"+fwdParams;

this.goa.Log({zone:this.id,msg:url});
//this.goa.Log({zone:this.id,msg:'<a href="'+url+'" target="_blank">'+url+'</a>'});
return url;
}



goAdverticumZone.prototype._invocate=function(){

if(this.displayOptions.invocateZone==false){
return false;
}

var params={
'src':this._getInvocationUrl(),
'charset':'iso-8859-2',
'type':'text/javascript'
};

if(this.displayOptions['mode']=="write"){
var invocationCode=this.goa.buildObjectString(this.goa._templateScript(params));

if(document.closed){
this.goa.Error({zone:this.id,msg:'Document closed. Can\'t invocate.'});
return false;
}
document.write(invocationCode);
this.goa.Log({zone:this.id,msg:'invocated(write)'});

}else if(this.displayOptions['mode']=="dom"){
var invocingElement=this.goa.buildObject(this.goa._templateScript(params));
document.getElementsByTagName("head")[0].appendChild(invocingElement);
this.goa.Log({zone:this.id,msg:'invocated(dom)'});
}
}


goAdverticumZone.prototype.importAdData=function(addata){
if(!addata){
this.goa.Error({zone:this.id,msg:"Missing ad data"});
return;
}
for(var i in addata){
if(addata[i].toString().match(/^\[.*?\]$/))
this.addata[i]=null;
else
this.addata[i]=addata[i];
}

}



goAdverticumZone.prototype._setParams=function(params){
this.displayOptions={
mode:'write',
container:'goAdverticumContainer'+this.id,
labelID:'goAdverticumLabel'+this.id,
displayContainer:'block',
displayLabel:'block',
noSpacing:false,
containerClass:false
};

this.serverRequest={};
this.invocationAttributes={
'charset':'iso-8859-2',
'type':'text/javascript',
'id':'zoneInvocation'+this.id
}

if(params && params.displayOptions)
this.goa._importObject(params.displayOptions,this.displayOptions);
if(params && params.elementAttributes)
this.goa._importObject(params.elementAttributes,this.elementAttributes);
if(params && params.serverRequest)
this.goa._importObject(params.serverRequest,this.serverRequest);
if(params && params.fwdParams)
this.goa._importObject(params.serverRequest,this.fwdParams);

this.mode=this.displayOptions.mode;

this.default_dhtmlparams={

maximumAV:0,
maximumAVpT:0,
T:0,
cookieExpire:0,

viewed:false,
    
titleText:"hirdetés",
    
dhtmlWidth:0,
dhtmlHeight:0,
bannerCentered:true,
bannerTop:null,
bannerLeft:null,

layerCentered:false,
layerTop:null,
layerLeft:null,
layerBorderWidth:"0",
layerBorderStyle:"solid",
layerBorderColor:"#0000A0",
layerZIndex:110,
    layerBackground:'',
    
popUp:false,
    
bannerID:null,
popupBackground:'',
    
closeType:"title",

titleBackground:"#0000A0",
titleColor:"#FFFFFF",
titleFontFamily:"Verdana,Arial,sans-serif",
titleHeight:15,
titleFontBold:true,
titleFontItalic:false,
titleFontSize:10,
titleLineHeight:12,
    
closeWidth:10,
closeHeight:10,
    
stayAlive:0,
layerOnly:false,
forceLayer:false,
openOnClose:false,
openDelay:200,
    
counterUrlBase:'',

cookieSplitChar:"-"
};
}



goAdverticumZone.prototype._createZoneHTML=function(){
var zoneHTML="";
var style=[];
var styledef="";
var classdef="";

if(this.addata.type=="ct" &&(!this.addata.zona_up && !this.addata.zona_right && !this.addata.zona_down && !this.addata.zona_left && !this.addata.width && !this.addata.height)){
style.push("display:inline");
}else{
style.push("white-space:nowrap");

if(!this.displayOptions.noSpacing){

if(this.addata.zona_up){
style.push("margin-top:"+this.addata.zona_up+"px");
}
if(this.addata.zona_right){
style.push("margin-right:"+this.addata.zona_right+"px");
}
if(this.addata.zona_down){
style.push("margin-bottom:"+this.addata.zona_down+"px");
}
if(this.addata.zona_left){
style.push("margin-left:"+this.addata.zona_left+"px");
}

style.push("width:"+(
parseInt(this.addata.width)+
parseInt(this.addata.banner_right)+
parseInt(this.addata.banner_left))+"px");

style.push("height:"+(
parseInt(this.addata.height)+
parseInt(this.addata.banner_up)+
parseInt(this.addata.banner_down))+"px");
}
}

styledef=" style='"+style.join(";")+"'";

if(this.displayOptions.containerClass){
classdef=" class='"+this.displayOptions.containerClass+"'";
}

zoneHTML="<div id='"+this.displayOptions.container+"' "+classdef+styledef+">";
if(this.goa.debugMode)
zoneHTML+=this.goa.buildObjectString(this.goa._templateZoneInfo({zoneID:this.id,creativeID:this.addata.banner_id}));
zoneHTML+=this.creativeHTML;
zoneHTML+="</div>";
return zoneHTML;
}



goAdverticumZone.prototype._setZoneContainer=function(){
var container=document.getElementById(this.displayOptions.container);
var style=container.style;

if(this.goa.debugMode){
container.appendChild(this.goa.buildObject(this.goa._templateZoneInfo({zoneID:this.id,creativeID:this.addata.banner_id})));
}


if(this.addata.type=="ct" 
&&(!this.addata.zona_up 
&& !this.addata.zona_right 
&& !this.addata.zona_down 
&& !this.addata.zona_left 
&& !this.addata.width 
&& !this.addata.height)){
style.display="inline";
return;
}else{
style.whiteSpace="nowrap";
}

if(!this.displayOptions.noSpacing){


if(this.addata.zona_up){
style.marginTop=this.addata.zona_up+"px";
}
if(this.addata.zona_right){
style.marginRight=this.addata.zona_right+"px";
}
if(this.addata.zona_down){
style.marginBottom=this.addata.zona_down+"px";
}
if(this.addata.zona_left){
style.marginLeft=this.addata.zona_left+"px";
}
}

if(this.creative || this.goa.debugMode){
style.display=this.displayOptions.displayContainer;
}

if(this.addata.width)
style.width=(
parseInt(this.addata.width)+
parseInt(this.addata.banner_right)+
parseInt(this.addata.banner_left))+"px";

if(this.addata.height)
style.height=(
parseInt(this.addata.height)+
parseInt(this.addata.banner_up)+
parseInt(this.addata.banner_down))+"px";

if(this.displayOptions.containerClass){
container.className=this.displayOptions.containerClass;
}

}



goAdverticumZone.prototype._isExternalAd=function(){
if(this.addata.type=="html")
return true;
return false;
}



goAdverticumZone.prototype._createWindow=function(pUrl){
var dhtmlparams=this.addata;

if(dhtmlparams.bannerLeft==null || dhtmlparams.bannerTop==null){
dhtmlparams.bannerLeft=(this.goa.env.frameWidth - this.goa.pxValue(this.addata.width,false))/ 2;
dhtmlparams.bannerTop=(this.goa.env.frameHeight - this.goa.pxValue(this.addata.height,true))/ 2;
}

var strWindowFeatures="";
strWindowFeatures+="width="+(this.goa.pxValue(this.addata.width,false));
strWindowFeatures+=",height="+(this.goa.pxValue(this.addata.height,true));
strWindowFeatures+=",top="+this.goa.pxValue(dhtmlparams.bannerTop,true);
strWindowFeatures+=",left="+this.goa.pxValue(dhtmlparams.bannerLeft,true);
strWindowFeatures+=",scrollbars=0";
strWindowFeatures+=",resizable=0";

var url=(pUrl)
? pUrl
:(this._isExternalAd())
? this.goa._getExternalUrl(this.addata)
:'';

this.popup=window.open(url,"popup_"+dhtmlparams.banner_id,strWindowFeatures);
if(!this.addata.popUp){
window.focus();
}

if((this.popup && !this._isExternalAd())&& !pUrl){
var d=this.popup.document;
d.title=this.addata.titleText;
var b=d.getElementsByTagName("body")[0];
if(b){
b.style.margin="0px";
b.style.padding="0px";
b.style.backgroundColor=(this.addata.backgroundColor)?this.addata.backgroundColor:"#ffffff";
}
}

if(this.popup){
this.goa.Log({zone:this.id,msg:'popup created'});
return true;
}

this.goa.Log({zone:this.id,msg:'creating popup failed'});
return false;
}


goAdverticumZone.prototype._getDhtmlContainerId=function(){
return "goAdverticumDhtmlContainer"+this.addata.banner_id;
}

goAdverticumZone.prototype._calculateLayerParams=function(){
var params={};
params.width=this.goa.pxValue(this.addata.layerWidth,false);

if(this.addata.layerLeft==null || this.addata.layerTop==null || this.addata.layerCentered==true){
params.left=Math.floor((this.goa.env.frameWidth - this.goa.pxValue(this.addata.width,false))/ 2);
params.top=Math.floor((this.goa.env.frameHeight - this.goa.pxValue(this.addata.height,true))/ 2);
}else{
params.left=this.addata.layerLeft;
params.top=this.addata.layerTop;
}

if(this.addata.closeType=="title"){
params.height=this.goa.pxValue(this.addata.layerHeight,true)+this.addata.titleHeight;
}else{
params.height=this.goa.pxValue(this.addata.layerHeight,true);
}


if(this.addata.layerBorderWidth > 0){
params.borderWidth=this.addata.layerBorderWidth;
params.borderStyle=this.addata.layerBorderStyle;
params.borderColor=this.addata.layerBorderColor;
}else{
params.borderWidth=0;
params.borderStyle='solid';
params.borderColor='blue';
}
params.id=this._getDhtmlContainerId();
params.zIndex=this.layerZIndex;
if(this.layerBackground !=null)
params.background=this.layerBackground;
return params;
}

goAdverticumZone.prototype._createLayerCloser=function(){
var d=document;
var closer;
var body=d.getElementsByTagName("body")[0];

this.addata.closeFunction=Function("window.goAdverticumDhtml.closeLayer("+this.id+")");

if(this.closeType=="img"){
var params;
params.closeWidth=this.addata.closeWidth;
params.closeHeight=this.addata.closeHeight;
params.left=this.goa.pxValue(this.goa.layerWidth,false)- this.addata.closeWidth+"px";
params.closeFunction=this.addata.closeFunction;
params.closeImgSrc=this.addata.closeImgSrc;
closer=this.goa.buildObject(this.goa._templateLayerCloserImage(params));
}
else{
this.addata.titleFontWeight=(this.addata.titleFontBold)? 'bold':'normal';
this.addata.titleFontStyle=(this.addata.titleFontItalic)? 'italic':'normal';
closer=this.goa.buildObject(this.goa._templateLayerCloserTitle(this.addata));
}
return closer;
}



goAdverticumZone.prototype._createLayer=function(){
var d=document;
var b=d.getElementsByTagName("body")[0];
if(!b)
return false;

var params=this._calculateLayerParams();
this.layer=this.goa.buildObject(this.goa._templateLayer(params));
if(this.addata.closeType !="flash" || this.goa.env.plugins["application/x-shockwave-flash"]< this.addata.swfversion){
this.layer.appendChild(this._createLayerCloser());
}
this.layer.appendChild(this.goa.buildObject(this.goa.Template(this.addata)));

b.insertBefore(this.layer,b.firstChild);
this.goa.protectFromHide=this.goa.getCreativeID(this.addata.banner_id);
this.hiddenObjects=this.goa.hideObjects(this.layer);

if(this.addata.stayAlive > 0){
setTimeout("window.goAdverticumDhtml.closeLayer("+this.id+")",this.addata.stayAlive);
}


return true;


}



goAdverticumZone.prototype.showDhtmlAd=function(){
this.goa.Log({zone:this.id,msg:'creating dhtml ad'});

if(!this.addata.layerOnly){

var popupCreated;
if(this.goa.browser.opera){

popupCreated=this._createWindow("http://ad.adverticum.net/html.prm?zona="+this.id+"&ord="+this.goa.commonOrd);

}else if(popupCreated=this._createWindow()){

if(!this._isExternalAd()){

if(this.popup.document){
var d=this.popup.document;
var b=d.getElementsByTagName("body")[0];
if(this.goa.browser.ie && this.addata.type=="flash"){
var s=this.goa.buildObject(this.goa._templateScript({'src':'http://imgs.adverticum.net/scripts/buildObject.js','type':'text/javascript','charset':'iso-8859-2'}),d);
this.popup.creative=this.goa.Template(this.addata);
b.appendChild(s);
if(this.popup.hasRun && !this.popup.hasCreated)
this.popup.buildObject(this.goa.Template(this.addata),d,b);

}else{
var c=this.goa.buildObject(this.goa.Template(this.addata),d);
if(b && c && d)b.appendChild(c);
}
}
}

this.viewed="p";
this._addAdView();
}
}

if(this.addata.layerOnly ||(!popupCreated && this.addata.forceLayer)){
if(this._createLayer())
this.viewed="l";
this._addAdView();
this.goa.Log({zone:this.id,msg:'created layer'});
}
}



goAdverticumZone.prototype.append=function(){

this.goa.Log({zone:this.id,msg:'creative:'+this.addata.banner_id});

if(!this._isAVSession()){
this.goa.Log({zone:this.id,msg:'it\'s not an AV session'});
return false;
}

if(this.dhtml){
this.goa.Log({zone:this.id,msg:'dhtml creative'});
if(this.addata.openOnClose){
this.goa.setOnUnload(Function("window.goAdverticumDhtml.showDhtmlAd("+this.id+")"));
this.goa.Log({zone:this.id,msg:'scheduled on unload'});
}
else if(this.addata.openDelay > 0){
setTimeout("window.goAdverticumDhtml.showDhtmlAd("+this.id+")",this.addata.openDelay);
this.goa.Log({zone:this.id,msg:'scheduled with '+this.addata.openDelay+'ms delay'});
}else{
this.showDhtmlAd();
}
return;
}

if(document.getElementById(this.displayOptions.labelID)){
document.getElementById(this.displayOptions.labelID).style.display=this.displayOptions.displayLabel;
}

if(this.mode=="write"){
this.creativeHTML=this.goa.buildObjectString(this.goa.Template(this.addata));
if(!this.creativeHTML)return;

if(this.addata.type !="ct"){
this.zoneHTML=this._createZoneHTML();
}
else{
this.zoneHTML=this.creativeHTML;
}
if(document.closed){
this.goa.Error({zone:this.id,msg:"Document closed"});
return false;
}
document.write(this.zoneHTML);
this._addAdView();
this.goa.Log({zone:this.id,msg:'creative added(write)'});
return true;
}

if(this.mode=="dom"){
if(!this._verify())
return false;
var container=document.getElementById(this.displayOptions.container);
this.creative=this.goa.buildObject(this.goa.Template(this.addata));
if(!this.creative)return false;
container.appendChild(this.creative);
this._setZoneContainer();
this._addAdView();
this.goa.Log({zone:this.id,msg:'creative added(dom)'});
return true;
}

this.goa.Error({zone:this.id,msg:"couldn't add creative"});
return false;
}


goAdverticumClass=function(){

this.version="1.12";
this.commonOrd=this._getOrd();
this.bannerhome="http://ad.adverticum.net";
this.zones=[];
this.hiddenObjects=[];
this.logs=[];
this.errors=[];
this.buildName="goAdverticumDhtml";
this.buildID=this.buildName+" v"+this.version;

this._Init();
}




goAdverticumClass.prototype.closeLayer=function(zoneID){
var zone=this._getZone(zoneID);
zone.closeLayer();
}



goAdverticumClass.prototype.setOnload=function(func){
var old=window.onload;
if(typeof(old)!="function"){
window.onload=func;
}else{
window.onload=function(){
old();
func();
}
}
}



goAdverticumClass.prototype.setOnUnload=function(func){
var old=window.onunload;
if(typeof(old)!="function"){
window.onunload=func;
}else{
window.onunload=function(){
old();
func();
}
}
}




goAdverticumClass.prototype._Init=function(){
this.env={};
this._getClientInfo();
this.start=new Date();
this._getDebugMode();
this._showLog();
this._getFrameDetails();
this.Log({zone:'global',msg:this.buildID+' loaded'});
}

goAdverticumClass.prototype._getClientInfo=function(){
this.browser=new Browser();

this._getPluginInfo();
}

goAdverticumClass.prototype._getDebugMode=function(){
if((location.search && location.search.toString().match(/goadebug/))||(window.goAdverticumDebugMode)){
this.debugMode=1;
}
}

goAdverticumClass.prototype.showDhtmlAd=function(zone){
var zone=this._getZone(zone);
if(zone){
zone.showDhtmlAd();
}
}



goAdverticumClass.prototype.pxValue=function(strValue,height){
if(strValue.toString().match("%")){
if(height)return Math.floor(this.env.frameHeight/100*parseInt(strValue));
else return Math.floor(this.env.frameWidth/100*parseInt(strValue));
}else{
return parseInt(strValue);
}
}

goAdverticumClass.prototype._getPluginInfo=function(){
this.env.plugins={};
this._detectFlash();
}

goAdverticumClass.prototype._detectIEFlash=function(){
for(var i=8;i>0;i--){
var flashVersion=0;
try{
var flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
this.env.plugins["application/x-shockwave-flash"]=i;
return;
}
catch(e){
}
}
}

goAdverticumClass.prototype._detectFlash=function(){
if(navigator.plugins && navigator.plugins.length){
var x=navigator.plugins["Shockwave Flash"];
if(x && x.description){
var result=x.description.toString().match(/\s(\d+)\./);
if(result[1]){
this.env.plugins["application/x-shockwave-flash"]=result[1];
}
}
}else{
this._detectIEFlash();
}
}


goAdverticumClass.prototype.adData=function(creative,dhtml_params){
this.Log({zone:creative.zona,msg:'got adData('+creative.type+')'});
if(!creative || !creative.zona || !creative.zona.match(/^\d+$/)){
this.Error({zone:this.id,msg:'missing or bad zone'});
return;
}
var zone=this._getZone(creative.zona);
zone.importAdData(creative);
if(dhtml_params && typeof(dhtml_params["d"])!=="undefined")
zone.importDhtmlParams(dhtml_params);
zone.append();
return true;
}

goAdverticumClass.prototype._getZone=function(zoneID){
for(var i=0;i<this.zones.length;i++){
if(this.zones[i].id==zoneID){
return this.zones[i];
}
}
this.Error({zone:this.id,msg:'there is no such zone'});
}



goAdverticumClass.prototype._importObject=function(importObj,targetObj){
if(!importObj || !targetObj)return;

for(var i in importObj){
if(importObj[i]===parseInt(importObj[i]))
targetObj[i]=parseInt(importObj[i]);
else if(importObj[i]==="false")
targetObj[i]=false;
else if(importObj[i]==="true")
targetObj[i]=true;
else if(importObj[i]==="null")
targetObj[i]=null;
else if(importObj[i]===null)
targetObj[i]=null;
else if(importObj[i].toString().match(/^\[A-Za-z0-9\]+$/))
targetObj[i]=null;
else 
targetObj[i]=importObj[i];
}
}



goAdverticumClass.prototype._getOrd=function(){
var ord='';
for(var i=0;i<6;i++){
ord+=String.fromCharCode(Math.round(Math.random()*24)+97);
ord+=Math.round(Math.random()*9);
ord+=String.fromCharCode(Math.round(Math.random()*24)+65);
}
return ord;
}




goAdverticumClass.prototype.processZoneData=function(){
if(!window.goAdverticumDhtmlZones || !window.goAdverticumDhtmlZones.length){
this.Log({zone:'global',msg:'no cached zone to process'});
return;
}

var zoneData;

this.Log({zone:'global',msg:'processing zones'});
while(typeof(window.goAdverticumDhtmlZones)==="object"  &&(zoneData=window.goAdverticumDhtmlZones.shift())){
if(zoneData.length > 1){
this.addZone(zoneData[0],zoneData[1]);
}else{
this.addZone(zoneData[0]);
}
}
}

goAdverticumClass.prototype.processAdData=function(){
if(!window.goAdverticumDhtmlData || !window.goAdverticumDhtmlData.length){
this.Log({zone:'global',msg:'no cached data to process'});
return;
}
this.Log({zone:'global',msg:'processing data'});
while(typeof(window.goAdverticumDhtmlData)==="object"  &&(adData=window.goAdverticumDhtmlData.shift())){
if(adData.length > 1){
this.adData(adData[0],adData[1]);
}else{
this.adData(adData[0]);
}
}
}


goAdverticumClass.prototype.addZone=function(zoneID,params){
var zone=new goAdverticumZone(zoneID,params);
if(!zone)
return false;
this.zones[this.zones.length]=zone;
zone._invocate();
}



goAdverticumClass.prototype._getJsStyleName=function(cssProp){
var nameParts=cssProp.split("-");
var jsProperty=nameParts[0];
for(var i=1;i<nameParts.length;i++){
var part=nameParts[i];
jsProperty+=part.substr(0,1).toUpperCase()+part.substr(1);
}
return jsProperty;
}



goAdverticumClass.prototype.buildObjectString=function(object){
var obj;
for(var i in object){
var objname=i;
var objattrs=object[i];
var objtextnodes=(object[i]['textnodes'])? object[i]['textnodes']:new Array();
var objchildren=(object[i]['children'])? object[i]['children']:new Array();
var children=[];
obj="<"+objname;
for(var j in objattrs){
if(j !='children'){
if(j=='style'){
var s="";
for(var k in objattrs[j]){
s+=k+":"+objattrs[j][k]+";";
}
obj+=" style=\""+s+"\"";
}else if(j !="textnodes"){
obj+=" "+j+"=\""+objattrs[j]+"\"";
}
}
}
obj+=">";
var childflag=false;
for(var j=0;j<objchildren.length;j++){
obj+=this.buildObjectString(objchildren[j]);
childflag=true;
}
for(var j=0;j<objtextnodes.length;j++){
obj+=objtextnodes[j];
childflag=true;
}
if(childflag || objname=="iframe" || objname=="script")
obj+="</"+objname+">";
}
return obj;
}



goAdverticumClass.prototype.buildObject=function(object,doc){
if(!doc)doc=document;
var obj;
for(var i in object){
var objname=i;
var objattrs=object[i];
var objchildren=(object[i]['children'])? object[i]['children']:new Array();
obj=doc.createElement(i);


for(var j=0;j<objchildren.length;j++){
obj.appendChild(this.buildObject(objchildren[j],doc));
}
for(var j in objattrs){
if(j !='children'){
if(j=='style'){
for(var k in objattrs[j]){
if(k=="float"){
obj[j]['cssFloat']=objattrs[j][k];
obj[j]['styleFloat']=objattrs[j][k];
}
else{
obj[j][this._getJsStyleName(k)]=objattrs[j][k];
}
}
}else if(j=='textnodes'){
for(var k=0;k<objattrs[j].length;k++)
obj.appendChild(doc.createTextNode(objattrs[j][k]));
}else if(j.match(/^on/)!=null){
obj[j]=objattrs[j];
}else{
obj.setAttribute(j,objattrs[j]);
}

}
}
}
return obj;
}



goAdverticumClass.prototype._getExternalUrl=function(params){
var externalUrl="";

if(params.externalUrl){
externalUrl+=params.externalUrl;
}else if(params.imghome){
externalUrl+=params.imghome+"/external/"+params.banner_id+".html";
}else{
externalUrl+=this.imghome+"/external/"+params.banner_id+".html";
}

externalUrl+="?title=";
externalUrl+=(params.titleText && params.titleText!="")
?(encodeURIComponent(params.titleText))
:'';

externalUrl+="&v";
externalUrl+="&cthref="+encodeURIComponent(params.cthref);
externalUrl+="&zona="+params.zona;

if((params.layerBackground || params.popupBackground)&&(params.layerBackground !='' || params.popupBackground !='')){
externalUrl+="&b&background-color:";
externalUrl+=((params.layerBackground!='')?(encodeURIComponent(params.layerBackground)):(encodeURIComponent(params.popupBackground)));
}

if(this.debugMode){
externalUrl+="&goadebug";
}

return externalUrl;
}



goAdverticumClass.prototype._getFlashLoaderUrl=function(params){
if(window.goAdverticumForceFlashPath){
return window.goAdverticumForceFlashPath+"/loader.swf";
}
return params.imghome+"/loader.swf";
}



goAdverticumClass.prototype._getFlashPath=function(params){
var swfsrc=params.swfsrc;
if(window.goAdverticumForceFlashPath){
swfsrc=swfsrc.replace(RegExp(params.imghome),window.goAdverticumForceFlashPath,swfsrc)
}
var path="path="+encodeURIComponent(swfsrc+"?clickTAG="+params.cthref+"&clickTARGET="+params.cttarget+"&cTRG="+params.cttarget);
return path;
}

goAdverticumClass.prototype._createStyleObject=function(stylestring){
var styleObj={};
if(!stylestring)
return styleObj;
var entries=stylestring.split(";");
for(var i in entries){
entry=entries[i].split(":");
styleObj[entry[0]]=entry[1];
}
return styleObj;
}

goAdverticumClass.prototype._getFrameDetails=function(){

if(self.innerWidth){
this.env.frameWidth=self.innerWidth;
this.env.frameHeight=self.innerHeight;
}else if(document.documentElement && document.documentElement.clientWidth){
this.env.frameWidth=document.documentElement.clientWidth;
this.env.frameHeight=document.documentElement.clientHeight;
}else if(document.body){
this.env.frameWidth=document.body.clientWidth;
this.env.frameHeight=document.body.clientHeight;
}else{
this.env.frameWidth=860;
this.env.frameHeight=600;
}

}

goAdverticumClass.prototype.Error=function(error){
var now=new Date();
var entry={
'zone':(error.zone)?error.zone:'',
'msg':error.msg,
'time':now.valueOf()-  this.start.valueOf()
};
this.errors[this.errors.length]=entry;

if(this.debugMode){
var params={
'zone':entry.zone,
'msg':entry.msg,
'time':entry.time,
'error':true
}
this.logWindow.appendChild(this.buildObject(this._templateLogEntry(params),this.logD));
}
}

goAdverticumClass.prototype.Log=function(logentry){
var now=new Date();
var entry={
'zone':(logentry.zone)?logentry.zone:'',
'msg':logentry.msg,
'time':now.valueOf()-  this.start.valueOf()
};
this.logs[this.logs.length]=entry;

if(this.debugMode){
var params={'zone':entry.zone,'msg':entry.msg,'time':entry.time,'error':false};
this.logWindow.appendChild(this.buildObject(this._templateLogEntry(params),this.logD));
}
}

goAdverticumClass.prototype._showLog=function(){

var b=document.getElementsByTagName("body")[0];

if(b){
if(this.debugMode){

if(!this.browser.opera || this.debugMode !=2)
this.logPop=window.open("","debugwindow"+this.commonOrd,"scrollbars=1,resizeable=1,width=600,height=200,statusbar=0,toolbar=0");

if(!this.logPop){
this.logWindow=this.buildObject(this._templateLogWindow());
b.insertBefore(this.logWindow,b.firstChild);
return;
}
this.logD=this.logPop.document;
this.logWindow=this.buildObject(this._templateLogWindow(),this.logD);
this.logD.title="goadebug "+this.commonOrd;
var pbs=this.logD.getElementsByTagName("body");
if(pbs)
var pb=this.logD.getElementsByTagName("body")[0];
if(pb){
pb.style.margin=0;
pb.style.padding=0;
pb.appendChild(this.logWindow);
}
this.setOnUnload(Function("window.goAdverticumDhtml.logPop.close()"));
}
}
}

goAdverticumClass.prototype.setCookie=function(cookieName,cookieValue,nTime){
var today=new Date();
 var expire=new Date();
if(nTime==null || nTime==0)nTime=36000;
expire.setTime(today.getTime()+nTime);
document.cookie=cookieName+"="+encodeURIComponent(cookieValue)+";expires="+expire.toGMTString()+";path=/";
}

goAdverticumClass.prototype.getCookie=function(name){
var c=document.cookie;
var index=c.indexOf(name+"=");
if(index==-1)return null;
index=c.indexOf("=",index)+1;
var endstr=c.indexOf(";",index);
if(endstr==-1)endstr=c.length;
return decodeURIComponent(c.substring(index,endstr));
}

goAdverticumClass.prototype.hideObjects=function(div){
var h=new Array();
var d=document;
var removeTags=new Array("select","object","iframe");
for(var i=0;i < removeTags.length;i++){
var objects=d.getElementsByTagName(removeTags[i]);
for(var j=0;j < objects.length;j++){
var o=objects[j];
if((o.id !=this.protectFromHide && this.checkOverlapping(o,div))&&(o.style.display !='none')){
this.hiddenObjects.push(o);
h.push(o);
o.style.visibility='hidden';
//this.Log({zone:this.id,msg:'object hid'});
this.Log({zone:'global',msg:'hid '+removeTags[i]+'('+o.id+')'});
}
}
}
return h;
}

goAdverticumClass.prototype.showObjects=function(objs){
var toShow=new Array();
for(var i=0;i < objs.length;i++){
var o=objs[i];
if(this.findIn(o,this.hiddenObjects)==1){
o.style.visibility='visible';
}
this.removeFrom(o,1);
}
}

goAdverticumClass.prototype.removeFrom=function(item,maxremove){
var j=0;
var chkCnt=0;
var removed=new Array();
while((j < this.hiddenObjects)&&(chkCnt < maxremove)){
if(this.hiddenObjects[j]==item){
removed.push(this.hiddenObjects.splice(j,1));
chkCnt++;
}else{
j++;
}
}
return removed;
}

goAdverticumClass.prototype.findIn=function(item,myArray){
var chkCnt=0;
for(var j=0;j < myArray.length;j++){
if(myArray[j]==item){
chkCnt++;
}
}
return chkCnt;
}

goAdverticumClass.prototype.checkOverlapping=function(obj1,obj2){
var oPos=new Array(
this.findPosX(obj1),
this.findPosY(obj1),
this.findPosX(obj1)+obj1.offsetWidth,
this.findPosY(obj1)+obj1.offsetHeight
);
var lPos=new Array(
this.findPosX(obj2),
this.findPosY(obj2),
this.findPosX(obj2)+obj2.offsetWidth,
this.findPosY(obj2)+obj2.offsetHeight
);
return this.checkBoxes(oPos,lPos);
}


goAdverticumClass.prototype.checkBoxes=function(o,l){
if(o[3]<=l[1])return false;
if(o[2]<=l[0])return false;
if(l[3]<=o[1])return false;
if(l[2]<=o[0])return false;
return true;
}


goAdverticumClass.prototype.findPosX=function(obj){
var curleft=0;
if(obj.offsetParent){
while(obj.offsetParent){
curleft+=obj.offsetLeft;
obj=obj.offsetParent;
}
}else if(obj.x)
curleft+=obj.x;

return Math.round(parseInt(curleft));
}

goAdverticumClass.prototype.findPosY=function(obj){
var curtop=0;
if(obj.offsetParent){
while(obj.offsetParent){
curtop+=obj.offsetTop;
obj=obj.offsetParent;
}
}else if(obj.y)
curtop+=obj.y;

return Math.round(parseInt(curtop));
}

goAdverticumClass.prototype.getCreativeID=function(bannerid){
return 'goAc_id'+bannerid;
}



goAdverticumClass.prototype.Template=function(params){
var creative=[];

if(params.prescript){
creative[creative.length]={'script':{'type':'text/javascript','charset':'iso-8859-2','src':params.prescript}}
}

switch(params.type){
case 'flash':
creative[creative.length]=this._templateFlash(params);
break;
case 'ct':
creative[creative.length]=this._templateCT(params);
break;
case 'inner_gif':
case 'outer_gif':
creative[creative.length]=this._templateImage(params);
break;
case 'html':
creative[creative.length]=this._templateExternal(params);
}

if(params.postscript){
creative[creative.length]={'script':{'type':'text/javascript','charset':'iso-8859-2','src':params.postscript}}
}

return{
'span':{
'children':creative
}
};
}

goAdverticumClass.prototype._templateCT=function(params){
return{
'a':{
'href':params.cthref,
'target':(params.cttarget)?(params.cttarget):"_blank",
'style':this._createStyleObject(params.style),
'textnodes':[(params.alt)?(params.alt):"Kattintson a hirdetésre!"]
}
}
}



goAdverticumClass.prototype._templateScript=function(params){
return{
'script':{
'type':params.type,
'charset':params.charset,
'src':params.src
}
}
}

goAdverticumClass.prototype._templateExternal=function(params){
return{
'iframe':{
'src':this._getExternalUrl(params),
'scrolling':'no',
'id':this.getCreativeID(params.banner_id),
'frameBorder':0,
'noresize':'noresize',
'style':{
'width':params.width+"px",
'height':params.height+"px",
'border':0,
'margin':params.banner_up+"px "+params.banner_right+"px "+params.banner_down+"px "+params.banner_left+"px",
'padding':0
}
}
}
}

goAdverticumClass.prototype._templateFlash=function(params){
if(this.env.plugins["application/x-shockwave-flash"]>=params.swfversion)
return{
'object':{
 'type':'application/x-shockwave-flash'
,'data':this._getFlashLoaderUrl(params)+"?"+this._getFlashPath(params)
,'width':params.width
,'id':this.getCreativeID(params.banner_id)
,'height':params.height
,'style':{
 'margin':params.banner_up+"px "+params.banner_right+"px "+params.banner_down+"px "+params.banner_left+"px" 
}
,'children':[
{'param':{
'name':'flashvars'
,'value':this._getFlashPath(params)
}
}
,{'param':{
'name':'wmode'
,'value':(params.wmode_type)?(params.wmode_type):"window"
}
}
,{'param':{
 'name':'quality'
,'value':(params.quality_type)?(params.quality_type):"autohigh"
}
}
,{'param':{
 'name':'movie'
,'value':this._getFlashLoaderUrl(params)+"?"+this._getFlashPath(params)
}
}
]
}
};
else 
return this._templateImage(params);
}

goAdverticumClass.prototype._templateImage=function(params){
return{
'a':{
'href':params.cthref,
'alt':params.alt,
'children':[
{'img':{
'src':params.imgsrc,
'style':{
'border-width':"0px",
'margin':params.banner_up+"px "+params.banner_right+"px "+params.banner_down+"px "+params.banner_left+"px",
'padding':"0px"
}
}
}
]
}
};
}

goAdverticumClass.prototype._templateLayer=function(params){

return{
'div':{
'id':params.id,
'style':{
'position':'absolute',
'width':params.width+"px",
'height':params.height+"px",
'top':params.top+"px",
'left':params.left+"px",
'border-width':params.borderWidth+"px",
'border-style':params.borderStyle,
'border-color':params.borderColor,
'z-index':params.zIndex,
'background-color':params.backgroundColor
}
}
};
}

goAdverticumClass.prototype._templateLayerCloserImage=function(params){
return{
'div':{
'style':{
'position':'absolute',
'width':params.width+"px",
'height':params.height+"px",
'top':0+"px",
'left':params.left+"px"
},
'children':[
{'a':{
'href':'javascript:;',
'title':'Bezár',
'onclick':params.closeFunction,
'children':[
{'img':{
'alt':'Bezár',
'src':params.closeImgSrc,
'style':{
'border':0
}
}
}
]
}
}
]
}
}
}

goAdverticumClass.prototype._templateLayerCloserTitle=function(params){
return{
'div':{
'style':{
'width':params.width+"px",
'height':params.titleHeight+"px",
'background':params.titleBackground,
'font-family':params.titleFontFamily,
'font-size':params.titleFontSize+"px",
'font-weight':params.titleFontWeight,
'font-style':params.titleFontStyle,
'color':params.titleColor,
'line-height':params.titleLineHeight+"px"
},
'children':[
{'a':{
'onclick':params.closeFunction,
'href':'javascript:;',
'id':'closer'+params.banner_id,
'textnodes':["x"],
'style':{
'display':'block',
'clear':'none',
'float':'right',
'color':params.titleColor,
'text-decoration':'none',
'font-family':'Verdana,Arial,sans-serif',
'font-weight':'bold',
'font-style':'normal',
'font-size':'100%'
}
}
}
],
'textnodes':[params.titleText]
}
}
}

goAdverticumClass.prototype._templateLogEntry=function(params){
return{
'div':{
'style':{'padding-top':'3px','padding-bottom':'3px','margin':'5px','border-bottom':'1px dashed #FFAA55','background-color':(params.error)?'red':''},
'children':[
{'span':{'style':{'margin-left':'5px','display':'block','clear':'none','float':'left'},'textnodes':[params.time]}},
{'span':{'style':{'margin-left':'5px','display':'block','clear':'none','float':'left'},'textnodes':[params.zone]}},
{'span':{'style':{'margin-left':'5px','display':'block','clear':'none','float':'left'},'textnodes':[params.msg]}},
{'span':{'style':{'clear':'left','display':'block'},'textnodes':[""]}}
]
}
};
}

goAdverticumClass.prototype._templateLogWindow=function(){
return{
'div':{
'id':'goAdverticumLogWindow',
'style':{
'font-family':'Lucida Console',
'font-size':'10px',
'background-color':'#FFF0E1',
'color':'#000000',
'z-index':'0'
},
'children':[
{'div':{
'style':{
'color':'white',
'background-color':'black',
'line-height':'16px',
'padding-left':'5px'
},
'textnodes':[this.buildID+" debug info("+this.start+")"]

}
}
]
}

}
}



goAdverticumClass.prototype._templateZoneInfo=function(params){
return{
'div':{
'style':{
'background-color':'#FF870F',
'font-family':'Lucida Console',
'font-size':'10px',
'color':'#000000'
},
'textnodes':[
params.zoneID,
",",
params.creativeID
]
}
}
}


window.goAdverticumDhtml=new goAdverticumClass();
window.goAdverticumDhtml.processZoneData();
window.goAdverticumDhtml.processAdData();
}

