
	// Global variables
	xMousePos = 0; // Horizontal position of the mouse on the screen
	yMousePos = 0; // Vertical position of the mouse on the screen
	xMousePosMax = 0; // Width of the page
	yMousePosMax = 0; // Height of the page
	

    getBrowserType();
	
	
	
	if (document.layers) { // Netscape
	    document.captureEvents(Event.MOUSEMOVE);
	    document.onmousemove = captureMousePosition;
	} else if (document.all) { // Internet Explorer
		document.onmousemove = captureMousePosition;
	} else if (document.getElementById) { // Netcsape 6
	    document.onmousemove = captureMousePosition;
	}		
	
	function captureMousePosition(e) {
		var dc; //DRAG CONTAINER
		var ddiv; //DRAG HELPER DIV
		var activeCont = undefined; //STORES THE ACTIVE CONTAINER DIV
		
		ev = e || window.event;
	
		if (ev.pageX || ev.pageY) {
	        xMousePos = ev.pageX;
	        yMousePos = ev.pageY;
	        xMousePosMax = window.innerWidth+window.pageXOffset;
	        yMousePosMax = window.innerHeight+window.pageYOffset;		
		
		} else {
	        xMousePos = ev.x+document.body.scrollLeft;
	        yMousePos = ev.y+document.body.scrollTop;
	        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
	        yMousePosMax = document.body.clientHeight+document.body.scrollTop;		
		}

		return false;
		
	}
	
	
	
	
	
	
	function encodeEmailText (str) {
	var out = ''
	var ccode;


		for (var i=0;i<str.length;i++) {
			ccode = str.charCodeAt(i) + 1
			out += String.fromCharCode(ccode);
		}

		alert(out);
		
		
	}


	function decodeEmailText (str) {
	var out = '';
	var ccode;

		for (var i=0;i<str.length;i++) {
			ccode = str.charCodeAt(i) - 1
			out += String.fromCharCode(ccode);
		}	

		out = '<a href="mailto:' + out + '" class="slink" >' + out + '</a>';
		
		document.write(out);
		
	}
	
	
	
	
	
	
	function showInfo(str) {
	
		if (str.length > 0 ) {
			getObj('hinfo').style.top = (parseInt(yMousePos) + 10) + 'px';
			getObj('hinfo').style.left = (parseInt(xMousePos) - 205) + 'px';
			getObj('hinfo').innerHTML = str;
			
			getObj('hinfo').style.display = 'block';
			
		} else {
			getObj('hinfo').style.display = 'none';
		
		}

	}
	
	function hideInfo () {
		getObj('hinfo').style.display = 'none';
	}	
	
	
	function showFInfo(str) {
	
		if (str.length > 0 ) {
			getObj('finfo').style.top = (parseInt(yMousePos) + 10) + 'px';
			getObj('finfo').style.left = (parseInt(xMousePos) + 10) + 'px';
			getObj('finfo').innerHTML = str;
			
			getObj('finfo').style.display = 'block';
			
		} else {
			getObj('finfo').style.display = 'none';
		
		}

	}
	
	function hideFInfo () {
		getObj('finfo').style.display = 'none';
	}	
	
	
	
	
	
	
	function positionDiv (tDiv) {
		var t;

		var l = (xMousePosMax / 2) - (getObj(tDiv).offsetWidth / 2);					
		getObj(tDiv).style.left = parseInt(l);
		
		//getObj(tDiv).style.top = yMousePos / 2;
	
		//alert(window.innerHeight + ' ' + window.pageYOffset)
		
		//alert(getObj('docbody').offsetHeight)
		
		t = window.pageYOffset
		if (t == undefined) {t = document.body.scrollTop};

		getObj(tDiv).style.top = t
	
	
		//getObj(tDiv).style.top = (document.body.clientHeight / 4);
		
		
		
		//var t = (yMousePosMax / 2) - (getObj(tDiv).offsetHeight / 2);					
		//getObj(tDiv).style.top = parseInt(t);		

	}	
		
	
	function OLDpositionDiv (tDiv) {
	

		var l = (xMousePosMax / 2) - (getObj(tDiv).offsetWidth / 2);					
		getObj(tDiv).style.left = parseInt(l);
		
		getObj(tDiv).style.top = yMousePos;
	
		//getObj(tDiv).style.top = (document.body.clientHeight / 4);
		
		
		
		//var t = (yMousePosMax / 2) - (getObj(tDiv).offsetHeight / 2);					
		//getObj(tDiv).style.top = parseInt(t);		

	}	
			

