	/************************************************************************************************/
    /* Restaurant Mosaic Website																	*/
    /* ============================================                         						*/
    /*																								*/
	/* Copyright (c) 2011,  Legacy Underwriting Management                  						*/
	/*																								*/
	/* Authors     :	Johann Terblanche															*/
	/* Created Date:	28-04-2011																	*/
    /* Description :	This page provides the common javascript functions used in the website		*/
	/************************************************************************************************/  
 
/* BUTTON DOWN 
 * This fuction changes the elements mouse over image to a active image
 */
function buttondown(element_id, src_location) {
	if (document.images) {
	  document.getElementById(""+element_id+"").src = ""+src_location+"_active.png?source=2012-01-20B";
	}
}
/* BUTTON UP 
 * This fuction changes the elements mouse off image to a inactive image
 */
function buttonup(element_id, src_location) {
	if (document.images) {
	  document.getElementById(""+element_id+"").src = ""+src_location+".png?source=2012-01-20B";
	}
}

/***************************************************************************************
TEST NUMERICS
	this function tests for numeric values and only allows then to be displayed
	
		e	:	element
***************************************************************************************/
function testNumerics(e){
	var KeyCode = (e.keyCode) ? e.keyCode : e.which;
	return ((KeyCode == 8) // backspace
		||	(KeyCode == 9) // tab
		||	(KeyCode == 37) // left arrow
		||	(KeyCode == 39) // right arrow
		||	(KeyCode == 46) // delete
		||	((KeyCode >= 96) && (KeyCode <= 105)) // 0-9 Num Pad
		||	((KeyCode > 47) && (KeyCode < 58)) // 0-9 Numeric
		   );
}// end function

//==================================================
// CURRENT TABBED MENU INDEX
//==================================================
var selectedTab = 1;


//==================================================
// SHOW ACTIVE TABBED MENU AND HIDE INACTIVE
//==================================================
function showTab(id, length){
	for (counter = 1; counter <= length; counter++){
		document.getElementById('tab_' + counter).style.display 		= 'none';
		document.getElementById('tab_' + counter).style.backgroundColor	= '';
		document.getElementById('tab_' + counter).style.border			= '#FFFFFF 0px solid';
		
		if(id != counter){
			document.getElementById('tabs_' + counter).style.backgroundColor	= "";
			document.getElementById('tabs_' + counter).style.border				= '#FFFFFF 0px solid';
			document.getElementById('tabs_' + counter).style.borderBottom		= '#FFFFFF 0px solid';
		}
	}//end for
	
	document.getElementById('tab_' + id).style.display = '';
	
	var obj = document.getElementById('tab_' + id); //TabWindow.rows[0].cells[(windowNr)];
	obj.style.backgroundColor	= '';//#D2D2D0';
	obj.style.border			= '#45637A 1px solid';
	obj.style.borderBottom		= '#45637A 1px solid';
	selectedTab = id; 
}//end function


//==================================================
// ENTER TABBED MENU
//==================================================
function overTabColor(TabNr){
	var obj = document.getElementById("tabs_"+TabNr+"");//TabWindow.rows[0].cells[(TabNr)];
	
	if (selectedTab == TabNr){ 
		
	} else {
		obj.style.backgroundColor	= '#E2E2E0';
		obj.style.border			= '#D2D2D0 1px solid';
		obj.style.borderBottom		= '#D2D2D0 1px olid';
	}//end if
}//end function overTabColor(TabNr)


//==================================================
// LEAVE TABBED MENU
//==================================================
function outTabColor(TabNr){
	var obj = document.getElementById("tabs_"+TabNr+"");//TabWindow.rows[0].cells[(TabNr)];
	
	if (selectedTab == TabNr){
		obj.style.backgroundColor	= "#D2D2D0";
		obj.style.border			= '#45637A 1px solid';
		obj.style.borderBottom		= '#45637A 1px solid';
	} else {
		obj.style.backgroundColor	= "";
		obj.style.border			= '#FFFFFF 0px solid';
		obj.style.borderBottom		= '#FFFFFF 0px solid';
	}//end if
	
}//end function outTabColor(TabNr)

function elementHTML(parent, child){
	document.getElementById(""+parent+"").innerHTML = document.getElementById(""+child+"").innerHTML;
	return true;
}

