
function showVcard(obj){
	var vcardElement=document.getElementById(obj).style;
	if (vcardElement.display=="block"){
			vcardElement.display="none";
		}
		else {
			vcardElement.display="block";
		}
	}

function showLeftNavSub(obj){
	var LeftNavSubElement=document.getElementById(obj).style;
	if (LeftNavSubElement.display=="block"){
			LeftNavSubElement.display="none";
		}
		else {
			LeftNavSubElement.display="block";
		}
	}



/***********************************************
* Dolphin Tabs Menu- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

var fliptabscontent={
	subcontainers:[], last_accessed_tab:null,

	revealsubmenu:function(curtabref){
	this.hideallsubs()
	if (this.last_accessed_tab!=null)
		this.last_accessed_tab.className=""
	if (curtabref.getAttribute("rel")) //If there's a sub menu defined for this tab item, show it
	document.getElementById(curtabref.getAttribute("rel")).style.display="block"
	curtabref.className="current"
	this.last_accessed_tab=curtabref
	},

	hideallsubs:function(){
	for (var i=0; i<this.subcontainers.length; i++)
		document.getElementById(this.subcontainers[i]).style.display="none"
	},


	init:function(menuId, selectedIndex){
	var tabItems=document.getElementById(menuId).getElementsByTagName("a")
		for (var i=0; i<tabItems.length; i++){
			if (tabItems[i].getAttribute("rel"))
				this.subcontainers[this.subcontainers.length]=tabItems[i].getAttribute("rel") //store id of submenu div of tab menu item
			if (i==selectedIndex){ //if this tab item should be selected by default
				tabItems[i].className="current"
				this.revealsubmenu(tabItems[i])
			}
		tabItems[i].onmouseover=function(){
		fliptabscontent.revealsubmenu(this)
		}
		} //END FOR LOOP
	}

}



var browsers = 'all';
var config = {
	hovers: new Array(
		{
			parentId:'nav',
			tagName:'li',
			tagPosition:'all',
			className:'hover'
		}
	),
	inputFields:new Array(
		{
			id:'login',
			setBack:true
		},
		{
			id:'searchProducts',
			setBack:true
		},
		{
			id:'searchSite',
			setBack:true
		}
	),
	togglers:new Array(
		{
			buttonId:'lang-button',
			blockId:'language',
			propertyType:'class',
			values:new Array('opened','closed'),
			defaultValue:'closed'
		}
	)
};

var initInputFields = function()
{
	currentState.inputFields = new Array();

	for (var index in config.inputFields){
		var conf = config.inputFields[index];
		var el = document.getElementById(conf.id);
		if (el){
			el.configIndex = index;
			currentState.inputFields[index] = el.value;
			el.onfocus = function(){
				var prevValue = currentState.inputFields[this.configIndex]; 
				if (this.value == prevValue){
					this.value = '';
				}
			}
			if (conf.setBack){
				el.onblur = function(){
					var prevValue = currentState.inputFields[this.configIndex];
					if (this.value == ''){
						this.value = prevValue;
					}
				}
			}
		}
	}
}

var initHovers = function()
{
	for (var index in config.hovers){
		var conf = config.hovers[index];
		var topLevelElement = document.getElementById(conf.parentId);
		if (topLevelElement){
			var subElements = topLevelElement.getElementsByTagName(conf.tagName);
			for (var i = 0; i < subElements.length; i++){
				if (conf.tagPosition == 'all' || (conf.tagPosition == 'children' && subElements[i].parentNode.id == conf.parentId))
				{
					subElements[i].configIndex = index;
					subElements[i].onmouseover = function(){
						this.className += ' ' + config.hovers[this.configIndex].className;
					};
					subElements[i].onmouseout = function(){
						this.className = this.className.replace(config.hovers[this.configIndex].className,'');
					};
				}
			}
		}
	}
}

var initTogglers = function()
{
	currentState.togglers = {
		buttons:new Array(),
		blocks:new Array()
	}; 

	for (var index in config.togglers){
		var conf = config.togglers[index];
		var button = document.getElementById(conf.buttonId);
		var block = document.getElementById(conf.blockId);
		if (button && block){
			button.configIndex = index;
			
			currentState.togglers.buttons[index] = button;
			currentState.togglers.blocks[index] = block;
			
			if (conf.propertyType == 'class'){
				block.className = conf.defaultValue;
			} else if (conf.propertyType == 'style'){
				block.style[conf.property] = conf.defaultValue;
			}
			
			button.onclick = function(){
				var propertyType = config.togglers[this.configIndex].propertyType;
				var property = config.togglers[this.configIndex].property;
				var values = config.togglers[this.configIndex].values;
				var button = currentState.togglers.buttons[this.configIndex];
				var block = currentState.togglers.blocks[this.configIndex];

				var currentIndex = 0;
				
				if (propertyType == 'class'){
					var currentStyle = block.className;
				} else if (propertyType == 'style'){
					var currentStyle = block.style[property];
				}				
				
				if (currentStyle){
					var ind = indexOf(values,currentStyle);
					if (ind + 1 < values.length){
						currentIndex = ind + 1;
					}
				}
				
				if (propertyType == 'class'){
					block.className = values[currentIndex];
				} else if (propertyType == 'style'){
					block.style[property] = values[currentIndex];
				}
				return false;
			}
		}
	}	
}

var indexOf = function(stack, item){
	var len = stack.length;
	for (var i = 0; i < len; i++){
		if (stack[i] === item) return i;
	}
	return -1;
}

var opera = window.opera;
var safari = navigator.appVersion.indexOf("Safari") != -1;
var ie = document.all && !window.opera;
var ff = navigator.userAgent.indexOf("Firefox") != -1;

var currentState = {};

var attachOnLoad = function(browsers,initMethod)
{
	if (opera && (browsers.match(/Opera/) || browsers.match(/all/))) {
		window.addEventListener("load", initMethod, false);
	} else if (safari && (browsers.match(/Safari/) || browsers.match(/all/))) {
		window.addEventListener("load", initMethod, false);
	} else if (ie && (browsers.match(/IE/) || browsers.match(/all/))) {
		window.attachEvent("onload", initMethod);
	} else if (ff && (browsers.match(/FF/) || browsers.match(/all/))) {
		window.addEventListener("load", initMethod, false);
	} else if (!ie && !ff && !safari && !opera) {
		if (window.addEventListener){
			window.addEventListener("load", initMethod, false);
		}
		else if (window.attachEvent){
			window.attachEvent("onload", initMethod);
		}
	} 
}




//The Language Selector in the top nav needs these:
attachOnLoad(browsers,initInputFields);
attachOnLoad(browsers,initHovers);
attachOnLoad(browsers,initTogglers);
//attachOnLoad(browsers,initLightBoxLinks);
//attachOnLoad(browsers,initTabs);


