function OpenNewWindow(url) {
    var win = window.open(url,'external');
    win.focus();
    return win;
}

// from https://customers.ime.reuters.com/rph/wmom/
function LaunchSliver(TargetURL)
{
	// Try to trick this window into thinking it was opened by another window so it will close without a dialog
	window.opener = "x";
	
	// Generate the parameters that we are going to give the window
	var WindowFeatures = "status = no, resizable = yes, left = " + (screen.availWidth - 440 - 12) + ", top = 0, width = 440, height = " + (screen.availHeight - 30);
	
	// Open the window and call the it "sliver"
	var WindowReference = window.open(TargetURL, "sliver", WindowFeatures, true);
	
	// If the window already existed then it may be behind other windows
	// Bring it to the front
	WindowReference.focus();

	return false;
}

function ToggleLinks(link, id) {
    var div = document.getElementById(id);
    if (link.expanded) {
        div.style.display = 'none';
        link.expanded = false;
    } else {
        div.style.display = '';
        link.expanded = true;
    }
}

/*****************************************************************************
 * Function:		validateLogin
 * Description:		login form validation
 * Author:			mk
 ****************************************************************************/
function validateLogin()
{
	var fname;
	if ( document.Login.userApp+'' != 'undefined' )
	{
    if (document.Login.userLogin.value == "" || document.Login.userPassword.value == "" || document.Login.userApp.value == "" )
    {   
        if (document.Login.userLogin.value == "")
            fname = 'Username';
        else
            fname = "";
        if (document.Login.userPassword.value == "")
        {
            if (fname == "")
                fname = 'Password';
            else
                fname = fname + ',' + ' Password';                 
        }
        if (document.Login.userApp.value == "")
            if (fname == "")
                fname = 'Application ID';
            else
                fname = fname + ',' + ' Application ID';
        alert ( 'Please provide ' + fname );
        return false;
    }
    else
    {
        document.Login.submit(); 
        return true;
    }
	}
	else
	{
    if (document.Login.userLogin.value == "" || document.Login.userPassword.value == "" )
    {   
        if (document.Login.userLogin.value == "")
            fname = 'Username';
        if (document.Login.userPassword.value == "")
        {
            if (fname == "")
                fname = 'Password';
            else
                fname = fname + ',' + ' Password';                 
        }
        alert ( 'Please provide ' + fname );
        return false;
    }
    else
    {
        document.Login.submit();
        return true;
    }
	}
}

