function ShowSubject(subject) {
	window.status=subject;
	return true;
}

function WriteOpenWindow(tag) {
	document.write(tag);
}

function OpenWindow(url) {
	win = window.open(url, '', 'resizable,menubar=yes,location=yes,titlebar=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,top=10,left=10')
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function TieButton(e,id)
{
	
	try{
		if (!e) var e = window.event;
		var btn = document.getElementById(id);
		
		if(btn == null){
			btn = document.getElementsByName(id)[0];
		}
			
		if(e.which || e.keyCode){if ((e.which == 13) || (e.keyCode == 13)) {btn.click();return false;}} else {return true}; 
	}catch(err){
		
	}
}

function ShowHideMarketTable(tableName)
{
	document.getElementById('Indices').style.display = "none";
	document.getElementById('Forex').style.display = "none";
	document.getElementById('Commodities').style.display = "none";
	document.getElementById('Rici').style.display = "none";
	document.getElementById('IndicesMenu').className = "box";
	document.getElementById('ForexMenu').className = "box";
	document.getElementById('CommoditiesMenu').className = "box";	
	document.getElementById('RiciMenu').className = "box";

	document.getElementById(tableName).style.display = "block";	
	document.getElementById(tableName+"Menu").className = "tabSelected";	
	
	//mindy's codes
	//set all to non-selected class
	document.getElementById("IndicesLeft").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft.jpg");
	document.getElementById("IndicesRight").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight.jpg");
	document.getElementById("ForexLeft").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft.jpg");
	document.getElementById("ForexRight").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight.jpg");
	document.getElementById("CommoditiesLeft").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft.jpg");
	document.getElementById("CommoditiesRight").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight.jpg");
	document.getElementById("RiciLeft").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft.jpg");
	document.getElementById("RiciRight").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight.jpg");
	//set selected element
	document.getElementById(tableName+"Left").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft_o.jpg");
	document.getElementById(tableName+"Right").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight_o.jpg");
}

function ShowHideCertTable(tableName)
{
	document.getElementById('TopPerforming').style.display = "none";
	document.getElementById('TopVolume').style.display = "none";
	document.getElementById('TopRipe').style.display = "none";
	//document.getElementById('TopPerformingDisclaimer').style.display = "none";
	//document.getElementById('TopVolumeDisclaimer').style.display = "none";
	document.getElementById('TopPerformingMenu').className = "box";
	document.getElementById('TopVolumeMenu').className = "box";
	document.getElementById('TopRipeMenu').className = "box";

	document.getElementById(tableName).style.display = "block";	
	//document.getElementById(tableName+'Disclaimer').style.display = "block";	
	document.getElementById(tableName+"Menu").className = "tabSelected";
	
	//mindy's codes
	//set all to non-selected class
	document.getElementById("TopPerformingLeft").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft.jpg");
	document.getElementById("TopPerformingRight").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight.jpg");
	document.getElementById("TopVolumeLeft").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft.jpg");
	document.getElementById("TopVolumeRight").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight.jpg");
	document.getElementById("TopRipeLeft").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft.jpg");
	document.getElementById("TopRipeRight").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight.jpg");
	//set selected element
	document.getElementById(tableName+"Left").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabLeft_o.jpg");
	document.getElementById(tableName+"Right").setAttribute("src","/ABNAMRO.Display/ABNAMRO-TEMPLATE/Images/rightBox_tabRight_o.jpg");
}

function ShowHideSeminarFormOnClick(seminarForm)
{	
	if(document.getElementById(seminarForm).style.display  =='none')
	{
		document.getElementById(seminarForm).style.display = 'inline';
	}
	else if(document.getElementById(seminarForm).style.display  == 'inline' || document.getElementById(seminarForm).style.display == '')
	{
		document.getElementById(seminarForm).style.display = 'none';
	}
}

function ShowHideSeminarForm()
{
	if(get_cookie('ShowHideSeminarForm') != '')
	{				
		if(document.getElementById(get_cookie('ShowHideSeminarForm')) != null)
		{
			document.getElementById(get_cookie('ShowHideSeminarForm')).style.display = 'inline';		
			return;
		}
	}
}

function GetDisplayStyle()
{
	var browserName = navigator.userAgent.toLowerCase(); 
	var displayStyle = '';
	
	if(browserName.indexOf("opera") != -1)
	{displayStyle = 'block';}
	else if(browserName.indexOf("firefox") != -1)
	{displayStyle = 'table-row';}
	else
	{displayStyle = 'block';}
	
	return displayStyle;
}
function ShowHideRow(rowName, bottomRowName)
{	
	var displayStyle = GetDisplayStyle();
	
	if(document.getElementById(rowName).style.display == displayStyle)
	{
		document.getElementById(rowName).style.display = "none";
		document.getElementById(bottomRowName).style.display = displayStyle;
	}
	else
	{
		document.getElementById(rowName).style.display = displayStyle;
		document.getElementById(bottomRowName).style.display = "none";
	}
}

function AgreeBtnDropCookie()
{
	if(get_cookie('AgreedABNAmro') == "")
	{
		var today = new Date();
		today.setTime( today.getTime() );

		var expires = 2 * 1000 * 60 * 60 * 24;
		var expires_date = new Date( today.getTime() + (expires) );
	
		document.cookie = "AgreedABNAmro=YES;expires=" + expires_date.toGMTString()+";";
		window.location = 'index.aspx?page=home';
	}
}

function CheckABNAmroAgreementCookie()
{
	if(get_cookie('AgreedABNAmro') == "YES")
	{		
		window.location = 'index.aspx?page=home';
	}
	
	return;
}

//Get cookie routine by Shelley Powers 
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function ConfirmDelete()
{
	if(confirm('Are you sure you want to delete?'))
	{
		return;
	}
	else
	{
		return false;
	}
}