/*____________________________________________________________________________________________________________ */
/*
 | Browser object
 */
function b3kb_Browser() {
 d=document;
 this.agt=navigator.userAgent.toLowerCase();
 this.major = parseInt(navigator.appVersion);
 this.dom=(d.getElementById)?1:0; // true for ie6, ns6
 this.ns=(d.layers);
 this.ns4up=(this.ns && this.major >=4);
 this.ns6=(this.dom&&navigator.appName=="Netscape");
 this.op=(window.opera? 1:0);
 this.ie=(d.all);
 this.ie4=(d.all&&!this.dom)?1:0;
 this.ie4up=(this.ie && this.major >= 4);
 this.ie5=(d.all&&this.dom);
 this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
 this.mac=(this.agt.indexOf("mac")!=-1);
}

var oBw = new b3kb_Browser();

/* begin new */
function b3kb_getX(o) { return (oBw.ns)?o.left:((o.style.pixelLeft)?o.style.pixelLeft:o.offsetLeft); }
function b3kb_setX(o,x) {
	if(oBw.ns) { 
		o.left=x;
	} else if(typeof o.style.pixelLeft != 'undefined') {
		o.style.pixelLeft=x+20;
	} else {
		thisPos = parseInt(x);			// preventing NS UNcaught Exception Error in strict.dtd mode: converting value to integer in case passed as string
		thisPos += "px";
		o.style.left = thisPos;
	}
}
function b3kb_getY(o) { return (oBw.ns)?o.top:((o.style.pixelTop)?o.style.pixelTop:o.offsetTop); }
function b3kb_setY(o,y) {
	if(oBw.ns) {
		alert("ns");
		o.top=y;
	} else if(typeof o.style.pixelTop != 'undefined') {
		o.style.pixelTop=y+10;
	} else {
		thisPos = parseInt(y);			// preventing NS UNcaught Exception Error in strict.dtd mode: converting value to integer in case passed as string
		thisPos += "px";
		o.style.top = thisPos;
	}
}
function b3kb_getPageX(o) { var x=0; if(oBw.ns) x=o.pageX; else { while(eval(o)) { x+=o.offsetLeft; o=o.offsetParent; } } return x; }
function b3kb_getPageY(o) { var y=0; if(oBw.ns) y=o.pageY; else { while(eval(o)) { y+=o.offsetTop; o=o.offsetParent; } } return y; }
function b3kb_getZ(o) { return (oBw.ns)?o.zIndex:o.style.zIndex; }
/* end new */

function b3kb_moveTo(o,x,y) { b3kb_setX(o,x);b3kb_setY(o,y); }
function b3kb_moveBy(o,x,y) { b3kb_setX(o,b3kb_getPageX(o)+x);b3kb_setY(o,b3kb_getPageY(o)+y); }

/*____________________________________________________________________________________________________________ */
/* untuk menu Calendars*/
objMenuPopUp = null;
function b3k_popLayer(div,href,offx,offy) {
	var e = d.getElementById(div);
	if (e.className.indexOf('hiddenlayer') != -1) {
		// if current popup is hidden, make sure all others are hidden.
		b3k_hidePopLayers('div','showlayer','hiddenlayer');	
		b3k_setLayerLocation(div,href,offx,offy);		
		e.className = 'showlayer'; //show layer	
	} else {
		clearTimeout(objMenuPopUp);
	}
}

function b3k_hideLayer(div) {
	var e = d.getElementById(div);
	if (e.className.indexOf('showlayer') != -1) {
		e.className = 'hiddenlayer';		
	} 
	MM_displayStatusMsg('');
}

function b3k_DelayPopup(div){
	objMenuPopUp = setTimeout("b3k_hideLayer('"+div+"')",500);
}

function b3k_ClearTimeOut(){
	clearTimeout(objMenuPopUp);
}

function b3k_hidePopLayers(elm,showclass,hideclass) {
	var elms = d.getElementsByTagName(elm);
	for (var i =  elms.length-1; i >=0; i--)	{
		if (elms[i].className.indexOf(showclass) != -1)	{
			// if a class contains 'showclass' set to 'hideclass'
			elms[i].className = hideclass;
		}
	}
}

function b3k_setLayerLocation(div,href,offx,offy) {
//alert(div,href.name);
	var e = d.getElementById(div);
	//get position of link
	var x=b3kb_getPageX(href);
	var y=b3kb_getPageY(href);
	// check and set there is offset
	x= offx ? x + offx : x;
	y= offy ? y + offy : y;
	//move layer
	b3kb_moveTo(e,x,y);
}