var dWidth = 800, dHeight = 600, dTop = 13, dLeft = 13; var focusId = null; function init() { if (null != focusId) setFocus(focusId); } function initSize(perc) { if (window.screen.availWidth && window.screen.availHeight) { dWidth = parseInt(window.screen.availWidth * perc); dHeight = parseInt(window.screen.availHeight * perc); dLeft = parseInt((window.screen.availWidth - dWidth)/2); dTop = parseInt((window.screen.availHeight - dHeight)/2); } } function setCurrentSize() { //debugger; if (window.innerWidth && window.innerHeight) { dWidth = window.innerWidth; dHeight = window.innerHeight; if (window.screenX && window.screenY) { dTop = window.screenY; dLeft = window.screenX; } } else if(document.documentElement.clientWidth && document.documentElement.clientHeight) { dWidth = document.documentElement.clientWidth; dHeight = document.documentElement.clientHeight; if (window.screenLeft && window.screenTop) { dTop = window.screenTop; dLeft = window.screenLeft; } } } function setFocus(eleId) { if (eleId.length > 0) { ele = document.getElementById(eleId); if (ele) ele.focus(); } } function sponsorSelect(nodeNum, sUrl, eUrl, obj) { initSize(); showLoadingDiv(); trackSelect(nodeNum, obj); setCurrentSize(); initSize(.75); if (null != sUrl) { var rand = new String (Math.random()); var rands = rand.substring (2, 11); var settings = "top=" + dTop + ",left=" + dLeft + ",width=" + dWidth + ",height=" + dHeight + ",location=yes,menubar=yes,resizable=yes,titlebar=yes,toolbar=yes,status=yes,scrollbars=yes"; window.open(eUrl, "child_" + rands, settings); window.location.href = sUrl; } else { window.location.href = eUrl; } } function sponsorSelectLp(nodeNum, lpUrl, eUrl, obj) { // debugger; initSize(); showLoadingDiv(); trackSelect(nodeNum, obj); initSize(.75); if (null != lpUrl) { var rand = new String (Math.random()); var rands = rand.substring (2, 11); var settings = "top=" + dTop + ",left=" + dLeft + ",width=" + dWidth + ",height=" + dHeight + ",location=yes,menubar=yes,resizable=yes,titlebar=yes,toolbar=yes,status=yes,scrollbars=yes"; win2=window.open(lpUrl, "child_" + rands, settings); win2.blur(); window.focus(); window.setTimeout("window.location.href = '" + eUrl + "'", 8000); } else { window.location.href = eUrl; } } function showLoadingDiv() { var selectDiv = document.getElementById('select'); var loadingDiv = document.getElementById('loading'); if (selectDiv && loadingDiv) { selectDiv.style.display = 'none'; loadingDiv.style.display = 'block'; } } function trackSelect(nodeNum, obj) { var fprov = getElementValue("fpr_" + nodeNum, "-1"); var sprov = getElementValue("spr_" + nodeNum, "-1"); var campId = getElementValue("campid_" + nodeNum, ""); var name = getElementValue("sn_" + nodeNum, ""); var cpc = getElementValue("c_" + nodeNum, ""); var nodeId = getElementValue("nid_" + nodeNum, "-1"); var st = getElementValue("sty_" + nodeNum, "0"); var siteId = getElementValue("ssns" , ""); var ip = getElementValue("ssnip" , ""); var zip = getElementValue("ssnz" , ""); var country = getElementValue("cc" , ""); var cate = getElementValue("pcn", ""); var partParam = getElementValue("ptp" , ""); var partValue = ""; if ("" != partParam) partValue = getElementValue(partParam , ""); omnitureTrackSelect(obj, cate, st, fprov, sprov, campId, name, cpc); // Check for Title sponsor if(st == "4") { campId = campId + "_Title"; } // Debug Alert // alert("obj: " + obj + " cate: " + cate + " st: " + st + " fprov: " + fprov + " sprov: " + sprov + " campId: " + campId + " name: " + name + " cpc: " + cpc); var url = "http://pub.sponsorselect.com/Common/Select.ashx?spr=" + sprov + "&fpr=" + fprov + "&campid=" + campId + "&sn=" + name + "&c=" + cpc + "&nid=" + nodeId + "&ssns=" + siteId + "&ssnip=" + ip + "&ssnz=" + zip + "&cc=" + country; if ("" != partParam) url = url + "&ptp=" + partParam + "&" + partParam + "=" + partValue; //document.getElementById("trackUrl").innerHTML = url; var httpReq = new HttpReq() httpReq.loadURL(url); } function omnitureTrackSelect(obj, category, stid, fprovider, sprovider, campaign, name, cpc) { var linkTrackEvents; var linkTrackVars = "prop1,prop2,prop3,prop4,prop5,hier1,events,products"; var type = getSponsorType(stid); var provider = getProviderName(fprovider, sprovider); var hier1 = category + ":" + type + ":" + provider + ":" + campaign + ":" + name; var products = ";" + campaign + ";1;" + cpc; if(stid == "4") { linkTrackEvents = "event13,purchase"; } else { linkTrackEvents = "event8,purchase"; } omnitureTrack(obj, linkTrackVars, linkTrackEvents, category, type, provider, campaign, name, null, hier1, products, "Sponsor Select"); // Debug Alert // alert("obj: " + obj + " linkTrackVars: " + linkTrackVars + " linkTrackEvents: " + linkTrackEvents + " category: " + category + " type: " + type + " provider: " + provider + " campaign: " + campaign + " name: " + name + " hier1: " + hier1 + " products: " + products); } function omnitureTrackCategory(obj, category) { var linkTrackVars = "prop1,events"; var linkTrackEvents = "event11"; omnitureTrack(obj, linkTrackVars, linkTrackEvents, category, null, null, null, null, null, null, null, "Category Select"); } function omnitureTrackSubscribe(obj) { var linkTrackVars = "events"; var linkTrackEvents = "event3"; omnitureTrack(obj, linkTrackVars, linkTrackEvents, null, null, null, null, null, null, null, null, "Subscribe"); } function omnitureTrackBack(obj) { var linkTrackVars = "events"; var linkTrackEvents = "event1"; omnitureTrack(obj, linkTrackVars, linkTrackEvents, null, null, null, null, null, null, null, null, "Back"); } function omnitureTrackClose(obj) { var linkTrackVars = "events"; var linkTrackEvents = "event2"; omnitureTrack(obj, linkTrackVars, linkTrackEvents, null, null, null, null, null, null, null, null, "NoThanks"); } function omnitureTrackSearch(obj, query) { var linkTrackVars = "events"; var linkTrackEvents = "event12"; omnitureTrack(obj, linkTrackVars, linkTrackEvents, null, null, null, null, null, query, null, null, "Search"); } function omnitureTrack(obj, linkTrackVars, linkTrackEvents, prop1, prop2, prop3, prop4, prop5, prop6, hier1, products, linkName) { //debugger; if (typeof(s_gi) == "function") { var s = s_gi("awsssnfandango"); if (typeof(s) == "object") { if (null != linkTrackVars) s.linkTrackVars = linkTrackVars; if (null != linkTrackEvents) { s.linkTrackEvents = linkTrackEvents; s.events = linkTrackEvents; } if (null != prop1) s.prop1 = prop1; if (null != prop2) s.prop2 = prop2; if (null != prop3) s.prop3 = prop3; if (null != prop4) s.prop4 = prop4; if (null != prop5) s.prop5 = prop5; if (null != prop6) s.prop6 = prop6; if (null != hier1) s.hier1 = hier1; if (null != products) s.products = products; if (null == linkName) linkName = ""; if (typeof(s.tl) == "function" && typeof(s.lt) == "function") { var lt = (obj.href != null) ? s.lt(obj.href) : ""; if (lt == "") { obj = cleanObj(obj); s.tl(obj, "o", linkName); } } } } } var excludeFields = ["dataFld", "dataFormatAs", "dataSrc", "host", "pathname", "search", "port", "hash"]; function cleanObj(obj) { if(!obj) return obj; var n = new Object, x; for(x in obj) { var exclude = false; for (var i = 0; i < excludeFields.length; i++) { if (x.indexOf(excludeFields[i]) >= 0) { exclude = true; break; } } if (!exclude) { try{n[x] = obj[x];}catch (error){} } } return n; } function getSponsorType(stid) { var result = null; switch(stid) { case "2": result = "Featured"; break; case "1": result = "Regular"; break; case "3": result = "Tier2"; break; case "4": result = "Title"; break; default: result = "NotDefined"; } return result; } function getProviderName(fProviderId, sProviderId) { var provider = "NotDefined"; if (fProviderId != "-1") provider = lookupFeedProvider(fProviderId); else if (sProviderId != "-1") provider = lookupSearchProvider(sProviderId); return provider; } function lookupFeedProvider(fpid) { var result = null; switch(fpid) { case "8": result = "AskCom"; break; case "7": result = "AwsOas"; break; case "1": result = "Iac"; break; default: result = "NotDefined"; } return result; } function lookupSearchProvider(spid) { var result = null; switch(spid) { case "1": result = "AskCom"; break; default: result = "NotDefined"; } return result; } function getElementValue(name, defaultValue) { var returnValue = defaultValue; if (document.getElementById(name)) returnValue = document.getElementById(name).value; return escape(returnValue); } function onKeySearch(e, nodeNum, obj) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e.which) keycode = e.which; if (13 == keycode) return selectSearch(nodeNum, obj); //return true; } function selectSearch(nodeNum, obj) { var searchId = "st" + "_" + nodeNum; var searchBox = document.getElementById(searchId); if (searchBox) { if (searchBox.value.length < 3) { alert("Please revise your search to include at least 3 characters."); return false; } else { omnitureTrackSearch(obj, searchBox.value); return select(nodeNum, obj); } } } function select(nodeNum, obj) { document.getElementById("fp").value = "1"; document.getElementById("node").value = nodeNum; var nt = getElementValue("nt_" + nodeNum, ""); if (nt == "1") { var cate = getElementValue("ca_" + nodeNum, ""); omnitureTrackCategory(obj, cate); } document.index.submit(); return false; } var BlankNodeNum = ""; function selectClose(obj) { document.getElementById("closeBtn").value = "1"; omnitureTrackClose(obj); select(BlankNodeNum); } function infoPop(mypage,myname,w,h) { myleft = (screen.width)?(screen.width-w)/2:100; mytop = (screen.height)?(screen.height-h)/2:100; settings = "width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no"; win=window.open(mypage,myname,settings); win.focus(); } function HttpReq() { this.action = null; this.XML = null; this.httpInterface = null; this.resetInterface(); return true; } HttpReq.prototype.isAvailable = function() { if (this.httpInterface == null) { return false; } return true; } HttpReq.prototype.loadURL = function(url) { this.resetInterface(); this.httpInterface.open("GET", url); this.httpInterface.send(null); return true; } HttpReq.prototype.resetInterface = function() { var self = this; if (this.httpInterface != null && this.httpInterface.readyState != 0 && this.httpInterface.readyState != 4) { this.httpInterface.abort(); } this.httpInterface = getHttpObj(); this.httpInterface.onreadystatechange = function() { self.executeAction(); return true; }; return true; } HttpReq.prototype.executeAction = function() { if (this.httpInterface.readyState == 4) { try { if (this.httpInterface.status == 200) { this.action(); } else if (this.httpInterface.status != 0) { //alert("There was an error while retrieving the URL: " + this.httpInterface.statusText); } } catch (error) { } } return true; } function getHttpObj() { var httpObj = null; try { httpObj = new XMLHttpRequest(); } catch (error) { try { httpObj = new ActiveXObject("Microsoft.XMLHTTP"); } catch (error) { httpObj = null; } } return httpObj; } function setBgColor(area, color) { if (!area.style) area = document.getElementById(area); if (area.style) { area.style.backgroundColor = color; area.style.cursor = "hand"; } } function clearBgColor(area, color) { if (!area.style) area = document.getElementById(area); if (area.style) { area.style.backgroundColor = color; area.style.cursor = "default"; } } function preloadImages(path) { try { if (document.images) { btn_select_on = new Image(); btn_select_on.src = path + "btn_select_press.gif"; btn_start_on = new Image(); btn_start_on.src = path + "btn_start_press.gif"; btn_back_on = new Image(); btn_back_on.src = path + "btn_back_press.gif"; } } catch (oEx){} } function imgPress(image, type) { try { if (document.images) { image.src = eval("btn_" + type + "_on.src"); } } catch (oEx){} }