function product_mark_tab(obj)
{
	var tabId = obj.id;
	
	var tab1 = document.getElementById('product-tab-description');
	var tab1c = document.getElementById('product-tab-description-content');
	var tab2 = document.getElementById('product-tab-data');
	var tab2c = document.getElementById('product-tab-data-content');
	var tab3 = document.getElementById('product-tab-comments');
	var tab3c = document.getElementById('product-tab-comments-content');
	var tab4 = document.getElementById('product-tab-multimedia');
	var tab4c = document.getElementById('product-tab-multimedia-content');
	
	if(tab1.id == tabId)
	{
		tab1.className="selected";
		tab1c.style.display="block";
	}
	else
	{
		tab1.className="tab";
		tab1c.style.display="none";
	}
	
	if(tab2.id == tabId)
	{
		tab2.className="selected";
		tab2c.style.display="block";
	}
	else
	{
		tab2.className="tab";
		tab2c.style.display="none";
	}
	
	if(tab3.id == tabId)
	{
		tab3.className="selected";
		tab3c.style.display="block";
	}
	else
	{
		tab3.className="tab";
		tab3c.style.display="none";
	}
	
	if(tab4.id == tabId)
	{
		tab4.className="selected";
		tab4c.style.display="block";
	}
	else
	{
		tab4.className="tab";
		tab4c.style.display="none";
	}
}








var globalMainProductIds = Array();
var globalMainPageTimeout = null;
var globalMainPageStartTimeout = null;
var globalMainPageCurrentProductPos = -1;
var globalMainCurrentTabSet = 0;


function mainLinkOver(obj,pos)
{
	var productCount = globalMainProductIds[globalMainCurrentTabSet].length;
	
	
	//clearing other link and images
	for(var i=0;i<productCount;i++)
	{
		var tmpImage = document.getElementById("main-product-image-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+i.toString());
		var tmpLink = document.getElementById("main-product-link-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+i.toString());
		tmpLink.style.backgroundColor = "transparent";
		tmpImage.style.display = "none";
	}
	
	obj.style.backgroundColor="#fff";
	var imageSpan = document.getElementById("main-product-image-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+pos.toString());
	imageSpan.style.display = "block";
	if(globalMainPageTimeout)
	{
		clearTimeout(globalMainPageTimeout);
	}
}

function mainLinkOut(obj,pos)
{
	//obj.style.backgroundColor="#D2F2FB";
	var imageSpan = document.getElementById("main-product-image-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+pos.toString());
	//imageSpan.style.display = "none";
	globalMainPageCurrentProductPos = pos;
	if(globalMainPageStartTimeout)
		clearTimeout(globalMainPageStartTimeout);
	globalMainPageStartTimeout = setTimeout("mainSwitchImage();",5000);
}

function mainSwitchImage()
{
	var productCount = globalMainProductIds[globalMainCurrentTabSet].length;
	
	//clearing other link and images
	for(var i=0;i<productCount;i++)
	{
		var tmpImage = document.getElementById("main-product-image-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+i.toString());
		var tmpLink = document.getElementById("main-product-link-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+i.toString());
		if(tmpLink)
			tmpLink.style.backgroundColor = "transparent";
		if(tmpImage)
			tmpImage.style.display = "none";
	}
	
	if(globalMainPageCurrentProductPos > productCount-2)
		globalMainPageCurrentProductPos = 0;
	else
		globalMainPageCurrentProductPos++;
	
	var newImageSpan = document.getElementById("main-product-image-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+globalMainPageCurrentProductPos.toString());
	var newLink = document.getElementById("main-product-link-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+globalMainPageCurrentProductPos.toString());
	
	if(newImageSpan)
		newImageSpan.style.display = "block";
	if(newLink)
		newLink.style.backgroundColor = "#fff";
	globalMainPageTimeout = setTimeout("mainSwitchImage()",2000);
}



function mainMarkTab(obj)
{
	var maxTabs = 10;

	//deselecting link from previous tab
	var oldLink = document.getElementById("main-product-link-tab-"+globalMainCurrentTabSet.toString()+"-pos-"+globalMainPageCurrentProductPos.toString());
	if(oldLink)
		oldLink.style.backgroundColor = "transparent";
	
	
	
	
	//selecting new tab
	for(var i=0;i<maxTabs;i++)
	{
		var tab = document.getElementById("main-tabs-" + i.toString());
		var content = document.getElementById("main-tabs-content-" + i.toString());
		var images = document.getElementById("main-tabs-images-" + i.toString());
		if(tab && content)
		{
			if(tab.id==obj.id)
			{
				tab.className = "selected const-width";
				globalMainCurrentTabSet = i;
				content.style.display = "block";
				images.style.display = "block";
			}
			else
			{
				tab.className = "tab const-width";
				content.style.display = "none";
				images.style.display = "none";
			}
		}
	}
	//starting switching from the begginning
	globalMainPageCurrentProductPos = -1;
	if(globalMainPageTimeout)
		clearTimeout(globalMainPageTimeout);
	mainSwitchImage();
	
	return false;
}





