function showDetail(basicName, id, count, status)
{
	for(i=1;i<=count;i++)
	{
	    divName = basicName + i;
	    divElement = document.getElementById(divName);

	    divNavName = basicName + "_navigation" + i;
	    divNavigation = document.getElementById(divNavName);

	    if(id == i)
	    {
		divElement.style.visibility = 'visible';
		divElement.style.display = 'block';
		if(status==1)
			divNavigation.className = basicName + '_active';
	    } else {
		divElement.style.visibility = 'hidden';
		divElement.style.display = 'none';
		if(status==1)
			divNavigation.className = basicName;
	    }
	}
}

function changeButtonStatus(basicName, id, count)
{
	for(i=1;i<=count;i++)
	{
	    divNavName = basicName + i;
	    divNavigation = document.getElementById(divNavName);

	    if(id == i)
	    {
		divNavigation.className = basicName + '_active';
	    } else {
		divNavigation.className = basicName;
	    }
	}
}

function showAndHide(showName, hideName)
{
	    divShow = document.getElementById(showName);
		divShow.style.visibility = 'visible';
		divShow.style.display = 'block';

	    divHide = document.getElementById(hideName);
		divHide.style.visibility = 'hidden';
		divHide.style.display = 'none';
}

function hideElement(hideName)
{
		if(document.getElementById(hideName)!=null)
		{
		    divHide = document.getElementById(hideName);
			divHide.style.visibility = 'hidden';
			divHide.style.display = 'none';
		}
}

function showElement(showName)
{
	    divShow = document.getElementById(showName);
		divShow.style.visibility = 'visible';
		divShow.style.display = 'block';
}

function changeVisibility(elemName,mode)
{
	if(document.getElementById(elemName)==null)
		return;

	divElem = document.getElementById(elemName);
	
	if(divElem.style.display == 'none')
	{
		divElem.style.visibility = 'visible';
		if(mode==1)
			mV = 'block';
		else
			mV = 'inline';
		divElem.style.display = mV;
	}
	else
		hideElement(elemName);
}

function searchPrice(Vstart,Vstop) {
	document.getElementById('PriceStart').value = Vstart;
	document.getElementById('PriceStop').value = Vstop;
	document.SearchPrice.submit();
	document.getElementById('PriceSubmit').disabled = 'disabled';
}




var oldLink = null;
// code to change the active stylesheet
function setActiveStyleSheet(link, title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  if (oldLink) oldLink.style.fontWeight = 'normal';
  oldLink = link;
  link.style.fontWeight = 'bold';
  return false;
}



function searchUserVariant(link,category) {
	v = link.value;
	if(v != -1)
		window.location = "/shop/advanced_search_filter/"+category+"/"+v;
}

function setSelectSize(value,itemsCount) {

	hideElement('CartSelectSizeFirst');
	for(i=1;i<=itemsCount;i++) {
		hideElement('CartSelectSize'+i);
	}

	if(value > 0)
	{
		showElement('CartSelectSize'+value);
	} else {
		showElement('CartSelectSizeFirst');
	}
}

function setSelectCompletSize(value,itemsCount,itemID) {

	hideElement('Cart'+itemID+'SelectSizeFirst');
	for(i=1;i<=itemsCount;i++) {
		hideElement('Cart'+itemID+'SelectSize'+i);
	}

	if(value > 0)
	{
		showElement('Cart'+itemID+'SelectSize'+value);
	} else {
		showElement('Cart'+itemID+'SelectSizeFirst');
	}
}

var requisitCompletItems = new Array();

function increaseRequisited(itemID)
{
	var n = 'CartItem'+itemID+'Status';
	var v = document.getElementById(n);
	v.value = 1;
}

function decreaseRequisited(itemID)
{
	var n = 'CartItem'+itemID+'Status';
	var v = document.getElementById(n);
	v.value = 0;
}

function checkRequisited()
{
	var _ok = true;
	for(i=0;i<(requisitCompletItems.length);i++)
	{
		var n = 'CartItem'+requisitCompletItems[i]+'Status';
		var v = document.getElementById(n);

		if(v.value != 1)
			_ok = false;
	}
	if(_ok == true)
		document.getElementById('CartButtonCommit').disabled=false;
	else
		document.getElementById('CartButtonCommit').disabled=true;
}

function setRequisitedVariants()
{
	for(i=0;i<(requisitCompletItems.length);i++)
	{
		var n = 'Cart'+requisitCompletItems[i]+'SelectColor';
		var nS = 'Cart'+requisitCompletItems[i]+'SelectSize1';
		var v = document.getElementById('CartItem'+requisitCompletItems[i]+'Variant');

		document.getElementById('CartItem'+requisitCompletItems[i]+'Variant').value = 
		document.getElementById(n)[
			document.getElementById(n).selectedIndex
			].text+'/'+
			document.getElementById(nS).value;
	}
}

function changeSearchCheckbox(n) {
	if(document.getElementById(n) == null)
		return;

	var elem = document.getElementById(n);
	var v = elem.style.fontWeight;
	var ch = document.getElementById('AdvancedOnlyThis');

	hideElement('shop_left_menu_supplier_local');
	hideElement('shop_left_menu_supplier_upper');

	if(v == 400 && ch.checked == true)
	{
		v = 700;
		col = '#f00000';
		nCh = 'shop_left_menu_supplier_local';
	} else {
		v = 400;
		col = '#000000';
		nCh = 'shop_left_menu_supplier_upper';
	}

	document.getElementById(n).style.fontWeight = v;
	document.getElementById(n).style.color = col;
	showElement(nCh);
}

function productPrintingEdition(address) {
	nW = window.open(address, 'sort', 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=no, width=800, height=600, left=30, top=30')
	nW.focus();
}

function showSizesTable(url_sizes)
{
	noweokno=window.open(url_sizes,"sizes","width=700,height=500,scrollbars=yes,resizable=yes,toolbars=no,fullscreen=no")
}

var OrderPaymentMethod = 0;