<!--
//===Check to validate only 2 decimal
function is2DecCcy( strNum ) {

	var intCounter=0 , intLoop, intStartPos;

	strNum = Trim(strNum);
	if (strNum == '') return false; // Not number
	if (strNum == '.') return false; // Not number

	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // One . only
		if (strNum.charAt(intLoop) == ".") intCounter++;
		if (intCounter > 1) return false;
	}


	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // 0-9, . only
		if (((strNum.charAt(intLoop) < "0") || (strNum.charAt(intLoop) > "9")) &&
				(strNum.charAt(intLoop) != ".")	)
			return false;
	}

	intStartPos = strNum.indexOf("."); // four decimal only
	if (intStartPos != -1){
		if ((strNum.length - (intStartPos  + 1 )) > 2)
			return false;
	}
	return true; // value is 0
}

// eliminate the left and right spaces from the string.
function Trim(string) {
	
	var i;
	var intCount;
	
	
	//truncate the left spaces.
	// 1. get the number of spaces at left side of the string.
	// 2. get the new string without the left spaces.
	
	intCount = 0;
	for (i = 0; i < string.length; i++)
		if ((string.charAt(i)) != " ")
			break;
		else
			intCount = intCount + 1;
		
	string = string.substring(intCount, string.length);
	
		
	
	//truncate the right spaces.
	// 1. use the string that has been truncated just now and get
	//	  the number of spaces on the right side of the string.
	// 2. get the final string and return.
	
	intCount = 0;
	for (i = string.length-1; i >= 0; i--)
		if ((string.charAt(i)) != " ")
			break;
		else
			intCount = intCount + 1;
		
	
	string = string.substring(0, string.length-intCount);	
	return string;		
	
}

//  Returns true if strNum  is only number

function isNumber( strNum ) {

	var intCounter=0 , intLoop;

	strNum = Trim(strNum);

	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // 0-9 only
		if (((strNum.charAt(intLoop) < "0") || (strNum.charAt(intLoop) > "9")
				))
			return false;
	}

	return true; // value is 0
}

function isNum(e){	//angka only
var key = window.event ? e.keyCode : e.which;
 
if (
	(key > 47 && key < 58) || key == 8 || key == 0
	) return true; 
	return false;
}

//  Returns true if strNum  is alphabet

function isAlphabet( strNum ) {

	var intLoop, strUNum;

	strUNum= strNum.toUpperCase();
	for (intLoop = 0; intLoop < strUNum.length; intLoop++) {
		if (((strUNum.charAt(intLoop) < "A") || (strUNum.charAt(intLoop) > "Z"))
		      && (strUNum.charAt(intLoop) != " ") )
			return false;
	}
	return true;
}

function isAlphaNum( strNum ) {

	var intLoop, strUNum;

	strUNum= strNum.toUpperCase();
	for (intLoop = 0; intLoop < strUNum.length; intLoop++) {
		if ((((strUNum.charAt(intLoop) < "A") || (strUNum.charAt(intLoop) > "Z")) &&
			 ((strUNum.charAt(intLoop) < "0") || (strUNum.charAt(intLoop) > "9")))
		      && (strUNum.charAt(intLoop) != " "))
			return false;
	}
	return true;
}

//  Returns true if strNum  is a number

function isCcy( strNum ) {

	var intCounter=0 , intLoop, intStartPos;

	strNum = Trim(strNum);
	if (strNum == '') return false; // Not number
	if (strNum == '.') return false; // Not number

	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // One . only
		if (strNum.charAt(intLoop) == ".") intCounter++;
		if (intCounter > 1) return false;
	}


	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // 0-9, . only
		if (((strNum.charAt(intLoop) < "0") || (strNum.charAt(intLoop) > "9")) &&
				(strNum.charAt(intLoop) != ".")	)
			return false;
	}

	intStartPos = strNum.indexOf("."); // four decimal only
	if (intStartPos != -1){
		if ((strNum.length - (intStartPos  + 1 )) > 4)
			return false;
	}
	return true; // value is 0
}

