//****************************************************************************
// Copyright PROCIT B.V., The Netherlands, 2005
// The Netherlands
// info@procit.com

// This program is the intellectual property of Procit B.V., The Netherlands ("Procit").
// The program may be used, modified and/or copied only with the written permission of
// Procit or in accordance with the terms and conditions stipulated in the
// agreement/contract under which the program has been supplied.
//****************************************************************************

//****************************************************************************
//Project              : Intrum Justitia
//File                 : functions.js
//Description          : JS for TAB component
//****************************************************************************
//History
//
//
//Comments
// 
//****************************************************************************


	var blnIncludeCheck = true;
	var iCurrentTabSelected = null;
	var oCurrentTabHover = null;
	var oCurrentTabSelected = null;
	
	function processTabClick(iIndex)
	{
		try
		{
			// Hide current tab
			if (iCurrentTabSelected != null)
				document.getElementById("divArea" + iCurrentTabSelected).style.display = 'none';

			// Make new tab visible			
			if (document.getElementById("divArea" + iIndex) == undefined)
				throw('Tab area not found. Please make sure to have used BeginTabArea and EndTabArea on all tabs.')

			// Navigate to child target url
			if (document.getElementById("divArea" + iIndex).targeturl != '')
				if (document.getElementById("fraArea" + iIndex) != undefined)
					if (document.getElementById("fraArea" + iIndex).src == 'about:blank')
						document.getElementById("fraArea" + iIndex).src = document.all("divArea" + iIndex).targeturl;
			
			document.forms(0).st.value = iIndex;
			alert(document.forms(0).st.value) 
			document.getElementById("divArea" + iIndex).style.display = '';
			iCurrentTabSelected = iIndex;

			doSelected(document.getElementById("tdTab" + iIndex));

		} catch(e) {alert('Error processTabClick(' + iIndex + '): ' + e);}
		fieldfocus(iIndex);
	}
	
	function doHover(oTab)
	{
		try
		{
			// Make current tab normal
			if (oCurrentTabHover != null)
				oCurrentTabHover.className = oTab.standardstyle

			// Make new tab hover
			if (oCurrentTabSelected != oTab)
			{
				oTab.className = oTab.hoverstyle
				oCurrentTabHover = oTab
			}
			
		} catch(e) {alert('Error doHover(' + iIndex + '): ' + e);}
	}
	
	function doSelected(oTab)
	{	
		try
		{
			// Make current tab normal
			if (oCurrentTabSelected != null)
				oCurrentTabSelected.className = oTab.standardstyle

			// Make new tab hover
			oTab.className = oTab.selectedstyle
			oCurrentTabSelected = oTab
			oCurrentTabHover = null
			
		} catch(e) {alert("Error doSelected(" + iIndex + "): " + e);}
	}

	function doStandard(oTab)
	{
		try
		{
		
			//if (oCurrentTabSelected != null)
				//if (oCurrentTabSelected == oTab)
				//	return

			// Make new tab standard
			if (navigator.appName == "Microsoft Internet Explorer") // IE
			{
				oTab.className = oTab.standardstyle
			}
			else  // Mozilla, Safari, ...
			{
				var standardstyle=oTab.getAttribute("standardstyle");
				oTab.setAttribute("class",standardstyle)
			}
			
			
			
			//oCurrentTabHover = oTab
			
		} catch(e) {alert('Error doStandard(' + iIndex + '): ' + e);}
	}
	
	function openURL(url)
	{
	alert(url);
	document.fraArea2.src= url
	}
	
	function fieldfocus(index)
	{
		
	}
