var trackinsite="false", page_type = vdri.pt, cid = '', ch = '', debug = 'false', stat =''; fail = 'false', search_token_id = '#search_token', error_reporting = 'true', top_ads_id = '#afs_top_ads', bot_ads_id = '#afs_bottom_ads', ws_results_id = '#ws_results', related_keywords = [], image_url = '', referrer = document.referrer, fail = 'false', ads_returned = 0, rel_returned = 0, ws_returned = 0, domain_kw = '', rel_normalizing = 'no', voodoo_request_info = {}, grequest = {}, sec_ads_resp = {}, fl='false', adb = 'true'; // Load URI Params once adbbuild(); timg_js('ji','1'); loadParams(); var num_ads_displayed = 0; $(document).ready(function() { if(adb == 'true'){ timg_js('ab','1'); } else { timg_js('ab','0'); } }); function google_afd_ad_request_done(google_afd_response) { if (window.console && window.console.log) { //window.console.log(google_afd_response); } if(trackinsite == 'true'){ try{ insite(google_afd_response); } catch(e){} } try{ vdri.feedback_url = google_afd_response.related_searches_feedback_url; }catch(e){} try{ set_searchtoken(google_afd_response); } catch(e) { log(e,'');} if(fail == 'false'){ if (google_afd_response.faillisted) { stat = 'faillist'; fail = 'true'; } else if (/^true$/.test(google_afd_response.needsreview)) { stat = 'needsreview'; fail = 'true'; } else if (/^true$/.test(google_afd_response.adult) && !(/_adult_/.test(google_afd_response.client))) { stat = 'adult'; //fail = 'true'; } else if(/^true$/.test(google_afd_response.blocked)) { stat = 'blocked'; fail = 'true'; } else { if(typeof google_afd_response.adult != "undefined"){ if(google_afd_response.adult == "false"){ stat = 'clean'; } else { stat = ''; //log(JSON.stringify(google_afd_response),'err'); } } else { if(typeof google_afd_response.error_code != "undefined"){ stat = 'ERROR'; if(google_afd_response.error_code == 239){ if (window.console && window.console.log) { window.console.log("Error: 239"); window.console.log(google_afd_response); } window.location = 'http://' + vdri.domain; return; } //log('Error Code ' + google_afd_response.error_code,'err'); } else { if(vdri.pt != 'AFS_S'){ //log(JSON.stringify(google_afd_response),'err'); } } } } } if(fail == 'true'){ // To DO Backfill Fail Over if(vdri.pt != "SEC"){ vdri.pt = "SEC"; grequest.tt = vdri.trackingtoken; build_request_info(grequest); return; } } var bf_secondary = 'false'; if(typeof google_afd_response.ads == "undefined"){ vdri.adsundefined = google_afd_response; if(fl == 'false'){ if (window.console && window.console.log) { //window.console.log("bf~Sec"); } if(page_type == 'AFS_S' || page_type == 'AFD_L' || page_type == 'AFD_S'){ if(typeof vdri != "undefined"){ // Fail 1 if(page_type != 'AFS_S' && typeof google_afd_response.search_token != "undefined"){ twoclick(); } if(typeof vdri.afsr != "undefined"){ timg_js('af','1'); var adl = (typeof google_afd_response.ads != "undefined")?google_afd_response.ads.length : 0; var rdl = (typeof google_afd_response.radlinks != "undefined")?google_afd_response.radlinks.length : 0; ads_returned = adl; rel_returned = rdl; var greqkw = (typeof grequest.kw != "undefined")?grequest.kw : ''; log_ad_mismatch(adl,rdl,grequest.num_ads,grequest.num_radlinks,greqkw,vdri.pt,vdri.gpterm,"true"); isJSloaded(stat); return; } // Fail 2 var a = {u_h:'',u_w:'',d_h:'',d_w:'',u_top:'',u_left:''}; if (window.screen) a.u_h = window.screen.height, a.u_w = window.screen.width; // New Fraud Checks var doc = window.document; if (typeof window.innerWidth === 'number') { a.d_w = window.innerWidth; a.d_h = window.innerHeight; } else if (doc.documentElement !== undefined && doc.documentElement.clientWidth !== undefined && doc.documentElement.clientWidth !== 0) { a.d_w = doc.documentElement.clientWidth; a.d_h = doc.documentElement.clientHeight; } else if (doc.body !== undefined && doc.body.clientWidth !== undefined) { a.d_w = doc.body.clientWidth; a.d_h = doc.body.clientHeight; } else { a.d_w = ''; a.d_h = ''; } if (typeof window.screenLeft === 'number') { a.u_top = window.screenTop; a.u_left = window.screenLeft; } else if (window.screenX !== undefined) { a.u_top = window.screenY; a.u_left = window.screenX; } else { a.u_top = ''; a.u_left = ''; } // End Fraud fl='true'; $.ajax({ url: "/nads.php", dataType: 'json', data: {domain:vdri.domain,num_ads:grequest.num_ads,num_radlinks:grequest.num_radlinks,channel:grequest.channel,tt:vdri.trackingtoken,rr:"adsundef",u_h:a.u_h,u_w:a.u_w,d_h:a.d_h,d_w:a.d_w,u_top:a.u_top,u_left:a.u_left,u_his:window.history.length}, async: false, success: function(json){ if(json.ads && json.ads.length > 0){ vdri.pt = 'SEC'; google_afd_response.ads = []; for(idx = 0; idx < json.ads.length; idx++) { google_afd_response.ads.push({n: json.ads[idx].n, type: json.ads[idx].type, line1: json.ads[idx].line1, line2: json.ads[idx].line2, url: json.ads[idx].url, visible_url: json.ads[idx].visible_url }); } bf_secondary = 'true'; } } }); } if(typeof google_afd_response.ads == "undefined"){ if(vdri.pt != "SEC"){ log("Failing To Secondary No Ads Returned",''); if (window.console && window.console.log) { //window.console.log("Failing To Secondary No Ads Returned"); } vdri.pt = "SEC"; grequest.tt = vdri.trackingtoken; build_request_info(grequest); return; } } } } } // Did JS Load isJSloaded(stat); var adl = (typeof google_afd_response.ads != "undefined")?google_afd_response.ads.length : 0; var rdl = (typeof google_afd_response.radlinks != "undefined")?google_afd_response.radlinks.length : 0; ads_returned = adl; rel_returned = rdl; //if(adl < grequest.num_ads || rdl < grequest.num_radlinks){ var greqkw = (typeof grequest.kw != "undefined")?grequest.kw : ''; log_ad_mismatch(adl,rdl,grequest.num_ads,grequest.num_radlinks,greqkw,vdri.pt,vdri.gpterm,bf_secondary); //log_ad_mismatch(a,r,rqa,rqr,kw,pgt,gptrm,bfsec) //} // set the search toke switch(page_type) { case 'AFS_S': // search results if(vdri.fd != "sc" || vdri.pt != 'SEC'){ try { process_afs_ads(google_afd_response); } catch(e){if (window.console && window.console.log) { window.console.log(e); }} } else { try{ process_afd_ads(google_afd_response); } catch(e){if (window.console && window.console.log) { window.console.log(e); }} } try{ process_rs(google_afd_response); } catch(e){log(e,'err');} break; case 'AFD_L': case 'AFD_S': case 'SEC': try{ process_rs(google_afd_response); process_afd_ads(google_afd_response); } catch(e){log(e,'err');} break; case 'AFS_L': default: if(vdri.layout != "4"){ try{ process_rs(google_afd_response); process_pc(google_afd_response); } catch(e){log(e,'err');} } break; } if(GetParam('twoclick') != null){ twoclick(); } $('body').css('display', 'block'); } // process afd ads function process_afd_ads(afd_response) { log('process_afd',''); if(afd_response.ads && afd_response.ads.length > 0 && typeof afd_response.ads != "undefined") { view_afd_ads($(top_ads_id), afd_response.ads, afd_response.sponsored_listings_feedback_url); } else { log('No AFD Ads Returned','err'); } } // process afs ads function process_afs_ads(afd_response) { log('process_afs',''); var num_top_ads = 0; if(afd_response.ads && afd_response.ads.length > 0 && typeof afd_response.ads != "undefined") { num_top_ads = view_afs_ads($(top_ads_id), $(bot_ads_id), afd_response.ads,afd_response.sponsored_listings_feedback_url); if(vdri.fd != "sc"){ try{ view_ws_results($(ws_results_id), num_top_ads,afd_response.feedback_url); } catch(e){ if (window.console && window.console.log) { window.console.log(e); } } } } else { log('No AFS Ads Returned','err'); } log('end process_afs',''); } // process popular categories function process_pc(afd_response) { if(afd_response.categories && afd_response.categories.length > 0) { view_pc_kws(parseInt(vdri.pc), afd_response.categories, afd_response.related_searches_feedback_url,afd_response.category_token); } } // process rs keywords function process_rs(afd_response) { log('process_rs'); var idx, link_units = [], feedback_url,alt_related; try{ if (afd_response.radlinks && afd_response.radlinks.length > 0 && typeof afd_response.radlinks != "undefined") { link_units = afd_response.radlinks; feedback_url = afd_response.related_searches_feedback_url; } else { // use related_keywords for fallback if(typeof vdri != "undefined"){ var a = {u_h:'',u_w:''}; if (window.screen) a.u_h = window.screen.height, a.u_w = window.screen.width; $.ajax({ url: "/nads.php", dataType: 'json', data: {domain:vdri.domain,num_ads:grequest.num_ads,num_radlinks:grequest.num_radlinks,tt:vdri.trackingtoken,s:2,u_h:a.u_h,u_w:a.u_w}, async: false, success: function(json){ if(json.radlinks && json.radlinks.length > 0){ for(idx = 0; idx < json.radlinks.length; idx++) { link_units.push({term: json.radlinks[idx].term, token: json.token}); } } alt_related = ' AltRelated:'+ link_units.length; } }); feedback_url = ''; } log('No Related Searches Returned' + alt_related,'err'); } }catch(e){log(e,'')} // Filter Based on Domain Owner requirements link_units = keywordFilter(link_units); // Normalize Link Units ...... Bad Google not giving us what we asked for!!!!! if(link_units.length < grequest.num_radlinks){ rel_normalizing = 'yes'; link_units = normalize_linkunits(link_units); } if(parseInt(vdri.related) > 0){ for(ii=1; ii <= parseInt(vdri.related); ii++){ log('related+'+ii); var ad_count=0,offset=0,i=ii+1; var obj = $("#related-"+ ii); try{ ad_count = obj.attr('count'); } catch(e){ ad_count=5; } try{ offset = obj.attr('offset'); } catch(e){ offset=0; } view_rs_kws(obj, link_units, feedback_url,ad_count,offset); } } log('end process_rs'); } // set search token function set_searchtoken(afd_response) { // set the search token if(afd_response.search_token) { $(search_token_id).val(afd_response.search_token); vdri.search_token = afd_response.search_token; } } function get_num_ads_displayed() { return num_ads_displayed; } /*************************************/ /* View Functions Begin Here */ /*************************************/ // Display AFD Ads function view_afd_ads(jobj, ads, feedback_url){ var idx, html = []; try { num_ads_displayed = ads.length; timg_js('ja',num_ads_displayed); //log("AFD Ads",''); // Clear 2 Divs $(ws_results_id).empty(); $(bot_ads_id).empty(); for(idx = 0; idx < ads.length; idx++) { html[idx] = build_ad(ads[idx]); } jobj.empty().append(html.join('')); jobj.find('li:first').addClass('first'); jobj.find('li:last').addClass('last'); jobj.prepend('
  • '+ build_feedback_url('Sponsored Listings', feedback_url) +'
  • '); } catch(e){ log("view_afd_ads Error:" + e,'err'); } // record the number of ads } // Display Web Search function view_ws_results(jobj, num_ads, feedback_url){ var html = ''; try{ if(num_ads < 5) { num_ads = 5; } $.ajaxSetup({ cache: false }); // turn off ie caching $.getJSON('/websearch.php', {q: vdri.gpterm, max: num_ads}, function(data) { $.ajaxSetup({ cache: true }); if(data && typeof data.results != "undefined") { //log(data.results.length,''); $.each(data.results, function(idx, r) { html += build_ws(r); }); jobj.html(html); jobj.find('li:first').addClass('first'); jobj.find('li:last').addClass('last'); jobj.prepend('
  • '+ build_feedback_url('Search Results', feedback_url) +'
  • '); } else { jobj.html(''); } }); } catch(e) { //jobj.html(''); if (window.console && window.console.log) { window.console.log(e); } //log("view_ws Error:" + e,'err'); } } // Display Popular Categories function view_pc_kws(cat_divs, categories, feedback_url,category_token){ if(cat_divs > 0){ var idx=0, idx2=0, html = ''; try{ for(idx = 0; idx < categories.length && idx <= cat_divs; idx++) { var html = '',ii = idx+1;; html += '
  • ' + categories[idx].term + '
  • '; for(idx2 = 0; idx2 < categories[idx].subcategories.length; idx2++) { html += '
  • ' + make_kw_link(categories[idx].subcategories[idx2].term,category_token,'pc') + '
  • '; } $("#popular-" + ii).empty(); $("#popular-" + ii).html(html); $("#popular-" + ii).find('li:first').addClass('first'); $("#popular-" + ii).find('li:last').addClass('last'); $("#popular-" + ii).prepend('
  • '+ build_feedback_url('Popular Categories:', feedback_url) + '
  • '); } } catch(e) { log("view_pc_kws Error:" + e,'err'); } } } // display afs ads: top ads, bottom ads function view_afs_ads(jobj_top, jobj_bot, ads, feedback_url) { var idx, html = '', top_ads_html = [], bot_ads_html = [], num_top_ads = 0, num_bot_ads = 0; try{ num_ads_displayed = ads.length; timg_js('ja',num_ads_displayed); for(idx = 0; idx < ads.length; idx++) { if(ads[idx].position && ads[idx].position == 'Top') { num_top_ads++; top_ads_html[idx] = build_ad(ads[idx]); } else { num_bot_ads++; bot_ads_html[idx] = build_ad(ads[idx]); } } if(num_top_ads > 0) { jobj_top.empty().append(top_ads_html.join('')); jobj_top.find('li:first').addClass('first'); jobj_top.find('li:last').addClass('last'); jobj_top.prepend('
  • ' + build_feedback_url('Sponsored Listings', feedback_url) + '
  • '); } else { jobj_top.empty(); $(ws_results_id).remove(); } if(num_bot_ads > 0) { jobj_bot.empty().append(bot_ads_html.join('')); jobj_bot.find('li:first').addClass('first'); jobj_bot.find('li:last').addClass('last'); jobj_bot.prepend('
  • ' + build_feedback_url('Sponsored Listings', feedback_url) + '
  • '); } else { jobj_bot.empty(); } } catch(e) { log("view_afs_ads Error:" + e,'err'); } // return the number of top ads return num_top_ads; } function view_rs_kws(jobj, link_units, feedback_url,ad_count,offset) { var idx=0, html = [], true_idx=0; true_idx = parseInt(offset); true_idx = (true_idx == 0)?true_idx : true_idx - 1; try{ for(idx = 0; idx < link_units.length && idx < ad_count; idx++) { if(typeof link_units[true_idx].term != "undefined"){ try { html[idx] = '
  • ' + make_kw_link(link_units[true_idx].term, link_units[true_idx].token,'rs') + '
  • '; true_idx++; } catch(e){} } } jobj.empty().append(html.join('')); jobj.find('li:first').addClass('first').find('li:last').addClass('last'); jobj.prepend('
  • '+ build_feedback_url('Related Searches:', feedback_url) + '
  • '); } catch(e) { log("view_rs_kws Error:" + e,'err'); log(jobj,''); log('Ad Count:' + ad_count + " Offset:" + offset,''); } } /*************************************/ /* Helper Funtions */ /*************************************/ function make_kw_link(term, token,link_type) { log("kw link" + encodeURIComponent(term)); var src; var cleanterm = term.replace("'",""); try{ if(page_type == 'AFS_L'){ switch(link_type){ case "rs": src = 'lrs'; break; case "pc": src = 'lpc'; break; } } else { src = link_type; } var aab = GetParam('aab'); log("end kw link "+ term); var link = ""; link += term + ""; return link; } catch(e){ log("make_kw_link err "+ e,'err'); } } function normalize_linkunits(radlinks){ var new_links = []; var numlinks = (typeof grequest.num_radlinks != "undefined")?grequest.num_radlinks:0; for(idx = 0; idx < numlinks;idx++){ for(idx2=0;idx2 < radlinks.length; idx2++){ if(typeof radlinks[idx2] != "undefined"){ new_links.push(radlinks[idx2]); } if(idx2 == radlinks.length){ idx2 = 0;} } } return new_links; } function build_ad(ad) { var idx, html = ''; html = ''; html += '
  • ' + ad.line1 + '
    '; html += ''+ ad.line2 + ' '; //html += (ad.type == 'text/wide' ? '
    ' : '
    '); // convert narrow ads to wide html += (ad.line3 ? ad.line3 : ' '); html += '
    '; html += ''; html += ad.visible_url + ''; // if(ad.seller_ratings) { var srtext = ad.seller_ratings.text; var newsr = ''; if(typeof srtext != "undefined"){ newsr = srtext.replace("{{RATING}}",'').replace("{{LINK_START}}",'').replace("{{LINK_END}}",''); } html += ''; html += newsr; html += ''; } // if(ad.sitelinks && ad.sitelinks.length > 0) { html += ''; for(idx = 0; idx < ad.sitelinks.length; idx++) { if(idx == 0) { html += ''; } else if(!(idx % 2)) { // odd numbers html += ''; } html += ''; } if(idx % 2) { html += ''; // place holder for odd number of results } html += ''; html += ''; // ie adds extra line break after table even with display: inline; if(!jQuery.browser.msie) { html += ''; } } else { html += ''; } html += '
  • '; return html; } function build_ws(ad) { html = ''; html += '
  • ' + gpolicify(vdri.gpterm,ad.title) + '
    '; html += ''+ gpolicify(vdri.gpterm,ad.description); html += ''; html += ''; html += gpolicify(vdri.gpterm,ad.url) + '
  • '; return html; } function build_feedback_url(label, feedback_url) { //log(feedback_url,''); if(feedback_url && feedback_url != '') { return ''+ label +''; } else { return label; } } function gpolicify(term,str){ term = decodeURIComponent(term).replace("'","").replace("+"," "); var terms = term.split(" "); for (var i = 0, len = terms.length; i < len; i++) { srctm = terms[i]; var re = new RegExp(srctm, "gi"); str = str.replace(re, '$&'); } return str; } function build_onclick(type,ty,tm,ur){ if(typeof ur == "undefined") ur=''; var html = ''; try{ html += " onclick=\"behavior('"+type+"','" + ty.replace("'","") + "','" + tm.replace("'","") + "','" + ur + "');\" "; } catch(e){ log("Build Onclick Error:" + e,'err'); } return html; } // On Click Tracking Function // For Ad clicks function behavior(type,ty,term,ur){ var params ={}, src; if(typeof ur == "undefined") ur=''; try{ if(term == ''){ term = vdri.gpterm; } if(vdri.gpsrc == 'null'){ src = ty; } else { src = vdri.gpsrc; } params.src = src; params.domain = vdri.domain; params.trackingtoken = vdri.trackingtoken; params.cty = type; params.ty = ty; params.pt = vdri.pt; params.term = term; params.fd = vdri.fd; params.ur = encodeURIComponent(ur); //log(params,''); $.ajax({ cache: false, global: false, async: false, type: "POST", url: '/status.php', data: params }); } catch(e){ log("Behavior click Error: " + e,'err'); } } function twoclick(){ preloadfallback(); var len = vdri.rel_terms.length; if(len > 0){ //vdri.pt = 'AFS_F'; switch(vdri.layout){ case "06": case "07": if(vdri.pt == 'AFD_L'){ var cont = $('.grid_9'); $('.grid_3').remove(); } else if(vdri.pt == 'AFS_L'){ var cont = $('.cont'); } break; case "202": case "05": if(vdri.pt == 'AFD_L'){ var cont = $('.grid_8'); $('.grid_4').remove(); } else if(vdri.pt == 'AFS_L'){ var cont = $('.cont'); } break; case "08": if(vdri.pt == 'AFD_L'){ var cont = $('.grid_8'); $('.grid_4').remove(); } break; } var even = /[02468]$/.test(len); if(even){ var ctr = Math.floor(len/2); } else { len = len - 1; var ctr = Math.floor(len/2); } var split = []; split[0] = vdri.rel_terms.slice(0,ctr); split[1] = vdri.rel_terms.slice(ctr,(ctr + ctr)); var split = []; split[0] = vdri.rel_terms.slice(0,ctr); split[1] = vdri.rel_terms.slice(ctr); var html_head = ''; if(cont){ cont.attr('class','grid_12'); cont.addClass('cont'); cont.html(html_head); $('body').css('display', 'block'); vdri.afsr = 'yes'; //exit; return; } } else { return; } } function preloadfallback(){ try{ if(typeof vdri.rel_images != "undefined"){ var imageObj = new Image(); var i=0; vdri.preloaded = []; for(var key in vdri.rel_images){ imageObj.src='/photos/500_200/' + vdri.rel_images[key]; vdri.preloaded[i] = vdri.rel_images[key]; i++; if(i==2)break; } } } catch(e){} return; } /*************************************/ /* Utility Functions */ /*************************************/ function loadParams(){ var gpsrc = GetParam('src'); var gpterm = GetParam('term'); /*if(gpsrc != 'null'){ vdri.gpsrc = (gpsrc.length < 3)? gpsrc :''; } else { vdri.gpsrc = ''; }*/ vdri.gpterm = gpterm; vdri.gpsrc = gpsrc; } function GetParam(name) { try{ var match = new RegExp(name + "=*([^&]+)*", "i").exec(location.search); if (match == null) match = new RegExp(name + "=(.+)", "i").exec(location.search); if (match == null) return null; match = match + ""; //**convert match to a string result = match.split(","); //return decodeURIComponent(result[1]); return result[1]; } catch(e){console.log(e);} } function keywordFilter(related) { var tindex, newRel= []; if(vdri.filter_terms.length > 0) { var startTotal = related.length; try { for(tindex = 0; tindex < related.length; tindex++) { if(!keywordFilterCheck(related[tindex].term.toLowerCase())) { newRel.push(related[tindex]); } } if(newRel.length < startTotal){ var b = newRel; newRel.concat(b); } } catch(e){log(e,'')} return newRel; } else { return related; } } function logStatus(type) { $.ajax({ cache: false, global: false, async: true, type: "POST", url: '/status.php', data: {domain: vdri.domain,trackingtoken: vdri.trackingtoken, type: type, action: 'dstatus'} }); } function keywordFilterCheck(term){ var tindex; for(tindex = 0; tindex < vdri.filter_terms.length; tindex++) { if(term.indexOf(vdri.filter_terms[tindex].toLowerCase()) >= 0) { return true; } } return false; } // Build Fail Over Feed Request and // Execute. Called if needsreview or faillisted detected // Once in the system domain will use correct feed function build_request_info(a){ var b,c,d; voodoo_request_info.api = a.api; voodoo_request_info.hl = a.hl; voodoo_request_info.adtest = a.adtest; voodoo_request_info.domain_name = vdri.domain; voodoo_request_info.client = "realvoodoo"; voodoo_request_info.num_ads = a.num_ads; voodoo_request_info.num_radlinks = a.num_radlinks; voodoo_request_info.tt = vdri.trackingtoken; if(vdri.gpterm != '' || vdri.gpterm != null){ voodoo_request_info.q = vdri.gpterm; } d = "/js/voodoo_ads.js"; b = document.createElement("script"); b.setAttribute("src", d); b.setAttribute("language", "JavaScript"); b.setAttribute("type", "text/javascript"); document.body.appendChild(b); } function errReport(err){ if(error_reporting == 'true'){ a = "/err.php?domain=" + vdri.domain + "&trackingtoken=" + vdri.trackingtoken + "&err=" + encodeURIComponent(err); b = document.createElement("iframe"); b.setAttribute("src", a); b.setAttribute("width", 0); b.setAttribute("height", 0); b.style.display = "none"; document.body.appendChild(b); } } function log_ad_mismatch(a,r,rqa,rqr,kw,pgt,gptrm,bfsec){ var c,b; var s = ''; if(bfsec == 'true'){ s = '1'; } try{ c = "/err.php?domain=" + vdri.domain + "&trackingtoken=" + vdri.trackingtoken + "&action=numads&srcterm="+gptrm+"&pt="+pgt+"&reqads="+rqa+"&ads="+a+"&reqrel="+rqr+"&rel="+r+"&kw="+kw+"&gm="+vdri.gm+"&cc="+vdri.cc+'&backfill='+s; b = document.createElement("iframe"); b.setAttribute("src", c); b.setAttribute("width", 0); b.setAttribute("height", 0); b.style.display = "none"; document.body.appendChild(b); } catch(e){} } function isJSloaded(status){ var f = chkf(); var stat = (vdri.pt == 'AFS_S')?'SEARCH':status; a = "/status.php?domain=" + vdri.domain + "&trackingtoken=" + vdri.trackingtoken + "&status=" + stat + "&u_his="+f.u_his+"&u_h="+f.u_h+"&u_w="+f.u_w+"&d_h="+f.d_h+"&d_w="+f.d_w+"&u_top="+f.u_top+"&u_left="+f.u_left+"&http_referrer=" + encodeURIComponent(document.referrer); b = document.createElement("iframe"); b.setAttribute("src", a); b.setAttribute("width", 0); b.setAttribute("height", 0); b.style.display = "none"; document.body.appendChild(b); var timg = document.createElement("img"); timg.setAttribute("src", "/c.php?domain="+vdri.domain+"&mt="+vdri.mt+"&tt="+vdri.trackingtoken+"&js=1") document.body.appendChild(timg); return; } function log(str,iserror) { try{ if(debug == 'true'){ if (window.console && window.console.log) { window.console.log(str); } } if(error_reporting == 'true' && iserror == 'err' && vdri.pt != 'SEC'){ errReport(str); } } catch(e){ if(error_reporting == 'true'){ errReport(str + ' Status:' + stat); } } } function request_secondary_ads(){ var d,b,kw; if(vdri.gpterm != null){ kw = '&q='+vdri.gpterm; } d = "/nads.php?callback=sec_ads&client=realvoodoo&output=js&num_ads=10&num_radlinks=12&tt="+vdri.trackingtoken+"&domain=" + vdri.domain + kw + "&channel="+ grequest.channel; b = document.createElement("script"); b.setAttribute("src", d); b.setAttribute("language", "JavaScript"); b.setAttribute("type", "text/javascript"); document.body.appendChild(b); } function chkf(){ var a = {}; if (window.screen) a.u_h = window.screen.height, a.u_w = window.screen.width; var doc = window.document; if (typeof window.innerWidth === 'number') { a.d_w = window.innerWidth; a.d_h = window.innerHeight; } else if (doc.documentElement !== undefined && doc.documentElement.clientWidth !== undefined && doc.documentElement.clientWidth !== 0) { a.d_w = doc.documentElement.clientWidth; a.d_h = doc.documentElement.clientHeight; } else if (doc.body !== undefined && doc.body.clientWidth !== undefined) { a.d_w = doc.body.clientWidth; a.d_h = doc.body.clientHeight; } else { a.d_w = ''; a.d_h = ''; } if (typeof window.screenLeft === 'number') { a.u_top = window.screenTop; a.u_left = window.screenLeft; } else if (window.screenX !== undefined) { a.u_top = window.screenY; a.u_left = window.screenX; } else { a.u_top = ''; a.u_left = ''; } a.u_his = window.history.length; return a; } function truncate(str, limit) { var bits, i; if ("string" !== typeof str) { return ''; } bits = str.split(''); if (bits.length > limit) { for (i = bits.length - 1; i > -1; --i) { if (i > limit) { bits.length = i; } else if (' ' === bits[i]) { bits.length = i; break; } } bits.push(''); } return bits.join(''); } function timg_js(v,num){ var timg = document.createElement("img"); timg.setAttribute("src", "/c.php?domain="+vdri.domain+"&mt="+vdri.mt+"&tt="+vdri.trackingtoken+"&"+v+"="+num); document.body.appendChild(timg); return; } function adbbuild(){ var cadb = document.createElement("script"); cadb.setAttribute("src", "/js/ads.js"); cadb.setAttribute("language", "JavaScript"); cadb.setAttribute("type", "text/javascript"); document.body.appendChild(cadb); } function checkadb(){ adb = "false"; } function insite(j){ if(typeof j != "undefined"){ var jstr = JSON.stringify(j); $.ajax({ cache: false, global: false, async: false, type: "POST", url: '/j.php', data: 'domain='+vdri.domain+'&tt='+vdri.trackingtoken+'&mt='+vdri.mt+'&json='+encodeURIComponent(jstr) }); } return; }