﻿function switchToSSL()
{
	var url = window.location.href.replace("http://", "https://");

	if ( url.charAt(url.length - 1) == '/' )
	{
		url += "Default.aspx"
	}
	
	document.forms[0].action = url;
}

function clickButton( buttonID, evt )
{	
    var key; 
    
    if(typeof(window.event) != "undefined")
    { 
        key = window.event.keyCode; 
    }
    else
    { 
        key = (typeof(evt)!="undefined")?evt.keyCode:0;
    } 
    
    if(key == 13)
    { 
        var button = document.getElementById( buttonID );
               
        if ( button )
	    {
		    button.focus();
		    button.click();
		    return false;
	    }
    }
    
    return true;
}

function openCenteredWindow(url, width, height)
{
	var left = ((window.top.screen.width - width) / 2);
	var top = ((window.top.screen.height - height) / 2);
	
	window.open(url, '', 'height=' + height + ',width=' + width + ',left=' + left + ',top=' + top + ',menubar=no,resizable=no,toolbar=no,directories=no');
}	

function openCenteredWindowEx(url, width, height, scrollbars)
{
	var left = ((window.top.screen.width - width) / 2);
	var top = ((window.top.screen.height - height) / 2);	
	
	if ( scrollbars )
		window.open(url, '', 'height=' + height + ',width=' + width + ',left=' + left + ',top=' + top + ',menubar=no,resizable=no,toolbar=no,directories=no,scrollbars=yes');
	else
		window.open(url, '', 'height=' + height + ',width=' + width + ',left=' + left + ',top=' + top + ',menubar=no,resizable=no,toolbar=no,directories=no');	
}
