// JavaScript Document
image1 = new Image();
image1.src = "images/back1.gif";
image2 = new Image();
image2.src = "images/back2.gif";
image3 = new Image();
image3.src = "images/bataviahotel_06b.gif";
image4 = new Image();
image4.src = "images/sepa2.gif";
image5 = new Image();
image5.src = "images/sepa3.gif";
image6 = new Image();
image6.src = "images/fancy_progress.png";
image6 = new Image();
image6.src = "images/fancy_closebox.png";


var xmlHttp;
function createXMLHttpRequest(){
	if(window.ActiveXObject){
		xmlHttp =  new ActiveXObject('Microsoft.XMLHTTP');
	}else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	
	}		
}

function startRequestPOST(pageName,source){
var queryString = document.getElementById(source).value;
createXMLHttpRequest();
	if(source=="sec"){
		xmlHttp.onreadystatechange = handleStateChange;
	}else if(source=="cat"){
		xmlHttp.onreadystatechange = handleStateChangeCat;
	}else if(source=="cont"){
		xmlHttp.onreadystatechange = handleStateChangeCont;
	}else{
		xmlHttp.onreadystatechange = handleStateChange;
		
	}

xmlHttp.open("POST",pageName,true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send("param="+ queryString);
	
}

function startRequestGET(pageName,source){
	var queryString = document.getElementById(source).value;
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open("GET",pageName + "?param=" + queryString ,true);
	xmlHttp.send(null);
}

function handleStateChange(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			hasil();	
		}		
	}	
}

function handleStateChangeCat(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			hasilCat();	
		}		
	}	
}
function handleStateChangeCont(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			hasilCont();	
		}		
	}	
}

function movepic(img_name,img_src) {
document[img_name].src=img_src;
}

function over(img){
img.border = 1;
}
function out(img){
img.border = 0;
}



function swapImg(wr1,wr2,img_name) {
if(img_name.alt==wr2)
{img_name.src=wr1;img_name.alt=wr1;}
else
{img_name.src=wr2;img_name.alt=wr2;}
}

function collapseExpand(element,jmlhElement){
	for(i=1;i<=jmlhElement;i++){	
		document.getElementById(element + i).style.display =(document.getElementById(element+i).style.display=="none")?"":"none";
	}	
}

function nothing(){
	return;
}
function changeimg(obj,imgsrc){
document.getElementById(obj).innerHTML = "<img src=\""+imgsrc+"\" width=\"125\" height=\"208\" border=\"0\"/>";
}

function linkchg(highlight){
source=event.srcElement
source.style.backgroundColor=highlight
}

function linkchgback(base){
source.style.backgroundColor=base
}

function readenter(e,readfunc)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if (keycode == 13)
	{
		eval(readfunc);
	}
}
function validateMail(email) {
     if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == (email.length-1)) {  // @ must not be the last character
        return false;
    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid
		return false;
    } else if (email.lastIndexOf(".") == (email.length-1)) {  // . must not be the last character
		
		return false;
    }
    return true;
}

function allValidChars(field) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  for (var i=0; i < field.length; i++) {
    var letter = field.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}

function openNewWindow(URL,winName,attributes) { 
  testwindow=window.open(URL,winName,attributes);
 	testwindow.moveTo(300,300);

}



// JavaScript Document