
/**
 *	Whatever:hover - V1.42.060206 - hover & active
 *	------------------------------------------------------------
 *	(c) 2005 - Peter Nederlof
 *	Peterned - http://www.xs4all.nl/~peterned/
 *	License  - http://creativecommons.org/licenses/LGPL/2.1/
 *
 *	Whatever:hover is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation; either
 *	version 2.1 of the License, or (at your option) any later version.
 *
 *	Whatever:hover is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *	Lesser General Public License for more details.
 *
 *	Credits and thanks to:
 *	Arnoud Berendsen, Martin Reurings, Robert Hanson
 *
 *	howto: body { behavior:url("csshover.htc"); }
 *	------------------------------------------------------------
 */

var csshoverReg = /(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i,
currentSheet, doc = window.document, hoverEvents = [], activators = {
	onhover:{on:'onmouseover', off:'onmouseout'},
	onactive:{on:'onmousedown', off:'onmouseup'}
}

function parseStylesheets() {
	if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
	window.attachEvent('onunload', unhookHoverEvents);
	var sheets = doc.styleSheets, l = sheets.length;
	for(var i=0; i<l; i++) 
		parseStylesheet(sheets[i]);
}
	function parseStylesheet(sheet) {
		if(sheet.imports) {
			try {
				var imports = sheet.imports, l = imports.length;
				for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);
			} catch(securityException){}
		}

		try {
			var rules = (currentSheet = sheet).rules, l = rules.length;
			for(var j=0; j<l; j++) parseCSSRule(rules[j]);
		} catch(securityException){}
	}

	function parseCSSRule(rule) {
		var select = rule.selectorText, style = rule.style.cssText;
		if(!csshoverReg.test(select) || !style) return;

		var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');
		var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);
		var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1];
		var affected = select.replace(/:(hover|active).*$/, '');
		var elements = getElementsBySelect(affected);
		if(elements.length == 0) return;

		currentSheet.addRule(newSelect, style);
		for(var i=0; i<elements.length; i++)
			new HoverElement(elements[i], className, activators[pseudo]);
	}

function HoverElement(node, className, events) {
	if(!node.hovers) node.hovers = {};
	if(node.hovers[className]) return;
	node.hovers[className] = true;
	hookHoverEvent(node, events.on, function() { node.className += ' ' + className; });
	hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); });
}
	function hookHoverEvent(node, type, handler) {
		node.attachEvent(type, handler);
		hoverEvents[hoverEvents.length] = { 
			node:node, type:type, handler:handler 
		};
	}

	function unhookHoverEvents() {
		for(var e,i=0; i<hoverEvents.length; i++) {
			e = hoverEvents[i]; 
			e.node.detachEvent(e.type, e.handler);
		}
	}

