//date
function tS(){ x=new Date(); x.setTime(x.getTime()); return x; }
function lZ(x){ return (x>9)?x:'0'+x; }
function dT(){ if(fr==0){ fr=1; document.write('<span id="tP">'+eval(oT)+'</span>'); } tP.innerText=eval(oT); setTimeout('dT()',1000); } 
function y4(x){ return (x<500)?x+1900:x; }
//var dN=new Array('Sunday','Monday, ','Tuesday, ','Wednesday, ','Thursday, ','Friday, ','Saturday, '),mN=new Array('January','February','March','April','May','June','July','August','September','October','November','December'),fr=0,oT="dN[tS().getDay()]+' '+mN[tS().getMonth()]+' '+tS().getDate()+', '+y4(tS().getYear())+' '+'-'+' '+lZ(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '";
var dN=new Array('Minggu','Senin, ','Selasa, ','Rabu, ','Kamis, ','Jumat, ','Sabtu, '),mN=new Array('Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember'),fr=0,oT="dN[tS().getDay()]+' '+tS().getDate()+' '+mN[tS().getMonth()]+' '+y4(tS().getYear())+' '+'-'+' '+lZ(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '";

function confirmClose() { 
	if (confirm( "Anda yakin untuk Keluar?" )) { 
		window.close(); 
	} else { 
		return false; 
	} 
}

//form non aktif enter key
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}

//random image
today=new Date();
   jran=today.getTime();
   var number=3;
   var random_number=0;
   var image="";

function randomizeNumber()
   {
   ia=9301;
   ic=49297;
   im=233280;
   jran = (jran*ia+ic) % im;
   random_number=Math.ceil( (jran/(im*1.0)) *number);

   if (random_number==1)
      image="img/top_image.jpg";
   if (random_number==2)
      image="img/top_image1.jpg";
   if (random_number==3)
      image="img/top_image2.jpg";
   }

//WinPopUp

function winpoptox(mod,wh,hh,vb,target,sb) {
	if (sb == null) { sb='no'; }
	w_x=(screen.width-wh)/2;
	w_y=(screen.height-hh)/2;
	window.open(mod + '.php?' + vb,target,"scrollbars="+ sb +",toolbar=no,top=1,left=1,resizable=no,screenX=1,screenY=1,menubar=no,location=no,width="+ wh +",height="+ hh +",status=no");
}

function winpop(url,wh,hh) {
window.open(url,'credit',"scrollbars=no,toolbar=no,top=1,left=1,resizable=no,screenX=1,screenY=1,menubar=no,location=no,width="+ wh +",height="+ hh +",status=no");
}
function winpoptopr(mod,wh,hh,vb,target,sb) {
	if (sb == null) { sb='no'; }
	w_x=(screen.width-wh)/2;
	w_y=(screen.height-hh)/2;
	window.open(mod + '.php?' + vb,target,"scrollbars="+ sb +",toolbar=no,top=1,left=1,resizable=no,screenX=1,screenY=1,menubar=yes,location=no,width="+ wh +",height="+ hh +",status=no");
}

function wopen(href) {
	window.open(href,'_top');
}

function winPopup(url,name,windowWidth,windowHeight){    myleft=(screen.width)?(screen.width-windowWidth)/2:50;	mytop=(screen.height)?(screen.height-windowHeight)/2:50;	properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=no,resizable=no,location=no,toolbar=no,top="+mytop+",left="+myleft;    window.open(url,name,properties,'_top')
}
