//function openDialogWin(Err,bC,EP)
//{var RV=OW("Message","800","400","","","no","no","no","no","no",UR,"modal");}

function OpenErrorWin(strName,iW,iH,TOP,LEFT,R,S,SC,T,TB,URL,TYPE,dArg)
{
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
//LEFT = screen.availWidth - (screen.availWidth - 150);
//screen.availWidth-10, screen.availHeight-10
if (TYPE=="modal" || TYPE=="modalIframe")
{
var sF=""
var _rv
sF+=T?'unadorned:'+T+';':'';
sF+=TB?'help:'+TB+';':'';
sF+=S?'status:'+S+';':'';
sF+=SC?'scroll:'+SC+';':'';
sF+=R?'resizable:'+R+';':'';
sF+=iW?'dialogWidth:'+iW+'px;':'';
sF+=iH?'dialogHeight:'+iH+'px;':'';
sF+=TOP?'dialogTop:'+TOP+'px;':'';
sF+=LEFT?'dialogLeft:'+LEFT+'px;':'';
if (TYPE=="modal")
{
	if (agt.indexOf("msie") > 0)
	{_rv=window.showModalDialog(URL,dArg?dArg:"",sF);}
}
else
{
var da=new Object()
da.w=iW;
da.h=iH;
da.url=URL;
_rv=window.showModalDialog('iframe.cfm?urlStr='+URL,da,sF);
}

if ("undefined" == typeof(_rv) )
{
var sF=""
sF += iW?'width='+iW+',':'';
sF+=iH?'height='+iH+',':'';
sF+=R?'resizable='+R+',':'';
sF+=S?'status='+S+',':'';
sF+=SC?'scrollbars='+SC+',':'';
sF+=T?'titlebar='+T+',':'';
sF+=TB?'toolbar='+TB+',':'';
sF+=TB?'menubar='+TB+',':'';
sF+=TOP?'top='+TOP+',':'';
sF+=LEFT?'left='+LEFT+',':'';
var HMW=window.open(URL?URL:'about:blank',strName?strName:'',sF);
if ( (document.window != null) && (!HMW.opener) )
HMW.opener=document.window;
HMW.focus();
}


if ("undefined" != typeof(_rv) )
return _rv;
}
else
{
var sF=""
sF += iW?'width='+iW+',':'';
sF+=iH?'height='+iH+',':'';
sF+=R?'resizable='+R+',':'';
sF+=S?'status='+S+',':'';
sF+=SC?'scrollbars='+SC+',':'';
sF+=T?'titlebar='+T+',':'';
sF+=TB?'toolbar='+TB+',':'';
sF+=TB?'menubar='+TB+',':'';
sF+=TOP?'top='+TOP+',':'';
sF+=LEFT?'left='+LEFT+',':'';
var HMW=window.open(URL?URL:'about:blank',strName?strName:'',sF);
if ( (document.window != null) && (!HMW.opener) )
HMW.opener=document.window;
HMW.focus();
}
}

function getWindowProperty(strName,iW,iH,TOP,LEFT,R,S,SC,T,TB,URL,TYPE,dArg)
{
var sF=""
sF += iW?'width='+iW+',':'';
sF+=iH?'height='+iH+',':'';
sF+=R?'resizable='+R+',':'';
sF+=S?'status='+S+',':'';
sF+=SC?'scrollbars='+SC+',':'';
sF+=T?'titlebar='+T+',':'';
sF+=TB?'toolbar='+TB+',':'';
sF+=TB?'menubar='+TB+',':'';
sF+=TOP?'top='+TOP+',':'';
sF+=LEFT?'left='+LEFT+',':'';
return sF;
}

function openNewWindow(URL,h,w) {
	if ('undefined' == typeof(h))
		h = 600;
	if ('undefined' == typeof(w))
		w = 600;
					//strName,iW,iH,TOP,LEFT,R,S,SC,T,TB,URL,TYPE,dArg
	//alert(getWindowProperty("regularPopup",w,h,"","","yes","no","yes","no","no",URL,"regular"));
	return(OpenErrorWin("regularPopup"+Math.round(Math.random()*1000000),w,h,"","","yes","no","yes","no","no",URL,"regular"));
	
}

function openNewWindowNoScroll(URL,h,w) {
	if ('undefined' == typeof(h))
		h = 600;
	if ('undefined' == typeof(w))
		w = 600;
					//strName,iW,iH,TOP,LEFT,R,S,SC,T,TB,URL,TYPE,dArg
	//alert(getWindowProperty("regularPopup",w,h,"","","yes","no","yes","no","no",URL,"regular"));
	return(OpenErrorWin("regularPopup"+Math.round(Math.random()*1000000),w,h,"","","no","no","no","no","no",URL,"regular"));
	
}

function Err(URL,bC,msg,title,h,w)
{
	if ('undefined' == typeof(h))
		h = 217
	if ('undefined' == typeof(w))
		w = 399
	if (URL=='')
		URL = '/confirmation.cfm?msg='+msg+'&title='+title+'&r='+Math.round(Math.random()*1000000);
	
	bC=bC?1:0;
	var RV=OpenErrorWin("Error",w,h,"","","no","no","no","no","no",URL,"modal");
	if ( !RV.help && !RV.url )
		return RV.state;
	if (RV.help)
		CPH(RV.help);
	if (RV.url)
	{
		if ('undefined' != typeof(DoSave) )
		DoSave(RV.url);
	else
		location.href=RV.url;
	}
}

    // Hide all layers first.
    function hideAllMenu()	{
		var divs = document.getElementsByTagName("div")
      	for (i = 0; i < divs.length; i++)
			if (divs[i].id.indexOf('d0') >= 0)
          	divs[i].style.display = 'none'
	}
    function ShowMenu(n)
    {
      var menu, arrowImg
	  menu = document.getElementById("menuD" + n);
	  // Determine if the menu is currently showing.
      if (menu.style.display == 'block')
      {
        // If it is showing, hide the menu and update the twisty image.
        menu.style.display = 'none'
      }
      else
      {
        // Show the menus and update their twisty images.
        i = 2
        while (n.length >= i)
        {		
		menu = document.getElementById("menuD" + n.substring(0, i));              
          arrowImg = eval("document.images['i" + n.substring(0, i) + "']")
          menu.style.display = "block"
          i += 2
        }
      }
    }
	hideAllMenu();
  	function ShowDiv(divID)
    {
    var menu
	menu = document.getElementById(divID);
    if (menu.style.display == 'block')
        menu.style.display = 'none'
	else
		menu.style.display = "block"
	}
	
function showCompDiv(prefix,id)
{
	var menu
	if ("undefined" == typeof(prefix) )
	  prefix = 'menuID';
	var divs = document.getElementsByTagName("div")
    for (i = 0; i < divs.length; i++){
		if (divs[i].id.indexOf(prefix) >= 0){
			if (divs[i].id.indexOf(prefix+id) == 0)
    	      	divs[i].style.display = 'block'
			else
			  	divs[i].style.display = 'none'
		}
	}
}
