CommentaryAugust 22, 2011

at Standardnewspapers.com

S
Standard Staff
Standard Newspapers
10 min read · 1904 words

The domain standardnewspapers.com may be for sale. Click here for details. Welcome to standardnewspapers.com Legal Terms <!-- //parking object for AFD var parkingData = { 'googleStatus': 'Clean', 'pageType': '2', 'staticLinks': [ ], 'globalLinks': [ ], 'searchLinkDivs': [ { 'maxCount': 15, 'divID': 'result_links_wrap', 'divClass': 'result_links', 'headerText': 'Related Searches:' }, { 'maxCount': 4, 'divID': 'footer_links_wrap', 'divClass': 'footer_links', 'headerText': 'Related Searches:' } ], 'resultLinkDiv': { 'divID': 'wide_ad_unit', 'divClass': 'listings' }, 'pcpID': '00000000-0000-0000-0000-000000000000', 'clientIPHash': '582519992', 'userAgentHash': '-1040964162', 'time': '8/22/2011 3:01:50 PM', 'ticks': '634496221105818882', 'domainName': 'standardnewspapers.com', 'searchText': 'Chicago Newspaper', 'actionCode': 'StaticLink', 'adNetworkID': '82000', 'resultLinkType': 'GoogleSponsored', 'vipIP': '8.5.1.15', 'sessionID': 'ce244ebe-5a28-4a14-9f00-d9dbda01d710', 'visitorID': '9fe08ead-9701-4665-88a7-ab16771b676d', 'ippiClassification': '2', 'daughterWindow': '1', 'requestGuid': '00ebcb69-3dce-4ec0-bfd6-cbd9c868dc60', 'searchLinkType': 'StaticLink', 'templateID': '516', 'themeID': '212083', 'pageUrl': '/location/classifieds/chicago/news/chicago_newspaper.htm', 'wireframeID': '0', 'searchLinkRank': '9', 'referrer': '', 'apiIteration': 1, 'mobileBrowserType': 4, 'twoLine': 1 }; //request object for AFD var google_afd_request = { client: 'ca-dp-demandmedia20_js', channel: '019001', domain_name: 'standardnewspapers.com', hl: '', num_radlinks:19, q: 'Chicago Newspaper', token: '' }; //error code var errorCode = 0; //AFD callback function google_afd_ad_request_done(google_afd_response) { //process google response processGoogleResponse(google_afd_response); //echo google response echoGoogleResponse(google_afd_response); } //process AFD response function processGoogleResponse(google_afd_response) { //return if no response if (!exists(google_afd_response)) { errorCode = 1; //write_status('No response from Google.'); failover(); return; } //alert error if (google_afd_response.error_code) { errorCode = google_afd_response.error_code; //write_status('Google returned error code ' + google_afd_response.error_code + '.'); failover(); return; } //redirect if we're expecting 'clean' but get 'adult' if ((parkingData.googleStatus == 'Clean') && ((exists(google_afd_response.adult)) && (google_afd_response.adult == 'true'))) { //alert('afd call: us=clean google=adult'); var location = window.location.href; if (location.indexOf('googleStatus=') == -1) { if (location.indexOf('?') == -1) location += '?googleStatus=1'; else location += '&googleStatus=1'; window.location = location; return; } } //redirect if we're expecting 'adult' but get 'clean' if ((parkingData.googleStatus == 'Adult') && ((exists(google_afd_response.adult)) && (google_afd_response.adult == 'false'))) { //alert('afd call: us=adult google=clean'); var location = window.location.href; if (location.indexOf('googleStatus=') == -1) { if (location.indexOf('?') == -1) location += '?googleStatus=0'; else location += '&googleStatus=0'; window.location = location; return; } } //show message and return if 'faillisted' or 'needsreview' if (((exists(google_afd_response.needsreview)) && (google_afd_response.needsreview == true)) || ((exists(google_afd_response.faillisted)) && (google_afd_response.faillisted == true))) { //write_status('Domain marked FailListed or NeedsReview by Google.'); failover(); return; } //return if no search-links on landing page if ((parkingData.pageType == 1) && (((!exists(google_afd_response.link_units)) || (google_afd_response.link_units.length <= 0)) && ((parkingData.staticLinks.length <= 0) && (parkingData.globalLinks.length <= 0)))) { //write_status('Response from Google contains no related terms, and no alternate links exist.'); failover(); return; } //return if no ads on results page if ((parkingData.pageType == 2) && ((!exists(google_afd_response.ads)) || (google_afd_response.ads.length <= 0))) { //write_status('Response from Google contains no sponsored listings.'); failover(); return; } //have manual search token? if (exists(google_afd_response.search_token)) { //set cookie setCookie('googleToken', google_afd_response.search_token); } //return if no output divs if ((!exists(parkingData.searchLinkDivs)) || (parkingData.searchLinkDivs.length <= 0)) { failover(); return; } //vars var static_index = 0; var related_index = 0; var global_index = 0; //loop through output divs for (j = 0; j < parkingData.searchLinkDivs.length; j++) { //vars var links = ''; var count = 0; //open ul links += '<ul>'; //have static link token? if (google_afd_response.token) { //loop through static links for (i = static_index; i < parkingData.staticLinks.length; i++) { //increment and break if (count++ >= parkingData.searchLinkDivs[j].maxCount) break; //determine link class var linkClass = 'i' + count; if (count == 1) linkClass += ' first'; //open li links += '<li class="' + linkClass + '">'; //render link links += '<a href="/?s=' + encodeURIComponent(parkingData.staticLinks[i].term) + '&ac=5&slt=' + parkingData.staticLinks[i].linkType + '&slr=' + count + '&lpt=' + parkingData.pageType + '&gdt=' + google_afd_response.token + '"><span>' + parkingData.staticLinks[i].term + '</span></a>'; //close li links += '</li>'; //remember index static_index = i + 1; } } //have related links? if ((google_afd_response.link_units) && (google_afd_response.link_units.length > 0)) { //loop through related links for (i = related_index; i < google_afd_response.link_units.length; i++) { //increment and break if (count++ >= parkingData.searchLinkDivs[j].maxCount) break; //determine link class var linkClass = 'i' + count; if (count == 1) linkClass += ' first'; //open li links += '<li class="' + linkClass + '">'; //render link links += '<a href="/?s=' + encodeURIComponent(google_afd_response.link_units[i].term) + '&ac=2&slt=8&slr=' + count + '&lpt=' + parkingData.pageType + '&gdt=' + google_afd_response.link_units[i].token + '"><span>' + google_afd_response.link_units[i].term + '</span></a>'; //close li links += '</li>'; //remember index related_index = i + 1; } } //followed by global links //have static link token? if (google_afd_response.token) { //loop through static links for (i = global_index; i < parkingData.globalLinks.length; i++) { //increment and break if (count++ >= parkingData.searchLinkDivs[j].maxCount) break; //determine link class var linkClass = 'i' + count; if (count == 1) linkClass += ' first'; //open li links += '<li class="' + linkClass + '">'; //render link links += '<a href="/?s=' + encodeURIComponent(parkingData.globalLinks[i].term) + '&ac=5&slt=' + parkingData.globalLinks[i].linkType + '&slr=' + count + '&lpt=' + parkingData.pageType + '&gdt=' + google_afd_response.token + '"><span>' + parkingData.globalLinks[i].term + '</span></a>'; //close li links += '</li>'; //remember index global_index = i + 1; } } //close ul links += '</ul>'; //build full html var linksHtml = ''; linksHtml += '<div class="' + parkingData.searchLinkDivs[j].divClass + '">'; linksHtml += '<div class="' + parkingData.searchLinkDivs[j].divClass + '_Hdr">'; if (google_afd_response.feedback_url) linksHtml += '<span><a href="' + google_afd_response.feedback_url + '">' + parkingData.searchLinkDivs[j].headerText + '</a></span>'; else linksHtml += '<span>' + parkingData.searchLinkDivs[j].headerText + '</span>'; linksHtml += '</div>'; linksHtml += '<div class="' + parkingData.searchLinkDivs[j].divClass + '_Col1">'; linksHtml += links; linksHtml += '</div>'; linksHtml += '</div>'; //write html to proper <div> element var divID = parkingData.searchLinkDivs[j].divID; var element = document.getElementById(divID); if (element) element.innerHTML = linksHtml; //make top bar links header clickable? if (google_afd_response.feedback_url) { element = document.getElementById('feedback_URL'); if (element) element.innerHTML = '<a href="' + google_afd_response.feedback_url + '">Related Searches</a>'; } } //have ads? if ((google_afd_response.ads) && (google_afd_response.ads.length > 0)) { //vars var adsHtml = ''; var adCount = 0; var dw = ''; //daughter window? if (parkingData.daughterWindow == '1') dw = ' target="_blank"'; //open ads ul adsHtml += '<ul>'; //loop through ads for (i = 0; i < google_afd_response.ads.length; i++) { //determine link class var linkClass = ''; if (i == 0) linkClass += 'first'; else if (i == (google_afd_response.ads.length - 1)) linkClass += 'last'; //open li adsHtml += '<li class="' + linkClass + '">'; //build click url var click_url = build_paid_click(google_afd_response.ads[i], google_afd_response.ads.length); //title adsHtml += '<a class="title"' + dw + ' href="' + click_url + '">' + google_afd_response.ads[i].line1 + '</a>'; //url adsHtml += '<a class="url"' + dw + ' href="' + click_url + '">' + google_afd_response.ads[i].visible_url + '</a>'; //abstract adsHtml += '<p class="abstract">' + google_afd_response.ads[i].line2 + '</p>'; //close li adsHtml += '</li>'; //increment adCount++; } //close ads ul adsHtml += '</ul>'; //determine header text var headerText = 'Sponsored Listings'; if (parkingData.templateID == '51607') headerText = 'Ads'; //add div wrapper var resultClass = ''; if (parkingData.resultLinkDiv) resultClass = parkingData.resultLinkDiv.divClass; if (google_afd_response.feedback_url) adsHtml = '<div class="' + resultClass + '"><div class="sr"><h2><a href="' + google_afd_response.feedback_url + '">' + headerText + '</a></h2>' + adsHtml + '</div></div>'; else adsHtml = '<div class="' + resultClass + '"><div class="sr"><h2>' + headerText + '</h2>' + adsHtml + '</div></div>'; //write html to proper <div> element if (parkingData.resultLinkDiv) { var divID = parkingData.resultLinkDiv.divID; var element = document.getElementById(divID); if (element) element.innerHTML = adsHtml; } } } //write status message function write_status(message) { document.getElementById('status').innerHTML = '<p>' + message + '</p>'; } //build paid click url function build_paid_click(ad, sponsoredCount) { var url = ''; url += '/forward302.aspx?tu=' + encodeURIComponent(ad.url); url += '&id=' + encodeURIComponent(parkingData.pcpID); url += '&r=' + encodeURIComponent(ad.n); url += '&d=' + encodeURIComponent(parkingData.domainName); url += '&a=' + encodeURIComponent(parkingData.adNetworkID); url += '&ac=' + encodeURIComponent(parkingData.actionCode); url += '&slt=' + encodeURIComponent(parkingData.searchLinkType); url += '&rlt=' + encodeURIComponent(parkingData.resultLinkType); url += '&tid=' + encodeURIComponent(parkingData.templateID); url += '&thid=' + encodeURIComponent(parkingData.themeID); url += '&sid=' + encodeURIComponent(parkingData.sessionID); url += '&st=' + encodeURIComponent(parkingData.searchText); url += '&vip=' + encodeURIComponent(parkingData.vipIP); url += '&ippi=' + encodeURIComponent(parkingData.ippiClassification); url += '&ocip=' + encodeURIComponent(parkingData.clientIPHash); url += '&oua=' + encodeURIComponent(parkingData.userAgentHash); url += '&wtt=' + encodeURIComponent(parkingData.ticks); url += '&rid=' + encodeURIComponent(parkingData.requestGuid); url += '&mbt=' + encodeURIComponent(parkingData.mobileBrowserType); url += '&pu=' + encodeURIComponent(parkingData.pageUrl); url += '&vid=' + encodeURIComponent(parkingData.visitorID); url += '&wid=' + encodeURIComponent(parkingData.wireframeID); url += '&spc=' + encodeURIComponent(sponsoredCount); url += '&slr=' + encodeURIComponent(parkingData.searchLinkRank); url += '&du=' + encodeURIComponent(stripHTML(ad.visible_url)); if (parkingData.daughterWindow == '1') url += '&dw=' + encodeURIComponent('true'); else url += '&dw=' + encodeURIComponent('false'); url += '&ref=' + encodeURIComponent(parkingData.referrer); return url; } //strip html markup from string function stripHTML(oldString) { var newString = ''; var inTag = false; for(var i = 0; i < oldString.length; i++) { if (oldString.charAt(i) == '<') inTag = true; if (oldString.charAt(i) == '>') { if(oldString.charAt(i+1)=='<') { //dont do anything } else { inTag = false; i++; } } if (!inTag) newString += oldString.charAt(i); } return newString; } //does object exist? function exists(x) { if (typeof (x) == 'undefined') return false; if (x == null) return false; if (x === '') return false; return true; } //set cookie function setCookie(Name, Value) { var ArgumentCount; var ArgumentValues; var Domain; var Expires; var Path; var Secure; ArgumentValues = setCookie.arguments; ArgumentCount = setCookie.arguments.length; Expires = (ArgumentCount > 2) ? ArgumentValues[2] : null; Path = (ArgumentCount > 3) ? ArgumentValues[3] : null; Domain = (ArgumentCount > 4) ? ArgumentValues[4] : null; Secure = (ArgumentCount > 5) ? ArgumentValues[5] : false; document.cookie = Name + '=' + escape (Value) + ((Expires == null) ? '' : ('; expires=' + Expires.toGMTString())) + ((Path == null) ? '' : ('; path=' + Path)) + ((Domain == null) ? '' : ('; domain=' + Domain)) + ((Secure == true) ? '; secure' : ''); } //get cookie function getCookie(Name) { var Argument; var ArgumetLength; var CookieLength; var EndString; var i; var j; Argument = Name + '='; ArgumentLength = Argument.length; CookieLength = document.cookie.length; i = 0; while (i < CookieLength) { j = i + ArgumentLength; if (document.cookie.substring(i, j) == Argument) { EndString = document.cookie.indexOf (';', j); if (EndString == -1) EndString = document.cookie.length; return unescape(document.cookie.substring(j, EndString)); } i = document.cookie.indexOf(' ', i) + 1; if (i == 0) break; } return (null); } //delete cookie function deleteCookie(Name) { var CookieValue; var ExpirationDate; ExpirationDate = new Date(); ExpirationDate.setTime (ExpirationDate.getTime() - 1); CookieValue = getCookie(Name); if (CookieValue != null) setCookie(Name, '', ExpirationDate, '/'); } //failover function failover() { var location = window.location.href; if (location.indexOf('?') == -1) { location += '?ai=' + (parseInt(parkingData.apiIteration) + parseInt(1)); } else { var split = location.split('?'); location = split[0]; var query = split[1]; var params = query.split('&'); var itemsWritten = 0; for (i=0; i<params.length; i++) { if (params[i].indexOf('ai=') == -1) { if (itemsWritten == 0) location += '?' + params[i]; else location += '&' + params[i]; itemsWritten++; } } if (itemsWritten == 0) location += '?ai=' + (parseInt(parkingData.apiIteration) + parseInt(1)); else location += '&ai=' + (parseInt(parkingData.apiIteration) + parseInt(1)); itemsWritten++; } if (location != window.location.href) window.location = location; } //echo google response function echoGoogleResponse(google_afd_response) { try { var url = '/GoogleListener.aspx?rt=afd' + '&pt=' + encodeURIComponent(parkingData.pageType) + '&rid=' + encodeURIComponent(parkingData.requestGuid) + '&dn=' + encodeURIComponent(parkingData.domainName) + '&st=' + encodeURIComponent(parkingData.searchText) + '&aid=' + encodeURIComponent(parkingData.adNetworkID) + '&ec=' + encodeURIComponent(errorCode) + '&ippi=' + encodeURIComponent(parkingData.ippiClassification); var str = JSON.stringify(google_afd_response); var http = createXMLHttpRequest(); if (http != null) { http.open('POST', url, true); http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); http.setRequestHeader('Content-length', str.length); http.setRequestHeader('Connection', 'close'); http.send(str); } } catch (e) { } } //create xml http request object function createXMLHttpRequest() { try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {} try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} try { return new XMLHttpRequest(); } catch(e) {} return null; } --> function GetIPPI(g) { var xmlHttp = createXMLHttpRequest(); if (xmlHttp != null) { xmlHttp.open('GET', '/'+g+'.ippi?g='+g, true); xmlHttp.send(null); } } function createXMLHttpRequest() { try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {} try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} try { return new XMLHttpRequest(); } catch(e) {} return null; } GetIPPI('00ebcb69-3dce-4ec0-bfd6-cbd9c868dc60'); var dexBaseURL=(("https:"==document.location.protocol) ? "https://a248.e.akamai.net/demdex.download.akamai.com/dm/3/" : "http://cdn.demdex.net/dm/3/"); document.write(unescape("%3Cscript src='"+ dexBaseURL + "demdex.js' type='text/javascript' %3E%3C/script%3E")); var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); var pageTracker = _gat._getTracker("UA-2249740-15"); pageTracker._initData(); pageTracker._trackPageview();

Tags:CommentaryArchive2011
Share:

Related Articles