/***************************************************
// Hier stehen fuer Werbezwecke relevante Funktionen
/***************************************************/

/*alte checkfunktion*/
function document_checkvisible (id, height) {
  var element = document.getElementById (id);

  if (element) {

   if (parent.innerHeight) // all except Explorer
    {
  	h = parent.innerHeight;
    }
    else if (parent.document.documentElement && parent.document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
    {
	h = parent.document.documentElement.clientHeight;
    }
    else if (parent.document.body) // other Explorers
    {
	h = parent.document.body.clientHeight;
    }    
   
    //window.alert(element.offsetTop+" "+h);
    return (element.offsetTop + height) <= h;

  }
}


/* Diese Funktion ueberprueft, ob sich der ad im sichtbaren Bereich des users befindet */
function document_checkvisible_ad (id, height, type, rand, dummy) {
  var element = document.getElementById (id);

  if (element) {

   if (parent.innerHeight) // all except Explorer
    {
  	h = parent.innerHeight;
    }
    else if (parent.document.documentElement && parent.document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
    {
	h = parent.document.documentElement.clientHeight;
    }
    else if (parent.document.body) // other Explorers
    {
	h = parent.document.body.clientHeight;
    }    
   
    // wenn dummy aktiviert ist, werden adinfos angezeigt
    if(dummy){
        if((element.offsetTop + height) <= h)
            showstatus = 'ja';
        else
            showstatus = 'nein';
        alert("position: "+type+"\n sum:"+(element.offsetTop + height)+"\n h: "+h+"\n Anzeigestatus: "+showstatus);
    }
    
    if ((element.offsetTop + height) <= h) {
        
        if(type=='ad_skyscaper_top')
            element.innerHTML = '<iframe style="width:160px; height:500px; background-color:red;"></iframe>';
        else if(type=='ad_skyscaper_bottom')
            element.innerHTML = '<iframe style="width:160px; height:500px; background-color:red;"></iframe>';
        else if(type=='ad_button_1')
            element.innerHTML = show_om_button1();
        else if(type=='ad_button_2') {
            element.innerHTML = document.write('<script src="http://ad.ad-srv.net/yasni2/98fej5dbseev"></script>');
            eval(element.innerHTML);
        } else if(type=='ad_bottom')
            element.innerHTML = '<SCRIPT TYPE="text/javascript" SRC="http://ad.yieldmanager.com/st?ad_type=pop&ad_size=0x0&section=623664&banned_pop_types=29&pop_times=1&pop_frequency=3600"></SCRIPT>';

    }
  }
}

/*orange media einbindung an button_pos1*/
function show_om_button1() {

    ord=(typeof(ord)!='undefined')?ord:Math.random()*10000000000000000;
    return ('<scr'+'ipt language="JavaScript" src="http://ad.de.doubleclick.net/adj/P4444.om.yasni.de_de/Personen;sz=300x100;kw=;tile=4;n1=' + (typeof(n1) == 'undefined' ? '' : n1) + ';n2=' + (typeof(n2) == 'undefined' ? '' : n2) + ';n3=' + (typeof(n3) == 'undefined' ? '' : n3) + ';n4=' + (typeof(n4) == 'undefined' ? '' : n4) + ';n5=' + (typeof(n5) == 'undefined' ? '' : n5) + ';n6=' + (typeof(n6) == 'undefined' ? '' : n6) + ';n7=' + (typeof(n7) == 'undefined' ? '' : n7) + ';n8=' + (typeof(n8) == 'undefined' ? '' : n8) + ';n9=' + (typeof(n9) == 'undefined' ? '' : n9) + ';n10=' + (typeof(n10) == 'undefined' ? '' : n10) + ';n11=' + (typeof(n11) == 'undefined' ? '' : n11) + ';n12=' + (typeof(n12) == 'undefined' ? '' : n12) + ';n13=' + (typeof(n13) == 'undefined' ? '' : n13) + ';n14=' + (typeof(n14) == 'undefined' ? '' : n14) + ';n15=' + (typeof(n15) == 'undefined' ? '' : n15) + ';n16=' + (typeof(n16) == 'undefined' ? '' : n16) + ';n17=' + (typeof(n17) == 'undefined' ? '' : n17) + ';n18=' + (typeof(n18) == 'undefined' ? '' : n18) + ';n19=' + (typeof(n19) == 'undefined' ? '' : n19) + ';n20=' + (typeof(n20) == 'undefined' ? '' : n20) + ';n21=' + (typeof(n21) == 'undefined' ? '' : n21) + ';n22=' + (typeof(n22) == 'undefined' ? '' : n22) + ';n23=' + (typeof(n23) == 'undefined' ? '' : n23) + ';n24=' + (typeof(n24) == 'undefined' ? '' : n24) + ';n25=' + (typeof(n25) == 'undefined' ? '' : n25) + ';n26=' + (typeof(n26) == 'undefined' ? '' : n26) + ';n27=' + (typeof(n27) == 'undefined' ? '' : n27) + ';n28=' + (typeof(n28) == 'undefined' ? '' : n28) + ';n29=' + (typeof(n29) == 'undefined' ? '' : n29) + ';n30=' + (typeof(n30) == 'undefined' ? '' : n30) + ';n31=' + (typeof(n31) == 'undefined' ? '' : n31) + ';n32=' + (typeof(n32) == 'undefined' ? '' : n32) + ';n33=' + (typeof(n33) == 'undefined' ? '' : n33) + ';n34=' + (typeof(n34) == 'undefined' ? '' : n34) + ';n35=' + (typeof(n35) == 'undefined' ? '' : n35) + ';n36=' + (typeof(n36) == 'undefined' ? '' : n36) + ';n37=' + (typeof(n37) == 'undefined' ? '' : n37) + ';n38=' + (typeof(n38) == 'undefined' ? '' : n38) + ';n39=' + (typeof(n39) == 'undefined' ? '' : n39) + ';n40=' + (typeof(n40) == 'undefined' ? '' : n40) + ';n41=' + (typeof(n41) == 'undefined' ? '' : n41) + ';n42=' + (typeof(n42) == 'undefined' ? '' : n42) + ';n43=' + (typeof(n43) == 'undefined' ? '' : n43) + ';n44=' + (typeof(n44) == 'undefined' ? '' : n44) + ';n45=' + (typeof(n45) == 'undefined' ? '' : n45) + ';n46=' + (typeof(n46) == 'undefined' ? '' : n46) + ';n47=' + (typeof(n47) == 'undefined' ? '' : n47) + ';n48=' + (typeof(n48) == 'undefined' ? '' : n48) + ';n49=' + (typeof(n49) == 'undefined' ? '' : n49) + ';n50=' + (typeof(n50) == 'undefined' ? '' : n50) + ';n51=' + (typeof(n51) == 'undefined' ? '' : n51) + ';n52=' + (typeof(n52) == 'undefined' ? '' : n52) + ';n53=' + (typeof(n53) == 'undefined' ? '' : n53) + ';n54=' + (typeof(n54) == 'undefined' ? '' : n54) + ';n55=' + (typeof(n55) == 'undefined' ? '' : n55) + ';n56=' + (typeof(n56) == 'undefined' ? '' : n56) + ';n57=' + (typeof(n57) == 'undefined' ? '' : n57) + ';n58=' + (typeof(n58) == 'undefined' ? '' : n58) + ';n59=' + (typeof(n59) == 'undefined' ? '' : n59) + ';n60=' + (typeof(n60) == 'undefined' ? '' : n60) + ';n61=' + (typeof(n61) == 'undefined' ? '' : n61) + ';n62=' + (typeof(n62) == 'undefined' ? '' : n62) + ';n63=' + (typeof(n63) == 'undefined' ? '' : n63) + ';n64=' + (typeof(n64) == 'undefined' ? '' : n64) + ';n65=' + (typeof(n65) == 'undefined' ? '' : n65) + ';n1=' + (typeof(n1) == 'undefined' ? '' : n1) + ';n2=' + (typeof(n2) == 'undefined' ? '' : n2) + ';n3=' + (typeof(n3) == 'undefined' ? '' : n3) + ';n4=' + (typeof(n4) == 'undefined' ? '' : n4) + ';n5=' + (typeof(n5) == 'undefined' ? '' : n5) + ';n6=' + (typeof(n6) == 'undefined' ? '' : n6) + ';n7=' + (typeof(n7) == 'undefined' ? '' : n7) + ';n8=' + (typeof(n8) == 'undefined' ? '' : n8) + ';n9=' + (typeof(n9) == 'undefined' ? '' : n9) + ';n10=' + (typeof(n10) == 'undefined' ? '' : n10) + ';n11=' + (typeof(n11) == 'undefined' ? '' : n11) + ';n12=' + (typeof(n12) == 'undefined' ? '' : n12) + ';n13=' + (typeof(n13) == 'undefined' ? '' : n13) + ';n14=' + (typeof(n14) == 'undefined' ? '' : n14) + ';n15=' + (typeof(n15) == 'undefined' ? '' : n15) + ';n16=' + (typeof(n16) == 'undefined' ? '' : n16) + ';n17=' + (typeof(n17) == 'undefined' ? '' : n17) + ';n18=' + (typeof(n18) == 'undefined' ? '' : n18) + ';n19=' + (typeof(n19) == 'undefined' ? '' : n19) + ';n20=' + (typeof(n20) == 'undefined' ? '' : n20) + ';n21=' + (typeof(n21) == 'undefined' ? '' : n21) + ';n22=' + (typeof(n22) == 'undefined' ? '' : n22) + ';n23=' + (typeof(n23) == 'undefined' ? '' : n23) + ';n24=' + (typeof(n24) == 'undefined' ? '' : n24) + ';n25=' + (typeof(n25) == 'undefined' ? '' : n25) + ';n26=' + (typeof(n26) == 'undefined' ? '' : n26) + ';n27=' + (typeof(n27) == 'undefined' ? '' : n27) + ';n28=' + (typeof(n28) == 'undefined' ? '' : n28) + ';n29=' + (typeof(n29) == 'undefined' ? '' : n29) + ';n30=' + (typeof(n30) == 'undefined' ? '' : n30) + ';n31=' + (typeof(n31) == 'undefined' ? '' : n31) + ';n32=' + (typeof(n32) == 'undefined' ? '' : n32) + ';n33=' + (typeof(n33) == 'undefined' ? '' : n33) + ';n34=' + (typeof(n34) == 'undefined' ? '' : n34) + ';n35=' + (typeof(n35) == 'undefined' ? '' : n35) + ';n36=' + (typeof(n36) == 'undefined' ? '' : n36) + ';n37=' + (typeof(n37) == 'undefined' ? '' : n37) + ';n38=' + (typeof(n38) == 'undefined' ? '' : n38) + ';n39=' + (typeof(n39) == 'undefined' ? '' : n39) + ';n40=' + (typeof(n40) == 'undefined' ? '' : n40) + ';n41=' + (typeof(n41) == 'undefined' ? '' : n41) + ';n42=' + (typeof(n42) == 'undefined' ? '' : n42) + ';n43=' + (typeof(n43) == 'undefined' ? '' : n43) + ';n44=' + (typeof(n44) == 'undefined' ? '' : n44) + ';n45=' + (typeof(n45) == 'undefined' ? '' : n45) + ';n46=' + (typeof(n46) == 'undefined' ? '' : n46) + ';n47=' + (typeof(n47) == 'undefined' ? '' : n47) + ';n48=' + (typeof(n48) == 'undefined' ? '' : n48) + ';n49=' + (typeof(n49) == 'undefined' ? '' : n49) + ';n50=' + (typeof(n50) == 'undefined' ? '' : n50) + ';n51=' + (typeof(n51) == 'undefined' ? '' : n51) + ';n52=' + (typeof(n52) == 'undefined' ? '' : n52) + ';n53=' + (typeof(n53) == 'undefined' ? '' : n53) + ';n54=' + (typeof(n54) == 'undefined' ? '' : n54) + ';n55=' + (typeof(n55) == 'undefined' ? '' : n55) + ';n56=' + (typeof(n56) == 'undefined' ? '' : n56) + ';n57=' + (typeof(n57) == 'undefined' ? '' : n57) + ';n58=' + (typeof(n58) == 'undefined' ? '' : n58) + ';n59=' + (typeof(n59) == 'undefined' ? '' : n59) + ';n60=' + (typeof(n60) == 'undefined' ? '' : n60) + ';n61=' + (typeof(n61) == 'undefined' ? '' : n61) + ';n62=' + (typeof(n62) == 'undefined' ? '' : n62) + ';n63=' + (typeof(n63) == 'undefined' ? '' : n63) + ';n64=' + (typeof(n64) == 'undefined' ? '' : n64) + ';n65=' + (typeof(n65) == 'undefined' ? '' : n65) + ';ord='+ord+'?" type="text/javascript"></scr'+'ipt>');

}

/* STOERER EINBINDUNG */
function stoerer() {
		viewportheight = getViewport();
		// Den Offset abhängig von der Höhe des Werbemittels einstellen!
		topOffset = viewportheight - 100;
		topOffset = topOffset + "px";
		document.getElementById("werbung").style.top=topOffset;
	}

function getViewport() {
    var viewportwidth;
    var viewportheight;
    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

    if (typeof window.innerWidth != 'undefined') {
        viewportwidth = window.innerWidth,
        viewportheight = window.innerHeight
    }

    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

     else if (typeof document.documentElement != 'undefined'
         && typeof document.documentElement.clientWidth !=
         'undefined' && document.documentElement.clientWidth != 0)
     {
    viewportwidth = document.documentElement.clientWidth,
    viewportheight = document.documentElement.clientHeight
    }

    // older versions of IE
    else {
        viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
        viewportheight = document.getElementsByTagName('body')[0].clientHeight
    }

    return viewportheight;
}
