    var popWindow = null;
    
    var MSG_INVALID_CHAR = "Invalid characters entered.  Please change your search query.";
    var MSG_INVALID_FUZZY = "Improper use of Fuzzy Operator!";
    var MSG_FUZZY_CONFLICT = "Fuzzy Operator cannot be used with Fuzzy search Level selection.";
    var MSG_PUB_YEARS = "Please enter a year or a range of years, using four digits to indicate each year. E.g.: 1791 or 1790-1815";
    var MSG_SUBJECT_LIMIT = "Only 10 Subject Areas may be selected.";
    var MSG_SERIAL_LIMIT = "Only 10 Serial Titles may be selected.";
    var MSG_INVALID_PAGE = "Please enter a valid page number.";
    var MSG_INVALID_PAGERANGE = "Please enter a valid range of page numbers.";
    
    function popNewWindow(url) {
        popWindow = window.open(url, "sata", "width=700,height=450,screenX=100,screenY=100,top=100,left=100,scrollbars=1,resizable=yes");
        popWindow.focus();
    }
    
    function disableObject(objName)
	{
        var obj = document.getElementById(objName);
        obj.style.display = "none";
	}
		
	function enableObject(objName)
	{
        var obj = document.getElementById(objName);
        obj.style.display = "";
	}
    
    function toggle(id)
    {
        var obj = document.getElementById(id);
        if (obj.style.display == "")
        	obj.style.display = "none";
        else
        	obj.style.display = "";
	}

    function executeURL(url)
    {
	   	var dummyImg = new Image();
	    dummyImg.src = url;
    }
    
    function isFieldEmpty(value)
    {
		return ((value==null) || (value.replace(/\s*$/, "").length==0));
    }

	function validYearOrRange(value) 
	{
		if ( value.length == 0 ) 
		{
		    return true;
		}
		re = /^\d{4}(-\d{4})?$/;
		return re.test(value);
	}
	
	function isValidFuzzy(value)
    {
        if (!isEmpty(value) && value.indexOf("~") > -1)
        {
            var delimiter = " ";
            var temp = value + " dummy";

            while (temp.indexOf(delimiter) > -1)
            {
                var term = temp.substring(0, temp.indexOf(delimiter));
                if (term.match(/~/) != null && !(term.match(/^[^~]+~[0-9]{1,2}$/)))
                {
                    return false;
                }
                temp = temp.substring(temp.indexOf(delimiter) +1);
            }
        }
        return true;
    }

	function isValidField(value)
    {
        return (!isEmpty(value) && value.indexOf("%") < 0);
    }

    function makeRemote(url)
	{
		calcAndPullUp(url,"browse",600,600,1);
	}

    function calcAndPullUp( pageToLoad, winName, width, height, center)
    {
        xposition=0; yposition=0;
        if ((parseInt(navigator.appVersion) >= 4 ) && (center))
        {
            xposition = (screen.width - width) / 2;
            yposition = (screen.height - height) / 2;
        }
        args = "width=" + width + "," + "height=" + height + "," + "location=1," + "menubar=0," + "resizable=1," + "scrollbars=1," + "status=1," + "titlebar=1," + "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
        remote = window.open( pageToLoad,winName,args);
		if (remote.opener == null)
			remote.opener = window;
		else
			remote.focus();
    }

 	function validYearOrRange(value) 
	{
		if ( value.length == 0 ) 
		{
		    return true;
		}
		re = /^\d{4}(-\d{4})?$/;
		return re.test(value);
	}

 	function validPageOrRange(op, value) 
	{
		if ( value.length == 0 ) 
		{
		    return true;
		}
		if ( op == 'RG' ) 
		{		
			re = /^\d{1,4}-\d{1,4}$/;		
		} 
		else 
		{
			re = /^\d{1,4}$/;		
		}
		return re.test(value);
	}
 
    function isCustomFieldInvalid(formField, fuzzyField)
    {
        if (isEmpty(formField))
        {
            return false;
        }
        if (formField.indexOf("%") > -1)
        {
            alert(MSG_INVALID_CHAR);
            return true;
        }
        if (formField.match(/~/) != null)
        {
            if (fuzzyField.selectedIndex > 0)
            {
                alert(MSG_MULTIPLE_FUZZY);
                return true;
            }
            
            var delimiter = " ";
    	    var temp = formField + " dummy";
    	    
    	    while (temp.indexOf(delimiter) > -1)
    	    {
    	        var term = temp.substring(0, temp.indexOf(delimiter));
    	        if (formField.match(/~/) && !(term.match(/^[^~]+~[0-9]{1,2}$/)))
    	        {
    	            alert(MSG_INVALID_FUZZY);
    	            return true;
    	        }
    	        temp = temp.substring(temp.indexOf(delimiter) +1);
    	    }
        }
        return false;
    }

    function exceedsLimit(selections, limit)
    {
        var total = 0;
    	for (i = 0; i < selections.length; i++)
	    {
	       if (selections[i].selected == true)
	       {
	           total++;
	       }
	    }
        return (total > limit);
    }
    
     function goLocation(url)
     {
         location=url;
     }

	function submitForm( form) 
	{
		form.submit();
	}

	function img_act (tag) 
	{
		document[tag].src = eval(tag + "h.src");
	}
	
	function img_inact (tag) 
	{
	    document [tag].src = eval(tag + ".src");
	}
	
 

    