//####################
//#### AJAX FUNCTIONS ####
//####################


	function sendRequestNoCallback (strURL) {
	
		createXMLHttp ()


		// POSTS DATA AND RETURNS DATA
		var refresh = Math.random();
		var str = "";
		
		if (strURL.lastIndexOf('?') != -1) {
			temp = "&";
		} else {
			temp = "?";
		}


		req.open('GET',strURL+temp+'r='+refresh);
		req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');		
		req.send(str);			
			
		return false;
	}	


	
	function sendRequest(strURL, tDiv) {
	
		document.body.style.cursor='wait';
	
		createXMLHttp ()

		targetDiv = tDiv;
		recenterScreen = 1;

		
		if (targetDiv == 'content') {
			curPage = strURL;
		}
		
		if (targetDiv != 'screen' && targetDiv.lastIndexOf('results') == -1 ) {
			getObj(targetDiv).style.top = yMousePos;
			getObj(targetDiv).style.left = xMousePos + 10;
			getObj(targetDiv).style.display = 'block';
		} else {
			//FADE OUT THE BACKGROUND
			//getObj('screenfade').style.display = 'block';
		}
		
		
	
		// POSTS DATA AND RETURNS DATA
		var refresh = Math.random();
		var str = "";
		
		if (strURL.lastIndexOf('?') != -1) {
			temp = "&";
		} else {
			temp = "?";
		}

		req.open('GET',strURL+temp+'r='+refresh);
		req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		
		req.onreadystatechange = handleResponse;
		req.send(str);			
		
		return false;
	}	
	
	function handleResponse () {
		if (req.readyState == 4) {		
			// RESPONSE LOADED
		
	        if (req.status == 200) {
	            // RESPONSE OK
				
				var response = req.responseText;
							
				//response = utf8decode(response);
				
				//alert(response.search(/!!!HIDESCREEN!!!/))
				
				if (response.search(/!!!HIDESCREEN!!!/) != -1) {
					// HIDE THE TARGET DIV - OCCURS AFTER SCREEN FORM SAVE
					hideScreen();
					
					//REFRESH THE PARENT SCREEN
					refreshParent();
				
				
				} else {
				
					getObj(targetDiv).innerHTML = response;

					//RUN ANY CODE IN SCRIPT TAGS
					parseScript(response);
					
					
					
					if (targetDiv == 'screen') {
						getObj(targetDiv).style.display = 'block';		
						
						if (recenterScreen == 1) {centerDiv(targetDiv)};
						
						focusFirstField (targetDiv);
						
						//getObj(targetDiv).desc.focus();
						
						//getObj(targetDiv).style.top = 60;
						
					}
					
					
					// CHECK FOR START AND STOP TIMER COMMANDS
					if (response.search(/!!!STARTITEMTIMER!!!/) != -1) {				
						startItemTimer()
					}					
					
				}
				
				document.body.style.cursor='default';
				
				//alert(xMousePosMax + ' ' + getObj(targetDiv).offsetWidth);
											
	        } else {
				// RESPONSE FAILED
	            alert("There was a problem contacting the server" +
	                req.statusText);
	        }		
		

		}
	}		
	
	
	function createXMLHttp () {
		req = false;
	    // branch for native XMLHttpRequest object
	    if(window.XMLHttpRequest) {
	    	try {
				req = new XMLHttpRequest();
	        } catch(e) {
				req = false;
	        }
	    // branch for IE/Windows ActiveX version
	    } else if(window.ActiveXObject) {
	       	try {
	        	req = new ActiveXObject("Msxml2.XMLHTTP");
	      	} catch(e) {
	        	try {
	          		req = new ActiveXObject("Microsoft.XMLHTTP");
	        	} catch(e) {
	          		req = false;
	        	}
			}
	    }
	}
	
	
	function parseScript(_source) {
	
		//RUNS JAVASCRIPT IN AJAX PAGE AFTER IT'S LOADED 
		var source = _source;
		var scripts = new Array();
		

		
		// Strip out tags
		while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
			var s = source.indexOf("<script");
			var s_e = source.indexOf(">", s);
			var e = source.indexOf("</script", s);
			var e_e = source.indexOf(">", e);
			
			// Add to scripts array
			scripts.push(source.substring(s_e+1, e));
			// Strip from source
			source = source.substring(0, s) + source.substring(e_e+1);
		}
		
		// Loop through every script collected and eval it
		for(var i=0; i<scripts.length; i++) {
			try {			
				eval(scripts[i]);
			}
			catch(ex) {
				// do what you want here when a script fails
			}
		}
		
		// Return the cleaned source
		return source;
	}	
	
	

	
	function focusFirstField (fObj) {
	
		f_setfocus(getObj('screenfrm'));
	
	}
	
	function f_setfocus( aForm )
		{
			if( aForm.elements[0]!=null) {
				var i;
				var max = aForm.length;
				for( i = 0; i < max; i++ ) {
					if( aForm.elements[ i ].type != "hidden" &&
						!aForm.elements[ i ].disabled &&
						!aForm.elements[ i ].readOnly ) {
						aForm.elements[ i ].focus();
						break;
					}
				}
			}
	}		
	
	
	
