
function openCenterWin(url, windowname, width, height)
{
    var left = (screen.width - width) /2;
    var top = (screen.height - height) / 2;
    
	var settings  = 'height=' + height + ',';
	settings += 'width='+ width + ',';
	settings += 'top=' + top + ',';
	settings += 'left='+ left + ',';
	settings += 'scrollbars=yes,toolbar=no,resizable=yes';
	
	win = window.open(url, windowname, settings);
	
	if(parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();  
    }
}

function trapKeyDown(buttonId)
{
	var button = document.getElementById(buttonId);
	
	if (event.keyCode == 13)
	{ 
		event.returnValue=false;
		event.cancel = true;
		button.click();
	} 
}


function decryptHrefEmail(encrypted)
{
    parent.location = decrypt(encrypted);
}
function decryptTextEmail(encrypted)
{
    document.write(decrypt(encrypted));
}
function decrypt (encrypted)
{
    var allChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_@: ";
                    
    var plainText = "";
    for (i = 0; i < encrypted.length; i++)
    {
        var encryptedChar = encrypted.charAt(i);
        var index = allChars.indexOf(encryptedChar)
        if (index == -1)
        {
            decryptedChar = encryptedChar;
        }
        else
        {
            decryptedChar = allChars.charAt((index + 10) % allChars.length);
        }
        plainText += decryptedChar;
    }
    return plainText;
}
   