function getElementsBySelect(rule) {
	var parts, nodes = [doc];
	parts = rule.split(' ');
	for(var i=0; i<parts.length; i++) {
		nodes = getSelectedNodes(parts[i], nodes);
	}	return nodes;
}
	function getSelectedNodes(select, elements) {
		var result, node, nodes = [];
		var identify = (/\#([a-z0-9_-]+)/i).exec(select);
		if(identify) {
			var element = doc.getElementById(identify[1]);
			return element? [element]:nodes;
		}
		
		var classname = (/\.([a-z0-9_-]+)/i).exec(select);
		var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
		var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;
		for(var i=0; i<elements.length; i++) {
			result = tagName? elements[i].all.tags(tagName):elements[i].all; 
			for(var j=0; j<result.length; j++) {
				node = result[j];
				if(classReg && !classReg.test(node.className)) continue;
				nodes[nodes.length] = node;
			}
		}	
		
		return nodes;
	}

var CurrentTab;
var TAB_ONE = 0;

//=============================	Sets ans unsets active tabs ===============================================
function resetTabs(option){
	CurrentTab = option;
	for(var i=0;i<=TAB_COUNT;i++){
		if(i != option){
			document.getElementById("tab"+ i).className = 'tabUnselected';
			document.getElementById("l_tab"+ i).className = 'l_tabUnselected';
			document.getElementById("r_tab"+ i).className = 'r_tabUnselected';
		}
		else{
			document.getElementById("tab"+ i).className = 'tabSelected';
			document.getElementById("l_tab"+ i).className = 'l_tabSelected';
			document.getElementById("r_tab"+ i).className = 'r_tabSelected';
		}
	}

}
//=============================	Ceates a dynamic tabs and links tab content	======================================
function createTabs(iOption, sType, str){
	var temp = new Array();
	temp = str.split('¬');	
	var i = 0;
	var newTabs = "";
	//alert(temp.length);
	while(i < temp.length){
		if(sType == "TABS"){
			TAB_COUNT = temp.length;
			//<span id='btest"+(i+1)+"'></span>    <span id='ctest"+(i+1)+"'></span><span class='tabGap'></span>	getMenu("+i+","+iOption+")	onmouseover='showMenu("+iOption+")' onmouseout='throwMenu()'	onclick='replace2("+(i+1)+")'
			newTabs = newTabs + "<span class='dtest' id='tab"+(i+1)+"' onmouseover='tabHoverIn("+(i+1)+")' onmouseout='tabHoverOut("+(i+1)+")' onclick='replace("+(i+1)+")'><p>"+temp[i]+"</p></span>";
		}
		if(sType == "MENU"){
			newTabs = newTabs + "<div class='dropOption' onmouseover=\"getMenu("+i+","+iOption+")\" >"+temp[i]+"</div>";
		}
		if(sType == "MENU2"){
			newTabs = newTabs + "<div class='dropOption' >"+temp[i]+"</div>";
		}
		i++;
	}
	if(sType == "TABS"){
		document.getElementById('tabContainer').innerHTML = "<div id='tabLeftArrow' onclick=\"moveTabs('L','0px')\"></div><div id='tab_text_container'><div id='atest'>"+newTabs+"</div></div><div id='tabRightArrow' onclick=\"moveTabs('R','-150px')\"></div>";
	}
	if(sType == "MENU"){
		document.getElementById('subMenuHolder').innerHTML = "<div id='dropMenu' onmouseover='showMenu("+iOption+")' onmouseout='hideMenu("+iOption+")'>"+newTabs+"</div>";
	}
	if(sType == "MENU2"){
		document.getElementById('subMenuHolder2').innerHTML = "<div id='dropMenu2' onmouseover='showMenu2("+iOption+")' onmouseout='hideMenu2("+iOption+")'>"+newTabs+"</div>";
	}
}
//==================================	hover functions for tab system	===========================================
function tabHoverIn(option){
	if(option != CurrentTab){
		document.getElementById("tab"+ option).className = 'tabUnselected';
	}
}
function tabHoverOut(option){
	if(option != CurrentTab){
		document.getElementById("tab"+ option).className = 'tabUnselected';
	}
}
//========================================	GENERIC HOLDER	======================================
function addholder(heading, arg1, arg2){
	var newholder = "<table cellspacing='0' cellpadding='0' border='0'><tr><td><div class='holder_top'></div></td></tr><tr><td><div class='generic_column_holder'><div class='holder_title'><b>"+heading+"</b>"+arg1+arg2+"</div></div></td></tr><tr><td><div class='holder_bottom'></div></td></tr></table>";
	return newholder;
}
//===============================================	USED TO MOUNT IMAGE AND TEXT FOR PDF FILES	===========
function addfileimage(imgSrc, altText, titleText){
	var newimage = "<table><tr><td><div class='holder_img'><img src='"+imgSrc+"' alt='"+altText+"'  title='"+titleText+"' ></div></td>";
	return newimage;
}
function addfileimage2(fileSrc, imgSrc, altText, titleText){
	var newimage = "<table><tr><td><div class='holder_img'><a href='" +fileSrc+ "' target='_blank'><img src='"+imgSrc+"' alt='"+altText+"'  title='"+titleText+"' border='0' ></a></div></td>";
	return newimage;
}
function addholdertext(holdertext){
	var newholdertext = "<td><div class='holder_text'><p>"+holdertext+"</p></div></td></tr></table>";
	return newholdertext;
}
function addholdertext2(fileSrc, holdertext){
	var newholdertext = "<td><div class='holder_text'><p><a class='pdf_links' href='"+fileSrc+"' target='_blank'>"+holdertext+"</a></p></div></td></tr></table>";
	return newholdertext;
}

//=============================	Counts the number of specified characters in a string	===============
function CountValue( strText, reTargetString ){
	var intCount = 0;
	// Use replace to globally iterate over the matching
	// strings.
	strText.replace(
		reTargetString,
		// This function will get called for each match
		// of the regular expression.
		function(){
			intCount++;
		}
	);
	// Return the updated count variable.
	return( intCount );
}
//=============================	control and change position of tabs and arrows ========================
function addTabArrows(bool){
	if(bool == true){
		document.getElementById("tabLeftArrow").style.visibility = "hidden";
	}
	if(bool == false){
		document.getElementById("tabRightArrow").style.visibility = "hidden";
		document.getElementById("tabLeftArrow").style.visibility = "hidden";
	}
}
function moveTabs(button, pos){
	if(button == "R"){
	//document.getElementById("atest").style.left = pos;
	$("#atest").animate({left: pos}, 500 );
	document.getElementById("tabLeftArrow").style.visibility = "visible";
	document.getElementById("tabRightArrow").style.visibility = "hidden";
	}else{
	$("#atest").animate({left: pos}, 500 );
	document.getElementById("tabLeftArrow").style.visibility = "hidden";
	document.getElementById("tabRightArrow").style.visibility = "visible";
	}
}

//==================================	when logo clicked go home and quick links		===================================================
function goHome(){
	window.location = "../index.php";
}
function goAboutUs(){
	window.location = "../about_us/about_us.php";
}
function goPartners(){
	window.location = "../partners/business_partners.php";
}
function goSupport(){
	window.location = "../support/support.php";
}
function goSolutions(){
	window.location = "../solutions/solutions_overview.php";
}
function goProducts(){
	window.location = "../all_products.php";
}
//==================================	Function that fades tabs in and out in all browsers ( ff, ie, Opera, Safari )  ===================================================
function fadeTabs(itabNo){
	for(var i = 0; i < (TAB_COUNT +1); i++){
		if($("#tabs"+i).is(":visible")){
			$("#tabs"+i).fadeOut(300);
			$("#tabs"+i).queue(function () {
				$("#tabs"+itabNo).fadeIn(300);
				$("#tabs" + itabNo).dequeue();
			});
		}
	}
}

/*
NAME		: main_menu.js
AUTHOR		: Steven Hill
CREATION DATE	: 16/09/08
LAST MODIFIED	: 16/09/08
VERSION		: 1.0.0 
COPYRIGHT	: Data Track Group 
DETAILS		: The following code contains all the javascript needed to run the main menu which consists of a jquery accordion menu. A comment has been left on the page to
			  Identify where the jquery code begins. (JQuery code is JavaScript but has its own syntax)
			  NOTE:
			  The accordian effect requires the JQuery library file. this file MUST be included for the menu to work. The library file is free and can be download for free.

REQUIRED FILES: main_menu.css
			  main_menu.php
			  jquery.js
*/

	//used for mouseover & mouseout events
	// check where event(mouse) is coming from come from
		 function doSomething(e) {
			if (!e) var e = window.event;
			var relTarg = e.relatedTarget || e.fromElement;
		} 
	//check where event(mouse) is going to
	 	function doSomething2(e) {
			if (!e) var e = window.event;
			var relTarg = e.relatedTarget || e.toElement;
			//mouseOutDestination = relTarg.id;
		} 
		function closeAccordion() {
		  //	 $("#subMenuHolder").slideUp(200);
		//	 $("#subMenuHolder2").slideUp(200);
		document.getElementById('subMenuHolder').style.visibility = "hidden";
		document.getElementById('subMenuHolder2').style.visibility = "hidden";
		document.getElementById('subMenuHolder3').style.visibility = "hidden";
		document.getElementById('subMenuHolder4').style.visibility = "hidden";
		document.getElementById('subMenuHolder5').style.visibility = "hidden";
			// $("#subMenuHolder3").slideUp(200);
			document.getElementById('menu_1').style.background = "";
			document.getElementById('menu_1').style.color = "black";
			document.getElementById('menu_2').style.background = "";
			document.getElementById('menu_2').style.color = "black";
			document.getElementById('menu_3').style.background = "";
			document.getElementById('menu_3').style.color = "black";
			document.getElementById('menu_4').style.background = "";
			document.getElementById('menu_4').style.color = "black";
			document.getElementById('menu_5').style.background = "";
			document.getElementById('menu_5').style.color = "black";	
		}
		
		