// -->

function ValidateEmail(object_value)
{		
	email_pattern=new RegExp("^[a-zA-Z0-9]+(([_]|\\.|-)?[a-zA-Z0-9])*@([a-zA-Z0-9]+([_]|-?[a-zA-Z0-9])*(\\.))+[a-zA-Z]{2,4}$");
	return object_value.search(email_pattern);
}


//function for delete
function confirmDelete(formname){
				
			if (confirm('Apakah anda benar ingin menghapus file ini?')){
				formname.mode.value = 'delete';
				formname.method ='post';
				formname.submit();
			}
			else {	
				formname.mode.value = '';
				return false;
			}
		}
		
function deleteCheck(){
	if (confirm('Apakah anda benar ingin menghapus file ini?')){
		var a = '';
		for(i=0;i<document.formData.chkList.length;i++){
			if(document.formData.chkList[i].checked) a += document.formData.chkList[i].value + ',';
		}
		a = a.substring(0, a.length-1);
		document.formData.cekId.value = a;
		document.formData.method ='post';
		document.formData.submit();
	}
	else {	
		formname.mode.value = '';
		return false;
	}
}

function changestatus(){
	
	formname = document.formData;
	
	formname.mode.value = 'changestatus';
	formname.method = 'POST';
	formname.submit();
	return true;
 
} 

//function for checklist		
var checkflag = "false";
function check(field) {
	if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;
		}
	checkflag = "true";
	return "Uncheck"; 
	} else {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false;
		}
	checkflag = "false";
	return "Check"; 
	}
}

function ceklist(){
	for(j=0;j<document.formData.chkList.length;j++){
		if(document.formData.chkList1.checked==true){
			document.formData.chkList[j].checked=true;
		}else{
			document.formData.chkList[j].checked=false;
		}
	}
}

//function for trim		
function trim(value) {
	var temp = value;
	var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
	 if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
	 var obj = / +/g;
	temp = temp.replace(obj, " ");
	if (temp == " ") { temp = ""; }
	 return temp;
}


function OnSearch(pageTarget, order, asc) { 
	  	  field = document.frmSearch.selField.value;
	  	  crt = document.frmSearch.selCriteria.value;
	  	  value = document.frmSearch.txtValue.value;
	  	  //order = frmHidden.hidOrder.value;
	  	  //asc = frmHidden.hidAsc.value;
	  	  //status = frmHidden.hidStatus.value;
	  	  location.href= pageTarget+"?page=0&order="+ order +"&asc="+ asc +"&field1="+ field +"&crt1="+ crt +"&val1="+ value 
}
	
	/* =================================== NUMERIC FUNCTION ======================================================= */
	
	
		function checkBlank(component) { 
		  temp = document.getElementById(component);  
		  if (trim(temp.value) == ''){
		   temp.value  = '0';
		  }
		} 
		function isNum(e){	//angka only
		var key = window.event ? e.keyCode : e.which;
		 
		if (
			(key > 47 && key < 58) || key == 8 || key == 46 || key == 0
			) return true; 
			return false;
		}
		 
		function isNum_minus(){	//titik dan angka and (-) only 
			if (
				(event.keyCode > 44 && event.keyCode < 58)
				) event.returnValue = true; 
				else event.returnValue = false;
		}
		
		function isInt(){		
		if (
		(event.keyCode > 47 && event.keyCode < 58) 
		) event.returnValue = true;
		else event.returnValue = false;	
		}
		
	/* =================================== END OF NUMERIC FUNCTION ======================================================= */
	function OnChangePageEnter(e){
		
		var key = window.event ? e.keyCode : e.which;
			
		if(key == 13){ 
			window.event.keyCode = 0;
			OnChangePage();
		}
		 
	}
	
var xmlhttp;
//==================================================

function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}

