//alternativa al target _blank STRICT
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

window.onload = externalLinks;

// setta il contenuto di default della newsletter
function nlVal(obj, msg, event)
  {
  switch(event)
    {
    case 'blur':
      if (obj.value == '')
        {
        obj.value = msg;
        obj.style.color = '#666666';
        }
      break;

    case 'focus':
      if (obj.value == msg)
        {
        obj.value = '';
        obj.style.color = '#000000';
        }
      break;
    }
  }

function checkAddProd(msg, accessorio)
  {
  if (accessorio != '1') {
	  var x=document.getElementById("sel_id_taglia")

	  if (x.options[x.selectedIndex].value == "")
    	{
	    alert(msg);
	    return false;
	    }
  } else return true;
  }

// nascondo tutte le tabelline delle taglie e mostro solo quella che mi interessa (mootools)
function show_tab(taglia)
  {
  $$('.tab_taglie').each(function(el){ el.setStyle('display', 'none'); });
  $('tab_'+ taglia).setStyle('display', 'block');
  }

function viewImg(new_src)
  {
  document.getElementById("central-img").src = new_src;
  return false;
  }

function popUpHelp(href)
  {
  window.open(href, 'help', 'width=600px, height=400px, scrollbars=1, menubar=0, toolbar=0');
  return false;
  }

function openTellAFriend(baseurl)
  {
  url = baseurl + '/tellafriend.php?url=' + escape(location.href);
  popup = window.open(url, 'tellafriend', 'width=650, height=400, scrollbars=1, resizable=1, statusbar=1');
  popup.focus();
  }


// visualizza/nasconde i sottomenu all'onmouseover
function hideSubMenu(par) {
  var submenu = document.getElementById(par).style.visibility;

  switch(submenu) {
    case 'visible':
      document.getElementById(par).style.visibility='hidden';
      break;
    case 'hidden':
      document.getElementById(par).style.visibility='visible';
      break;
    default:
      break;
  }
}

// nasconde i submenu all'onmouseover sulle voci del menu principale
function closeSubMenu(par){
  document.getElementById(par).style.visibility='hidden';
}

function Bookmark()
  {
  title = window.location.host;
  url = "http://" + window.location.host;

  // Mozilla Firefox Bookmark
  if (window.sidebar)
    window.sidebar.addPanel(title, url,"");
  // IE Favorite
  else if( window.external )
    window.external.AddFavorite( url, title);
  // Opera Hotlist
  else if(window.opera && window.print)
    alert("Premere \"Ctrl + t\" per salvare la pagina nei preferiti.");
  }