/*
	fungsi buat ngeprint hanya area tertentu aja
	source code di dapat dari Winfolinx.com
*/
var gAutoPrint = true; 
function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}

function daydatetime(){
	var d=new Date();
    var weekday=new Array("Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu");
    var monthname=new Array("Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktiber","Nopember","Desember");	
	var def = d.getTimezoneOffset()/60;
	var gmt = (d.getHours() + def);
	var format = weekday[d.getDay()] + ", ";
	format += d.getDate() + " ";
	format += monthname[d.getMonth()] + " ";
	format += d.getFullYear() + " ";
	format +=  (IfZero(d.getHours()) + ":" + IfZero(d.getMinutes()) + ":" + IfZero(d.getSeconds()));
    /*document.write(weekday[d.getDay()] + ", ");
    document.write(d.getDate() + " ");
    document.write(monthname[d.getMonth()] + " ");
    document.write(d.getFullYear());*/
	document.getElementById("time").innerHTML= format;
	setTimeout("daydatetime()",1000);
}

function IfZero(num) {
	return ((num <= 9) ? ("0" + num) : num);
}
function check24(hour) {
	return (hour >= 24) ? hour - 24 : hour;
}

var timerID = null;
var timerRunning = false;
function stopclock (){
	if(timerRunning)
	clearTimeout(timerID);
	timerRunning = false;
}
function showtime () {
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	var timeValue = "" + ((hours >12) ? hours -12 :hours)
	if (timeValue == "0") timeValue = 12;
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	//timeValue += (hours >= 12) ? " P.M." : " A.M."
	document.write(timeValue);
	timerID = setTimeout("showtime()",1000);
	timerRunning = true;
}
function startclock() {
	stopclock();
	showtime();
}