//This will draw a silly white box with a blue border beneath whatever tab you hand it.
// The function "_g()" is part of the core application that replaces getElementById

function myshow(tgt){
	if (document.getElementById(tgt)) {	
		if(!window.current==false){
			kill();
			hide(window.current);
		}
		window.current = tgt;
		document.getElementById(tgt).style.visibility='visible';
	}
}//myshow
function showDrop(tgt){
	//disable('PQF'); //debug
	toggleSelect('hidden');
	myshow(tgt);

}//showDrop;

var closeTime = 0;
function hideDrop(tgt){
//	if (navigator.appVersion.indexOf('MSIE') > 0){ // set drop removal delay only for IE
//			closeTime = setTimeout(function(){
//			myhide(tgt);
//			},2700);
//		}
//	else {
		myhide(tgt);
//	}
	//enable('PQF');//debug
	toggleSelect('visible');
}//showDrop
function myhide(tgt){
	if (document.getElementById(tgt)) {	
	document.getElementById(tgt).style.visibility='hidden';
	}
}//myhide
function disable(tgt){
	if (document.getElementById(tgt)) {	
		document.getElementById(tgt).disabled = true;
	}
}//disable
function enable(tgt){
	if (document.getElementById(tgt)) {	
		document.getElementById(tgt).disabled = false;
	}
}//enable
function toggleSelect(state){
	if (navigator.appVersion.indexOf('MSIE') > 0){ // disable Select box only for IE
		var selects = document.getElementsByTagName('select');
		for (var i = 0; i <selects.length; i++){
			selects[i].style.visibility = state;
		}
	}
}//toggleSelect
function addBox(context2, a, ename, bname, box, ieoffsettabon, ieoffsettaboff){
			toggleSelect('hidden'); // for the top tab. 
        if(!_g(bname)){
       		var newThing = document.createElement('div');
	        newThing.id=bname;
			newThing.className='dlist';
			_g(ename).parentNode.appendChild(newThing);
			document.getElementById(bname).style['z-index']= '1001';
//if (navigator.appVersion.indexOf('Safari') > 0) {
				//var b_dd = '<div onmouseover="showDrop(\''+bname+'\')"; onmouseout="hideDrop(\''+bname+'\')";  id="gcgdd_holder"><div id="safarimenu_childb1">';  
				//} else {
				var b_dd = '<div onmouseover="showDrop(\''+bname+'\')"; onmouseout="hideDrop(\''+bname+'\')";  id="gcgdd_holder"><div id="tabmenu_child">';  
				//}
//				b_dd+='<div style="margin-top:-1px; font-size:0px; height:1px; width 100%; border-top-width: 1px;border-top-style: solid;border-top-color: #ffffff;"></div><div style="margin-top:-1px;font-size:0px; height:1px; border-top-width: 1px;border-top-style: solid;border-top-color: #F29C2E;"></div>';
            var alength = box.length;
			for (i = 0;(i < alength); i++) {
				if (box[i][0]=='LINE') {
					b_dd+='<div class="dd_divider">&nbsp;</div>';
				}
				else {
				b_dd+='<a href="'+box[i][1]+'"><span>'+box[i][0].replace(/<br *\/*>/gi, ' ')+'</span></a>\n';
				}
				}
//    		b_dd+='<div style="font-size:0px; height:1px; width 100%; border-top-width: 1px;border-top-style: solid;border-top-color: #cccccc;"></div></div></div>';
    		b_dd+='</div></div>';
			_g(bname).style.visibility='visible';
			
			toggleSelect('hidden');
			
			_g(bname).innerHTML = b_dd;
			}
			else{
				_g(bname).style.visibility=a;
        }	
}//addbox

function pr_overbox(context2, ename, bname, box, ieoffsettabon, ieoffsettaboff) {
		clearTimeout(closeTime);
	    addBox(context2, 'visible', ename, bname, box, ieoffsettabon, ieoffsettaboff);
	
}//pr_overbox

function pr_outbox(ename, bname) {
	    addBox(null,'hidden', ename, bname, null, null, null, null);
			toggleSelect('visible');
}//pr_outbox
