// JavaScript Document
var xmlHttp;
var txtfill;
function sendcmd()
{ 
 //document.getElementById(txtfill).innerHTML='papapapappapapap';
xmlHttp=GetObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="adcat.php";

xmlHttp.onreadystatechange=ubah;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);

//alert("test");
}

function createDiv()
{
	
	
}



function showform_validation(target,src,frno)
{ 
no=parseInt(frno);
var pan=document.forms[no].elements.length;
page=target;
var nama;
var nilai;
var args;
for(var i=0;i< pan;i++)
{
	nama=document.forms[no].elements[i].name;
	nilai=document.forms[no].elements[i].value;
	judul=document.forms[no].elements[i].title;
	tipe=document.forms[no].elements[i].type;
	if(nilai == ""){
		alert(judul);
		return false;
		break;
	}
	
	if(tipe == "checkbox"){
	if(document.forms[no].elements[i].checked){	
	args +="&"+nama+"="+nilai;
	}else
	{
	//args +="&"+nama+"="+'';	
	}//end cheked
		}else
	{
		args +="&"+nama+"="+nilai;
	}
}

//------------------
xmlHttp=GetObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 } 
var url=page;
url=url+"?";
url=url+args;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=ubah ;
xmlHttp.open("get",url,true);
xmlHttp.send(null);
}
//-----------------------------------------------------------------------------------------------------------------------



function ubah() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 //detect resolution
var x,y;
var test1 = document.body.scrollHeight;
var test2 = document.body.offsetHeight
if (test1 > test2) // all but Explorer Mac
{
	x = document.body.scrollWidth;
	y = document.body.scrollHeight;
}
else // Explorer Mac;
     //would also work in Explorer 6 Strict, Mozilla and Safari
{
	x = document.body.offsetWidth;
	y = document.body.offsetHeight;
}
document.body.scrollTop=0;

 document.getElementById('tampil').style.display="";
 document. getElementById('tampil').style.width=x;
 document. getElementById('tampil').style.height=y;
 //---------------
 document.getElementById('txthasil').innerHTML=xmlHttp.responseText;
  }else
{
document.getElementById('txthasil').innerHTML="loading...";  
}
};

function GetObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}//---------------------

function tutup()

{
 document.getElementById('tampil').style.display="none";	
}
