function Toggle (sObj) {
	obj = document.getElementById(sObj).style;
	if (obj.display == '') {
		obj.display = 'none';
	} else {
		obj.display = '';
	}
}

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 ChangeTripWay(changevalues, hdchangewayid, div1,div2,div3,div4,depid,destid, imgpath, imgid)
{
    var hdvalue = document.getElementById(hdchangewayid);
     
    var img = document.getElementById(imgid);
    var divfrom1 = document.getElementById(div1);
    var divfrom2 = document.getElementById(div2);
    var divto1 = document.getElementById(div3);
    var divto2 = document.getElementById(div4);
    var txt1 = document.getElementById(depid);
    var txt2 = document.getElementById(destid);
    
    if ( changevalues )
    {
        var tval = txt1.value;
        txt1.value = txt2.value;
        txt2.value = tval;
        
        if ( hdvalue.value == "1" )
        {
            hdvalue.value = "0"
        }
        else
        {
            hdvalue.value = "1"
        }
    }
    if ( hdvalue.value == "1" )
    {
        img.src = imgpath + "1.gif";
        divfrom1.style.display = 'none';
        divfrom2.style.display = '';
        
        divto1.style.display = 'none';
        divto2.style.display = '';
    }
    else
    {
        img.src = imgpath + "0.gif";
        divfrom1.style.display = '';
        divfrom2.style.display = 'none';
        
        divto1.style.display = '';
        divto2.style.display = 'none';
    }
}
        
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;
}
   