function GetXmlHttpObject()
{
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 gettheDate() {
Todays = new Date();
TheDate = getHari(Todays.getDay()) +" , " + Todays.getDate() +" "+ getBln(Todays.getMonth()) + " " + Todays.getFullYear();
return TheDate;
}

var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning) clearTimeout(timerID);
timerRunning = false;
}
function startclock () {
// Make sure the clock is stopped
stopclock();
showtime();
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >23) ? hours -24 :hours)
timeValue = ((hours <10) ? "0" : "") + hours
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
document.getElementById("date").innerHTML = " "+gettheDate();
document.getElementById("clock").innerHTML = " "+timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;

}

function getHari(hari){
var nmHari = "";
switch(hari){
case 0: nmHari = "Minggu"; break;
case 1: nmHari = "Senin"; break;
case 2: nmHari = "Selasa"; break;
case 3: nmHari = "Rabu"; break;
case 4: nmHari = "Kamis"; break;
case 5: nmHari = "Jum'at"; break;
case 6: nmHari = "Sabtu"; break;
}
return nmHari;
}

function getBln(bln){
var nmBln = "";
switch(bln){
case 0: nmBln = "Januari"; break;
case 1: nmBln = "Februari"; break;
case 2: nmBln = "Maret"; break;
case 3: nmBln = "April"; break;
case 4: nmBln = "Mei"; break;
case 5: nmBln = "Juni"; break;
case 6: nmBln = "Juli"; break;
case 7: nmBln = "Agustus"; break;
case 8: nmBln = "September"; break;
case 9: nmBln = "Oktober"; break;
case 10: nmBln = "November"; break;
case 11: nmBln = "Desember"; break;
}
return nmBln;
}

function animate(lastTick, timeLeft, closingId, openingId)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
  
  var opening = (openingId == '') ? null : document.getElementById(openingId);
  var closing = (closingId == '') ? null : document.getElementById(closingId);
 
  if(timeLeft <= elapsedTicks)
  {
    if(opening != null)
      opening.style.height = ContentHeight + '%';
    
    if(closing != null)
    {
      closing.style.display = 'none';
      closing.style.height = '0px';
    }
    return;
  }
 
  timeLeft -= elapsedTicks;
  var newClosedHeight = Math.round((timeLeft/TimeToSlide) * ContentHeight);

  if(opening != null)
  {
    if(opening.style.display != 'block')
      opening.style.display = 'block';
    opening.style.height = (ContentHeight - newClosedHeight) + 'px';
  }
  
  if(closing != null)
    closing.style.height = newClosedHeight + 'px';

  setTimeout("animate(" + curTick + "," + timeLeft +",'" + closingId + "','" + openingId + "')", 33);
}

function animate1(lastTick, timeLeft, closingId, openingId)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
  
  var opening = (openingId == '') ? null : document.getElementById(openingId);
  var closing = (closingId == '') ? null : document.getElementById(closingId);
 
  if(timeLeft <= elapsedTicks)
  {
    if(opening != null)
      opening.style.width = ContentWidth + '%';
    
    if(closing != null)
    {
      closing.style.display = 'none';
      closing.style.width = '0px';
    }
    return;
  }
 
  timeLeft -= elapsedTicks;
  var newClosedWidth = Math.round((timeLeft/TimeToSlide) * ContentWidth);

  if(opening != null)
  {
    if(opening.style.display != 'block')
      opening.style.display = 'block';
    opening.style.width = (ContentWidth - newClosedWidth) + 'px';
  }
  
  if(closing != null)
    closing.style.width = newClosedWidth + 'px';

  setTimeout("animate1(" + curTick + "," + timeLeft +",'" + closingId + "','" + openingId + "')", 33);
}

function nulis(element){
	nq=element.value.split(",").join("");
	var tulis = "";
	//var koma = a.indexOf(".");
	//if(koma == -1){
		var string1 = nq;
		//var string2 = "";
	/*}
	else{
		var string1 = a.substring(0, koma);
		var string2 = a.substring(koma, a.length);
	}*/
	for(i=0;i<string1.length;i++){
		if((string1.length-i)%3==0 && i!=0)
		{
			tulis+=",";
		}
		tulis+=string1.charAt(i);
	}
	//tulis = tulis + string2;
	element.value = tulis;
}

