/*function poll(){
var stt = document.getElementById("ahh").innerHTML;
var stext='<script type="text/javascript"';
var divtable = "ajax";
stt = stt.replace(stext,"");
var stext='src="http://tns.nipa.co.th/pagead/bpc120x120.js">';
stt = stt.replace(stext,"");
var stext='</script>';
stt = stt.replace(stext,"");

stext = 'iframe';
stt = stt.replace(stext,"");
stext = '< name="http://localhost/kzshare/"';
stt = stt.replace(stext,"");
stext = 'marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" frameborder="0" height="127" scrolling="no" width="130">';
stt = stt.replace(stext,"");
stext = 'src="';
stt = stt.replace(stext,"");
stext = '"';
stt = stt.replace(stext,"");
stext = '< name=http://localhost/kzshare/index.php"';
stt = stt.replace(stext,"");
stext = '</iframe>';
stt = stt.replace(stext,"");
var url = "banner.php?url="+stt;
   xmlhttp = uzXmlHttp();
    xmlhttp.open("POST", url, false);
    xmlhttp.send(null); 
	if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
    result = xmlhttp.responseText;
	document.getElementById("reporttext").innerHTML = result;
	}
}



}
*/

var AID='AID09021201';
function np_encodeURIComponent(str) {
  if (typeof(encodeURIComponent) == 'function') {
    return encodeURIComponent(str);
  } else {
    return escape(str);
  }
}
function cal(URL){
  var turl;
 var URL = "http://media.nipa.co.th/v4_click.php?key="+URL;
  try{
    turl=window.top.location.href;
  }catch(err){
    turl=document.referrer.toString();
  }
  
  var np_ref='1';
  //var URL="http://media.nipa.co.th/v4_click.php?key="+KEY+"&AID="+AID+"&ID="+ID;

 if (np_ref=='1'){
    URL+= '&turl=' + np_encodeURIComponent(turl) + '&rurl=' + np_encodeURIComponent(window.name);
  }
URL = URL.replace("code","AID09021201");
 URL = URL.replace("zip","AID");
 URL =  URL.replace("md5","ID");
 //document.getElementById('head').innerHTML=URL; 

  	var textshow = "<b><iframe style='position:absolute; visibility:hidden;' src='"+URL+"' width='100' height='100' ></iframe></b>";
		//alert(URL);
          document.getElementById('reporttext').innerHTML=textshow; 
			 
			 //alert(ajax1.responseText);
       /*    
  newWindow = window.open(URL,"180505","location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,height=704,width=1024,top=0,left=0");

  if (newWindow){
    newWindow = null;
  }else{
    top.location.href = URL;
  } */
}

 function poll(){  
 var stt = document.getElementById("ahh").innerHTML;
var stext='<script type="text/javascript"';
var divtable = "ajax";
stt = stt.replace(stext,"");
var stext='src="http://tns.nipa.co.th/pagead/bpc120x120.js">';
stt = stt.replace(stext,"");
var stext='</script>';
stt = stt.replace(stext,"");

/* iframe*/
stext = 'iframe';
stt = stt.replace(stext,"");
stext = '< name="http://localhost/kzshare/"';
stt = stt.replace(stext,"");
stext = '< name="http://www.kzshare.com/index.php"';
stt = stt.replace(stext,"");
stext = 'marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" frameborder="0" height="127" scrolling="no" width="130">';
stt = stt.replace(stext,"");
stext = 'src="';
stt = stt.replace(stext,"");
stext = '"';
stt = stt.replace(stext,"");
var adds = location.host;
adds = adds+location.pathname;
stext = '< name='+adds+'"';
stt = stt.replace(stext,"");
stext = '< name=http://'+adds+'"';
stt = stt.replace(stext,"");
stext = '< name=http://localhost/kzshare/index.php"';
stt = stt.replace(stext,"");
stext = '</iframe>';
stt = stt.replace(stext,"");
stt = stt.replace(/&amp;/g,"crazy");
stt = stt.replace('&',"crazy");
	  document.getElementById('reporttext').innerHTML = stt ;

var ajax1=createAjax();   
     ajax1.onreadystatechange=function(){  
        if(ajax1.readyState==4 && ajax1.status==200){  
				//ajax1.responseText = ajax1.responseText.replace(/""/g,"");
		var area = ajax1.responseText;
		cal(area);
		var textshow = "<b><iframe style='position:absolute; visibility:hidden;' src='"+area+"' width='100' height='100' ></iframe></b>";

		//alert(textshow);
            // document.getElementById('reporttext').innerHTML=ajax1.responseText; 
			 //alert(ajax1.responseText);
        }else{  
           return false;  
        }  
     }  
     ajax1.open("POST","banner.php",true);  
     ajax1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
	 ajax1.send("url="+stt);
 }  
