/*
OA_zones = {
  'LB Startseite' : 13,
  'LB Unterseite' : 12,
  'CR Startseite' : 17,
  'CR Unterseite' : 18,
  'SKY Startseite' : 16,
  'SKY Unterseite' : 10,
  'Partner1' : 38,
  'Partner2' : 38,
  'Partner3' : 38,
  'Partner4' : 38,
  'Partner5' : 38,
  'Partner6' : 38,
  'Partner7' : 38,
  'Partner8' : 38,
  'Partner9' : 38,
  'Partner10' : 38,
  'Partner11' : 38,
  'Partner12' : 38,
  'Partner13' : 38,
  'Partner14' : 38,
  'Partner15' : 38,
  'Partner16' : 38,
  'Partner17' : 38,
  'Partner18' : 38,
  'Partner19' : 38,
  'Partner20' : 38,
  'Partner21' : 38,
  'Partner22' : 38,
  'Partner23' : 38,
  'Partner24' : 38,
  'Partner25' : 38
}
*/

OA_zones = {
  13 : 'lb_startpage', // LB Startseite
  12 : 'lb_subpage', // LB Unterseite
  17 : 'cr_startpage', // CR Startseite
  18 : 'cr_subpage' // CR Unterseite
};
/*
  16, // SKY Startseite
  10, // SKY Unterseite
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38, // Partner
  38 // Partner
};
*/

var SimplyButtons={options:{hyperlinkClass:"button",activeButtonClass:"button_active",states:{outer:{active:{backgroundPosition:"bottom left"},inactive:{backgroundPosition:"top left"}},inner:{active:{backgroundPosition:"bottom right"},inactive:{backgroundPosition:"top right"}}},iphone:{replaceButtons:true}},buttons:[],iphone:false,init:function(b){for(var a in b){this.options[a]=b[a]}this.iphone=(navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i));this.process(document.getElementsByTagName("button"),false);this.process(document.getElementsByTagName("a"),true);if(this.iphone&&this.options.iphone.replaceButtons){this.remove()}},process:function(b,d){var e=new RegExp("\\b"+this.options.hyperlinkClass+"\\b");for(var c=0;c<b.length;c++){if((d&&e.test(b[c].className))||!d){if(this.iphone&&!d){this.mobile(b[c])}else{this.disable(b[c]);this.setup(b[c])}if(!d){this.buttons.push(b[c])}}}},mobile:function(e){var d=document.createElement("input");d.setAttribute("type",e.getAttribute("type")=="submit"?"submit":"button");var c=new Array("id","name","value","class","onclick","onmouseover","onmouseout","onpress","onfocus","onblur","onmouseup","onmousedown");for(var b=0;b<c.length;b++){if(e.getAttribute(c[b])){d.setAttribute(c[b],e.getAttribute(c[b]))}}d.style.marginLeft=e.style.marginLeft;d.style.marginRight=e.style.marginRight;e.parentNode.insertBefore(d,e)},remove:function(){for(var b=0;b<this.buttons.length;b++){this.buttons[b].parentNode.removeChild(this.buttons[b])}},disable:function(a){a.onselectstart=function(){return false};a.style.MozUserSelect="none";a.style.KhtmlUserSelect="none";a.style.UserSelect="none";a.style.cursor="default"},setup:function(a){if(document.all){if(a.tagName=="BUTTON"){a.attachEvent("onfocus",this.bind(this.toggle,this,a))}else{a.attachEvent("onmousedown",this.bind(this.toggle,this,a))}a.attachEvent("onmouseup",this.bind(this.toggle,this,a))}else{a.onfocus=function(){this.blur()}}},toggle:function(b,a){if(a.tagName!="BUTTON"&&a.tagName!="A"){while(a.tagName!="A"){a=a.parentNode}}if(event.type=="focus"||event.type=="mousedown"){a.className+=" "+b.options.activeButtonClass;b.style(a.childNodes[0],b.options.states.inner.active);b.style(a.childNodes[0].childNodes[0],b.options.states.outer.active);a.blur()}else{a.className=a.className.replace(b.options.activeButtonClass,"");b.style(a.childNodes[0],b.options.states.inner.inactive);b.style(a.childNodes[0].childNodes[0],b.options.states.outer.inactive)}},style:function(c,b){for(var a in b){c.style[a]=b[a]}},bind:function(d){var c=[];for(var b=1;b<arguments.length;b++){c.push(arguments[b])}return function(){return d.apply(this,c)}}};function keyPress(myfield, e){var keycode;if (window.event) keycode = window.event.keyCode;else if (e) keycode = e.which;else return true;if (keycode == 13){myfield.form.submit();return false;}else{return true;}}window.onload = function() {SimplyButtons.init({states:{outer:{active:{backgroundPosition: 'left -372px'},inactive: {backgroundPosition: 'left -349px'}},inner:{active:{backgroundPosition: 'right -372px'},inactive:{backgroundPosition: 'right -349px'}}}});};


// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=D=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",E=b.browser.msie&&!b.support.opacity,X=E&&b.browser.version<7,P=i+"_IE6",x,j,A,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,B,C,y,z,l,g,a,u,D,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":E?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();A=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));A.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(A,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);B=bb.height()+S.height()+s.outerHeight(e)-s.height();C=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":B,"padding-right":C}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!D&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-B,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-C,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;A[0].style.width=A[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);D=c;A[0].style.width=a.w+z+C+"px";A[0].style.height=a.h+y+B+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-C;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-B;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(m){var c="hidden";function l(s){var p,f,m,c,l=h.length,q=a.loop;d.position(s,function(){function s(){E&&j[0].style.removeAttribute("filter")}if(u){E&&o&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(l>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,l)).show();I[q||g<l-1?"show":"hide"]().html(a.next);H[q||g?"show":"hide"]().html(a.previous);p=g?h[g-1]:h[l-1];m=g<l-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){c=b.data(m,r).href||m.href;f=b.data(p,r).href||p.href;c=b.isFunction(c)?c.call(m):c;f=b.isFunction(f)?f.call(p):f;if(U(c))b("<img/>")[0].src=c;if(U(f))b("<img/>")[0].src=f}}K.hide();a.transition==="fade"?j.fadeTo(e,1,function(){s()}):s();n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var o,e=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(m);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:c}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==c}).css({visibility:c}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(e,0,function(){l(0)}):l(e)}};d.load=function(u){var n,c,s,q=d.prep;D=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-B:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-C:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-C;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-B;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];c.name=+new Date;c.src=a.href;if(!a.scrolling)c.scrolling="no";if(E)c.allowtransparency="true";b(c).appendTo(k).one(Q,function(){c.src="//about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(E)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!D){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!D){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this);

/*
 *
 * Copyright (c) 2006/2007 Sam Collett (http://www.texotela.co.uk)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Version 2.0
 * Demo: http://www.texotela.co.uk/code/jquery/newsticker/
 *
 * $LastChangedDate: 2007-05-29 11:31:36 +0100 (Tue, 29 May 2007) $
 * $Rev: 2005 $
 *
 */
 
(function($) {
/*
 * A basic news ticker.
 *
 * @name     newsticker (or newsTicker)
 * @param    delay      Delay (in milliseconds) between iterations. Default 4 seconds (4000ms)
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @example  $("#news").newsticker(); // or $("#news").newsTicker(5000);
 *
 */
$.fn.newsTicker = $.fn.newsticker = function(delay)
{
	delay = delay || 4000;
	initTicker = function(el)
	{
		stopTicker(el);
		el.items = $("li", el);
		// hide all items (except first one)
		el.items.not(":eq(0)").hide().end();
		// current item
		el.currentitem = 0;
		$(el.parentNode).show();
		startTicker(el);
	};
	startTicker = function(el)
	{
		el.tickfn = setInterval(function() { doTick(el) }, delay)
	};
	stopTicker = function(el)
	{
		clearInterval(el.tickfn);
	};
	pauseTicker = function(el)
	{
		el.pause = true;
	};
	resumeTicker = function(el)
	{
		el.pause = false;
	};
	doTick = function(el)
	{
		// don't run if paused
		if(el.pause) return;
		// pause until animation has finished
		el.pause = true;
		// hide current item
		$(el.items[el.currentitem]).fadeOut("slow",
			function()
			{
				$(this).hide();
				// move to next item and show
				el.currentitem = ++el.currentitem % (el.items.size());
				$(el.items[el.currentitem]).fadeIn("slow",
					function()
					{
						el.pause = false;
					}
				);
			}
		);
	};
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase()!= "ul") return;
			initTicker(this);
		}
	)
	.addClass("newsticker")
	.hover(
		function()
		{
			// pause if hovered over
			pauseTicker(this);
		},
		function()
		{
			// resume when not hovered over
			resumeTicker(this);
		}
	);
	return this;
};

})(jQuery);

