var serverName = "m.admedia.com"; var mobile_browser = "0"; /*var jscripts = document.getElementsByTagName('script'); for(i=0; i < jscripts.length; i++) { if(jscripts[i].src.indexOf('footerroll.admedia') != -1) { mobile_browser = "0"; throw "Footerroll already exists"; } } */ var scriptId = 0; var cssId = 0; var aid = ""; var affl = ""; var subid = "MA***"; var listingsCount = 10; var ipaddress = "18.234.51.17"; var ua = "CCBot/2.0 (https://commoncrawl.org/faq/)"; var mobile_device = "Desktop / full capability browser"; var dev = ""; var sword = ""; var dittoimage = 0; var click_tracking = ""; var admobile_items = null; var refUrl = encodeURIComponent(document.referrer); var crawlData = null; var numOfAds = 0; var def_fontSize = 50; var def_reSize = 1; var admobile_currentWidth = window.innerWidth; var admobile_currentHeight = window.innerHeight; var isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1; if(!isWebkit && window.matchMedia) var mql = window.matchMedia("(orientation: portrait)"); //alert(isWebkit); var currentSize = 0; var adsClosed = 0; if(dev == "ipad") { var ptSize = 30; var lsSize = 23; var ptCutoff = 18; var lsCutoff = 18; } else { var ptSize = 50; var lsSize = 30; var ptCutoff = 15; var lsCutoff = 13; } var currentAd = 0; var firstResize = 0; var urlOrDesc = 'u'; var okResize = 1; var dispTimer = null; var lastOrientation = 0; var fadeTimer = null; function trackclick(url) { if(document.images){ (new Image()).src=url; } } if(mobile_browser == 1) { function xss_css(url) { var css_id = null; var css = document.createElement('link'); css.setAttribute('rel', 'stylesheet'); css.setAttribute('type', 'text/css'); css.setAttribute('href', url); css.setAttribute('id', 'css_id'+cssId); css_id = document.getElementById('css_id'+cssId); if(css_id){ document.getElementsByTagName('head')[0].removeChild(css_id); } document.getElementsByTagName('head')[0].appendChild(css); cssId++; } function loadScript(url, callback) { var head = document.getElementsByTagName("head")[0]; addLater = false; if(!head){ head = document.createElement("head"); addLater = true; } var script = document.createElement("script"); script.src = url; script.type = "text/javascript"; if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; // callback(); } }; } else { //Others script.onload = function(){ //callback(); }; } head.appendChild(script); if(addLater){ document.documentElement.appendChild(head); } } function admobile_closeAds() { adsClosed = 1; admobile_hideAds(); } function admobile_hideAds() { document.getElementById('admobile_ad_wrapper').style.visibility = "hidden"; } function admobile_showAds() { if(adsClosed == 0) document.getElementById('admobile_ad_wrapper').style.visibility = "visible"; } function admobile_loadAds() { var crData = []; crData['contextual'] = sword; handleMobLoading(crData); } function handleMobLoading(data) { if(!crawlData) crawlData = data; if(!admobile_items) { var xurl = "http://"+serverName+"/"+'content_new.php?' + 'aid=' + aid + '&affl=' + affl + '&subid=' + encodeURI(subid) + '&n=' + listingsCount + '&Terms=' + encodeURI(data['contextual']) + '&pageUrl=' + encodeURI(document.location.href) + '&nt='+Math.random() + '&callback=getMobContentCallback'; loadScript(xurl, function(){}); } else getMobContentCallback(admobile_items, 0, 0); } function getAdContent(num) { var object = admobile_items; var adHTML = ''; if(object.items[num]) { object.items[num].title = object.items[num].title.replace(/\+/g, " "); adHTML += ''; adHTML += ''+object.items[num].title+''; adHTML += ''+object.items[num].displayUrl+''; adHTML += ''; } return adHTML; } function switchAd() { if(currentAd == (numOfAds - 1)) currentAd = 0; else currentAd++; var adContent = getAdContent(currentAd); document.getElementById('admobile_adBox').innerHTML = adContent; } getMobContentCallback = function (object, dir, useObj) { admobile_items = object; numOfAds = object.items.length; document.getElementById('admobile_adBox').innerHTML = getAdContent(0); } function fadeOut(what, duration) { what.mtop = 1; what.nint = window.setInterval(function() { what.mtop = parseFloat(what.mtop - 0.1); what.mtop = parseFloat(what.mtop.toFixed(2)); if(parseFloat(what.mtop) != 0) { //alert(what.mtop); document.getElementById('admobile_ad_info_desc').style.opacity = what.mtop; } else { //alert(what.mtop); clearInterval(what.nint); } }, 10 * duration); //alert(what.mtop); } function fadeIn(what, duration) { what.mtop_in = 0; what.nint_in = window.setInterval(function() { what.mtop_in = parseFloat(what.mtop_in + 0.1); what.mtop_in = parseFloat(what.mtop_in.toFixed(2)); if(parseFloat(what.mtop_in) != 1.1) { //alert(what.mtop_in); document.getElementById('admobile_ad_info_desc').style.opacity = what.mtop_in; } else { //alert("fie"); clearInterval(what.nint_in); } }, 10 * duration); //alert(what.mtop); } function admobile_reSize(r) { if(okResize == 1 || r == 0) { okResize = 0; if(mql && !window.orientation) { if(mql.matches) window.orientation = 0; else window.orientation = 90; } if(window.orientation === null || window.orientation === undefined) { admobile_closeAds(); return; } if(window.orientation == 0 || window.orientation == 180) { if(dev == "ipad") admobile_currentHeight = 1200; else admobile_currentHeight = 1400; currentSize = ptSize; } else { if(dev == "ipad") admobile_currentHeight = 650; else admobile_currentHeight = 500; currentSize = lsSize; } admobile_hideAds(); var newHeight = window.innerHeight; var newScale = newHeight/admobile_currentHeight; var new_fontSize = Math.round((currentSize * newScale)); //new_fontSize -= 1; //alert(admobile_currentHeight + " - " + newHeight + " - " + window.orientation + " - " + new_fontSize + " - " + window.screen.availHeight); def_reSize = newScale * def_reSize; document.getElementById('admobile_ad').style.fontSize = new_fontSize+"px"; admobile_currentHeight = newHeight; currentSize = new_fontSize; if(((window.orientation == 0 || window.orientation == 180) && currentSize > ptCutoff) || ((window.orientation == 90 || window.orientation == -90) && currentSize > lsCutoff)) { if(firstResize == 0 || r == 0) { admobile_showAds(); if(r != 0) firstResize = 1; } else { //alert('s'); switchAd(); dispTimer = window.setTimeout(function(){ admobile_showAds(); clearTimeout(dispTimer); }, 2000); } } okResize = 1; } } if(1) { var css_url = "http://"+serverName+"/css/admobile_ad_styles.css"; xss_css(css_url); var contentHTML = '
'; document.write(contentHTML); //adjustSize(0); admobile_reSize(0); admobile_loadAds(); //showAds(); setInterval(function() { var newText = ''; var object = admobile_items; if(urlOrDesc == 'u') { if(object.items[currentAd]) newText = object.items[currentAd].description; } else { if(object.items[currentAd]) newText = object.items[currentAd].displayUrl; } if(newText != '') { fadeOut(document.getElementById('admobile_ad_info_desc'), 10); //document.getElementById('admobile_ad_info_desc').style.marginTop = "3em"; fadeTimer = window.setTimeout(function() { document.getElementById('admobile_ad_info_desc').innerHTML = newText; fadeIn(document.getElementById('admobile_ad_info_desc'), 10); clearTimeout(fadeTimer); }, 1100); if(urlOrDesc == 'u') urlOrDesc = 'd'; else urlOrDesc = 'u'; } }, 7000); window.onresize = function() { if(isWebkit) admobile_reSize(1); else { admobile_reSize(1); } } window.onscroll = function() { if(isWebkit) admobile_reSize(1); else admobile_closeAds(); } window.addEventListener("orientationchange", function() { if(isWebkit) admobile_reSize(1); else admobile_closeAds(); }, false); if(mql) { mql.addListener(function(m) { if(isWebkit) admobile_reSize(1); else admobile_closeAds(); }); } window.setTimeout(function() { firstResize = 1; }, 2000); } }