var timeout; var showAd = false; /* -- COOKIE LOGIC -- */ function cookiesEnabled() { Set_Cookie( 'test', 'none', '', '/', '', '' ); /* If Get_Cookie succeeds, cookies are enabled, since the cookie was successfully created. */ if ( Get_Cookie( 'test' ) ) { cookie_set = true; Delete_Cookie('test', '/', ''); } else { document.write( 'cookies are not currently enabled.' ); cookie_set = false; } return cookie_set; } function setQuestCookie() { Set_Cookie("questFlash","already seen",24,"/","",""); } function Set_Cookie( name, value, expires, path, domain, secure ) { // set time, it's in milliseconds var today = new Date(); today.setTime( today.getTime() ); /* if the expires variable is set, make the correct expires time, the current script below ( expires = expires * 1000 * 60 * 60 * 24 ) will set 'expires' for 'X' number of days; to make it set for hours, delete * 24, for minutes, delete * 60 * 24 */ if ( expires ) { expires = expires * 1000 * 60 * 60; } var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } // this function gets the cookie, if it exists function Get_Cookie( name ) { var start = document.cookie.indexOf( name + "=" ); var len = start + name.length + 1; if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) { return null; } if ( start == -1 ) { return null; } var end = document.cookie.indexOf( ";", len ); if ( end == -1 ) { end = document.cookie.length; } return unescape( document.cookie.substring( len, end ) ); } // this deletes the cookie when called function Delete_Cookie( name, path, domain ) { if ( Get_Cookie( name ) ) { document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; } } /* -- VISUAL LOGIC -- */ function appear() { var the_style = getStyle( "floatingflash" ); /* adPositionDepth determines where the ad will stop; higher value will equal lower point on page */ var endPosition = 300; if ( the_style ) { var current_top = parseInt( the_style.top ); var new_top = current_top + 5; if ( document.layers ) { the_style.top = new_top; } else { the_style.top = new_top + "px"; } if ( new_top < endPosition ) { the_timeout = setTimeout( 'appear();', 10 ); } //Adjust inline style on page the_style.marginLeft = 38 + "%"; } } // appear function disappear() { var the_style = getStyle( "floatingflash" ); the_style.display = 'none'; } // disappear function getStyle(ref) { if( document.getElementById && document.getElementById(ref) ) { return document.getElementById(ref).style; } else if ( document.all && document.all(ref)) { return document.all(ref).style; } else if ( document.layers && document.layers[ref] ) { return document.layers[ref]; } else { return false; } } // getStyle function showHideButtonIfAdScheduled() { /* Show the interstitial div's close button ('X') if an ad loads into the interstial div tag (a.k.a. "floatingflash"). If an ad is not loaded, the div will not grow passed the 'emptyDivSize'. */ var emptyDivSize = 10; var hideButtonStyle = getStyle( "hideButton" ); var curWidth = parseInt( document.getElementById( "floatingflash" ).offsetWidth ); var curHeight = parseInt( document.getElementById( "floatingflash" ).offsetHeight ); if ( curWidth > emptyDivSize || curHeight > emptyDivSize ) { hideButtonStyle.display = 'block'; } } /* -- MASTER TIRGGER FUNCTION -- */ function userHasNotSeenAd() { var enableAd = true; if ( Get_Cookie( "questFlash" )!= null ) { enableAd = false; } else { setQuestCookie(); enableAd = true; } if ( !cookiesEnabled() ) { enableAd = true; } return enableAd; }