// JavaScript Document

var toggle = true;
var soundfile="sidebar.wav" //path to sound file, or pass in filename directly into playsound()

function playsound(soundfile){
if (document.all && document.getElementById){
document.getElementById("soundeffect").src="" //reset first in case of problems
document.getElementById("soundeffect").src=soundfile
}
}

function bindsound(tag, soundfile, masterElement){
if (!window.event) return
var source=event.srcElement
while (source!=masterElement && source.tagName!="HTML"){
if (source.tagName==tag.toUpperCase()){
playsound(soundfile)
break
}
source=source.parentElement
}
}

function gup( name )
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}

function showtsm(op)
{
element=document.getElementById("tsm");
if (op==1)
{
bytefx.size(element,{width:112,height:100},6,null);
tsmcheck=1;
}
else
{
//alert(this.mus);
bytefx.size(element,{width:112,height:0},6,null);
tsmcheck=0;
}

}

function showtsm0(op)
{
element=document.getElementById("tsm");
if (op==1)
{
bytefx.size(element,{width:85,height:80},6,null);
tsmcheck=1;
}
else
{
//alert(this.mus);
bytefx.size(element,{width:85,height:0},6,null);
tsmcheck=0;
}

}


function show(object) {
if (document.layers && document.layers[object])
document.layers[object].visibility = 'visible';
else if (document.all) {
document.all[object].style.visibility = 'visible';
document.all[object].style.zIndex = 100;
}
}
function hide(object) {
if (document.layers && document.layers[object])
document.layers[object].visibility = 'hidden';
else if (document.all)
document.all[object].style.visibility = 'hidden';
}

function showHide( id )
{
var el;
if (document.getElementById) {
el = document.getElementById(id);
} else if (document.all) {
el = document.all[id];
} else if (document.layers) {
el = document.layers( id )
}

if ( el.style ){
el.style.display =
('display' == el.style.display)? 'none':'inline';
}
}

/* 
styTog() -- a function to toggle CSS style attributes
This function accepts four parameters from the calling event:
targ_id, which is the id of the target element;
sty_attrJ, which is the style attribute's name in JavaScript syntax;
sty_attrC, which is the style attribute's name in CSS syntax;
set_val, which is the second toggle state value;

The element id, "zedSpan" is reserved for this function's use.
*/
function styTog(targ_id,sty_attrJ,sty_attrC,set_val){ 
var targ=document.getElementById(targ_id);
var targ_stat="";
var targ_sty="";
var attr_chk=sty_attrC.toLowerCase()
var excp_flag=0;
if(attr_chk.indexOf("color")!=-1 || attr_chk.indexOf("font")!=-1){
excp_flag=1;
if(!document.getElementById("zedSpan")){
var insSpan=document.createElement("span");
insSpan.setAttribute("id","zedSpan");
document.body.appendChild(insSpan);
}
var zS=document.getElementById("zedSpan").style
zS[sty_attrJ]=set_val;
}
if(targ.currentStyle){ //code for IE
if(excp_flag==1)set_val=zS[sty_attrJ];
targ_stat=targ.currentStyle[sty_attrJ];
}else{ //code for W3C-spec-compatible
if(excp_flag==1){
var tst_span=document.getElementById("zedSpan");
var tst_sty=document.defaultView.getComputedStyle(tst_span,"");
set_val=tst_sty.getPropertyValue(sty_attrC);
excp_flag=0;
}
targ_sty=document.defaultView.getComputedStyle(targ,"");
targ_stat=targ_sty.getPropertyValue(sty_attrC);
}
targ_stat!=set_val ? targ.style[sty_attrJ]=set_val : targ.style[sty_attrJ]="";
}

function setass(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;
    }
  }
}

function KW_s(r, g, b, el) {
    d=document;hr=r.toString(16);hg=g.toString(16);hb=b.toString(16);
	hr=(hr.length==1)?"0"+hr:hr;hg=(hg.length==1)?"0"+hg:hg;hb=(hb.length==1)?"0"+hb:hb;
	if (d.getElementById) d.getElementById(el).style.color="#"+hr+hg+hb;
}

function KW_c(a,b,s,i) { return Math.floor(a*((s-i)/s)+b*(i/s)) }

function KW_fade(r,g,b,e,n,l,s,o){
    for(i=0;i<=s;i++)setTimeout("KW_s("+KW_c(r,e,s,i)+","+KW_c(g,n,s,i)+","+KW_c(b,l,s,i)+",'"+o+"');",i*s);
}

function conferma (lang) { 
if (lang=="ita") {
chiediConferma = confirm('La Collezione è presentata attraverso il brand ARTEPITALIA, con i Servizi di Consulting, di Progettazione su Misura, il Contract. Clicca OK per Accedere ad ARTEPITALIA');
}
else
{
  chiediConferma = confirm('La Collezione è presentata attraverso il brand ARTEPITALIA, con i Servizi di Consulting, di Progettazione su Misura, il Contract. Clicca OK per Accedere ad ARTEPITALIA'); 
}
  
  if (chiediConferma == true){ 
    window.open("http://www.artepitalia.com"); //ricarica la pagina 
  } 

  /* o anche nella forma più sintetica: 

  if (confirm('Sei sicuro di voler uscire dalla pagina?')){ 
    location.href="#"; //ricarica la pagina 
  } 
  */ 
} 
