// JavaScript Document
var adwin;
function showAd(lnk,type){
	makeadHit(type);
/*	showMessage("You'll automatically redirected to "+lnk);
	setTimeout("goToSite('"+lnk+"')",10000);*/
	/*adwin=window.open("http://www.google.com/");*/
	goToSite(lnk);
    /*setTimeout("goToSite('"+lnk+"')",10000);*/
}

function makeadHit(type){
	var xmlHttp=createXmlHttpRequestObject();
	if(xmlHttp){
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
        	xmlHttp.open("GET", "./include/advhit.php?type="+type, true);
	        xmlHttp.onreadystatechange = hitHandler;
    	    xmlHttp.send(null);
		}
	}
}

function hitHandler(){
}

function goToSite(lnk){
/*	adwin.location=lnk;*/
//	alert("link"+lnk);
	window.open(lnk);
//	adwin.close();
	//closeMessage();
}

function closeMessage(){
    document.getElementById('banner').innerHTML='';
    document.getElementById('banner').style.width=0;
    document.getElementById('banner').style.height=0;
    document.getElementById('banner').style.border=0;

}

function showMessage(msg,btns){

    bx='<table width="100%" height="100%"><tr height="90%"><td>'+msg+'</td></tr>';
    if(btns){
        bx+='<tr height="10%"><td align="center" valign="bottom"><input type="button" value="Ok" style="width:55px;"  onclick="closeMessage()" /></td></tr>'  ;
//        bx+='<input type="button" value="Cancel" onclick="closeMessage()" style="width:55px;" /></td></tr>';
    }
    bx+='</table>';
    document.getElementById('banner').style.width='530px';
    document.getElementById('banner').style.height='310px';
    document.getElementById('banner').style.border='1px solid #333333';
    document.getElementById('banner').innerHTML=bx;

}
