var MWGAd_defaultAdGroup=new AdvertisementGroup(null);var MWGAd_defaultAdTokenGroup=new AdvertisementTokenGroup(null);var MWGAd_reservedSearchKeywordsTokenName="kw";var MWGAd_defaultAdTokenDelimeter=";";var MWGAd_defaultAdTokenValueDelimeter="=";var MWGAd_sourceSplitAgent="$mwg$";var MWGAd_outputType="DartIFrame";var MWGAd_Location="";var MWGAd_Script="";var MWGAd_largeRandomInt=MWGAd_GenerateRandomUniqueInteger();function OverrideTokenDelimeter(a){MWGAd_defaultAdTokenDelimeter=a}function OverrideTokenValueDelimeter(a){MWGAd_defaultAdTokenValueDelimeter=a}function AdvertisementToken(b,d,a,c){this.name="";this.value="";this.useOnce=false;this.merged=false;this.multipleValues=c;if(b!=null){this.name=b;this.value=d;if(a){this.useOnce=a}else{this.useOnce=false}if(c){this.multipleValues=c}else{this.multipleValues=false}}}AdvertisementToken.prototype.Serialize=function(b,a){return b+this.name+a+this.value};function AdvertisementTokenGroup(a){this.Tokens=null;if(a!=null){this.Tokens=new Array(a)}else{this.Tokens=new Array()}}AdvertisementTokenGroup.prototype.Serialize=function(b,a){var e="";var c=false;if(this.Length()>0){for(var d=0;d<this.Tokens.length;d++){if(this.Tokens[d]){if(this.Tokens[d].name==MWGAd_reservedSearchKeywordsTokenName){c=true;e+=this.Tokens[d].Serialize(b,a)}}}for(var d=0;d<this.Tokens.length;d++){if(this.Tokens[d]){if((c&&this.Tokens[d].name!=MWGAd_reservedSearchKeywordsTokenName)||!c){e+=this.Tokens[d].Serialize(b,a)}}}}return e};AdvertisementTokenGroup.prototype.SerializeURL=function(){return this.Serialize("&","=")};AdvertisementTokenGroup.prototype.RemoveAll=function(){this.Tokens=new Array()};AdvertisementTokenGroup.prototype.RemoveByName=function(a){if(this.Tokens==null){return}else{for(var b=0;b<this.Tokens.length;b++){if(this.Tokens[b]!=null&&this.Tokens[b].name==a){this.Tokens.splice(b,1);return}}}};AdvertisementTokenGroup.prototype.RemoveUseOnceTokens=function(){if(this.Tokens==null){return}else{var b=this.Tokens.length;var a=0;while(a<b){if(this.Tokens[a]!=null&&this.Tokens[a].useOnce==true){this.RemoveByName(this.Tokens[a].name);b=this.Tokens.length}else{a=a+1}}}};AdvertisementTokenGroup.prototype.Merge=function(c){if(this.Tokens==null){this.Tokens=c}else{for(var b=0;b<c.Length();b++){var a=this.FindByName(c.Tokens[b].name);if(a!=null){a.value=c.Tokens[b].value}else{this.Add(new AdvertisementToken(c.Tokens[b].name,c.Tokens[b].value))}}}};AdvertisementTokenGroup.prototype.FindByName=function(a){for(var b=0;b<this.Tokens.length;b++){if(this.Tokens[b]!=null&&this.Tokens[b].name==a){if(this.Tokens[b].multipleValues==true){if(this.Tokens[b].merged!=true){this.Tokens[b].merged=true;return this.Tokens[b]}}else{return this.Tokens[b]}}}};AdvertisementTokenGroup.prototype.Add=function(c){if(this.Tokens==null){this.Tokens=new Array()}if(c.value.indexOf("#")==0){var a=c.value.substring(1).split("|");for(var b=0;b<a.length;b++){this.Tokens[this.Tokens.length]=new AdvertisementToken(c.name,a[b],c.useOnce,true)}}else{this.Tokens[this.Tokens.length]=c}};AdvertisementTokenGroup.prototype.Length=function(){if(this.Tokens==null){return -1}else{return this.Tokens.length}};function AdvertisementGroup(a){this.Ads=null;if(a!=null){this.Ads=new Array(a)}else{this.Ads=new Array()}}AdvertisementGroup.prototype.RemoveAll=function(){this.Ads=new Array()};AdvertisementGroup.prototype.RemoveByLocation=function(a){if(this.Ads==null){return}else{for(var b=0;b<this.Ads.length;b++){if(this.Ads[b]!=null&&this.Ads[b].adLocation==a){this.Ads.splice(b,1);return}}}};AdvertisementGroup.prototype.Add=function(a){if(this.Ads==null){this.Ads=new Array()}this.Ads[this.Ads.length]=a};AdvertisementGroup.prototype.RefreshAll=function(a,d){MWGAd_SetOrdValue(a);if(d!=null){try{MWGAd_defaultAdTokenGroup.Merge(d)}catch(c){}}if(this.Ads!=null){for(var b=0;b<this.Ads.length;b++){if(MWGAd_outputType=="DartJS"){return this.Ads[b].RefreshAd(MWGAd_outputType)}if(MWGAd_outputType=="DartIFrame"){this.Ads[b].RefreshAd(MWGAd_outputType)}}}};AdvertisementGroup.prototype.Length=function(){if(this.Ads==null){return -1}else{return this.Ads.length}};function Advertisement(d,a,b,c){this.frame=d;this.adLocation=a;this.adContents="";MWGAd_Location=a;if(b!=null&&b.length>0){this.adContents=b}MWGAd_outputType=c}Advertisement.prototype.RefreshAd=function(a){if(a=="DartJS"){return MWGAd_RefreshAdContent(this.frame,this.adLocation,this.adContents)}if(a=="DartIFrame"){MWGAd_RefreshAdContent(this.frame,this.adLocation,this.adContents)}};Advertisement.prototype.Exists=function(){return MWGAd_ElementExists(this.frame,this.adLocation)};function MWGAd_RefreshSite(a,c){var b=window.top;if(MWGAd_outputType=="DartJS"){return MWGAd_RefreshAllInFrameTree(b,a,c)}if(MWGAd_outputType=="DartIFrame"){MWGAd_RefreshAllInFrameTree(b,a,c)}}function MWGAd_RefreshAllInFrameTree(a,b,f){if(a.frames){for(var c=0;c<a.frames.length;c++){if(MWGAd_outputType=="DartJS"){return MWGAd_RefreshAllInFrameTree(a.frames[c],b,f)}if(MWGAd_outputType=="DartIFrame"){MWGAd_RefreshAllInFrameTree(a.frames[c],b,f)}}}try{if(a.MWGAd_RefreshRegisteredAds){if(MWGAd_outputType=="DartJS"){return a.MWGAd_RefreshRegisteredAds(b,f)}if(MWGAd_outputType=="DartIFrame"){a.MWGAd_RefreshRegisteredAds(b,f)}}}catch(d){}}function MWGAd_RefreshRegisteredAds(a,b){if(MWGAd_outputType=="DartJS"){return MWGAd_defaultAdGroup.RefreshAll(a,b)}if(MWGAd_outputType=="DartIFrame"){MWGAd_defaultAdGroup.RefreshAll(a,b)}}function MWGAd_ElementExists(frame,id){if(eval(frame.document.getElementById(id))){return true}else{return false}}function MWGAd_RefreshAdContent(frame,id,optionalContent1){var optionalContent="";var width=120;var height=60;var cssText="";if(optionalContent1!=null&&optionalContent1.length>0){var strTemp=new String(optionalContent1);var strTemp1;if(strTemp.indexOf(MWGAd_sourceSplitAgent)!=-1){strTemp1=strTemp.split(MWGAd_sourceSplitAgent);if(strTemp1!=null&&strTemp1.length>0){optionalContent=strTemp1[0];for(var count=1;count<strTemp1.length;++count){if(strTemp1[count].indexOf("c=")!=-1){cssText=strTemp1[count].substring(2)}if(strTemp1[count].indexOf("w=")!=-1){width=strTemp1[count].substring(2)}if(strTemp1[count].indexOf("h=")!=-1){height=strTemp1[count].substring(2)}}}}else{optionalContent=strTemp}}var curValue="";var containerID=id+"_Container";var sourceID=id+"_Source";var frame_container=null;var frame_theAdNode=null;var frame_theAdSource=null;if(frame==null){return}if(!eval(frame)){return}if(!MWGAd_ElementExists(frame,containerID)){return}else{frame_container=frame.document.getElementById(containerID)}if(!MWGAd_ElementExists(frame,id)){return}else{frame_theAdNode=frame.document.getElementById(id)}if(MWGAd_outputType=="DartJS"){if(cssText!=""){frame_theAdNode.style.cssText=cssText}}if(optionalContent!=null&&optionalContent.length>0){curValue=optionalContent}if(curValue.length==0){if(!MWGAd_ElementExists(frame,sourceID)){return}else{frame_theAdSource=frame.document.getElementById(sourceID)}curValue=frame_theAdSource.value}var frame_newAdNode=frame.document.createElement("div");if(MWGAd_outputType=="DartIFrame"){frame_container.innerHTML="";frame_newAdNode.id=id}while(curValue.indexOf("<mwg_adtokens_mwg/>")>=0){try{curValue=curValue.replace("<mwg_adtokens_mwg/>",MWGAd_defaultAdTokenGroup.Serialize(MWGAd_defaultAdTokenDelimeter,MWGAd_defaultAdTokenValueDelimeter))}catch(e){break}}newOrdValue=MWGAd_BuildOrdNameValuePair();while(curValue.indexOf("<mwg_adord_mwg/>")>=0){try{curValue=curValue.replace("<mwg_adord_mwg/>",newOrdValue)}catch(e){break}}if(MWGAd_outputType=="DartJS"){return curValue}if(MWGAd_outputType=="DartIFrame"){showAD(id,curValue,width,height,cssText)}MWGAd_defaultAdTokenGroup.RemoveUseOnceTokens()}function MWGAd_SetupJavaScriptAd(b){var a=document.createElement("script");a.setAttribute("language","javascript");a.setAttribute("src",b);return a}function MWGAd_SetupIFrameAd(g,f,d,a){var b=document.createElement("DIV");var c=document.createElement("IFRAME");var e=MWGAd_GenerateRandomUniqueInteger();c.setAttribute("id","id_"+g+e);c.setAttribute("name","name_"+g+e);c.style.width=d+"px";c.style.height=a+"px";c.setAttribute("width",""+d);c.setAttribute("height",""+a);c.setAttribute("src",f);c.setAttribute("marginwidth","0");c.setAttribute("marginheight","0");c.setAttribute("hspace","0");c.setAttribute("vspace","0");c.setAttribute("frameBorder","0");c.setAttribute("scrolling","no");c.setAttribute("borderCOLOR","#000000");c.setAttribute("visibility","visible");c.setAttribute("margin","0");c.setAttribute("padding","0");c.setAttribute("style","margin:0px;padding:0px;");return c}function MWGAd_GenerateRandomUniqueInteger(){var e=Math.random()+"";var d=e*1000000000000000000;var f=Date.parse(new Date())+""+d;return f}function MWGAd_SterilizeSearchKeywords(a){return MWGAd_StripCharsInBag(a,'#",*.()=+<>[];')}function MWGAd_StripCharsInBag(d,e){var b;var a="";for(b=0;b<d.length;b++){var f=d.charAt(b);if(e.indexOf(f)==-1){a+=f}}return a}function MWGAd_BuildOrdNameValuePair(){return";ord="+MWGAd_largeRandomInt+"?"}function MWGAd_SetOrdValue(a){MWGAd_largeRandomInt=a}function MWGAd_GetOrdValue(){if(MWGAd_outputType=="DartJS"){var d=parent.document.getElementsByTagName("frame");var c=false;if(d&&d.length>0){for(var b=0;b<d.length;b++){var a=d[b].contentWindow.document.getElementById("hUniqueORD");if(a&&a.value!=""){MWGAd_largeRandomInt=a.value;c=true;break}}}if(c==false){var a=document.getElementById("hUniqueORD");if(a){a.value=MWGAd_largeRandomInt}}}return MWGAd_largeRandomInt}function MWGAd_RandomizeOrdValue(){MWGAd_SetOrdValue(MWGAd_GenerateRandomUniqueInteger())}function MWGAd_GetDefaultTokenGroup(){return MWGAd_defaultAdTokenGroup}function showAD(b,f,a,d,c){try{if(f!=""&&f.substring(0,5)!=MWGAd_sourceSplitAgent){var j=document.getElementById(b+"_Container");j.innerHTML="";var i=document.createElement("DIV");i.setAttribute("id",b);if(c!=""){j.setAttribute("style",c);j.style.cssText=c}if(MWGAd_outputType=="DartJS"){return f}if(MWGAd_outputType=="DartIFrame"){i.appendChild(MWGAd_SetupIFrameAd(b,f,a,d))}j.appendChild(i)}}catch(g){}};
