// JavaScript Document

function setMyCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getMyCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
//setMyCookie('countcookie',0,1);
// counter zone
if(counttime = 1*getMyCookie('countcookie')) {
	counttime ++;
} else {
	counttime = 1;
}
setMyCookie('countcookie',counttime,1);

webendArr = new Array();
webpicendArr = new Array();

//webendArr[0] = 'http://www.rapedshares.com?f=';
//webendArr[0] = 'http://uploader.nungfree.in/download.php?file=';
webendArr[0] = 'http://download.clipbase.in/download.php?file=';
//webendArr[2] = 'http://uploader.nungfree.in/download.php?file=';
//webendArr[1] = 'http://sharefile.sport2hand.com/download.php?file=';
webendArr[1] = 'http://download.thaimarketpress.com/download.php?file=';

//webendArr[3] = 'http://award.weloveshopping.com/link.php?l=';
webendArr[2] = 'http://award.weloveshopping.com/link.php?shopid=180015&l=';
webendArr[3] = 'http://award.weloveshopping.com/link.php?shopid=133726&l=';
//webendArr[5] = 'http://www.zoomgirl.info/?p=';
//webendArr[6] = 'http://www.soccercrazy.info/detecturl.php?r=';
arrayindex = counttime%webendArr.length;

webend = webendArr[arrayindex];
webpicend =webpicendArr[arrayindex];
shortwebend = webend.replace ('http://','');


function getAreaObj(myidbodycontent) {
	if (document.getElementById(myidbodycontent)) {
		myareaobj = document.getElementById(myidbodycontent);
	} else {
		var divobj = document.getElementsByTagName('*');
		for (i=0;i<divobj.length;i++) {
			divitem = divobj[i];
			if (divitem.className == myidbodycontent || divitem.getAttribute('class') == myidbodycontent) {
				myareaobj = divitem;
				return myareaobj;
			}
		}
		return false;
	}
	return myareaobj;
}

var areobj = getAreaObj(idbodycontent);

				
function setLinkB(){	
	if (areobj) {		
			aArr = areobj.getElementsByTagName('a');
			for(i=0;i<aArr.length;i++){
				linkArr = aArr[i].href.split('http://');
				textlink = aArr[i].innerHTML;
				if( 1*aArr[i].href.indexOf(shortwebend) && 1*linkArr.length>1){
					url = linkArr[1*linkArr.length-1];
					var external_link = (1*url.indexOf(domainname) <0) 
					if(external_link) {
						if (domainname == 'bscclub.com') {
							url = webendArr[0]+url;
						} else {
							url = webend+url;
						}
						aArr[i].href =url;
					} 
					aArr[i].innerHTML = textlink;
				}	
			}
	}	
}

function setImageSize(){
	imageArr = areobj.getElementsByTagName('img');
	for(i=0;i<imageArr.length;i++){
		picwidth = width;
		if(1*imageArr[i].width>picwidth){
			imageArr[i].width = picwidth;
		}

			srcArr = imageArr[i].src.split('http://');
			imageArr[i].setAttribute('onClick',function() {window.open(webpicend+srcArr[1]);});
			imageArr[i].onclick  = function() {window.open(webpicend+srcArr[1]);};
	}
	setTimeout("setImageSize()",1500);
}

function openNewWindow(url) {
		window.open(url);
}
setLinkB();
