var show_activ = 0;
var hide_activ = 0;

function getTipLayer(_index) {
	return document.getElementById('menu' + _index) || {style:{}};
}

function _showTip(_index) {
	_hideTips();
	getTipLayer(_index).style.display = 'block';
	document.getElementById("submenu").style.display = "none";		
}

function _hideTip(_index) {
	getTipLayer(_index).style.display = 'none';
	document.getElementById("submenu").style.display = "block";
	activ_hide = _index;
}

function _hideTips() {
	_hideTip(show_activ);
	show_activ = 0;      	
}

var _to = null;

function tipOver(_index) {
	if (_to) window.clearTimeout(_to);
        if (show_activ!=_index) _showTip(_index);
	show_activ = _index;
}

function tipOut(_index) {
	if (_to) window.clearTimeout(_to);
	_to = window.setTimeout('_hideTips()', 300);
}


function ext_popup(url,name,width,height,center,resize,scroll,posleft,postop) {
	if (posleft != 0) { x = posleft }
	if (postop  != 0) { y = postop  }
	if (!scroll) { scroll = 1 }
	if (!resize) { resize = 1 }
	if ((parseInt (navigator.appVersion) >= 4 ) && (center)) {
	  X = (screen.width  - width ) / 2;
	  Y = (screen.height - height) / 2;
	}
	if (scroll != 0) { scroll = 1 }
	var Win = window.open( url, name, 'width='+width+',height='+height+',top='+Y+',left='+X+',resizable='+resize+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no');
}


function showsub(id){
	if(document.getElementById(id).style.display=="none"){
		var t=document.getElementById(id).style.display="block";
	} else {
		var t=document.getElementById(id).style.display="none";
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openWindow(
	targetURL,
	windowName,
	top,
	left,
	width,
	height,
	withMenubar,
	withToolbar,
	withScrollbars,
	withStatusbar,
	withTitlebar,
	withHotkeys,
	isResizable,
	isAlwaysRaised,
	taskBarLocation,
	isDependent) {

  var retValue, strStyle;

  if ((withMenubar!='0') && (withMenubar!='1')) {
		withMenubar='0';
	};
	if ((withToolbar!='0') && (withToolbar!='1')) {
			withToolbar='0';
	};
	if ((withScrollbars!='0') && (withScrollbars!='1')&& (withScrollbars!='yes')&& (withScrollbars!='auto')) {
			withScrollbars='0';
	};
	if ((withStatusbar!='0') && (withStatusbar!='1')) {
			withStatusbar='0';
	};
	if ((withTitlebar!='0') && (withTitlebar!='1')) {
			withTitlebar='0';
	};
	if ((withHotkeys!='0') && (withHotkeys!='1')) {
			withHotkeys='0';
	};
	if ((isResizable!='0') && (isResizable!='1')) {
			isResizable='0';
	};
	if ((isAlwaysRaised!='0') && (isAlwaysRaised!='1')) {
			isAlwaysRaised='0';
	};
	if ((taskBarLocation!='0') && (taskBarLocation!='1')) {
			taskBarLocation='0';
	};
	if (((isDependent!='') && (isDependent!='dependent')) || (isDependent=='undefined')) {
			isDependent='dependent';
	};
  strStyle =
    'menubar=' + withMenubar +
    ',toolbar=' + withToolbar +
    ',scrollbars=' + withScrollbars +
    ',status=' + withStatusbar +
    ',width=' + width +
    ',height=' + height +
    ',top=' + top +
    ',left=' + left +
    ',titlebar=' + withTitlebar +
    ',resizable=' + isResizable +
    ',alwaysRaised=' + isAlwaysRaised +
    ',hotkeys=' + withHotkeys +
    ',location=' + taskBarLocation +
    ',\'' + isDependent + '\'';
  retValue = window.open(targetURL,windowName,strStyle);

  return retValue;
}

function popUp(targetURL, windowName, width, height) {
	var ret;
	ret=openWindow(
	targetURL,
	windowName,
	'0','0',width,height,
	'0',
	'0',
	'0',
	'0',
	'0',
	'0',
	'1',
	'0',
	'0',
	'dependent');
	return false;
}
