// contents Copyright (c) 2002-2004 InContact Systems Inc.
//10aug05 jah
//19jul05 jah
//07sep04 jah
//17jun04 jah
if(!window.Node){
//for dhtml menus
var Node={ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3,
COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_FRAGMENT_NODE: 11}
}
function advSwitch(){
if (document.getElementById('advButton').value == 'Advanced'){
document.getElementById('advBlock').style.display='block';
document.getElementById('advButton').value = 'Collapse'}
else{
document.getElementById('advBlock').style.display='none';
document.getElementById('advButton').value = 'Advanced'}
}
var optionLabel;
function optionSwitch(){
if (document.getElementById('optionButton').value == 'Comments'){
document.getElementById('optionBlock').style.display='none';
document.getElementById('cmntBlock').style.display='block';
document.getElementById('optionButton').value = optionLabel}
else{
document.getElementById('cmntBlock').style.display='none';
document.getElementById('optionBlock').style.display='block';
document.getElementById('optionButton').value = 'Comments'}
}
function replhtml(nodeid, newhtml){
var parentnode=document.getElementById(nodeid);
var childnode=parentnode.childNodes;
var nodecnt=childnode.length;
for(var i=nodecnt-1;i>=0;i--){parentnode.removeChild(childnode[i])}
parentnode.innerHTML='<b class="pgd">'+newhtml+'</b>';
}
function initCap(str){
var temp; var arr = str.split(/\s+/g);
for (i = 0 ; i < arr.length ; i ++ ) {
temp = arr[i].toLowerCase();
if (i == 0 || !(temp == 'a' || temp == 'of' || temp == 'and' || temp == 'or' || temp == 'the' || temp == 'for')){
arr[i] = temp.charAt(0).toUpperCase() + temp.substring(1)}
else {arr[i] = temp}
}
return arr.join(' ');
}
function helpsrch(){
return popUp3('/util/help_message.asp?h=search_tips','width=700,height=500,left=0,top=0','mu_help_window');
}
function popsrch(page, feat, width, height, left, top, win){
if (!width) width = '660';
if (!height) height = '400';
if (!left) left = '100';
if (!top) top = '50';
if (!win) win = '';
var features = 'width='+width+',height='+height+',left='+left+',top='+top;
if (feat) features = features+','+feat;
var page2=page;
if (page.toLowerCase().substring(0,4) != 'http') page2 = '/util/' + page
return popUp3(page2,features,'mu_search_win'+win);
}
function poppreview(datafield, td){
var newwin = popUp3("", "top=50,left=50,hotkeyes=no,Height=300,Width=400,resizable=yes", "mu_preview_win");
newwin.document.open();
newwin.document.writeln("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>");
newwin.document.writeln("<html><head><title>Preview HTML</title>");
newwin.document.writeln(cssnames);
newwin.document.writeln("</head><body>");
newwin.document.writeln("<table><tr>");
if (td == 'yes') newwin.document.write("<td>");
newwin.document.writeln(datafield.value);
if (td == 'yes') newwin.document.write("</td>");
newwin.document.writeln("</tr></table></body></html>");
newwin.document.close();
return newwin;
}
var muglobalwin;
function popUp3(URL, winFeat, winName) {
var availL, availT, testit, winH, winW;
if (!(URL)) URL = "";
if (!(winFeat)) winFeat = "";
if (!(winName)) winName = "_blank";
availL = (screen.availLeft) ? screen.availLeft :
	Math.floor((screen.width - screen.availWidth) / 2);
availT = (screen.availTop) ? screen.availTop :
	Math.floor((screen.height - screen.availHeight) / 2);
if (winFeat.search(/scrollbars/i) == -1) {
   if (winFeat.length != 0) winFeat += ",";
   winFeat += "scrollbars=yes";
}
if (winFeat.search(/resizable/i) == -1)
   winFeat += ",resizable=yes";
testit = winFeat.match(/height=(\d+)/i);
if (testit) {
   if (testit[1] > screen.availHeight) {
		winH = screen.availHeight;
		winFeat = winFeat.replace(/height=(\d+)/i, "height=" + winH);
	}
	else { if (testit[1] < 50) {
		winH = Math.floor(screen.availHeight * 2 / 3);
		winFeat = winFeat.replace(/height=(\d+)/i, "height=" + winH);
		}
		else
		winH = Number(testit[1]);
	}
}
else {
	winH = Math.floor(screen.availHeight * 2 / 3);
	winFeat += ",height=" + winH;
}
testit = winFeat.match(/width=(\d+)/i);
if (testit) {
   if (testit[1] > screen.availWidth) {
		winW = screen.availWidth;
		winFeat = winFeat.replace(/width=(\d+)/i, "width=" + winW);
	}
	else { if (testit[1] < 50) {
		winW = Math.floor(screen.availWidth * 2 / 3);
		winFeat = winFeat.replace(/width=(\d+)/i, "width=" + winW);
		}
		else
		winW = Number(testit[1]);
	}
}
else {
	winW = Math.floor(screen.availWidth * 2 / 3);
	winFeat += ",width=" + winW;
}
testit = winFeat.match(/top=(\d+)/i);
if (testit) {
   if (Number(testit[1]) + winH > screen.availHeight) {
		winFeat = winFeat.replace(/top=(\d+)/i, "top=" +
			(screen.availHeight + availT - winH));
	}
}
else {
   winFeat += ",top=" + Math.floor((screen.availHeight -
		 winH) / 2 + availT);
}
testit = winFeat.match(/left=(\d+)/i);
if (testit) {
   if (Number(testit[1]) + winW > screen.availWidth) {
		winFeat = winFeat.replace(/left=(\d+)/i, "left=" +
			(screen.availWidth + availL - winW));
	}
}
else {
   winFeat += ",left=" + Math.floor((screen.availWidth -
		winW) / 2 + availL);
}
muglobalwin = window.open(URL, winName, winFeat);
if (muglobalwin.opener==null)muglobalwin.opener=self;
setTimeout('muglobalwin.focus()',250);
return muglobalwin;
}

function minSet(){
var cw,w,pl,pr,ml,mr,br,bl,ad;

var g=document.getElementById('div-wrap');w=770;
if(g&&document.body&&document.body.clientWidth){gs=g.currentStyle;
cw=parseInt(document.body.clientWidth);pl=parseInt(gs.paddingLeft);
pr=parseInt(gs.paddingRight);ml=parseInt(gs.marginLeft);mr=parseInt(gs.marginRight);
bl=parseInt(gs.borderLeftWidth);br=parseInt(gs.borderRightWidth);ml=ml?ml:0;
mr=mr?mr:0;pl=pl?pl:0;pr=pr?pr:0;bl=bl?bl:0;br=br?br:0;ad=pl+pr+ml+mr+bl+br;
if(cw<=w){w-=ad;g.style.width=w+"px";}else{g.style.width="auto";}}}

if(document.getElementById&&navigator.appVersion.indexOf("MSIE")>-1&&!window.opera){
if(window.attachEvent){window.attachEvent("onresize",minSet);window.attachEvent("onload",minSet);}
else{onload=minSet;onresize=minSet;}}

function dbmgotomenu(){
switch(document.dbmmenu.menu.value){
case '-1':{location.href='main.asp';break}
case '-2':{location.href='index_a.asp?exec=end';break}
default:location.href='menu.asp?id='+document.dbmmenu.menu.value
}}

function dbmgotocmenu(){
location.href=document.dbmmenu.cmenu.value
}