﻿function openClose(theID) {
var divNum = new Array("Nabi","Sahabah","Ulama"); 
  for(var i=0; i < divNum.length; i++) {
    if (divNum[i] == theID) {
      if (document.getElementById(divNum[i]).style.display == "block") { document.getElementById(divNum[i]).style.display = "none" }
      else {
        document.getElementById(divNum[i]).style.display = "block"
      }
  } else {
    document.getElementById(divNum[i]).style.display = "none"; }
  }
}

function HelpWindow(mypage ) {
var winl = 50;
var wint = (screen.height - 400) / 2;
var basepage= 'http://e-malabari.net/gsemua.htm'
winprops = 'height= 200,width= 400,top='+wint+',left='+winl+',scrollbars= yes,resizable=no'
win = window.open(mypage, 'menu', winprops)


win.document.close();
}


function NewWindow(mypage ) {
var winl = 50;
var wint = (screen.height - 400) / 2;
var basepage= mypage;
winprops = 'height= 400,width= 600,top='+wint+',left='+winl+',scrollbars= yes,resizable'
win = window.open(mypage, 'menu', winprops)
}

function NewWindow1(mypage ) {
var winl = 50;
var wint = (screen.height - 400) / 2;
var basepage= 'http://e-malabari.net/gsemua.htm'
winprops = 'height= 400,width= 700,top='+wint+',left='+winl+',scrollbars= yes,resizable'
win = window.open("", 'menu', winprops)
 win.document.open();

if (parseInt(navigator.appVersion) >= 4) { win.window.focus();}
win.document.write("<html><head><title>e-Malabari Network</title></head>",
	"<frameset rows=\"85,*\" framespacing=\"0\" border=\"0\" frameborder=\"0\">\n",
   "<frame name=\"gmenu\" src=\"http://e-malabari.net/gmenu.htm\" scrolling=\"no\" target=\"_self\">\n",
 "<frameset cols=\"160,*\">\n",
 "<frame name=\"gref\" target=\"gala\" src=\"http://e-malabari.net/cgi-bin/related.pl?cont=",
mypage,
 "\" scrolling=\"auto\">\n",
"<frame name=\"gala\" src=\"",mypage,"\" target=\"footnotes\" >\n",
   "</frameset><noframes> <body> </body> </noframes></html>");


win.document.close();
}


function changeurl(mypage)
{
parent.dalam.location.href=mypage

}

if(!window.Node){
  var Node = {ELEMENT_NODE : 1, TEXT_NODE : 3};
}

function checkNode(node, filter){
  return (filter == null || node.nodeType == Node[filter] || node.nodeName.toUpperCase() == filter.toUpperCase());
}

function getChildren(node, filter){
  var result = new Array();
  var children = node.childNodes;
  for(var i = 0; i < children.length; i++){
    if(checkNode(children[i], filter)) result[result.length] = children[i];
  }
  return result;
}

function getChildrenByElement(node){
  return getChildren(node, "ELEMENT_NODE");
}

function getFirstChild(node, filter){
  var child;
  var children = node.childNodes;
  for(var i = 0; i < children.length; i++){
    child = children[i];
    if(checkNode(child, filter)) return child;
  }
  return null;
}

function getFirstChildByText(node){
  return getFirstChild(node, "TEXT_NODE");
}

function getNextSibling(node, filter){
  for(var sibling = node.nextSibling; sibling != null; sibling = sibling.nextSibling){
    if(checkNode(sibling, filter)) return sibling;
  }
  return null;
}
function getNextSiblingByElement(node){
        return getNextSibling(node, "ELEMENT_NODE");
}

// Menu Functions & Properties



function showMenu() {

  if(activeMenu){
    activeMenu.className = "";
    getNextSiblingByElement(activeMenu).style.display = "none";
  }
  if(this == activeMenu){
    activeMenu = null;
  } else {
    this.className = "active";
    getNextSiblingByElement(this).style.display = "block";
    activeMenu = this;
	setCookie("menu",this.id)
  }
  return false;
}
function showMenuStart(acti) {



    acti.className = "active";
    getNextSiblingByElement(acti).style.display = "block";
activeMenu = acti;
  
  return false;
}
function setCookie(c_name,value)
{
document.cookie=c_name+ "=" + escape(value);
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return null;
}

var activeMenu=null;
if(document.createElement) window.onload = initMenu;




function initMenu(){
  do_onload()
  var menus, menu, text, a, i,ak ,j, menunam;
  menus = getChildrenByElement(document.getElementById("menu"));
  j=0;
  menunam = 'menunum'+j;
  for(i = 0; i < menus.length; i++){
    menu = menus[i];
    text = getFirstChildByText(menu);
    a = document.createElement("a");
    menu.replaceChild(a, text);
    a.appendChild(text);
    a.href = "#";
	a.id = menunam;
    a.onclick = showMenu;
    a.onfocus = function(){this.blur()};
	j=j+1;
	menunam = 'menunum'+j;
  }
var activeMenu = getObject(getCookie('menu'));
if (activeMenu){showMenuStart(activeMenu);}

}



// this is for the language 



function do_onload(){

var alltags=document.getElementsByTagName("*")
totm=getElementbyClass(alltags, "Malay")
tote=getElementbyClass(alltags, "English")
toty=getElementbyClass(alltags, "Myalam")
totj=getElementbyClass(alltags, "Jawi")
genap=getElementbyClass(alltags, "even")
ganjil=getElementbyClass(alltags, "odd")
expandmalay()

showit()
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}


