﻿function addEvent(d,c,b){if(d.addEventListener){d.addEventListener(c,b,false);return true;}else{if(d.attachEvent){var a=d.attachEvent("on"+c,b);
return a;}else{return false;}}}function removeElement(a){if(a){a.parentNode.removeChild(a);}}function moveChildren(c,b){if(c&&b){while(c.hasChildNodes()){var a=c.childNodes[0];
b.appendChild(a);}}}sas_tmstp=Math.round(Math.random()*10000000000);sas_masterflag=1;function SmartAdServer(a,b,c){if(sas_masterflag==1){sas_masterflag=0;
sas_master="M";}else{sas_master="S";}document.write('<script src="http://www3.smartadserver.com/call/pubj/'+a+"/"+b+"/"+sas_master+"/"+sas_tmstp+"/"+escape(c)+'?"></script>');
}addEvent(window,"load",movePubs);var showAlert=false;function movePubs(){var b=document.getElementById("pubs");var j=getNumberOfPubs(b);
if(showAlert){alert("numberOfPubs : "+j);}if(b){if(b.hasChildNodes()){var k=b.childNodes;for(var a=0;a<k.length;a++){var d=b.childNodes[a];
if(d.nodeName.toLowerCase()=="div"){var e=d.attributes.id.value;var f="pub"+e+"Container";var g="pub"+e+"Placeholder";var h=document.getElementById(e);
var c=document.getElementById(f);var l=document.getElementById(g);if(hasPubs(h)){if(showAlert){alert("hasPubs : "+h.attributes.getNamedItem("id").value);
}movePub(h,l);}else{removePubContainer(c,l);}}}removePubs(b);if(typeof onPubsMoved=="function"){onPubsMoved();}}}}function getNumberOfPubs(e){var a=0;
if(e){if(e.hasChildNodes()){var d=e.childNodes;for(var b=0;b<d.length;b++){var c=e.childNodes[b];if(c.nodeName.toLowerCase()=="div"){a=a+1;
}}}}return a;}function removePubContainer(a,b){if(a){if(showAlert){alert("remove : "+a.attributes.getNamedItem("id").value);
}removeElement(a);}else{if(b){if(showAlert){alert("remove : "+b.attributes.getNamedItem("id").value);}removeElement(b);}}}function movePub(a,b){if(showAlert){alert("movePub : "+a.attributes.getNamedItem("id").value);
}moveChildren(a,b);}function hasPubs(f){var a=false;var g=1;var d=0;if(f.hasChildNodes){var b=f.childNodes;for(var c=0;c<b.length;
c++){var e=f.childNodes[c];if(e.nodeName.toLowerCase()=="script"){d=d+1;if(d==2){continue;}}if(d>=2&&e.nodeType==g){a=true;
break;}}}return a;}function removePubs(a){removeElement(a);}
