
/* This is used to open up a 'popup' type content item */
function openPopup(url)
{
    var newPopup = window.open(url, 'PMUSA', 'width=540,height=600,menubars=0,scrollbars=1,resizable=0');
}

/* This is used for links inside the 'popup' to open in the parent */
function openParent(url)
{
    window.opener.location = url;
    window.opener.focus();
    window.close();
}

/* This is used for external links to open in a new window */
function extLink(url)
{
     var extLinkWindow = window.open(url);
}

/* function to close windows on close link / image click */
function closeWindow()
{
    window.close();
}

function activateFormItem(tID,selectedValue,ignoreValue)
{
    tField = document.getElementById(tID);
    tField.disabled = 'false';
    alert(selectedValue);

}

/* functions for site search box in page header */
function search(url)
{
    var searchField = document.getElementById('searchInput');
    if (searchField != null && searchField.value != 'Search' && searchField.value != '')
    {
        window.location.href = url + "?q=" + searchField.value.replace(/"/g,"%22");
    } else {
        alert('Please enter a valid search term');
    }
} 

/* clears a text field when it is clicked on */
function clearField(f,ignoreStr)
{
    if(f.value==ignoreStr){
        f.value = '';
    }
}

/* "submits" a form when enter key is hit while in a text field.  "submission" in this case is just redirection to tURL with the sending field's value appended to the querystring "q" parameter */
function submitOnEnter(tKey,tURL,tField)
{
    var keynum;
    if(window.event) // IE
    {
        keynum = tKey.keyCode;
    }
    else if(tKey.which) // Netscape/Firefox/Opera
    {
        keynum = tKey.which;
    }
    if(keynum==13){ // if key hit is enter key then "submit" form
        if(tField.id == 'searchInput'){ // if this is the site search box, pass over to function built for it
            search(tURL);
        } else {
            window.location = tURL+"?q="+tField.value
        }
    }
}

function isIE6(){
    version=0;
    if (navigator.appVersion.indexOf("MSIE")!=-1){
        temp=navigator.appVersion.split("MSIE")
        version=parseFloat(temp[1]);
        if (version<7) {
            return true;
        }
    }
    return false;
}