/* Changed 8 June 05 printi(article) written 31 Jul 05 size of window
   Altered 21 Sep 05 with menus. 27 Oct 05 printi to cope with queries.
   31 Jan 05 new function. 28 Mar 06 new function cdel - confirm delete, dont
   yet understand how to use it! ans: you include onclick="return cdel(<text>)"
   on any <input type="submit" .... > button for deletion. cdel() altered
   its name to cmsg and added parameter 09 Apr 06. A few new routines for
   handling the [id] issue in lettform.php. Xtra parameter to fixartid
   12 Dec 06 Changed angle bracket <> to square bracket [] for ID SIGNOFF and 
   RECIPIENT 17 Dec 06
*/
function fixartid(website,TxFldName)
    { var aTex = '';
    document.doform.elements[TxFldName].focus();
    aTex = document.selection.createRange();
    var an = doform.letter_artix.value;
    var firstBit = '<a href="http://' + website + '/orig.php[ID]&article=';
    var nextBit = an + '">';
    var lastBit = '</a>';
    if ( aTex.text != '' ) aTex.text = firstBit + nextBit  + document.selection.createRange().text + lastBit;
    range = document.doform.elements[TxFldName].createTextRange();
    var m = range.moveStart("textedit");
    range.select();
    }
function cmsg(message)
    {
    return confirm(message);
    }
function SetSelectOptions(the_form, the_field, do_check)
    {
    var selectObject = document.forms[the_form].elements[the_field];
    var selectCount  = selectObject.length;
    for (var i=0; i<selectCount; i++)
        {
        selectObject.options[i].selected = do_check;
        }
    return true;
    }
function SetAllCheckBoxes(the_form, the_field, do_check)
    {
    if(!document.forms[the_form]) return;
    var objCheckBoxes = document.forms[the_form].elements[the_field];
    if(!objCheckBoxes) return;
    var countCheckBoxes = objCheckBoxes.length;
    if(!countCheckBoxes)
	objCheckBoxes.checked = do_check;
    else
	// set the check value for all check boxes
	    for(var i = 0; i < countCheckBoxes; i++)
		objCheckBoxes[i].checked = do_check;
    }
function reportpopup(mylink,windowname,wid,heigh)
	{
	if (! window.focus)return true;
	var href;
	x='width='+wid+',height='+heigh+',scrollbars=yes, top=1, left=1';
/*	x='width=1024, height=768, scrollbars=yes, top=1, left=1'; */
	if (typeof(mylink) == 'string')
	  href=mylink;
	else
	  href=mylink.href;
	window.open(href,windowname,x);
	return false;
	}
function npopup(param)
    {
    if(! window.focus) return true;
    window.open(param,"aletter","menubar=0,toolbar=0,personalbar=0,status=0,scrollbars=1,width=700,height=451");
    return;
    }
function printi(art)
    {
    var11="prfriendly.php?"+art;
    window.open(var11,"", "menubar=0,toolbar=0,personalbar=0,status=0,scrollbars=1,width=700,height=451");
    }
var jobsProd = false;
var jobsDev = false;

var wtW=500;
var wtO=[],wtP=[],wtA,wtT,wtTf;

function wtSet(m,cssclass) {
	if (document.getElementById&&document.createElement) {
		var m=document.getElementById(m);
		m.className=cssclass;
		var e,f,i,j;

		var e=m.firstChild;
		while (e) {
			if (e.tagName=='LI') {
				var div = document.createElement('div');
				while (e.firstChild) {
					div.appendChild(e.firstChild);
				}
				e.appendChild(div);
			}

			e=e.nextSibling;
		}
		var children = m.childNodes;
		e=m.getElementsByTagName('a');
		if (!wtTf) wtTf=new Function('wtHAT();');
		for (i=0;i<e.length;i++) {
			e[i].onmouseout=e[i].onblur=wtTf;
		}
		m = m.getElementsByTagName('ul');
		for (i=0;i<m.length;i++) {
			if (j=m[i].id) {
				wtO[j]=m[i];
				e=m[i].parentNode;
				f=e.parentNode.getAttribute('id');
				if (wtO[f]) {
					wtP[j]=f;
				}
				
				f = new Function('wtS(\''+j+'\');');
				e = e.getElementsByTagName('a');
				
				for (cspare=0;cspare<e.length;cspare++) {
					e[cspare].onmouseover=e[cspare].onfocus=f;
				}
				
				wtH(j);
			}
		}
	}
}

function wtHA() {
	if (wtA) {
		while (wtA) wtH(wtA);
		wtHE('visible');
	}
}

function wtHAT() {
	if (!wtT) wtT=setTimeout('wtHA();', wtW);
}

function wtTC() {
	if (wtT) {
		clearTimeout(wtT);
		wtT=null;
	}
}

function wtS(m) {
	wtTC();
	if (wtA) while (wtA&&m!=wtA&&wtP[m]!=wtA) wtH(wtA);
	else wtHE('hidden');

	wtSH(m,'visible');
	wtA=m;
}

function wtH(m) {
	if (m==wtA) wtA=wtP[m];
	wtSH(m,'hidden');
	wtT=null;
}

function wtSH(m,v) {
		wtO[m].parentNode.firstChild.className = v;	

	wtO[m].style.visibility = v;
}

function wtHE(v) {
	if(!(jobsProd || jobsDev))
	{
		wtHEV(v,document.getElementsByTagName('select'));
	}
}

function wtHEV(v,e) {
	for (var i=0;i<e.length;i++) e[i].style.visibility = v;
}
