//EVENTS: _onSessionTimeoutWindowShow, _onSessionTimeoutWindowHide
var _showSTM_T = null;
var _sessionTTL = (this._sessionTTL_min ? this._sessionTTL_min * 60000 : 30 * 60000);
document.write('<div id="_divST" onmousedown="javascript: return false;" dir="ltr" style="DISPLAY: none; Z-INDEX: 9999999; VISIBILITY: hidden; WIDTH: 0px; POSITION: absolute; HEIGHT: 0px"></div>');
function _showSTM(){_showSTM_T = null;
if (this._onSessionTimeoutWindowShow)
     this._onSessionTimeoutWindowShow();
if (document.getElementById('_divST'))
    document.getElementById('_divST').innerHTML = '<iframe WIDTH="100%" HEIGHT="100%" MARGINWIDTH="0" MARGINHEIGHT="0" HSPACE="0" VSPACE="0" FRAMEBORDER="0" SCROLLING="NO" SRC="SessionTimeoutDialog.aspx"></iframe>';}
function _setShowSTM_T()
{
    if (!document.body.disablesessionlimitation && _showSTM_T == null)
     _showSTM_T = setTimeout(_showSTM, _sessionTTL);
} 
window.onload = _addCode(window.onload, "document.body.onunload = _addCode(document.body.onunload,'if(_showSTM_T != null) clearTimeout(_showSTM_T);_showSTM_T=null;');_setShowSTM_T();document.body.onmousedown = _addCode(document.body.onmousedown, 'var canDo=(_showSTM_T != null); if(canDo)clearTimeout(_showSTM_T); if(canDo)_showSTM_T=null; if(canDo)_setShowSTM_T();');");
//-----
function _addCode(oFunction, strCode, strParams)
{
	var fCont='';
	if(oFunction && oFunction != null && (''+oFunction) != '') fCont=(''+oFunction).split('{')[1].split('}')[0];
	return new Function('' + strParams, fCont + ';' + strCode);
}

function _userNameAndPasswordValidChars(eventObj)
{
    if (!eventObj) 
        eventObj = event;

    if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Safari") != -1)// FireFox
    {
        var key = eventObj.which;	
	    if(eventObj.charCode!=0 && !(key>=65 && key <=90) && !(key>=97 && key <=122) && !(key>=48 && key <=57)  && !(key==95) && !(key==45) && !(key==46) && !(key==33) && !(key==127))  
		return _disableEventBubble(eventObj);
    }
    else    //IE 
    {
        var key = eventObj.keyCode;	
	    if(!(key>=65 && key <=90) && !(key>=97 && key <=122) && !(key>=48 && key <=57)  && !(key==95) && !(key==45) && !(key==46) && !(key==33) && !(key==127))  
		return _disableEventBubble(eventObj); 
    }

    return true;
}

function _disableEventBubble(eventObj)
{
    if(!eventObj) eventObj=event;
	return ECancelBubble(eventObj)
}

function ECancelBubble(eventObj)
{

    if(navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Safari") != -1)// FireFox
    {
        eventObj.stopPropagation();  
        eventObj.preventDefault();
    }
    else    //IE 
    {
        eventObj.cancelBubble = true;
        eventObj.returnValue  = false;    
    }
    return false;
}


function _msieVersion()
{
	var ua = window.navigator.userAgent;
	var msie = ua.indexOf ("MSIE ");
	if (msie > 0) return parseFloat(ua.substring(msie+5,ua.indexOf(";",msie)));
	else return 0;
}
function _Logout(mode)
{
	if (!mode) 
	    mode = '';
	if (document.getElementById('_qBox'))
	{
	     if (document.getElementById('_qBox').contentWindow)
	     {
	      if (document.getElementById('_qBox').contentWindow.closeQBox)
	         document.getElementById('_qBox').contentWindow.closeQBox();
	     }
	}
	window.location = ('Forex.Logout.aspx?mode=' + mode);
}
function _createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function _readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function _eraseCookie(name)
{
	_createCookie(name,"",-1);
}