xAds=new Array('300x250','160x600','728x90');all_ads=new Array(xAds.length);all_cont=new Array(xAds.length);all_cont_width=new Array(xAds.length);all_guides=new Array(xAds.length);all_guides_off=new Array(xAds.length);all_areas=new Array(xAds.length);var pgC;var pgURL;pgA=new Array('maincontent','side1','side2');adA=new Array(pgA.length);var posInt;var row_HK;function initTopAdArea(){row_HK=typeof userGLoc!='undefined'&&userGLoc=='HK';if(row_HK){createAdBar(2);}}function getAds(){pgC=document.getElementsByTagName("body").item(0).id;pgURL=document.URL;for(i=0;i<xAds.length;i++){all_ads[i]=document.getElementById('x-ad-'+xAds[i]);if(all_ads[i]!=null){all_ads[i].style.zIndex='999997';all_ads[i].id=''}}}function initAds(ad){if(ad==0){if(row_HK)return;adA[0]=document.getElementById(pgA[0]);all_areas[0]=adA[0]}if(ad==1){if(row_HK){ad=2;all_areas[2]='top'}else{for(j=1;j<pgA.length;j++){adA[j]=document.getElementById(pgA[j]);all_areas[j]=adA[j]}posInt=1}}insertAds(ad);}function createAdBar(ad){var aDim=xAds[ad].split('x');var bj=document.createElement('DIV');var bg=document.createElement('DIV');var bc=document.createElement('DIV');bj.style.width='100%';bj.style.padding='10px';bg.style.width='100%';bg.style.textAlign='center';bg.style.overflow='hidden';bc.style.margin='auto';bc.style.width=aDim[0]+'px';bc.style.height=aDim[1]+'px';bc.style.textAlign='left';bg.appendChild(bc);bj.appendChild(bg);all_cont[ad]=bj;all_guides[ad]=bc;var bu=document.getElementsByTagName("body").item(0);bu.insertBefore(all_cont[ad],bu.firstChild);}function createAdModule(ad){var aDim=xAds[ad].split('x');var bk=document.createElement('TABLE');var bw=bk.insertRow(-1);var bm=bw.insertCell(-1);var bh=document.createElement('DIV');var bd=document.createElement('DIV');var bn=document.createElement('SPAN');var bx='<br /><a href="#" onclick="javascript: if(confirm(\'You can remove ads from your own site by going premium...\')){window.location.href=\'https://register.xanga.com/premium/\';} return false;"><strong>remove ads</strong></a>';bk.className='left';bk.style.width='100%';bm.className='left';bn.className='smalltext';bh.style.width='100%';bh.style.textAlign='center';bh.style.overflow='hidden';bd.style.margin='auto';bd.style.width=aDim[0]+'px';bd.style.height=aDim[1]+'px';bd.style.textAlign='left';bn.innerHTML=bx;bh.appendChild(bd);bm.appendChild(bh);if(pgURL.search('hoodstars.com')==-1){bm.appendChild(bn);}all_cont[ad]=bk;all_guides[ad]=bd}function createAdItem(ad){var aDim=xAds[ad].split('x');var bo=document.createElement('TABLE');var bz=bo.insertRow(-1);var ca=bz.insertCell(-1);var bi=document.createElement('DIV');var bb=document.createElement('DIV');bo.style.width='100%';bi.style.width='100%';bi.style.overflow='hidden';bi.style.textAlign='center';bb.style.margin='auto';bb.style.marginTop='16px';bb.style.width=aDim[0]+'px';bb.style.height=aDim[1]+'px';bb.style.textAlign='left';bi.appendChild(bb);ca.appendChild(bi);all_cont[ad]=bo;all_guides[ad]=bb}function insertAds(ad){if(ad==2&&all_ads[2]!=null){positionAd('top',2);}if(ad==0&&all_ads[0]!=null){if(pgC.search('page-site-main')!=-1){var ba=3;var all_Ts=all_areas[0].getElementsByTagName('TABLE');var item_Ts=new Array();for(i=0;i<all_Ts.length;i++){if(all_Ts[i].className.search('blogbody')!=-1){item_Ts.push(all_Ts[i]);}}createAdItem(0);if(item_Ts.length>0){if(item_Ts.length<ba){item_Ts[item_Ts.length-1].parentNode.appendChild(all_cont[0]);}else{var cb=item_Ts[ba-1].previousSibling.className=='blogheader';if(ba>1&&cb){item_Ts[ba-2].parentNode.insertBefore(all_cont[0],item_Ts[ba-2].nextSibling);}else{item_Ts[ba-1].parentNode.insertBefore(all_cont[0],item_Ts[ba-1]);}}}else{all_areas[0].appendChild(all_cont[0]);}positionAd(adA[0],ad);}if(pgC.search('item')!=-1){var ba=2;createAdModule(0);positionAdModule(adA[0],0,ba);}}if(ad==1&&all_ads[1]!=null){createAdModule(1);var adArea,ba;if(pgC.search('item')!=-1){adA[2]==null}if(adA[2]!=null&&availW[2]>=xAds[1].split('x')[0]){adArea=adA[2];ba=2}else if(adA[1]!=null&&availW[1]>=xAds[1].split('x')[0]){adArea=adA[1];ba=2}else{adArea=adA[0];ba=1;all_ads[1]=null}all_areas[1]=adArea;if(adArea!=adA[0]){positionAdModule(adArea,1,ba);}}}function positionAdModule(area,ad,order){var adArea_nodes;var adArea_mods=new Array();var cc=document.createElement('BR');if(area.id=='side1'&&pgC.search('item')!=-1){adArea_nodes=area.getElementsByTagName('DIV');for(i=0;i<adArea_nodes.length;i++){if(adArea_nodes[i].id.search('xmodule')!=-1){adArea_mods.push(adArea_nodes[i]);}}}else{adArea_nodes=area.getElementsByTagName('TABLE');for(i=0;i<adArea_nodes.length;i++){if(adArea_nodes[i].className.search('left')!=-1){if(adArea_nodes[i].parentNode.id.search('xmodule')!=-1){adArea_mods.push(adArea_nodes[i].parentNode);}else{adArea_mods.push(adArea_nodes[i]);}}}}if(adArea_mods.length<order){area.appendChild(all_cont[ad]);}else{area.insertBefore(all_cont[ad],adArea_mods[order-1]);}var bl=all_cont[ad].nextSibling;if(bl!=null&&(bl.nodeName=='TABLE'||bl.id.search('xmodule')!=-1)){all_cont[ad].parentNode.insertBefore(cc,bl);}if(ad==1){all_cont_width[ad]=all_cont[ad].offsetWidth}positionAd(area,ad,all_cont_width[ad]);}function positionAd(area,ad,width){var bp=all_guides[ad];if(bp==undefined)return;var adv=all_ads[ad];if(area!='top'){var aPos=findPos(area);}else{aPos=-1}var be=findPos(bp);var bf=bp.parentNode;if(all_guides_off[ad]==null){var bq=strip_unit(getStyle(bf,'borderLeftWidth','border-left-width'));var bs=strip_unit(getStyle(bf,'borderTopWidth','border-top-width'));bf=bf.parentNode;bq+=strip_unit(getStyle(bf,'borderLeftWidth','border-left-width'));bs+=strip_unit(getStyle(bf,'borderTopWidth','border-top-width'));all_guides_off[ad]=new Array(bq,bs);adv.style.position='absolute';adv.style.display='block'}if(be[0]==0||aPos[0]==be[0]){adv.style.top='-77000px';adv.style.left='auto';adv.style.right=0}else if(width&&width<xAds[ad].split('x')[0]){var left_off=xAds[ad].split('x')[0]-width;if(all_areas[ad].id=='side2'){left_off=0}adv.style.top=be[1]+all_guides_off[ad][1]+'px';adv.style.left=be[0]+all_guides_off[ad][0]-left_off+'px'}else{adv.style.top=be[1]+all_guides_off[ad][1]+'px';adv.style.left=be[0]+all_guides_off[ad][0]+'px'}if(posInt==1){posInt=setInterval(rePosAd,500);}}window.onload=stopRePosAd;window.onresize=rePosAd;function rePosAd(){for(i=0;i<all_ads.length;i++){if(all_ads[i]!=null){positionAd(all_areas[i],i,all_cont_width[i]);}}}function stopRePosAd(){clearInterval(posInt);rePosAd();}function getStyle(el,styleProp,style_prop){if(el.currentStyle)var bv=el.currentStyle[styleProp];else if(window.getComputedStyle)var bv=document.defaultView.getComputedStyle(el,null).getPropertyValue(style_prop);return bv}function findPos(el){var bt=curY=0;if(el.offsetParent){bt=el.offsetLeft;curY=el.offsetTop;while(el=el.offsetParent){bt+=el.offsetLeft;curY+=el.offsetTop}}return[bt,curY]}function strip_unit(string){if(string.search('px')!=-1){string=string.substring(0,string.length-2);return parseInt(string);}if(isNaN(parseInt(string))){string=0}string=string;return string}