// Toggle an element css (show/hide)
function toggle(objName) {
	var obj = MM_findObj(objName);
	if( obj ) {
		if ( obj.className == 'hide' ) {
			obj.className = 'show';
		}
		else 
		{
			obj.className = 'hide';
		}
	}
}

function confirmSumbit(theText)
{
	var agree=confirm("Are you sure you wish to" + theText +"continue?");
	if (agree)
		return true ;
	else
		return false ;
}

function showStyle(objName, style) {
	var obj = MM_findObj(objName);
	if( obj ) obj.className = style;
}

function show(objName) {
	var obj = MM_findObj(objName);
	if( obj ) obj.className = 'show';
}

function hide(objName) {
	var obj = MM_findObj(objName);
	if( obj ) obj.className = 'hide';
}

function setFocus(objName) {
	var obj = MM_findObj(objName);
	if( obj ) obj.focus();
}

// Control Height of DIV Elements
function setPanelHeight( panelName, newH ) {
	var obj = MM_findObj(panelName);
	if(obj) obj.style.height = newH+"px";
}

// Clear the value of the input
function clearValue(objName) {
	var obj = MM_findObj(objName);
	if( obj ) obj.value = '';
}

// Builds a String for Multiple Selections
function getMultiple(objName, targetObjName)
{
	var obj = MM_findObj(objName);
	if( obj ){
		var arSelected = new Array();
		var targetObj = MM_findObj(targetObjName);
		while (obj.selectedIndex != -1)
		{
			if (obj.selectedIndex != 0) arSelected.push(obj.options[obj.selectedIndex].value);
			obj.options[obj.selectedIndex].selected = false;
		}
		
		// If target defined save Items
		if(targetObj){
			targetObj.value = arSelected.join(",");
		}
    }
}

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_changeProp(objName, x, theProp, theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

//functions for navigation
var selectedMenu = null ;
var selectedSubMenu = null;

function showSub(obj)
{	
	// hide selected subnav
	if(selectedSubMenu != null) {
		var selSubObj = MM_findObj(selectedSubMenu);
		if(selSubObj) selSubObj.className = 'subnav';
	}
  
	var subNav = obj + 'Lvl2';		
	var subNavObj = MM_findObj(subNav);
	if(subNavObj) subNavObj.className = 'subnavShow';
	
	var nav = obj;
	var navObj = MM_findObj(nav);
	if(navObj) navObj.className = 'selected';
}

function hideSub(obj)
{
	// hide active sub nav
	var subNav = obj + 'Lvl2';
	var subNavObj = MM_findObj(subNav);
	if(subNavObj) subNavObj.className = 'subnav';
	

	//show selected subnav
	//var subNav = obj + 'Lvl2';		
	//if (selectedSubMenu != null) document.getElementById(selectedSubMenu).className = 'subnavShow';		
		
}