//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var displaymode2=3
var enablefade2="yes" //("yes" to enable fade in effect, "no" to disable)
var autohidebox2=["no", 5] //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll2="yes" //Should box remain visible even when user scrolls page? ("yes"/"no)
var IEfadelength2=1 //fade in duration for IE, in seconds
var Mozfadedegree2=0.05 //fade in degree for NS6+ (number between 0 and 1. Recommended max: 0.2)

////////No need to edit beyond here///////////

if (parseInt(displaymode2)!=NaN)
var random_num=Math.floor(Math.random()*displaymode2)

function displayfadeinbox2(){
var ie=document.all && !window.opera
var dom=document.getElementById
iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
objref2=(dom)? document.getElementById("Advertizer") : document.all.Advertizer
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
var docwidth=(ie)? iebody.clientWidth : window.innerWidth
docheight=(ie)? iebody.clientHeight: window.innerHeight
var objwidth=objref2.offsetWidth
objheight=objref2.offsetHeight
objref2.style.left=docwidth/2-objwidth/2+"px"
objref2.style.top=scroll_top+docheight/2-objheight/2+"px"

if (showonscroll2=="yes")
showonscroll2var=setInterval("staticfadebox2()", 50)

if (enablefade2=="yes" && objref2.filters){
objref2.filters[0].duration=IEfadelength2
objref2.filters[0].Apply()
objref2.filters[0].Play()
}
objref2.style.visibility="visible"
if (objref2.style.MozOpacity){
if (enablefade2=="yes")
mozfadevar2=setInterval("mozfadefx2()", 150)
else{
objref2.style.MozOpacity=1
controlledhidebox2()
}
}
else
controlledhidebox2()
}

function mozfadefx2(){
if (parseFloat(objref2.style.MozOpacity)<1)
objref2.style.MozOpacity=parseFloat(objref2.style.MozOpacity)+Mozfadedegree2
else{
clearInterval(mozfadevar2)
controlledhidebox2()
}
}

function staticfadebox2(){
var ie=document.all && !window.opera
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
objref2.style.top=scroll_top+docheight/2-objheight/2+"px"
}

function hidefadebox2(){
objref2.style.visibility="hidden"
if (typeof showonscroll2var!="undefined")
clearInterval(showonscroll2var)
}

function controlledhidebox2(){
if (autohidebox2[0]=="yes"){
var delayvar=(enablefade2=="yes" && objref2.filters)? (autohidebox2[1]+objref2.filters[0].duration)*1000 : autohidebox2[1]*1000
setTimeout("hidefadebox2()", delayvar)
}
}

function initAdvertizer(){
  if (cContent != '0'){
    setTimeout("displayfadeinbox2()", 100)
  }
}

function get_cookie2(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}


if (displaymode2=="oncepersession" && get_cookie2("fadedin")=="" || displaymode2=="always" || parseInt(displaymode2)!=NaN && random_num==0){
if (window.addEventListener)
window.addEventListener("load", initAdvertizer, false)
else if (window.attachEvent)
window.attachEvent("onload", initAdvertizer)
else if (document.getElementById)
window.onload=initAdvertizer
document.cookie="fadedin=yes"
}

