﻿function showPnl(whichDiv) {
    // Toggle function
	if (document.getElementById(whichDiv).style.display == 'none') {
		document.getElementById(whichDiv).style.display = 'block';
	} else {
		document.getElementById(whichDiv).style.display = 'none';
	}
}

function showHeaderLink(whichLink, whichDiv) {
    // Toggle function
    if (document.getElementById(whichDiv).style.display == 'none') {
		document.getElementById(whichLink).setAttribute('className','butFold foldPlus');
	} else {
		document.getElementById(whichLink).setAttribute('className','butFold foldMin');
	}
}

function openPnl(whichLink, whichDiv, cssLink) {
    if( cssLink == "" ) cssLink = 'butFold foldMin';
    if( document.getElementById(whichLink) )
        document.getElementById(whichLink).setAttribute('className', cssLink);
    if( document.getElementById(whichDiv) )
        document.getElementById(whichDiv).style.display = 'block';
}

function hidePnl(whichLink, whichDiv, cssLink) {
    if( cssLink == "" ) cssLink = 'butFold foldPlus';
    if( document.getElementById(whichLink) )
        document.getElementById(whichLink).setAttribute('className', cssLink);
    if( document.getElementById(whichDiv) )
        document.getElementById(whichDiv).style.display = 'none';
}

function SetAutofocus(field, limit, next, evt)
{
  try{
     evt = (evt) ? evt : event;
     var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));

     if (charCode > 31 && field.value.length == limit){
         if( document.getElementById(next) ){
            document.getElementById(next).focus();
            
         }
     }
   } catch(err)
   {
   }
}
 function openHelpWindow(url) {
	    hlpwin = open(url, "", "scrollbars=1,width=500,height=450");
	    if (hlpwin != null && hlpwin.opener == null) {
		    hlpwin.opener = self;
	    }
    }
    
function expand(obj,id) {

    var divs = document.getElementsByTagName("div");
  
    for (var i = 0; i < divs.length;i++) 
    {
    
        var divid = divs[i].id;
        
        if (divid.indexOf("expand") > -1) 
        {
            var ctl = document.getElementById(divid);
            
            if (ctl.style) 
            {
                ctl.style.display = "none";
            }
          
        }
    }
    
    var ctl = document.getElementById("expand" + id);
 
        ctl.style.display = "block";
        obj.className = "minItem";
	return;
}

function expand2(id) {
    var ctl = document.getElementById("expand" + id);
    
    if(ctl){
        if(ctl.style){
            ctl.style.display = "block";
        }
    }
	return;
}

