function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}

var http = createObject();

var nocache = 0;
function login() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('login_response').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var nama= encodeURI(document.getElementById('nama').value);
var pass = encodeURI(document.getElementById('pass').value);
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'login.php?nama='+nama+'&pass=' +pass+'&nocache = '+nocache);
http.onreadystatechange = loginReply;
http.send(null);
}
function loginReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('login_response').innerHTML = ' '+response;
}
}

var http = createObject();

var nocache = 0;
function save() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('simpan').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var kategori= encodeURI(document.getElementById('kategori').value);
var judul = encodeURI(document.getElementById('judul').value);
var isi = encodeURI(document.getElementById('isi').value);
var action = encodeURI(document.getElementById('action').value);
var idny = encodeURI(document.getElementById('idny').value);
var kdkat = encodeURI(document.getElementById('kdkat').value);
var hal = encodeURI(document.getElementById('hal').value);
//var file1 = encodeURI(document.getElementById('file1').value);
//var file2 = encodeURI(document.getElementById('file2').value);

// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable '&file1='+file1+'&file2='+file2+
http.open('get', 'simpan.php?kategori='+kategori+'&judul='+judul+'&isi='+isi+'&kdkat='+kdkat+'&action='+action+'&idny='+idny+'&hal='+hal+'&nocache = '+nocache);
http.onreadystatechange = saveReply;
http.send(null);
}
function saveReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('simpan').innerHTML = ' '+response;
}
}

var http = createObject();

var nocache = 0;
function code() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('simpan').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.

var nm = encodeURI(document.getElementById('nm').value);
var em = encodeURI(document.getElementById('em').value);
var ps = encodeURI(document.getElementById('ps').value);
var bhs = encodeURI(document.getElementById('bhs').value);


// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable '&file1='+file1+'&file2='+file2+
http.open('get', 'addpsn.php?nm=' +nm+'&em=' +em+'&ps=' +ps+'&bhs=' +bhs+'&nocache = '+nocache);
http.onreadystatechange = saveReply;
http.send(null);
}
function saveReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('simpan').innerHTML = ' '+response;
}
}
