var googleAdClient="pub-1894578950532504";
var TMNadsenseCount=0;
function setStyle(){
    styles="<style>\n";
    styles+=".tmnAdsenseContainer  {float:left;}\n";
    styles+=".tmnAdsByGoogleCont   {float:left;}\n";
    styles+=".tmnAdsByGoogle       {font-size:12px; float:left; text-align:right;}\n";
    styles+=".tmnAdsByGoogle a     {color:#777777; text-decoration:none; font-size:11px;}\n";
    styles+=".tmnAdsenseAdCont     {float:left; overflow:hidden;}\n";
    styles+=".tmnAdsenseAdTitle    {margin-bottom:5px;}\n";
    styles+=".tmnAdsenseAdTitle a  {text-decoration:none; font-size:15px; color:#4444DD; font-weight: bold;}\n";
    styles+=".tmnAdsenseAdDescCont {}\n";
    styles+=".tmnAdsenseAdDesc     {color:#000000; font-size:11px;}\n";
    styles+=".tmnAdsenseAdLink     {}\n";
    styles+=".tmnAdsenseAdLink a   {color:#999999; text-decoration:none; font-size:11px;}\n";
    styles+="</style>\n";
    document.write(styles)
}
setStyle();
var TmnAdsense={
    checkHex:function(a){ return a.match(/^(?:#)?([0-9A-Fa-f]{6})$/) },
    display:function(h){
        if(TMNadsenseCount<3){
            TMNadsenseCount++;
            if(!h){ h=TmnAdsense.options }
            var e=new Date();
            var c=e.getTime();
            if(!h.width||h.width<100){ h.width=100 }
            if(!h.ad_width){ h.ad_width=100 }
            if(h.ad_width>h.width){ h.ad_width=h.width }
            if(!h.max_ads||h.max_ads<1){ h.max_ads=2 }
            if(h.max_ads>6){ h.max_ads=6 }
            if(!h.channel_id){ h.channel_id=null }
            if(!h.col_margin){ h.col_margin=0 }
            if(!h.row_margin){ h.row_margin=0 }
            if(!h.adsbyvertical){ h.adsbyvertical=10 }
            if(!h.adsbyhorizontal){ h.adsbyhorizontal=66 }
            else{ h.adsbyhorizontal+=66 }
            var a=0;
            var b="";
            if(typeof(h.adFontFamily)=="string"){
                b+="font-family:"+h.adFontFamily+";";
                if(typeof(h.adsbyFontFamily)!="string"){ h.adsbyFontFamily=h.adFontFamily }
            }
            var m="";
            if(typeof(h.adsbyFontSize)=="number"){m+="font-size:"+h.adsbyFontSize+"px;"}
            if(typeof(h.adsbyFontFamily)=="string"){m+="font-family:"+h.adsbyFontFamily+";"}
            if(typeof(h.adsbyFontWeight)=="string"){m+="font-weight:"+h.adsbyFontWeight+";"}
            if(typeof(h.adsbyColor)=="string"&&!!(a=TmnAdsense.checkHex(h.adsbyColor))){m+="color:#"+a[1]+";"}
            var k='style="';
            if(typeof(h.titleFontSize)=="number"){k+="font-size:"+h.titleFontSize+"px;"}
            if(typeof(h.titleFontFamily)=="string"){k+="font-family:"+h.titleFontFamily+";"}
            if(typeof(h.titleFontWeight)=="string"){k+="font-weight:"+h.titleFontWeight+";"}
            if(typeof(h.titleDecoration)=="string"){k+="text-decoration:"+h.titleDecoration+";"}
            if(typeof(h.titleFontColor)=="string"&&!!(a=TmnAdsense.checkHex(h.titleFontColor))){k+="color:#"+a[1]+";"}
            var l='style="';
            if(typeof(h.titleMarginBottom)=="number"){l+="margin-bottom:"+h.titleMarginBottom+"px;"}
            if(typeof(h.titlePaddingTop)=="number"){l+="padding-top:"+h.titlePaddingTop+"px;"}
            var j='style="';
            if(typeof(h.descFontSize)=="number"){j+="font-size:"+h.descFontSize+"px;"}
            if(typeof(h.descFontFamily)=="string"){j+="font-family:"+h.descFontFamily+";"}
            if(typeof(h.descDecoration)=="string"){j+="text-decoration:"+h.descDecoration+";"}
            if(typeof(h.descLineSpacing)=="number"){j+="line-height:"+h.descLineSpacing+"px;"}
            if(typeof(h.descFontColor)=="string"&&!!(a=TmnAdsense.checkHex(h.descFontColor))){j+="color:#"+a[1]+";"}
            if(typeof(h.descFontWeight)=="string"){j+="font-weight:"+h.descFontWeight+";"}
            var n='style="';
            if(typeof(h.descMarginBottom)=="number"){n+="margin-bottom:"+h.descMarginBottom+"px;"}
            var f='style="';
            if(typeof(h.linkFontSize)=="number"){f+="font-size:"+h.linkFontSize+"px;"}
            if(typeof(h.linkFontFamily)=="string"){f+="font-family:"+h.linkFontFamily+";"}
            if(typeof(h.linkDecoration)=="string"){f+="text-decoration:"+h.linkDecoration+";"}
            if(typeof(h.linkFontColor)=="string"&&!!(a=TmnAdsense.checkHex(h.linkFontColor))){f+="color:#"+a[1]+";"}
            if(typeof(h.linkFontWeight)=="string"){j+="font-weight:"+h.linkFontWeight+";"}
            var g='style="';
            if(typeof(h.linkMarginBottom)=="number"){g+="margin-bottom:"+h.linkMarginBottom+"px;"}
            if(!h.adsOnRow){var i=Math.floor((h.width+h.col_margin)/(h.ad_width+h.col_margin))}
            else{var i=h.adsOnRow}
            if(h.adstyle=="twoline"){
                n+="float:left;";
                g+="float:left;";
                if(typeof(h.descPaddingTop)=="number"){n+="padding-top:"+h.descPaddingTop+"px;"}
                if(typeof(h.linkPaddingTop)=="number"){g+="padding-top:"+h.linkPaddingTop+"px;"}
                if(typeof(h.linkPaddingLeft)=="number"){g+="padding-left:"+h.linkPaddingLeft+"px;"}
                else{g+="padding-left:10px;"}
                h.adsbyposition="topleft";
                i=1;
                h.ad_width=h.width
            }
            if(h.adstyle=="oneline"){
                l+="float:left;";
                n+="float:left;";
                g+="float:left;";
                if(typeof(h.descPaddingTop)=="number"){n+="padding-top:"+h.descPaddingTop+"px;"}
                if(typeof(h.descPaddingLeft)=="number"){n+="padding-left:"+h.descPaddingLeft+"px;"}
                else{n+="padding-left:10px;"}
                if(typeof(h.linkPaddingTop)=="number"){g+="padding-top:"+h.linkPaddingTop+"px;"}
                if(typeof(h.linkPaddingLeft)=="number"){g+="padding-left:"+h.linkPaddingLeft+"px;"}
                else{g+="padding-left:10px;"}
                h.adsbyposition="topleft";
                i=1;
                h.ad_width=h.width
            }
            if(h.adstyle=="twolineurltop"){
                l+="float:left;";
                n+="clear:both;";
                g+="float:left;";
                if(typeof(h.linkPaddingTop)=="number"){g+="padding-top:"+h.linkPaddingTop+"px;"}
                if(typeof(h.linkPaddingLeft)=="number"){g+="padding-left:"+h.linkPaddingLeft+"px;"}
                else{g+="padding-left:10px;"}
                h.adsbyposition="topleft";
                i=1;
                h.ad_width=h.width
            }
            d='<script type="text/javascript">\n';
            d+="<!--\n";d+="if(typeof(google_adnum) == 'undefined'){\n";
            d+="var google_adnum = 0;\n";
            d+="}\n";
            d+="function google_ad_request_done(google_ads){\n";
            d+="var s='';\n";
            d+="if(google_ads.length == 0){\n";
            d+="return;\n";
            d+="}\n";
            d+="if(google_ads.length != 0){\n";
            d+='s+=\'<div class="tmnAdsenseContainer" style="width: '+h.width+"px;\">'\n";
            d+='s+=\'<div class="tmnAdsByGoogleCont" style="width: '+h.width+"px;padding-bottom:"+h.adsbyvertical+"px\">'\n";
            d+='s+=\'  <div style="float:left" class="tmnAdsByGoogle">\'\n';
            d+="s+='    <a style=\"float:left;"+m+'" href="\' + google_info.feedback_url + \'" class="tmnAdsByGoogle">Ads by Google</a>\'\n';
            d+="s+='  </div>'\n";
            d+="s+='</div>'\n";
            d+="var marginR=0;\n";
            d+="var marginB=0;\n";
            d+="var numAds="+(i-1)+";\n";
            d+="var ad_less="+(i-1)+";\n";
            d+="for(var i = 0; i < google_ads.length; ++i){\n";
            d+="marginR=((i < ad_less)?"+h.col_margin+":0);\n";
            d+="if (i >= ad_less) {ad_less = (ad_less + "+(i)+");}\n";
            d+="marginB=(i < ((google_ads.length-1) - numAds)?"+h.row_margin+":0);\n";
            d+='s+=\'<div class="tmnAdsenseAdCont" style="width: '+h.ad_width+"px;margin-right:' + marginR + 'px; margin-bottom:'+ marginB +'px;"+b+"\">'\n";
            d+='s+=\'  <div class="tmnAdsenseAdTitle" '+l+"\">'\n";
            d+='s+=\'    <a class="tmnAdsenseAdTitle" href="\' + google_ads[i].url + \'" '+k+"\">' + google_ads[i].line1 + '</a>'\n";
            d+="s+='  </div>'\n";
            if(h.adstyle=="twolineurltop"){
                d+='s+=\'    <div class="tmnAdsenseAdLink" '+g+"\">'\n";
                d+='s+=\'      <a class="tmnAdsenseAdLink" href="\' + google_ads[i].url + \'" '+f+"\">'\n";
                d+="s+='        <span>' + google_ads[i].visible_url + '</span>'\n";
                d+="s+='      </a>'\n";
                d+="s+='    </div>'\n"
            }
            d+='s+=\'  <div class="tmnAdDescCont" '+n+"\">'\n";
            d+='s+=\'    <span class="tmnAdsenseAdDesc" '+j+"\">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span>'\n";
            d+="s+='  </div>'\n";
            if(!(h.adstyle=="twolineurltop")){
                d+='s+=\'    <div class="tmnAdsenseAdLink" '+g+"\">'\n";
                d+='s+=\'      <a class="tmnAdsenseAdLink" href="\' + google_ads[i].url + \'" '+f+"\">'\n";
                d+="s+='        <span>' + google_ads[i].visible_url + '</span>'\n";
                d+="s+='      </a>'\n";
                d+="s+='    </div>'\n"
            }
            d+="s+='</div>'\n";
            d+="}\n";
            d+="s+='</div>'\n";
            d+='if (google_ads[0].bidtype == "CPC") {\n';
            d+="google_adnum=google_adnum + google_ads.length;\n";
            d+="}\n";
            d+="}\n";
            d+="document.write(s);\n";
            d+="return;\n";
            d+="}\n";
            d+="google_ad_client='"+googleAdClient+"';\n";
            if(h.channel_id){d+="google_ad_channel='"+h.channel_id+"';\n"}
            d+="google_ad_output='js';\n";
            d+="google_max_num_ads='"+h.max_ads+"';\n";
            d+="google_ad_type='text_html';\n";
            d+="google_feedback='on';\n";
            d+="google_skip=google_adnum;\n";
            d+="-->\n";
            d+="<\/script>\n";
            d+='<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js?'+c+'"><\/script>';
            document.write(d)
        }
    },
    options:{adstyle:"twoline",
        width:315,
        ad_width:315,
        max_ads:4,
        adsOnRow:1,
        col_margin:0,
        titleFontSize:15,
        titleFontColor:"4444DD",
        titleDecoration:'none',
        descFontSize:11,
        descFontColor:"000000",
        linkFontSize:11,
        linkFontColor:"999999",
        linkPaddingTop:0
    }
};
