// JavaScript Document

/** jump to the url selected from combobox */
function jump(component) {
		if (component.options[component.selectedIndex].value != '')  {
			location.href=component.options[component.selectedIndex].value
		}
}

/** toggle the element with specified id**/
function showHide(theID) {
	var obj = document.getElementById(theID);
	obj.style.display = (obj.style.display == block ? none : block);
}

function toggleVisibility(theID) {
	var obj = document.getElementById(theID);
	var visible  = obj.style.visibility == "visible" || obj.style.visiblity=="" ;
	obj.style.visibility = visible ? "hidden" : "visible";
	
}

/** popup a window **/
function popup(mylink, windowname){
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, 'width=650,height=600,scrollbars=no');
	return false;
}

function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}



function openPopup(url) {
        //Guy King's fix - good job!
        if (typeof SymRealWinOpen != 'undefined') {
            if(navigator.appVersion.indexOf("MSIE")!=-1) { /* ie */
                window.open = SymRealWinOpen;
            } else {
                alert('Norton Internet Security may block this popup.\nPlease disable your popup blocker if you experience any problems.');
            }
        }
		var screenW = screen.width;
		var screenH = screen.height;
		var w = 400;
		var h = 450;
		
		var top = (screenH-h)/2;
		var left = (screenW-w)/2;
        // pop appropriately sized window 
	    w=window.open(url,'popup','width=' +w +',height='+h +'top=' + top + 'left='+ left +',toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,titlebar=no');
//			w.moveTo(left,top);
//        	w.focus();
}


function addInnovit() {
	var comp  = document.getElementById("googleSearchBox");
	if(comp.value=="")
		return false;
	comp.value = comp.value + " site:http://www.innovit.com";
	return true;
}