// search
function doClick(btnName, e)
{
    //allow the enter key to point to the correct button to click.
    if (window.event.keyCode == 13)
    {
        //Get the button the user wants to have clicked
        var btn = document.getElementById(btnName);
        if (btn != null)
        { //If we find the button click it
            btn.click();
            event.keyCode = 0
        }
    }
}
// search - get metadata
function GetStellentMetaData()
{
    document.domain = document.getElementById("HiddenDocumentDomain").value;
    var s = document.getElementById("HiddenAdvFields").value;
    var advFields = s.split(',');
    var advFrame = window.frames['iFrameAdvSearch'];
    
    if (advFrame.document.getElementById('ddoctitle'))
        if (advFrame.document.getElementById('ddoctitle').value)
            document.getElementById("HiddenTitle").value = advFrame.document.getElementById('ddoctitle').value;
        else
            document.getElementById("HiddenTitle").value = '';

    s = '';
    
    for (var i = 0; i < advFields.length; i++)
        if (advFrame.document.getElementById(advFields[i]))
            if (advFrame.document.getElementById(advFields[i]).value)
                s = s + advFields[i] + '=' + advFrame.document.getElementById(advFields[i]).value + '+';
    
    if (s.lastIndexOf('+') == s.length - 1)
    {
        s = s.substring(0, s.length - 1);
        document.getElementById("HiddenFilterFields").value = s;
    }
}
// search - "Enter" key functional
function submitFormWithEnter(e)
{
    var keycode;
    if(window.event)
    {
        keycode = window.event.keyCode;
    }
    else if (e)
    {
        keycode = e.which;
    }
    else
    {
        return true;
    }

    if(keycode==13)
    {
        return false;
    }
    else
    {
        return true;
    }
}

function disabilityCalculator(url) {
	newwindow = window.open(url,'calculator','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=620,height=470,left=200,top=200');
	newwindow.focus();
}

function lifeCalculator(url) {
	newwindow = window.open(url,'calculator','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=600,height=400,left=200,top=200');
	newwindow.focus();
}

function demoLaunch(url) {
	if(navigator.userAgent.indexOf("MSIE") == -1) {
	    newwindow = window.open(url,'winlaunch','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=792,height=600,top=50,left=50');
	    newwindow.focus();
	}
	else {
	    window.open(url,'winlaunch','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=792,height=600,top=50,left=50');
	}
}

function newsRelease(url) {
	if(navigator.userAgent.indexOf("MSIE") == -1) {
	    newwindow = window.open(url,'winlaunch','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width=500,height=475,top=200,left=200');
	    newwindow.focus();
	}
	else {
	    window.open(url,'winlaunch','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width=500,height=475,top=200,left=200');
	}
}

function popWindow(url) {
	newwindow = window.open(url,'winlaunch','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=480,height=270,left=200,top=200');
	newwindow.focus();
}