//#######################
//#### END AJAX FUNCTIONS ####
//#######################
	
	
	

	
	
	
	
	
	

	function toggleVis (objName) {
		temp = eval(getDocObject(objName))
		
		if (temp.style.display == 'none') {
			temp.style.display = 'block';
		} else {
			temp.style.display = 'none';
		}
	
	}
	
    function getBrowserType () {
    	if (navigator.userAgent.indexOf("Opera") != -1 && document.getElementById) browserType = "OP"; 
    	if (document.all) browserType = "IE"; 
    	if (document.layers) browserType = "NN"; 
    	if (!document.all && document.getElementById) browserType = "MO"; 
    }

	function changeClass (obj, newClass) {
		obj.className = newClass;
	}	

    function sort (strOrderBy){
	eval(getDocObject("orderby")).value = strOrderBy
	eval(getDocObject("button")).value = "Search"
	eval(getDocObject("presysion")).submit();
    } 

	
    function getObj(strObjectName) {
	var temp;

	var temp;

		temp = eval("document.all." + strObjectName)
		if (temp == undefined) {
			temp = eval("document." + strObjectName)
			if (temp == undefined) {
				temp = eval("document.getElementById('" + strObjectName + "')")
			}
		}	
	return temp;
    }	
	

    function getDocObject(strObjectName) {
	var temp;

	var temp;

		temp = "document.all." + strObjectName
		if (temp == undefined) {
			temp = "document." + strObjectName
			if (temp == undefined) {
				temp = "document.getElementById('" + strObjectName + "')"
			}
		}	
	return temp;
    }

	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}
	
	function changeImages() {
		if (document.images && (preloadFlag == true)) {
			for (var i=0; i<changeImages.arguments.length; i+=2) {
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}
	
	var preloadFlag = false;
	function preloadImages() {
		if (document.images) {
		
			nbannert1over = newImage("images/nbanner_t1_over.jpg");
			nbannert2over = newImage("images/nbanner_t2_over.jpg");
			nbannert3over = newImage("images/nbanner_t3_over.jpg");
			nbannert4over = newImage("images/nbanner_t4_over.jpg");
			nbannert5over = newImage("images/nbanner_t5_over.jpg");
			
			preloadFlag = true;
		}
	}

	function openwindow(url) {
		var screenwidth = window.screen.availWidth-10;
		var screenheight = window.screen.availHeight-50;
		var screenleft=(screen.width/2)-75;
		var screentop=(screen.height/2)-150;
		var params = 'left=' + screenleft + ',top=' + screentop + ',width=640,height=480,toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resize=yes,resizable=yes';
		var wind=window.open(url,'generalwindow',params);
	}	
	
	function openwindow2(url) {
		var screenwidth = window.screen.availWidth-10;
		var screenheight = window.screen.availHeight-50;
		var screenleft=(screen.width/2)-75;
		var screentop=(screen.height/2)-150;
		var params = 'left=' + screenleft + ',top=' + screentop + ',width=640,height=480,toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resize=yes,resizable=yes';
		var wind=window.open(url,'generalwindow2',params);
	}	


		function openwindow3(url) {
		var screenwidth = window.screen.availWidth-10;
		var screenheight = window.screen.availHeight-50;
		var screenleft=(screen.width/2)-75;
		var screentop=(screen.height/2)-150;
		var params = 'left=' + screenleft + ',top=' + screentop + ',width=630,height=480,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resize=yes,resizable=yes';
		var wind=window.open(url,'generalwindow3',params);
	}
	

	
	
	function changeImg (obj, str) {
		obj.src='images/' + str;
	}	
	
	
	
	
	function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
	{
	   var arVersion = navigator.appVersion.split("MSIE")
	   var version = parseFloat(arVersion[1])
	   if ((version >= 5.5) && (document.body.filters)) 
	   {
	      for(var i=0; i<document.images.length; i++)
	      {
	         var img = document.images[i]
	         var imgName = img.src.toUpperCase()
	         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	         {
	            var imgID = (img.id) ? "id='" + img.id + "' " : ""
	            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
	            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
	            var imgStyle = "display:inline-block;" + img.style.cssText 
	            if (img.align == "left") imgStyle = "float:left;" + imgStyle
	            if (img.align == "right") imgStyle = "float:right;" + imgStyle
	            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	            var strNewHTML = "<span " + imgID + imgClass + imgTitle
	            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
	            img.outerHTML = strNewHTML
	            i = i-1
	         }
	      }
	   }    
	}
	window.attachEvent("onload", correctPNG);
	
	