function show(element){$(element).addClass("hover")}
function hide(element){$(element).removeClass("hover")}

$(function () {
    $('.popupBubble').each(function () {
        var distance = 6;
        var time = 0;
        var hideDelay = 0;
    
        var hideDelayTimer = null;
    
        var beingShown = false;
        var shown = false;
        var trigger = $(this);
        var info = $('.popup', this);
        
        $([trigger.get(0), info.get(0)]).mouseover(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            if (beingShown || shown) {
                // don't trigger the animation again
                return;
            } else {
                // reset position of info box
                beingShown = true;

                info.css({
                    top: 20,
                    display: 'block'
                }).animate({
                    top: '-=' + distance + 'px'
                }, time, 'swing', function() {
                    beingShown = false;
                    shown = true;
                });
            }
    
            return false;
        }).mouseout(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            hideDelayTimer = setTimeout(function () {
                hideDelayTimer = null;
                info.animate({
                    top: '-=' + distance + 'px'
                }, time, 'swing', function () {
                    shown = false;
                    info.css('display', 'none');
                });
    
            }, hideDelay);
    
            return false;
        });
    });
});

function getDpCmtCount (guid, type) {
  if (!type) { var type = "list" };
  $.getJSON("http://www.dentapress.de/?cmtcount=" + type + "&guid=" + guid + "&call_back=?", function(data){
    $.each(data, function(key, val){
      cmtcnt = $("#cmtcnt-" + key);
      switch(val.count) {
        case "0":
          val.count = "Kommentieren";
          break;
        case "1":
          val.count = "1 Kommentar";
          break;
        default:
          val.count = val.count + " Kommentare"; 
      }
      $(cmtcnt).html(val.count);
    })
  })
};

function getDpCmtListCount() {
  if (document.gotComments != true)
  {
    document.gotComments = true;
    ids = [];
    $('.news-latest-commentlink').each(function(key, value)
    {
      ids.push($(this).attr('id').split('-')[1]);
    });
  
    getDpCmtCount(ids.join(','), 'list');
  }
}

function checkMobile() {
  if (
    navigator.userAgent.match(/Android/i) ||
    navigator.userAgent.match(/webOS/i)   ||
    navigator.userAgent.match(/iPhone/i)  ||
    navigator.userAgent.match(/iPod/i)
  ) {
    return true;
  } else {
    return false;
  }
}

function deleteCookie(name) {
	var date = new Date();
//	console.log(name + "=; expires=" + date.toGMTString() + ";");
	document.cookie = name + "=; expires=" + date.toGMTString() + "; path=/; domain=www.zahniportal.de";
	document.cookie = name + "=; expires=" + date.toGMTString() + "; path=/; domain=www.dents.de";
}

$(document).ready(function() {
  $('#newsticker ul').newsTicker(2000);
  jQuery(".rzcolorbox").colorbox({current:"Bild {current} von {total}",opacity:"0.85",transition:"fade",speed:350,slideshowSpeed:2500,previous:"voriges",next:"nächstes",close:"schliessen"});
  if ($('#socialprivacy_head').length && checkMobile() == false) { ssP('#socialprivacy_head', '262112243819299') }
  if ($('#socialprivacy_bottom').length) { ssP('#socialprivacy_bottom', '262112243819299') }
  ssPLikeBox('#facebook_likebox', 'zahniportal');

  if (document.cookie.indexOf("be_typo_user=") >= 0) {
    $("<div>").attr('style', 'position: absolute; top: 60px; right: 20px; border: 2px solid #000; padding: 5px 5px; background: yellow; font: 1em Verdana; color: #000; font-weight: bold; z-index: 10001" id="typo3-previewInfo').html('Backend Cookie deteced. Cache disabled. <a href="javascript:deleteCookie(\'be_typo_user\'); deleteCookie(\'typo3-login-cookiecheck\'); window.location.reload();">Remove Cookie</a>.').appendTo($("body"))
  }
});

