var activeNum = 0;
var numberOfDiv = 0;
var restoreNameDiv = '';

function showContent(activeDiv,divId,divName){
	
	switch (divName) {
		case 'feverfew':
			numberOfDiv = 7;
			break
			
		case 'soy':
			numberOfDiv = 9;
			break
		
		case 'oats':
			numberOfDiv = 9;
			break
			
		case 'shiitake':
			numberOfDiv = 7;
			break
		
		case 'lavender':
			numberOfDiv = 5;
			break
	}
	
	for (var i = 0; i<numberOfDiv; i++){
			document.getElementById(''+divName+'_content_'+i+'').style.display = 'none';
		}
		
	activeNum = activeDiv;
	restoreNameDiv = divName;
	document.getElementById(''+divName+'_content_'+divId+'').style.display = 'block';
}

function restoreDiv(){
	for (var i = 0; i<numberOfDiv; i++){
			document.getElementById(''+restoreNameDiv+'_content_'+i+'').style.display = 'none';
		}
	document.getElementById(''+restoreNameDiv+'_content_'+activeNum+'').style.display = 'block';
	}

//==============================================================================

function setStyle(){
	
	var args = setStyle.arguments;

	for (var i = 0; i<=3; i++){
			var elem = document.getElementById('link_tab_'+i+'');
			if (elem != null){
				elem.className = '';
				}
		}
	document.getElementById('link_tab_'+args[0]+'').className = 'active';
}

//==============================================================================

function openPopup (width, height, url, name) {

	var windowWidth = window.screen.width;
	var windowHeight = window.screen.height;
	
	var popupWidth = width;
	var popupHeight = height;
	
	var popupTop = (windowHeight - popupHeight) / 2;
	var popupLeft = (windowWidth - popupWidth) / 2;
	
	var features = "width=" +  popupWidth + ",height=" + popupHeight + ",top=" + popupTop + ",left=" + popupLeft;
	
	
	window.open(url, name, features);			
}

function openContactUsPop(width, height, url, name) {

	var windowWidth = window.screen.width;
	var windowHeight = window.screen.height;
	
	var popupWidth = width+30;
	var popupHeight = height+60;
	
	var popupTop = (windowHeight - popupHeight) / 2;
	var popupLeft = (windowWidth - popupWidth) / 2;
	
	var features = "width=" +  popupWidth + ",height=" + popupHeight + ",top=" + popupTop + ",left=" + popupLeft;
	
	Citbox.show(url,name,'width='+popupWidth+', height='+popupHeight);	
}

//==============================================================================

function toggleProdMenu (divName) {
	
	if(document.getElementById(divName).style.display == 'block'){
		if(navigator.userAgent.indexOf('MSIE') != -1){
			if(document.getElementById("flash")){
				document.getElementById('flash_content').style.zIndex  = 1;
			}
		}
			document.getElementById(divName).style.display = 'none';
		} 
		else {
		if(navigator.userAgent.indexOf('MSIE') != -1){
			if(document.getElementById("flash")){
				document.getElementById('flash_content').style.zIndex  = -1;
			}
		}
			document.getElementById(divName).style.display = 'block';
			}
}

//==============================================================================

function openPic(id, w, h){
	var winleft = (screen.width - w) / 2;
	var winUp = (screen.height - h) / 2;
	window.open(id,'foto','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',left='+winleft+',top='+winUp+'')
}

//==============================================================================

function showDisclaimer (disclaimer, linkId) {
	topPosition = (document.all)?document.documentElement.scrollTop:window.pageYOffset; 
	document.getElementById(disclaimer).style.display = 'block';
	document.getElementById(disclaimer).style.top = topPosition + 350 + "px";

	document.getElementById("link").href = linkId;
}

function closeDisclaimer(disclaimer){
	document.getElementById(disclaimer).style.display = 'none';
}