function time(action,time)
{
var t=setTimeout(""+action+"",time);
}

function showEpiredSession(sessionDiv){
	document.getElementById(sessionDiv).style.display = "inline"	;
}

var c = 7;
function fcwait() {
  if (c > 0) {
	var el = document.getElementById("downloadDelayTimeSec")
	if( el ){
	  el.innerHTML = "" + c
	}
	c = c - 1
	setTimeout("fcwait()", 950)
  }
}
fcwait();

function search_box(){
document.getElementById('txtValue').value='';
document.getElementById('txtValue').style.color='#000000'; 
document.getElementById('txtValue').style.textAlign='right'; 
document.getElementById('txtValue').style.fontStyle='normal'; 
document.getElementById('btn').disabled='';
}

function checkAvailable(page,formname,pathimage,param,cek){
valueZ = document.getElementById(formname);
if(pathimage == ''){
	var pathimage = '../img/';
}else{
	var pathimage = 'img/';
}
if(valueZ.value == ''){
	document.getElementById(param).innerHTML = '';
}else{
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	 alert ("Browser does not support HTTP Request");
	 return;
	}
	var able = trim(valueZ.value);
	if (!able) return;
	document.getElementById(param).innerHTML = '&nbsp;<img src="'+pathimage+'loader.gif" />';	
	xmlhttp.open("GET", page + '_proses.php?'+ param +'='+able, true);
	xmlhttp.onreadystatechange = function() {
			if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)){
				document.getElementById(param).innerHTML = xmlhttp.responseText;
				var chkAble = document.getElementById(cek).value;
				if(chkAble == 1){
					valueZ.value = '';
				}
			}
		return false;
		}
	xmlhttp.send(null);
}
}

function checkLoginAval(page,valueZ,param,divX){
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null){
 alert ("Browser does not support HTTP Request");
 return;
}
var able = trim(valueZ);
if (!able) return;
document.getElementById(divX).innerHTML = '&nbsp;<img src="../img/loader.gif" />';	
xmlhttp.open("GET", page + '_proses.php?'+ param +'='+able, true);
xmlhttp.onreadystatechange = function() {
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)){
	document.getElementById(divX).innerHTML = xmlhttp.responseText;
}
return false;
}
xmlhttp.send(null);
}

function checkLogin(page,name,msg,param,divX){
		formname = document.getElementById(name);
		if (formname.value ==''){
			alert(msg);
			formname.focus();
			return false;
		}else{
			checkLoginAval(page,formname.value,param,divX);
		}
}

function rollover(obj){
	obj.style.backgroundColor='#fdfbde';
}

function rollout(obj){
	obj.style.backgroundColor='';
}

var slideMenu=function(){
	var sp,st,t,m,sa,l,w,sw,ot;
	return{
		build:function(sm,sw,mt,s,sl,h){
			sp=s; st=sw; t=mt;
			m=document.getElementById(sm);
			sa=m.getElementsByTagName('li');
			l=sa.length; w=m.offsetWidth; sw=w/l;
			ot=Math.floor((w-st)/(l-1)); var i=0;
			for(i;i<l;i++){s=sa[i]; s.style.width=sw+'px'; this.timer(s)}
			if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)}
		},
		timer:function(s){s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}},
		slide:function(s){
			var cw=parseInt(s.style.width,'10');
			if(cw<st){
				var owt=0; var i=0;
				for(i;i<l;i++){
					if(sa[i]!=s){
						var o,ow; var oi=0; o=sa[i]; ow=parseInt(o.style.width,'10');
						if(ow>ot){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}
						owt=owt+(ow-oi)}}
				s.style.width=(w-owt)+'px';
			}else{clearInterval(m.timer)}
		}
	};
}();