﻿
if(window.Msn.Dap===undefined){window.Msn.Dap={};}
$(function(){var placeholderContaners=$('div.placeholderad');placeholderContaners.each(function(i){var placeholderad=$(this);switch(placeholderad.data("ADSTAT")){case"LIVE_ERROR":placeholderad.parent(".placeholder").remove();break;case"PREVIEW_ERROR":placeholderad.find(".placeholder_errorinfo div").append(" , "+placeholderad.data("ERRMSG"));placeholderad.find(".placeholder_errorinfo").css("display","block");placeholderad.find(".advertisement").css("display","none");break;default:placeholderad.find(".placeholder_errorinfo").remove();}});var customAdContent=$(".customad .advertisement,.customsuperbannerad .advertisement");customAdContent.each(function(){var $this=$(this);var $parent=$this.parent();var $span=$this.prev();var $content=$this.find(":last-child");var contentWidth=$content.width();if(contentWidth<=32){$content.bind("readystatechange load",function(){if(this.complete){contentWidth=$content.width();$span.width(contentWidth).css("display","inline-block");$parent.css("text-align",$this.css("text-align"));}});}
else{$span.width(contentWidth).css("display","inline-block");$parent.css("text-align",$this.css("text-align"));}});});Msn.Dap.outputAdvertisement=function(pg,ap,width,height){var isprev=$("input[name=dapispreview]").attr("value");var placeholderContaners=$('div.placeholderad');if(placeholderContaners.length){placeholderContaners.each(function(){var placeholderad=$(this);if(placeholderad.data("LOADED")!==true){var phclass=placeholderad.parent("div.placeholder").attr("class");var phlayout=phclass.split(" ");var phwidth;for(var a=0;a<phlayout.length;a++){if(phlayout[a].indexOf("phw")>-1){phwidth=phlayout[a];break;}}
var dapwidth=placeholderad.find("input[name=dapad_width]").attr("value");var page_layout=placeholderad.find("input[name=page_layout]").attr("value");var adErrMessage=Msn.Dap.checkAdDimension(phwidth,page_layout,dapwidth);if(isprev!=="true"&&adErrMessage.length>0){placeholderad.data("ADSTAT","LIVE_ERROR");}else{if(adErrMessage.length>0){placeholderad.data("ADSTAT","PREVIEW_ERROR");placeholderad.data("ERRMSG",adErrMessage);}
else{placeholderad.data("ADSTAT","CORRECT");var dapstr="<scr"+"ipt type=\"text/javascript\">";dapstr+="dap(\"&amp;PG="+pg+"&amp;AP="+ap+"\" ,"+width+" , "+height+")";dapstr+="<"+"/scr"+"ipt>";placeholderad.find(".advertisement").append(dapstr);}}
placeholderad.data("LOADED",true);}});}};Msn.Dap.checkAdDimension=function(phwidth,pagelayout,dapwidth){switch(pagelayout){case"3Col_ArticleLeft":case"3Col_ArticleCentre":return Msn.Dap.checkDimensionFor3Col(phwidth,dapwidth);case"2Col":return Msn.Dap.checkDimensionFor2Col(phwidth,dapwidth);}
return"";};Msn.Dap.checkDimensionFor3Col=function(phwidth,dapwidth){switch(phwidth){case"phw100":if(dapwidth!=="300"){return"only advertisements of width <strong>300</strong> is allowed according to your layout setting(<strong>100%</strong> width Placeholder , <strong>3 columns</strong> page layout).";}
break;case"phw65":if(dapwidth!=="234"){return"only advertisements of width <strong>234</strong> is allowed according to your layout setting.(<strong>65%</strong> width Placeholder , <strong>3 columns</strong> page layout)";}
break;case"phw47":if(dapwidth!=="180"){return"only advertisements of width <strong>180</strong> is allowed according to your layout setting.(<strong>47%</strong> width Placeholder , <strong>3 columns</strong> page layout)";}
break;case"phw35":return"no advertisement of any dimension is allowed according to your layout setting.(35% width Placeholder , 3 columns page layout)";}
return"";};Msn.Dap.checkDimensionFor2Col=function(phwidth,dapwidth){switch(phwidth){case"phw100":return"no advertisement of any dimension is allowed according to your layout setting.(100% width Placeholder , 2 columns page layout)";case"phw65":if(dapwidth!=="300"){return"only advertisements of width <strong>300</strong> is allowed according to your layout setting.(<strong>65%</strong> width Placeholder , <strong>2 columns</strong> page layout)";}
break;case"phw47":if(dapwidth!=="234"){return"only advertisements of width <strong>234</strong> is allowed according to your layout setting.(<strong>47%</strong> width Placeholder , <strong>2 columns</strong> page layout)";}
break;case"phw35":if(dapwidth!=="180"){return"only advertisements of width <strong>180</strong> is allowed according to your layout setting.(<strong>35%</strong> width Placeholder , <strong>2 columns</strong> page layout)";}}
return"";};if(!window.Msn)window.Msn={};Msn.ClientBrowser=function(){var a=navigator.userAgent.indexOf("MSIE")>-1;function b(){if(a)return parseFloat(navigator.userAgent.match(/MSIE ((?:[0-9]\.?)+)/)[1]);return 0}this.isIe6=function(){return a&&b()==6}};var browser=new Msn.ClientBrowser;function adjustImageMaxWidth(b,a){if(browser.isIe6()){var c=b.offsetWidth;if(a.width/c>.95)a.style.width="100%"}};if(!window.Msn)window.Msn={};Msn.ClientBrowser=function(){var a=navigator.userAgent.indexOf("MSIE")>-1;function b(){if(a)return parseFloat(navigator.userAgent.match(/MSIE ((?:[0-9]\.?)+)/)[1]);return 0}this.isIe6=function(){return a&&b()==6}};var browser=new Msn.ClientBrowser;function adjustParentContainerHeight(b,a){if(browser.isIe6()){a.style.zoom=1;b.style.height=a.height+"px"}};function pageX(a){return a.offsetParent?a.offsetLeft+pageX(a.offsetParent):a.offsetLeft}function pageY(a){return a.offsetParent?a.offsetTop+pageY(a.offsetParent):a.offsetTop}function topThePlayer(b){var a=document.getElementById(b);if(a){idealPageY=pageY(a);idealPageY=idealPageY-30<0?0:idealPageY-30;window.scrollTo(0,idealPageY)}}function RegisterEvent(){if(typeof this.IsRegistered=="undefined")Msn.Video.OnVideoTitle=function(c,a){var a=a+"_t";if(checkString(c)&&checkString(a)){var d=document.getElementById(a);if(d)d.innerHTML=c}var b=document.getElementById(a);if(b)if(!b.trigerOnLoad)b.trigerOnLoad=true;else topThePlayer(a)};this.IsRegistered=true};