function expandMyalam(){
var inc=0
while (toty[inc]){
toty[inc].style.display="block"
inc++
}
inc=0
while (totm[inc]){
totm[inc].style.display="none"
inc++
}
inc=0
while (totj[inc]){
totj[inc].style.display="none"
inc++
}

inc=0
while (tote[inc]){
tote[inc].style.display="none"
inc++
}

inc=0
while (genap[inc]){
genap[inc].style.backgroundColor='#000000'
inc++
}
inc=0
while (genap[inc]){
ganjil[inc].style.backgroundColor='#000000'
inc++
}
}

function expandJawi(){
var inc=0
while (totm[inc]){
totm[inc].style.display="none"
inc++
}

inc=0
while (toty[inc]){
toty[inc].style.display="none"
inc++
}

inc=0
while (totj[inc]){
totj[inc].style.display="block"
inc++
} 

inc=0
while (tote[inc]){
tote[inc].style.display="none"
inc++
}

inc=0
while (genap[inc]){
genap[inc].style.backgroundColor='#000000'
inc++
}
inc=0
while (genap[inc]){
ganjil[inc].style.backgroundColor='#000000'
inc++
}
}

function expandEnglish(){
var inc=0
while (totm[inc]){
totm[inc].style.display="none"
inc++
}

inc=0
while (toty[inc]){
toty[inc].style.display="none"
inc++
}

inc=0
while (totj[inc]){
totj[inc].style.display="none"
inc++
} 

inc=0
while (tote[inc]){
tote[inc].style.display="block"
inc++
}

inc=0
while (genap[inc]){
genap[inc].style.backgroundColor='#000000'
inc++
}
inc=0
while (genap[inc]){
ganjil[inc].style.backgroundColor='#000000'
inc++
}
}

function expandmalay(){
var inc=0
while (tote[inc]){
tote[inc].style.display="none"
inc++
}
inc=0
while (toty[inc]){
toty[inc].style.display="none"
inc++
}
inc=0
while (totj[inc]){
totj[inc].style.display="none"
inc++
}

inc=0
while (totm[inc]){
totm[inc].style.display="block"
inc++
}
inc=0
while (genap[inc]){
genap[inc].style.backgroundColor='#000000'
inc++
}
inc=0
while (genap[inc]){
ganjil[inc].style.backgroundColor='#000000'
inc++
}


}

//window.onload=do_onload

// ini nak tujar gambar

ie4 = (document.all)? true:false
var ie4 = false; if(document.all) { ie4 = true; }


function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId); 
 if (lText == '+') { link.innerHTML = '−'; d.style.display = 'block'; }
 else { link.innerHTML = '+'; d.style.display = 'none'; } }
function showhide(link, divId, status) { var lText = link.innerHTML; var d = getObject(divId); 
 if (status == 'show') { link.innerHTML = '−'; d.style.display = 'block'; }
 else { link.innerHTML = '+'; d.style.display = 'none'; } }


function showit() {
if (ie4) {blinking.style.visibility = "visible"}
setTimeout("hideit()",1000)
}

function hideit() {
if (ie4) {blinking.style.visibility = "hidden"}
setTimeout("showit()",500)
}

 
function toggleone(linkId, divId) { 
	if(linkId=='Da1'){MakeBlack('Da1');}else{MakeGrey('Da1');}
	if(linkId=='Da2'){MakeBlack('Da2');}else{MakeGrey('Da2');}
	if(linkId=='Da3'){MakeBlack('Da3');}else{MakeGrey('Da3');}
	if(linkId=='Da4'){MakeBlack('Da4');}else{MakeGrey('Da4');}
	if(linkId=='Da5'){MakeBlack('Da5');}else{MakeGrey('Da5');}
	
	if(divId=='D1'){MakeAppear('D1',true);}else{MakeAppear('D1',false);}
	if(divId=='D2'){MakeAppear('D2',true);}else{MakeAppear('D2',false);}
	if(divId=='D3'){MakeAppear('D3',true);}else{MakeAppear('D3',false);}
	if(divId=='D4'){MakeAppear('D4',true);}else{MakeAppear('D4',false);}
	if(divId=='D5'){MakeAppear('D5',true);}else{MakeAppear('D5',false);}
	
	}
	
function togglerecipe(linkId, divId) { 
	if(linkId=='mrec'){MakeColor('mrec','#FFCC99');}else{MakeColor('mrec','#FF9428');}
	if(linkId=='mind'){MakeColor('mind','#FFCC99');}else{MakeColor('mind','#FF9428');}
	if(linkId=='mcal'){MakeColor('mcal','#FFCC99');}else{MakeColor('mcal','#FF9428');}
		
	if(divId=='rec'){MakeAppear('rec',true);}else{MakeAppear('rec',false);}
	if(divId=='ind'){MakeAppear('ind',true);}else{MakeAppear('ind',false);}
	if(divId=='cal'){MakeAppear('cal',true);}else{MakeAppear('cal',false);}
	
	}
	
	//var dd = getObject(linkId) ; var d = getObject(divId);
 
 	//if ( dd.style.bgColor  == '#333333') { dd.style.backgroundColor  = '#000000';dd.style.bgColor  = '#000000'; d.style.display = 'block'; }
 	//else { dd.style.backgroundColor = '#333333'; dd.style.bgColor = '#333333';d.style.display = 'none'; }}
function MakeColor(liId,color)
	{getObject(liId).style.backgroundColor = color;}
	

function MakeGrey(liId)
	{getObject(liId).style.backgroundColor = '#000000';}
function MakeBlack(liId)
	{getObject(liId).style.backgroundColor = '#333333';}
	
function MakeAppear(dId,bool)
{if(bool==true){ getObject(dId).style.display = 'block';   }else{ getObject(dId).style.display = 'none';   }}
 
 