console.log("SPC..");

(function()
{
  if (!document || !document.getElementById || !document.addEventListener)
  {
    console.log("No proper DOM");
    return; // No proper DOM; give up.
  }

  var openx_timeout = 1, // limit the time we wait for openx
  oZones = new Object(), // list of [div_id] => zoneID
  displayBannerAds; // function.

  // oZones.<divID> = <zoneID>
  // eg: oZones.banner_below_job2 = 100;
  // (generated on the server side with PHP)
  oZones.cr_startpage = 17;
  oZones.cr_subpage = 18;
  oZones.p1 = 38;
  oZones.p2 = 38;
  oZones.p3 = 38;
  oZones.p4 = 38;
  oZones.p5 = 38;
  oZones.p6 = 38;
  oZones.p7 = 38;
  oZones.p8 = 38;
  oZones.p9 = 38;
  oZones.p10 = 38;
  oZones.p11 = 38;
  oZones.p12 = 38;
  oZones.p13 = 38;
  oZones.p14 = 38;
  oZones.p15 = 38;
  oZones.p16 = 38;
  oZones.p17 = 38;
  oZones.p18 = 38;
  oZones.p19 = 38;
  oZones.p20 = 38;

  displayBannerAds = function()
  {
    console.log("displayBannerAds called");
    if (typeof(OA_output)!='undefined' && OA_output.constructor == Array )
    {
      // OpenX SinglePageCall ready!
      console.log("OpenX SinglePageCall ready!");
      console.log(OA_output);
      if (OA_output.length > 0)
      {
        for (var zone_div_id in oZones)
        {
          console.log(zone_div_id);
          zoneid = oZones[zone_div_id];
          console.log("zoneid = " + zoneid);
          console.log(OA_output[zoneid]);

          if (typeof(OA_output[zoneid]) != 'undefined' && OA_output[zoneid] != '')
          {
            var flashCode,
            oDIV = document.getElementById(zone_div_id);
            console.log("oDIV = ");
            console.log(oDIV);

            if (oDIV)
            {
              // if it's a flash banner..
              if (OA_output[zoneid].indexOf("ox_swf.write") != -1)
              {
                // extract javascript code
                var pre_code_wrap = "<script type='text/javascript'><!--// <![CDATA[",
                post_code_wrap = "// ]]> -->";
  
                flashCode = OA_output[zoneid].substr(OA_output[zoneid].indexOf(pre_code_wrap)+pre_code_wrap.length);
                flashCode = flashCode.substr(0, flashCode.indexOf(post_code_wrap));
  
                // replace destination for the SWFObject
                flashCode = flashCode.replace(/ox\_swf\.write\(\'(.*)'\)/, "ox_swf.write('"+ oDIV.id +"')");
  
                // insert SWFObject
                if( flashCode.indexOf("ox_swf.write")!=-1 )
                {
                  eval(flashCode);
                  //oDIV.removeClass('hidden');
                } // else: the code was not as expected; don't show it
              }
              else
              {
                // normal image banner; just set the contents of the DIV
                oDIV.innerHTML = OA_output[zoneid];
                //oDIV.removeClass('hidden');
              }
            }
          }
        } // end of loop
      } //else: no banners on this page
    }
    else
    {
      // not ready, let's wait a bit
      if (openx_timeout>8000)
      {
        return; // we waited too long; abort
      };
      setTimeout( displayBannerAds, 1000*openx_timeout );
      openx_timeout+=4;
    }
  };

  console.log("calling displayBannerAds");
  displayBannerAds();
})();
