function go(url){
	location.href= url;
}



function prepareTabs(){
	$(document).ready(function() {
		$(".tab_content").hide(); 
		$("ul.tabs li:first").addClass("active").show(); 
		$(".tab_content:first").show(); 
		
		$("ul.tabs li").click(function() {
			$("ul.tabs li").removeClass("active"); 
			$(this).addClass("active");
			$(".tab_content").hide(); 
			var activeTab = $(this).find("a").attr("href");
			$(activeTab).fadeIn(); 
			return false;
		});

	});
}

function gID(objID){
	return document.getElementById(objID);
}

function cekKomentar(){
	if(gID('mn_komentar1').className == "active"){
		if(gID('komentar_nama').value == ""){
			alert('Nama Belum Diisi');
			return false;
		}

		if(gID('komentar_email').value == ""){
			alert('Email Belum Diisi');
			return false;
		}
		
		if(gID('komentar_text').value == ""){
			alert('Komentar Belum Diisi');
			return false;
		}
		
		if(gID('kode_aman1').value == ""){
			alert('Kode Aman Belum Diisi');
			return false;
		}
	} else {
		
	}
	return true;
}


function setPanelKomentar(){
	if(gID("frmKomentar").style.display == "none"){
		gID("frmKomentar").style.display = "block";
		gID("frmKomentar").style.float = "left";
		gID("frmKomentar").style.width = '500px';
		$(".container").css("width", "500px");
		gID("d_komentar").innerHTML = "[-] Tutup Komentar";
	} else {
		gID("frmKomentar").style.display = "none";
		gID("d_komentar").innerHTML = "[+] Beri Komentar";
	}
}

function setPanelKomentarTerbaru(){
	if(gID("frmKomentarTerbaru").style.display == "none"){
		gID("frmKomentarTerbaru").style.display = "block";
		gID("frmKomentarTerbaru").style.float = "left";
		gID("frmKomentarTerbaru").style.width = "500px";
		gID("d_komentar_terbaru").innerHTML = "[-] Tutup Komentar Terbaru";
	} else {
		gID("frmKomentarTerbaru").style.display = "none";
		gID("d_komentar_terbaru").innerHTML = "[+] Komentar Terbaru";
	}
}


function startCatExpand(e,element)
{
	if(e.type != "onmouseenter")
	{
		var fromElement = e.relatedTarget || e.fromElement;
		while (fromElement && fromElement != element && fromElement.nodeName != 'BODY') {
			fromElement = fromElement.parentNode
		}
		if (fromElement == element) {
			return;
		}
	}
	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;		
	if(!imgElement.inited)
		init(imgElement);
	tableElement.style.width = tableElement.offsetWidth;
	tableElement.className = "gr_expanded";
	tableElement.nextSibling.width = tableElement.offsetWidth;
	tableElement.nextSibling.height = tableElement.offsetHeight+1;
	tableElement.parentNode.style.zIndex = 1;
	window.clearTimeout(imgElement.imgDelayID);
	imgElement.imgDelayID = window.setTimeout(imgElement.expand,100);
}


function endCatExpand(e,element)
{
	if(e.type != "onmouseleave")
	{
		var toElement = e.relatedTarget || e.toElement;
		while(toElement && toElement != element && toElement.nodeName != 'BODY') {
			toElement = toElement.parentNode;
		}
		if(toElement == element) {
			return;
		}
	}
	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
	window.clearTimeout(imgElement.imgDelayID);
	hideElements(tableElement);
	imgElement.contract();
}



function init(imgElement)
{
	imgElement.originalHeight = imgElement.height;
	imgElement.originalWidth = imgElement.width;
		
	imgElement.expand = function() 
		{
			var factor = Math.round(imgElement.height*.06);
			if(imgElement.width + factor < imgElement.originalWidth*2)
			{
				imgElement.width += factor;
				imgElement.height += factor;
				imgElement.imgDelayID = window.setTimeout(imgElement.expand,30);
			}
			else
			{
				imgElement.width = imgElement.originalWidth*2;
				imgElement.height = imgElement.originalHeight*2;
				var tableElement = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
					showElements(tableElement);
				if(tableElement.getAttribute("pushdown") == "1") {
					tableElement.nextSibling.height = tableElement.offsetHeight+1;
				}
			}
		};
	imgElement.contract = function() 
		{
			var factor = Math.round(imgElement.height*.08);
			if(imgElement.width - factor > imgElement.originalWidth)
			{
				imgElement.width -= factor;
				imgElement.height -= factor;
				imgElement.imgDelayID = window.setTimeout(imgElement.contract,15);
			}
			else
			{
				imgElement.width = imgElement.originalWidth;
				imgElement.height = imgElement.originalHeight;							
				var parentTable = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
					parentTable.className = "mid-content-item gr_expandable";
				parentTable.parentNode.style.zIndex = 0;
				parentTable.nextSibling.height = "1";
			}
		};		
	imgElement.inited = true;
}
function showElements(element)
{
	var trElements = element.firstChild.childNodes;
	if(trElements[1].firstChild.firstChild.nodeName == "DIV")
		trElements[1].firstChild.firstChild.style.height = "";		
	for(var i=0;i<trElements.length;i++)
	{
		if(trElements[i].getAttribute("hideexp") == "1") {
			trElements[i].style.display = "none";
		}
		else
		{
			if(trElements[i].style.display == "none")
			{
				trElements[i].style.display = "";
				trElements[i].rehide = true;
			}
		}
	}
}
function hideElements(element)
{
	var trElements = element.firstChild.childNodes;
	if(trElements[1].firstChild.firstChild.nodeName == "DIV") {
		trElements[1].firstChild.firstChild.style.height = "5px";
	}
	for(var i=0;i<trElements.length;i++)
	{
		if(trElements[i].getAttribute("hideexp") == "1") {
			trElements[i].style.display = "";
		}
		if(trElements[i].rehide) {
			trElements[i].style.display = "none";
			}
	}
}

