/*
#***********************************************************************************************#
#
#	bakwan : andi.ridwan@gmail.com
#	ibnu hazim : ibnuhazim1981@yahoo.com
#
#***********************************************************************************************#
#
#	function openw
#	function opennew
#	function jumpTo
#	function jumper
#	function cofirm
#	function delete_confirm_main
#	function delete_cofirm
#	function buttonact
#	function onbluralert
#	function onunloadalert
#	function radio_value
#	function printpage
#	function visiblebox
#
#***********************************************************************************************#
#
#	bakwan : 20060615 : (+) create this file
#	bakwan : 20060616 : (+) ubah function cofirm agar lebih reuseable
#	bakwan : 20060720 : (+) tambah function delete_confirm_main
#
#***********************************************************************************************#
*/

// ------------------------------------- begin : window function --------------------------------- //

// bakwan : open new window with strip option //
function openw(namafilecontact) 
{ 
	window.open(namafilecontact,'windowsbaru1','toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,width=850 height=500,resizable=1');
}

// bakwan : open new window with normal option //
function opennew(param) 
{ 
	window.open(param,'windowsbaru2','toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,width=850 height=500,resizable=1');
}

// ------------------------------------- end : window function ---------------------------------- //
	 
// ------------------------------------- begin : redirect function ------------------------------ //

// bakwan : change page depend from option value //
function jumpTo(optionchange)
{
	var optchange = optionchange.options[optionchange.selectedIndex].value;
	window.location.href = optchange;
}

// bakwan : change page depend from parameter value //
function jumper(param1,param2)
{
	window.location = param1+param2;
}

// ------------------------------------- end : redirect function -------------------------------- //

// ------------------------------------- begin : action function -------------------------------- //

// bakwan : show confirmation messege //
function cofirm(param1, param2, param3)	
{
	if (confirm(param3))
	{
		window.location = param1+"&"+param2;
	}
}

//bakwan : show main confirmation message //
function delete_confirm_main(param1)
{
	var is_confirmed= confirm(param1);
	if (is_confirmed){return false;}
	return false;
}

//ibnu : show confirmation message //
function delete_confirm()
{
	var is_confirmed= confirm("Are you sure to remove this?");
	if (is_confirmed){return true;}
	return false;
}

// bakwan : action in button //
function buttonact(param1,param2)	
{
	url = param1+param2;
	window.location = url;
}

function buttonactop(param1)	
{
	window.top.location.href= param1;
}

// bakwan : alert messege when mouse remove //
function onbluralert(param1,param2)
{
	if (param1)
	{
		alert(param2);
	}
}

// bakwan : alert messege when html page closed //
function onunloadalert(param1,param2)
{
	if (param1 == "" || param1 == null)
	{
		alert(param2);
	}
}

// bakwan : send selected radio input value //
function radio_value(param1,param2)
{
	for (var i=0; i <= document.radiofrm.id.length; i++)
	{
   		if (document.radiofrm.id[i].checked)
    	{
      		var rad_val = document.radiofrm.id[i].value;
			window.location = param1+"&"+rad_val;
      	}
   	}
}

// ------------------------------------- end : action function ---------------------------------- //

// ------------------------------------- begin : print function ------------------------------- //

function printpage() 
{
	window.print();  
}

// ------------------------------------- end : print function --------------------------------- //

// ------------------------------------- begin : visibleBox function ------------------------------- //

function visiblebox(id, skipopenclose)
{
	elm1 = document.getElementById("open"+id);
	elm2 = document.getElementById("close"+id);
	elm3 = document.getElementById("box"+id);
	if (skipopenclose) 
	{
		if (elm3.style.display == "") 
		{
			elm3.style.display = "none";
		} 
		else 
		{
			elm3.style.display = "";
		}
	}
	else 
	{
		if (elm1.style.display == "") 
		{
			elm1.style.display = "none";
			elm2.style.display = "";
			elm3.style.display = "none";
		}
		else 
		{
			elm1.style.display = "";
			elm2.style.display = "none";
			elm3.style.display = "";
		}
	}
}

// ------------------------------------- end : visibleBox function --------------------------------- //

// ------------------------------------- begin : set row pointer --------------------------------------- //
// create by Ibnu Hazim
function setPointer(theRow, thePointerColor)
{
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = thePointerColor;
    }

    return true;
} 
// ------------------------------------- end : set row pointer --------------------------------------- //