var Advertiser = { "INFO": {"CookieName" : "DERDB"}, "GADC": {"CookieName" : "GADC","UserInfoKey" : "EUD"}, "Login":{ "LoginCookieName" : "Login", isLogin : function (){ regEx = new RegExp(this.LoginCookieName+'[=;]','i'); cookies = document.cookie.substring(0) + ';'; if (cookies.search(regEx) == -1){ return false; } return true; } }, "Util":{ "CookieDomain" : ".myspace.com", "RandomSeed" : Date.parse(new Date()), _documentURL: decodeURI(document.URL), Encode64: function (input){ var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4 = ""; var i = 0; do{ chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)){ enc3 = enc4 = 64; } else if (isNaN(chr3)){ enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < input.length); return output; }, Decode64: function (input){ var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4 = ""; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); do{ enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) output = output + String.fromCharCode(chr2); if (enc4 != 64) output = output + String.fromCharCode(chr3); chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < input.length); return output; }, SetCookie: function (cookieName, cookieValue, expirationDate){ var cookie = document.cookie = cookieName + "=" + cookieValue + "; path=/;" if (this.CookieDomain != "") cookie += " domain=" + Advertiser.Util.CookieDomain + ";"; if (expirationDate != null) cookie += " expires=" + expirationDate + ";"; document.cookie = cookie; }, RemoveCookie: function (name){ if (this.CookieDomain == "") document.cookie = name + '=; expires=Wed, 19-Jan-2005 08:28:17 GMT; path=/'; else document.cookie = name + '=; domain=' + Advertiser.Util.CookieDomain + '; expires=Wed, 19-Jan-2005 08:28:17 GMT; path=/'; }, ReadCookie: function (name){ regEx = new RegExp(name+'=([^;]*)','i'); if (document.cookie.search(regEx) == -1){ return null; } return RegExp.$1; }, ReadCookieKey: function (cookieName,key){ var cookie = this.ReadCookie(cookieName); if (cookie != null){ regEx = new RegExp(key+'=([^&]*)','i'); if (cookie.search(regEx) == -1){ return null; } return RegExp.$1; } return null; }, ReadKey: function(source, key) { if (source != null){ regEx = new RegExp(key+'=([^&]*)','i'); if (source.search(regEx) == -1){ return null; } return RegExp.$1; } return null; }, SetKey: function(source, key, value) { if (source.indexOf(key+'=') != -1) { var newPair = key + '=' + value; regEx = new RegExp(key+'=([^&]*)','i'); source = source.replace(regEx, newPair); } else { source = source + '&' + key + '=' + value; } return source; }, AddToCookie: function (cookieName, key, value, isSession) { var expirationDate = null; if(!isSession) { expirationDate = new Date(); expirationDate.setYear(expirationDate.getFullYear()+1); expirationDate = expirationDate.toGMTString(); } var unencodedValue = null; var encodedValue = Advertiser.Util.ReadCookie(cookieName); if (encodedValue != null) { unencodedValue = Advertiser.Util.Decode64(unescape(encodedValue)); } if (unencodedValue != null) { unencodedValue = Advertiser.Util.SetKey(unencodedValue, key, value); Advertiser.Util.SetCookie(cookieName, Advertiser.Util.Encode64(unencodedValue), expirationDate); } }, getJSVar: function (name){ var v = eval("typeof("+name+")"); if(v == "undefined") return null; return eval(name); }, AddEvent: function(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } }, "SDC":{ "blueLithContent" : "", "DisplayedFriendEUD" : "", //do not change DisplayedFriendEUD name "PixelSrc" : "../seg.fimserve.com/relay@", "RSIKey" : "rsi_want", targetValuesSet : false, setTargetValues : function(){ var targetValue = Advertiser.Util.ReadCookie(Advertiser.INFO.CookieName); if (targetValue != null) targetValue = Advertiser.Util.Decode64(targetValue); if (targetValue == null || targetValue.length === 0) return; var gender = Advertiser.Util.ReadKey(targetValue, "gender"); var age = Advertiser.Util.ReadKey(targetValue, "age"); var culture = Advertiser.Util.ReadKey(targetValue, "cultuserpref"); try{ sdcgender = gender == "M" ? "0" : "1"; sdcage = age; if (culture === "21514") sdcculture = 16; Advertiser.SDC.targetValuesSet = true; } catch (e) {} }, writePixel: function(){ if (typeof(rsi_want) != 'undefined'){ Advertiser.Util.AddToCookie(Advertiser.INFO.CookieName, Advertiser.SDC.RSIKey, rsi_want, true); } derdbValue = Advertiser.Util.ReadCookie(Advertiser.INFO.CookieName); googleValue = Advertiser.Util.ReadCookieKey(Advertiser.GADC.CookieName,Advertiser.GADC.UserInfoKey); if ((derdbValue == null || derdbValue.length == 0) && (googleValue == null || googleValue.length == 0)) return; fimpixelsrc = Advertiser.SDC.PixelSrc; if (derdbValue != null && derdbValue.length != 0){ fimpixelsrc += 'payload=' + derdbValue; if (googleValue != null && googleValue.length != 0) fimpixelsrc += '&'; } if (googleValue != null && googleValue.length != 0) fimpixelsrc += 'eud=' + googleValue; fimpixelstyle = 'display:none; position:absolute; left:0px; top:0px; border-width:0px;height:1px;width:1px;'; fimpixel = document.createElement('img'); fimpixel.setAttribute('src', fimpixelsrc); fimpixel.setAttribute('style', fimpixelstyle); fimpixel.style.display = 'none'; document.getElementsByTagName('body')[0].appendChild(fimpixel); Advertiser.Util.RemoveCookie(Advertiser.Login.LoginCookieName); }, checkBlueLith: function(blcode){ if(typeof(blcode) != 'string') blcode = Advertiser.SDC.blueLithContent; if(blcode == null || blcode.length == 0 || blcode.indexOf('//No Content') > -1) Advertiser.SDC.writePixel(); else{ eval(blcode); setTimeout('Advertiser.SDC.writePixel();', 1000); } } }, "DC":{ "AdSource" : "", syncBanner: function (tag, which){ switch (tag){ case null: case "null": var defaultTag = Advertiser.Util.getJSVar("defaultTag"); if (defaultTag && defaultTag != '') this.AdSource = defaultTag; break; default: this.AdSource = tag; break; } if(this.AdSource != "") { switch (which){ case "300x250": ad_wrapper("tkn_medrec", "", "x14"); break; case "728x90": ad_wrapper("tkn_leaderboard", "", "frame1"); break; } } } }, "CMS":{"BlueLithium" : "myspace_bluelithium"} } // -- End of Advertiser Object /* AdHelper Object */ var AdHelper = { _ad_randomseed: Date.parse(new Date()), _randomNumber: '', _adCount: 1, _keys: [], // url name/value pairs arrays _values: [], _idFromUrl: null, _qsParsed:false, _documentURL:document.URL, _setRandom: function(){ var randomm = 714025; var randoma = 4096; var randomc = 150889; var rndSeed = (this._ad_randomseed * randoma + randomc) % randomm; return rndSeed / randomm; }, _parseQueryString: function(){ this._qsParsed = true; var uri = decodeURI(this._documentURL); var query = uri.indexOf("?") == -1 ? "" : uri.substring(uri.indexOf("?")+1); var pairs = query.split("&"); var j = pairs.length; for (var i = 0; i < j ; i++){ var pos = pairs[i].indexOf('='); if (pos >= 0){ var argname = pairs[i].substring(0,pos); var value = pairs[i].substring(pos+1); this._keys[this._keys.length] = argname; this._values[this._values.length] = value; } } }, get_adCount: function(){ return this._adCount; }, set_adCount: function(value){ /// this._adCount = value; }, incrementAdCount: function(){ this._adCount++; }, queryString: function(key){ /// if (!this._qsParsed) this._parseQueryString(); var value = null; var j = this._keys.length; for (var i = 0 ; i < j; i++){ if (this._keys[i] == key){ value = escape(this._values[i].toLowerCase()); break; } } return value; }, getID: function(name){ var v = this.queryString(name); if (v != null) return v; else return 0; }, getVar: function(name){ var v = eval("typeof("+name+")"); if(v == "undefined") return null; return eval(name); }, getVarOrId: function(varName,queryName){ var v = this.getVar(varName); if (v == null) return null; else if (v != 0) return v; else return this.getID(queryName); }, getDownloadCategory: function (){ var dcat = this.queryString('cat'); if(dcat == null || dcat === '') { if (this.queryString('fuseaction') != null && this.queryString('fuseaction') === 'downloads') return 0; else return null; } if(dcat=="audiovideo")return 1; if(dcat=="business")return 2; if(dcat=="camera")return 3; if(dcat=="desktopenhancements")return 4; if(dcat=="devtools")return 5; if(dcat=="homeanded")return 6; if(dcat=="internet")return 7; if(dcat=="isit")return 8; if(dcat=="utilities")return 9; if(dcat=="spywarecenter")return 10; if(dcat=="powerdownloader")return 11; if(dcat=="mobile")return 12; if(dcat=="mac")return 13; return 0; }, getMySpaceTVHomeCategory: function (){ if(this._documentURL=="../vids.myspace.com/default.htm" || this._documentURL=="../vids.myspace.com/default.htm"){ return "1"; } else{ var qs_action = this.getID('fuseaction'); var qs_placement = this.getID('placement'); if(qs_action=="vids.splash"){ if(qs_placement=="animals")return "2"; if(qs_placement=="comedy")return "3"; if(qs_placement=="entertainment")return "4"; if(qs_placement=="games")return "5"; if(qs_placement=="music")return "6"; if(qs_placement=="sports")return "7"; return "1"; } } return null; }, isPremiumVideoContent: function (tvcatmaster_id,page){ if(page != 21003206 && page != 91000017) return false; if(tvcatmaster_id !== 400) return false; var vp = document.getElementById("vplayer"); if(vp == null)return false; return true; }, getTVCatMasterId: function(){ var tvcatmaster_id = this.getVar("tvcatmasterid"); if(tvcatmaster_id == null || isNaN(tvcatmaster_id)) return null ; switch(tvcatmaster_id){ case 1: case 2: tvcatmaster_id = 0; break; case 7: tvcatmaster_id = 300; break; case 9: tvcatmaster_id = 100; break; case 15: tvcatmaster_id = 200; break; case 8: tvcatmaster_id = 1001; break; default: break; } return tvcatmaster_id; }, get_idFromUrl: function(){ //el=str, case_sensitive=bool if(this._idFromUrl != null){ return this._idFromUrl; } var urls = this._documentURL; //stripTicks urls = urls.replace( /'/g, "" ); // look for friend, channel, or group id var re = new RegExp( "\\?[\\w\\W]*(friendid|channelid|groupid)=([^\\&\\?#]*)", "i" ); var arr = re.exec(urls); if(arr && arr.length>1){ this._idFromUrl = arr[2] ; } else{ // try vanity url var expr = /\/([\w]*)$/i; arr = expr.exec(urls); if(arr && arr.length>1) this._idFromUrl = arr[1].toLowerCase(); else this._idFromUrl = ''; } return this._idFromUrl; }, readCookie: function(name){ var nameEQ = name + "="; var ca = document.cookie.split(';'); var j = ca.length; for(var i=0;i < j ;i++){ var c = ca[i]; while (c.charAt(0)==' ') {c = c.substring(1,c.length);} if (c.indexOf(nameEQ) === 0) {return c.substring(nameEQ.length,c.length);} } return "Unknown"; }, get_randomNumber: function(){ if(this._randomNumber.length===0){ this._randomNumber = this._setRandom() + ""; } return this._randomNumber; } } /* End AdHelper */ /* AdCallAd Object */ function AdCallAd (page, subd){ /// /// var regex = /,/; if(regex.test(page)){ siteArr = page.split(","); this._page = siteArr[1]; } this._subd = subd; } AdCallAd.prototype = { _page : '', _pos : '', _adWidth : 0, _adHeight : 0, _subd : '', _friendID : 0, _queryString : "", get_page:function(){ return this._page; }, get_pos:function(){ return this._pos; }, get_adWidth:function(){ return this._adWidth; }, get_adHeight:function(){ return this._adHeight; }, get_subd:function(){ return this._subd; }, get_friendID:function(){ return this._friendID; }, get_queryString:function(){ return this._queryString; }, setAdProperties:function(givenPos, defaultWidth, defaultHeight, defaultPos, defaultFriendID){ /// /// /// /// /// this._pos = givenPos; switch (givenPos){ case 'frame1': this._friendID = AdHelper.get_idFromUrl(); this._adWidth=728; this._adHeight=90; this._pos = 'leaderboard'; this._subd = 'deLB'; break; case 'top': this._friendID = AdHelper.get_idFromUrl(); this._adWidth=468; this._adHeight=60; this._pos = 'banner'; this._subd = 'deBR'; break; case 'x08': this._friendID = AdHelper.get_idFromUrl(); this._adWidth=430; this._adHeight=600; this._pos = 'halfpage'; this._subd = 'deHP'; break; case 'x14': this._adWidth=300; this._adHeight=250; this._pos = 'mrec'; this._subd = 'deMR'; this._friendID = AdHelper.get_idFromUrl(); break; case 'x15': this._friendID = AdHelper.get_idFromUrl(); this._adWidth=160; this._adHeight=600; this._pos = 'skyscraper'; this._subd = 'deSK'; break; case 'x77': this._adWidth=1; this._adHeight=1; this._pos = '1x1'; this._subd = 'deSB'; break; case 'x78': // login page this._adWidth=750; this._adHeight=600; this._pos = 'interstitial'; this._subd = 'deSB'; break; case 'uhpfp': //uhp feature profile this._adWidth=200; this._adHeight=170; this._subd = 'deFP'; break; case 'west': this._adWidth=440; this._adHeight=160; this._subd = 'deWB'; break; case 'east': this._friendID = AdHelper.get_idFromUrl(); this._adWidth=300; this._adHeight=100; this._subd = 'deEB'; break; case 'fmovl': this._adWidth=229; this._adHeight=216; this._subd = 'deFML'; break; case 'fmovr': this._adWidth=229; this._adHeight=216; this._subd = 'deFMR'; break; case 'vrec': this._adWidth=240; this._adHeight=400; this._subd = 'deVR'; break; case 'nfblog': this._adWidth=300; this._adHeight=115; this._subd = 'desb'; break; case 'slogo': this._adWidth=80; this._adHeight=42; this._subd = 'desb'; break; case '923x250': this._adWidth=923; this._adHeight=250; this._subd = 'desb'; break; default: this._adWidth = defaultWidth; this._adHieght = defaultHeight; this._pos = defaultPos; this._friendID = defaultFriendID; break; } //parse the cookie for JP var cultureCookie = AdHelper.readCookie('MSCulture'); var cookieKey = '&IPCulture='; var keyindex = cultureCookie.indexOf(cookieKey); var culture = cultureCookie.substring(keyindex + cookieKey.length,cultureCookie.length); if (culture.indexOf('&') >= 0){ culture = culture.substring(0, culture.indexOf('&')); } if (culture.indexOf('ja-JP') >= 0){ this._subd = 'adjp01'; switch (givenPos){ case 'frame1': this._pos = 'leaderboard¶ms.styles=leaderboard'; break; case 'x08': this._pos = 'halfpage¶ms.styles=halfpage'; break; case 'x78': // login page this._pos = 'interstitial¶ms.styles=halfpage'; break; default: //keep given position break; } } }, addParam: function(pKey, pValue){ /// /// /// //optional parameter var checkNotZero = this.addParam.arguments[2]; if(pValue != null && pValue !== ''){ if(checkNotZero){ if(!pValue){ return false; } } this._queryString += "&" + pKey + "=" + pValue; return true; } else return false; } } /* End AdCallAd Object */ function sdc_wrapper(){//this is the scd version var argv = sdc_wrapper.arguments; var tokenID = argv[0]; var page = argv[1]; var pos = argv[2].toLowerCase(); var ctr = document.getElementById(tokenID); if (ctr == null) return; var ad = new AdCallAd(page, 'deLB'); ad.setAdProperties(pos, 728, 90, 'leaderboard¶ms.styles=leaderboard', AdHelper.get_idFromUrl()); //check if Japan ad if(ad.get_subd() === 'adjp01'){ ad_wrapper(tokenID, page, argv[2]); } else{ var fuseaction = AdHelper.queryString('fuseaction'); if (!Advertiser.SDC.targetValuesSet && fuseaction === 'user') { Advertiser.SDC.setTargetValues(); } ad.addParam("l", ad.get_page()); ad.addParam("pos", ad.get_pos()); ad.addParam("rnd", AdHelper.get_randomNumber().substring(2,11)); ad.addParam("fid", ad.get_friendID(), true); ad.addParam("cat", AdHelper.getVar("ad_Topic_ID"), true); ad.addParam("dwcat", AdHelper.getDownloadCategory()); ad.addParam("tvcat", AdHelper.getVar("tvcat"), true); ad.addParam("tvch", AdHelper.getVar("tvchanid"), true); ad.addParam("tvvid", AdHelper.getVar("videoid"), true); ad.addParam("tvhcat", AdHelper.getMySpaceTVHomeCategory(), true); ad.addParam("tvmcat", AdHelper.getTVCatMasterId()); ad.addParam("sp", AdHelper.queryString("schoolID")); ad.addParam("s", AdHelper.queryString("special")); ad.addParam("neg", AdHelper.getVar("sdcgender")); ad.addParam("ega", AdHelper.getVar("sdcage")); ad.addParam("luc", AdHelper.getVar("sdcculture")); ad.addParam("uhpt", AdHelper.getVar("uhpt")); ad.addParam("nwcat", AdHelper.getVar("nwcat")); ad.addParam("nwvert", AdHelper.getVar("nwvert")); ad.addParam("gsku", AdHelper.getVar("gsku")); ad.addParam("gcat", AdHelper.getVar("gcat")); if(document.getElementById("bandgenre1")){ ad.addParam("bg1", document.getElementById("bandgenre1").value, true); ad.addParam("bg2", document.getElementById("bandgenre2").value, true); ad.addParam("bg3", document.getElementById("bandgenre3").value, true); if(document.getElementById("labeltype")) { switch (document.getElementById("labeltype").value){ case 'Major': ad.addParam('mlt', '2'); break; case 'Indie': ad.addParam('mlt', '3'); break; default: ad.addParam('mlt', '1'); break; } } } var ged = Advertiser.Util.ReadCookieKey(Advertiser.GADC.CookieName,Advertiser.GADC.UserInfoKey); if (ged == null){ ged = ""; } ged += Advertiser.SDC.DisplayedFriendEUD; ad.addParam("ged", ged); if(Advertiser.DC.AdSource != '' && (ad.get_pos() == 'mrec' || ad.get_pos() == 'leaderboard')) return; var frameURL = "http://"+ ad.get_subd() +".opt.fimserve.com/adopt/@r=h" + ad.get_queryString(); ctr.innerHTML = ""; } }//sdc_wrapper function ad_wrapper(){//this is the ad wrapper version var argv = ad_wrapper.arguments; var tokenID = argv[0]; var page = argv[1]; var pos = argv[2].toLowerCase(); var ctr = document.getElementById(tokenID); if (ctr == null) return; var ad = new AdCallAd(page, 'deSB'); ad.setAdProperties(pos, 468, 60, 'test', '0'); var frameURL = ""; if(Advertiser.DC.AdSource){ frameURL = Advertiser.DC.AdSource; } else{ var fuseaction = AdHelper.queryString('fuseaction'); if (!Advertiser.SDC.targetValuesSet && fuseaction === 'user') { Advertiser.SDC.setTargetValues(); } ad.addParam("page", ad.get_page()); ad.addParam("position", ad.get_pos()); ad.addParam("rand", AdHelper.get_randomNumber().substring(2,11)); ad.addParam("friendid", ad.get_friendID(), true); ad.addParam("category", AdHelper.getVar("ad_Topic_ID"), true); ad.addParam("acnt", AdHelper.get_adCount()); ad.addParam("channelid", AdHelper.getVarOrId("ad_Video_CID", "channelid"), true); ad.addParam("downcat", AdHelper.getDownloadCategory(), true); ad.addParam("tvvideoid", AdHelper.getVar("videoid"), true); ad.addParam("tvcategoryid", AdHelper.getVar("tvcat"), true); ad.addParam("tvchannelid", AdHelper.getVar("tvchanid"), true); ad.addParam("tvhcat", AdHelper.getMySpaceTVHomeCategory(), true); ad.addParam("tvmastercategory", AdHelper.getTVCatMasterId()); ad.addParam("uhpt", AdHelper.getVar("uhpt")); ad.addParam("nwcat", AdHelper.getVar("nwcat")); ad.addParam("nwvert", AdHelper.getVar("nwvert")); var schoolIDAdded = ad.addParam("schoolpage", AdHelper.queryString("schoolID")); if(!schoolIDAdded) ad.addParam("schoolpage", "0"); if(document.getElementById("bandgenre1")){ var bandgenre1Added = ad.addParam("bg1", document.getElementById("bandgenre1").value, true); if(bandgenre1Added){ ad.addParam("bandgenre", document.getElementById("bandgenre1").value); } var bandgenre2Added = ad.addParam("bg2", document.getElementById("bandgenre2").value, true); if(bandgenre2Added){ ad.addParam("bandgenre", document.getElementById("bandgenre2").value); } var bandgenre3Added = ad.addParam("bg3", document.getElementById("bandgenre3").value); if(bandgenre3Added){ ad.addParam("bandgenre", document.getElementById("bandgenre3").value); } if(document.getElementById("labeltype")) { switch (document.getElementById("labeltype").value){ case 'Major': ad.addParam('mlt', '2'); break; case 'Indie': ad.addParam('mlt', '3'); break; default: ad.addParam('mlt', '1'); break; } } } var testmode = ad.addParam("special", AdHelper.queryString("special")); if (testmode) frameURL = "../detst.myspace.com/html.ng/site=myspace" + ad.get_queryString(); else frameURL = "http://"+ ad.get_subd() +".myspace.com/html.ng/site=myspace" + ad.get_queryString(); } ctr.innerHTML = ""; AdHelper.incrementAdCount(); }//ad_wrapper function sdc_wrapper_medrec_delay(){ var args = sdc_wrapper_medrec_delay.arguments; var token = document.getElementById("tkn_medrec"); if (token == null || args.length != 3) return; token.style.height = 250; var func = "sdc_wrapper('" + args[0] + "','" + args[1] + "','" + args[2] + "')"; setTimeout(func, 1000); } function ad_wrapper_medrec_delay(){ var args = ad_wrapper_medrec_delay.arguments; var token = document.getElementById("tkn_medrec"); if (token == null || args.length != 3) return; token.style.height = 250; var func = "ad_wrapper('" + args[0] + "','" + args[1] + "','" + args[2] + "')"; setTimeout(func, 1000); }