// kele8 AD JavaScript
// created by North Wind
//new window
var linkurl='http://goto.kele8.com';
function clearErrors() {
	return true;
}
window.onerror = clearErrors;
function openwindow(adName,w,h,l,t){//open new window . ad'name,width,height,left,top . with a random time opened
	setTimeout('openw("'+adName+'",'+w+','+h+','+l+','+t+')',1000+Math.floor(Math.random()*3000));
}
function openw(adName,w,h,l,t){//open new window . ad'name,width,height,left,top
	if(adName==undefined)return;
	var adtype=eval(adName + "type");
	if(adtype==undefined)return;
	var adurl=eval("url" + adName);
	if(adurl==undefined)return;
	var adclick=eval(adName + "click");
	if(adclick==undefined)return;
	var popName=eval(adName + "pop");
	var adwidth=300,adheight=250;
	var left=0,top=0;
	if(w!=undefined)adwidth=w;
	if(h!=undefined)adheight=h;
	if(l!=undefined)left=l;
	if(t!=undefined)top=t;
	if(popName){
		if(!popName.closed) popName.close();
	}
	if(adclick=="http"){
		popName = window.open(adurl, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+adwidth+',height='+adheight+',left='+left+', top='+top);
	}else if(adclick=="script"){
		var js='<scr'+'ipt src=' + adurl + '><\/scr' + 'ipt>';
		document.write(js);
	}
	else{
		switch(adtype){
			case "jpg":
				popName = window.open('', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+adwidth+',height='+adheight+',left='+left+', top='+top);
				if(popName)	popName.document.write('<style type="text/css">body {margin-left: 0px;margin-top: 0px;margin-right: 0px;	margin-bottom: 0px;}</style>');
				var js="<a href='"+adclick+"' targer='_blank' onclick ='javascript:window.open(\""+linkurl+"/count/count.dll/"+adName+"\",\"flyingwin\" ,\"toolbar=no,width=100,height=100,top=3000,left=3000\" );'><img src="+adurl+" WIDTH="+adwidth+" HEIGHT="+adheight+" border=0></a>";
				if(popName)popName.document.write(js);
				break;
			case "swf":
				popName = window.open('', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+adwidth+',height='+adheight+',left='+left+', top='+top);
				if(popName)popName.document.write('<style type="text/css">body {margin-left: 0px;margin-top: 0px;margin-right: 0px;	margin-bottom: 0px;}</style>');
				var js='<scr'+'ipt src="http://www.kele8.com/ad/linkurl.js"><\/scr' + 'ipt>';
				js +='<scr'+'ipt src="http://www.kele8.com/ad/public3.js"><\/scr' + 'ipt>';
				js += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+adwidth+'" height="'+adheight+'">  <param name="movie" value="'+adurl+'">  <param name="quality" value="high">  <embed src="'+adurl+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" "'+adwidth+'" height="'+adheight+'"></embed></object>';
				if(popName)popName.document.write(js);
				break;
			default:
				popName = window.open('', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+adwidth+',height='+adheight+',left='+left+', top='+top);
				if(popName)popName.document.write('<style type="text/css">body {margin-left: 0px;margin-top: 0px;margin-right: 0px;	margin-bottom: 0px;background-image: url(http://www.kele8.com/images/adbg.gif);}</style>');
				popName.document.write('<table width=100% height=100%><tr><td align=center>');
				var js="<a href='"+adclick+"' target='_blank' onclick ='javascript:window.open(\""+linkurl+"/count/count.dll/"+adName+"\",\"flyingwin\" ,\"toolbar=no,width=100,height=100,top=3000,left=3000\" );'>"+adurl+"</a>";
				if(popName)popName.document.write(js);
				if(popName)popName.document.write('<\/td><\/tr><\/table>');
		}
	}
}
function findObj(theObj, theDoc){
	var p, i, foundObj;
	if(!theDoc) theDoc = document;
	if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
	}
	if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	for (i=0; !foundObj && i < theDoc.forms.length; i++) 
		foundObj = theDoc.forms[i][theObj];
	for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
		foundObj = findObj(theObj,theDoc.layers[i].document);
	if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
	return foundObj;
}
function setText(objName,newText) { //v4.01
  if ((obj=findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
function setScript(objName,newText,w,h) { //v4.01
  if ((obj=findObj(objName))!=null){
    if (document.layers) {obj.document.write(unescape(newText)); obj.document.close();}
    else {obj.innerHTML = unescape('<iframe id="'+objName+'Iframe" frameborder="0" scrolling="no" height="'+h+'" width="'+w+'"></iframe>');
		var myframe=findObj(objName+'Iframe');
		if(myframe)myframe.document.write('<scr'+'ipt language="javas'+'cript" src="'+unescape(newText)+'">document.write("kele8 ad show");<\/scr'+'ipt>');
	}
  }
}
function showHideLayers(){ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3){
    if ((obj = findObj(args[i])) != null){
      visStr = args[i+2];
      if (obj.style){
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}

//img or swf
function showads(adName,w,h){//show jpg or gif or swf . ad'name,width,height with a random time showed
	setTimeout('show("'+adName+'",'+w+','+h+')',Math.floor(Math.random()*1000));
}
function show(adName,w,h) {//show jpg or gif or swf . ad'name,width,height
	if(adName==undefined)return;
	var adtype=eval(adName + "type");
	if(adtype==undefined)return;
	var adurl=eval("url" + adName);
	if(adurl==undefined)return;
	var adclick=eval(adName + "click");
	if(adclick==undefined)return;
	var adwidth=80,adheight=80;
	if(w!=undefined)adwidth=w;
	if(h!=undefined)adheight=h;
	if(adclick=="script"){
		//setScript(adName,adurl,adwidth,adheight);
	}else{
		switch(adtype){
			case "jpg":
				var js='<a href="'+adclick+'" target="_blank" onclick=javascript:showCount("'+adName+'")><img src="' + adurl + '" width="' + adwidth + '" height="' + adheight + '" border="0" align="middle"></a>';
				setText(adName,js);
				break;
			case "swf":
				var js='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+adwidth+'" height="'+adheight+'">  <param name="movie" value="'+adurl+'">  <param name="quality" value="high"> <param name="wmode" value="transparent"> <embed src="'+adurl+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+adwidth+'" height="'+adheight+'"></embed></object>';
				setText(adName,js);
				break;
			case "scroll":
				var js='<marquee height="16" width="200" hspace="0" loop="-1" vspace="0" scrollamount="3" onMouseOut="this.start();" onMouseOver="this.stop();"><a href="'+adclick+'" target="_blank" onclick=javascript:showCount("'+adName+'")>' + adurl + '</a></marquee>';
				setText(adName,js);
				break;
			case "txt":
				var js='<a href="'+adclick+'" target="_blank" onclick=javascript:showCount("'+adName+'")>' + adurl + '</a>';
				setText(adName,js);
				break;
			default:
				var js=adurl;
				setText(adName,js);
				break;
		}
	}
}
var flyingwin;
var gk=showModalDialog;
function showWindow(classname,url) {//count ad hits
	flyingwin=gk(linkurl+'/count/count.dll/'+classname,'flyingwin','status:0; help:0; dialogleft:10000px; dialogtop:10000px; dialogheight:0px; dialogwidth:0px');
	gk(linkurl+"/?"+url,'','status:0; help:0; dialogleft:10000px; dialogtop:10000px; dialogheight:0px; dialogwidth:0px');
}
function showCount(classname) {//count
	flyingwin=gk(linkurl+'/count/count.dll/'+classname,'flyingwin','status:0; help:0; dialogleft:10000px; dialogtop:10000px; dialogheight:0px; dialogwidth:0px');
}