document.write("<div id='tagbox' style='position:absolute;top:0;left:0;visibility:hidden;z-index:100'><table class='tag' cellpadding=0 cellspacing=0><td id='tagtext'></td></table></div>");

function tag(obj, text, offx, offy){ 		
	var x = findPosX(obj);
	var y = findPosY(obj);
	if(offx) x = x + offx;
	if(offy) y = y + offy;

	if(obj.src.match(/disabled/)){
	} else {
		obj.style.cursor = 'pointer';
	}
	 
 	document.getElementById('tagtext').innerHTML = "&nbsp;"+ text + "&nbsp;";
 	document.getElementById('tagbox').style.visibility = 'visible';
 	document.getElementById('tagbox').style.top = y+'px';
 	document.getElementById('tagbox').style.left = x+'px';
}	

function tagHide(){
	document.getElementById('tagbox').style.visibility = 'hidden';
}

function noOp(){
}

function quit(){
	self.close();
}

var alertmsg = '';
function checkAlert(){
	if(alertmsg.length > 0){
		alert(unescape(alertmsg));
	}
	
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}


// from www.ditchnet.org ( ajax-freakshow-drag-n-drop events-2)

function windowLoaded(evt) {
    // prevent IE text selection while dragging!!!
    // Little-known trick!
    document.body.ondrag = function () { return false; };
    document.body.onselectstart = function () { return false; };
}

function setOpacity(node,val) {
    if (node.filters) {
        try {
            node.filters['alpha'].opacity = val*100;
        } catch (e) { }
    } else if (node.style.opacity) {
        node.style.opacity = val;
    }
}


function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function hiliteNav(obj){
	switch(obj.className){
	case 'navmenu':
		obj.className = 'navmenu2'; return;
	}
}

function unhiliteNav(obj){
	switch(obj.className){
	case 'navmenu2':
		obj.className = 'navmenu'; return;
	}
}

var prev_nav = null;
var prev_td = null;
function toggleNav(obj){
	if(prev_td){
		prev_td.className = 'whitetext';
		prev_nav.className = 'nav';
	}
	
	var link = document.getElementById(obj.id + '_');
	link.className = 'nav3';
	prev_nav = link;
	obj.className = 'hotnav';	
	prev_td = obj;
	obj.blur();
}

var prev_row = null; 
var prev_class = '';

function hilight(obj){
	if(prev_row){
		document.getElementById(prev_row.id).className = prev_class;
		if(prev_row == obj){
			prev_row = null;
			return;
		}	
	}
	
	prev_row = obj;
	prev_class = obj.className;
	document.getElementById(prev_row.id).className = 'highlight_yellow';

}

function jsReLight(id){
	//alert(id);
	var obj = document.getElementById(id);
	prev_row = null;
	hilight(obj);
}

function check_popupBlocker(){
	window.status ='checking for popup blockers';
	w = 10;
	h = 10;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var properties = "scrollbars=yes,resizable=yes,height="+h+",width="+w+",top="+TopPosition+",left="+LeftPosition;
	var oWin = window.open('../common/popup_check.html','_blank',properties);
	
	if(!oWin){
		alert('This site uses popup windows. Please disable your popup blocker.') 
	} else {
		oWin.close();
	}
}

function setScroll(formname){
	if(document.getElementById('inpanel')){
		var offset = document.getElementById('inpanel').scrollTop;
		//alert('setting scroll to '+offset+ ' form '+formname);
		eval("document.myform.scroll.value="+offset+";");
	}	
}

function resetScroll(n){
//alert('resetScroll to '+n);
	if(document.getElementById('inpanel')){
		window.status = "resetScroll to " + n;
		document.getElementById('inpanel').scrollTop = n;
	}	
}