function pAct(id, action)
{
	var product = getObject(id);
	
	switch (action)
	{
	case 0:
		product.style.backgroundImage = "url('../images/product_bg_001.png')";
		break;
	case 1:
		product.style.backgroundImage = "url('../images/product_bg_002.png')";
		break;
	default:
		window.location = action;
		break;
	}
}

function switchVisibility(id, visible)
{
	v = "hidden";
	if (visible)
	{
		v = "visible";
	}
	getObject(id).style.visibility = v;
}

function changeMailLinkOld()
{
	var domain = "upitec.com";
	var link   = getObject('hidmail');
	if (link.innerHTML.match(':domain:'))
	{
		link.innerHTML = link.innerHTML.replace(':domain:', '@' + domain);
	}
}

function changeMailLink()
{
	var domain = "upitec.com";
	var link   = document.getElementsByTagName('a');
	for (i = 0; i < link.length; i++)
	{
		if (link[i].href.match('mail:') && link[i].href != "mail:")
		{
			link[i].innerHTML = link[i].href.replace('mail:', '') + '@' + domain;
			link[i].title = link[i].href.replace('mail', 'mailto') + '@' + domain;
			link[i].href = link[i].href.replace('mail', 'mailto') + '@' + domain;
		}
	}
}

function showTab(parentid, childid)
{
	var parent;
	var child;
	
	if (parentid == 1)
	{
		parent = 'retail';
	}
	else if (parentid == 2)
	{
		parent = 'fashion';
	}
	else if (parentid == 3)
	{
		parent = 'optics';
	}
	else
	{
		parent = 'retail';
	}
	
	if (childid == 1)
	{
		child = 'overview';
	}
	else if (childid == 2)
	{
		child = 'advantage';
	}
	else if (childid == 3)
	{
		child = 'functionality';
	}
	else
	{
		child = 'overview';
	}
	
	hideAllTabs(parent);
	
	getObject('container_'+parent).className = "show";
	getObject('container_'+parent+'_'+child).className = "show";
	getObject('link_'+parent+'_'+child).className = "now";
	
	if (childid == 3)
	{
		showFuncTab(parentid, 1);
	}
}

function hideAllTabs(parent)
{
	getObject('container_'+parent+'_overview').className = "hide";
	getObject('container_'+parent+'_advantage').className = "hide";
	getObject('container_'+parent+'_functionality').className = "hide";
	
	getObject('link_'+parent+'_overview').className = "notnow";
	getObject('link_'+parent+'_advantage').className = "notnow";
	getObject('link_'+parent+'_functionality').className = "notnow";
	}

function showFuncTab(parentid, childid)
{
	var parent;
	
	if (parentid == 1)
	{
		parent = 'retail';
	}
	else if (parentid == 2)
	{
		parent = 'fashion';
	}
	else if (parentid == 3)
	{
		parent = 'optics';
	}
	else
	{
		parent = 'retail';
	}

	hideAllFuncTabs();
	
	getObject(parent+'_func_'+childid).className = "right show";
}

function hideAllFuncTabs()
{
	var count;
	var parent;
	
	parent = 'retail';
	for (count = 1; count <= 15; count = count + 1)
	{
		getObject(parent+'_func_'+count).className = "right hide";
	}
	parent = 'fashion';
	for (count = 1; count <= 15; count = count + 1)
	{
		getObject(parent+'_func_'+count).className = "right hide";
	}
	parent = 'optics';
	for (count = 1; count <= 15; count = count + 1)
	{
		getObject(parent+'_func_'+count).className = "right hide";
	}
}

function getObject(objectId)
{
	if(document.getElementById && document.getElementById(objectId))
	{
		return document.getElementById(objectId);
	}
	else if (document.all && document.all(objectId))
	{
		return document.all(objectId);
	}
	else if (document.layers && document.layers[objectId])
	{
		return document.layers[objectId];
	}
	else
	{
		return false;
	}
}
