var xmlHttp;
var oTargetDiv	= '';
var object		= '';
var funcName	= '';

function getContentFromUrl(url, targetDiv, method, postData, fName)
{
	if ( url == '' )
	{
		alert ("URL for HTTP Request is empty");
		return;
	}
	if ( targetDiv == '' )
	{
		alert ("Target DIV not specified for HTTP Request");
		return;
	}
	if ( method == '' || method == undefined )
		method = 'GET';

	if ( fName != '' )
		funcName = fName;

	object = GetXmlHttpObject();
	if ( object == null )
	{
		alert ("Browser does not support HTTP Request");
		return;
	}

	oTargetDiv					= targetDiv;
	object.onreadystatechange	= stateChanged4Content;

	try
	{
		object.open(method, url, true);
		object.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
//		object.setRequestHeader('Content-Type',	'text/html; charset=iso-8859-1');
//		object.setRequestHeader('charset',		'iso-8859-1');
		object.send(postData==''?null:postData);
	}
	catch (e)
	{
		alert(e.message);
	}
}

function stateChanged4Content()
{
	if ( object.readyState == 4 || object.readyState == "complete" )
	{
		// If Target DIV is null then just use response to eval
		if ( oTargetDiv == null )
		{
			try
			{
				eval(object.responseText);
			}
			catch (e)
			{
				alert(e.message+"\n"+object.responseText);
			}
		}
		// Else Target DIV is assigned response
		else
		{
			oTargetDiv.innerHTML = object.responseText;
		}

		// Function Name is not empty then that function name is also called
		if ( funcName != '' )
		{
			eval(funcName);
		}
	}
	//	State	Description
	//	0		The request is not initialized
	//	1		The request has been set up
	//	2		The request has been sent
	//	3		The request is in process
	//	4		The request is complete

}

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 showHide()
{
var numericID = this.id.replace(/[^\d]/g,'');
var obj = document.getElementById('a' + numericID);
if(obj.style.display=='block'){
obj.style.display='none';
}else{
obj.style.display='block';
}		
}
function initShowHideContent()
{
var divs = document.getElementsByTagName('DIV');
for(var no=0;no<divs.length;no++){
if(divs[no].className=='on'){
divs[no].onclick = showHide;
}	
}	
}
window.onload = initShowHideContent;


function showhide(object)
{ document.getElementById('isi').style.display="none";
  document.getElementById('jadwal').style.display="none";
  object.style.display="block";
}
///
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}



