function MM_openBrWindow(theURL,winName,features)
{
	window.open(theURL,winName,features);
}

function resetField(element)
{

	if(element.value.length==0){
		element.value="Cerca...";
	}
}

function clearField(element)
{
	if( element.value=="Cerca...")
	{
		element.value="";
	}
}
function MM_openBrWindow(theURL,winName,features)
{
	window.open(theURL,winName,features);
}

function resetField(element)
{

	if(element.value.length==0){
		element.value="Cerca...";
	}
}

function clearField(element)
{
	if( element.value=="Cerca...")
	{
		element.value="";
	}
}


function showTabOn(tabId)
{
	document.getElementById(tabId+'_li').className = tabId+'_tabs_on';
	document.getElementById(tabId+'_div').style.display = 'block';
}

function showTabOff(tabOff)
{
	document.getElementById(tabOff+'_li').className = tabOff+'_tabs_off';
	document.getElementById(tabOff+'_div').style.display = 'none';
}

function centerElement(referenceID, theID) 
{
  infohost = document.getElementById(referenceID);
  infobox = document.getElementById(theID);
  var infohostY = 0;
  var infohostX = 0;
  var count = 0;
  var infohostFind = infohost;
  do 
  {
    infohostY += infohostFind.offsetTop;
    infohostX += infohostFind.offsetLeft;
  } while ( infohostFind = infohostFind.offsetParent )
  infobox.style.left = (infohostX - ((infobox.offsetWidth - infohost.offsetWidth) / 2)+0) + 'px';
  infobox.style.top = infohostY + (infohost.offsetHeight / 2) + 8 + 'px';  
  return;
}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function ToolTip(text, width, textalign)
{
	return Tip(text, BALLOON, true, ABOVE, true, OFFSETX, -10, WIDTH, width, TEXTALIGN, textalign, FADEIN, 600, FADEOUT, 600, PADDING, 8)
}

function selCategoria()
{
	$$(".showSel").each(function(item, index){
		item.selectedIndex = $("categoriaTutto").selectedIndex;
	});						
}


function selezionaTuttoFunc()
{
	$$(".checkSel").each(function(item, index){
		item.checked = true;
	});						
	$("selezionaTutto").checked = false;
	$$(".showSel").each(function(item, index){
		//item.style.visibility = 'hidden';
	});						
	
	//$("categoriaTutto").style.display = '';
	$("checkX").innerHTML = '<input type="checkbox" name="deselezionaTutto" id="deselezionaTutto" onclick="deselezionaTuttoFunc()" /> <label for="deselezionaTutto">Deseleziona tutti i prodotti</label>';
}

function deselezionaTuttoFunc()
{
	$$(".checkSel").each(function(item, index){
		item.checked = false;
	});						
	$("deselezionaTutto").checked = false;
	$$(".showSel").each(function(item, index){
		//item.style.visibility = 'visible';
	});	
	//$("categoriaTutto").style.display = 'none';
	$("checkX").innerHTML = '<input type="checkbox" name="selezionaTutto" id="selezionaTutto" onclick="selezionaTuttoFunc()" /> <label for="selezionaTutto">Seleziona tutti i prodotti</label>';
}

