// JavaScript Document
function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
bw=new verifyCompatibleBrowser() 
 
 
var speed=10
 
var loop, timer 
 
function ConstructObject(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp;this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; this.x; this.y; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 
function MoveArea(x,y){
 this.x=x;this.y=y
 this.css.left=this.x+"px";
 this.css.top=this.y+"px";
}
 
function MoveAreaDown(move){ 
	if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	} 
} 
function MoveAreaUp(move){ 
	if(this.y<0){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	} 
} 
 

function PerformScroll(speed){ 
	if(initialised){ 
		loop=true; 
		if(speed>0) objScroller.down(speed) 
		else objScroller.up(speed) 
	} 
}
 
function CeaseScroll(){ 
    loop=false 
    if(timer) clearTimeout(timer) 
}

function PerformScroll2(speed){ 
	if(initialised){ 
		loop=true; 
		if(speed>0) objScroller2.down(speed) 
		else objScroller2.up(speed) 
	} 
}
 
function CeaseScroll2(){ 
    loop=false 
    if(timer) clearTimeout(timer) 
} 

var initialised; 
function InitialiseScrollableArea(){ 

    objContainer=new ConstructObject('divContainer')
    objScroller=new ConstructObject('divContent','divContainer')
    objScroller.MoveArea(0,0) 
    objContainer.css.visibility='visible'
	

    initialised=true;
}
var prev="null";

function visualizza_menu(id,menuid) {
var e = document.getElementById(id);
var g = document.getElementById(menuid);
if(e.style.display == 'none') {
e.style.display = '';
g.className = "link_hover";
}else{
e.style.display = 'none';
g.className = "";
}
}

function visualizza_regalo() {
var e = document.getElementById("carrello-regala-dati");
var g = document.getElementById("carrello-regala");
if(e.style.display == 'none') {
e.style.display = '';
g.className = "carrello-regala-css-on";
}else{
e.style.display = 'none';
g.className = "carrello-regala-css";
}
}

function azzera_regalo() {
var e = document.getElementById("RegalaAmico");
e.action="carrello.asp?AzzeraRegalo=1#Regalo";
e.submit();
}

function visualizza_faq(id) {
var e = document.getElementById(id);
if(e.style.display == 'none') {
e.style.display = '';
}else{
e.style.display = 'none';
}
}

var xmlhttp;
function loadXMLDoc(id)
{
xmlhttp=null;
document.getElementById('Vetrina').innerHTML="<div align=\"center\"><br /><br /><img src=\"images/map_loading.gif\" width=\"400\" height=\"352\" alt=\"Loading\" /><br /><br />Caricamento in corso...</div>";
 var data = new Date();
  var Hh, Mm, Ss, mm;
  Hh = data.getHours();
  Mm = data.getMinutes();
  Ss = data.getSeconds();
  mm = data.getMilliseconds();
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change;
    xmlhttp.open("GET","inc_vetrina.asp?pag="+id+"&JSMode=Add&Temp="+ Hh + Mm + Ss + mm,true);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}

function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"

				
    document.getElementById('Vetrina').innerHTML=xmlhttp.responseText;
    }
  else
    {
    alert("Impossibile caricare i dati:" + xmlhttp.statusText);
    }
  }
}


var xmlhttp2;
function loadXMLDoc2(Tipoid)
{
xmlhttp2=null;
document.getElementById('loadconsigli').style.display = '';
document.getElementById('bottoniconsigli').style.display = 'none';
 var data = new Date();
  var Hh, Mm, Ss, mm;
  Hh = data.getHours();
  Mm = data.getMinutes();
  Ss = data.getSeconds();
  mm = data.getMilliseconds();

if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp2=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp2!=null)
  {
  xmlhttp2.onreadystatechange=state_Change2;
    xmlhttp2.open("GET","inc_consigli.asp?TipoId="+Tipoid+"&JSMode=Add&Temp="+ Hh + Mm + Ss + mm,true);
  xmlhttp2.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}

function state_Change2()
{
if (xmlhttp2.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp2.status==200)
    {// 200 = "OK"
	timeout = setTimeout("sethtml(xmlhttp2.responseText)", 2000);
    }
  else
    {
    alert("Impossibile caricare i dati:" + xmlhttp2.statusText);
    }
  }
}
 function sethtml(response)
 {
	 document.getElementById('Vetrina').innerHTML=response;
 }

function Remove_Item(url)
{
   if(confirm("Rimuovere il prodotto dal carrello?"))
   {
      location.href=url;
   }
   else ;
}
function Clear_Cart(url)
{
   if(confirm("Selezionano Ok, tutti i prodotti del carrello verranno rimossi. Continua?"))
   {
      location.href=url;
   }
   else ;
}

function OpenPlayer(url)
{
      document.getElementById('Mp3Player').innerHTML = "<br /><a name=\"Mp3\" id=\"Mp3\"></a><br /><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\" width=\"300\" height=\"85\" title=\"Mp3 player\"><param name=\"movie\" value=\"mp3player2009.swf?video="+url+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"opaque\" /><embed src=\"mp3player2009.swf?video="+url+"\" quality=\"high\" wmode=\"opaque\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"300\" height=\"85\"></embed></object>";
	  location.href="#Mp3";
}
function Clear_Cart(url)
{
   if(confirm("Selezionado Ok tutti i prodotti nel carrello verranno eliminati. Continuare?"))
   {
      location.href=url;
   }
   else ;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

$(window).load(function(){autoScroller('scroller', 1)});



function Mp3Player(url,Id)
{
      document.getElementById('Mp3Player-'+Id).innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\" width=\"150\" height=\"42\" align=\"middle\" title=\"Ascolta\"><param name=\"movie\" value=\"mp3player2009.swf?audio="+url+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"opaque\" /><embed src=\"mp3player2009.swf?audio="+url+"\" width=\"150\" height=\"42\" align=\"middle\" quality=\"high\" wmode=\"opaque\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\"></embed></object>";
}

function verScroll(dir, spd, loop) {
loop = true;
direction = "up";
speed = 10;
scrolltimer = null;
if (document.layers) {
var page = eval(document.divContent);
}
else {
if (document.getElementById) {
var page= eval("document.getElementById('divContent').style");
}
else {
if (document.all) {
var page = eval(document.all.contentLayer.style);
      }
   }
}
direction = dir;
speed = parseInt(spd);
var y_pos = parseInt(page.top);
if (loop == true) {
if (direction == "dn") {
page.top = (y_pos - (speed));
} else {
if (direction == "up" && y_pos < 10) {
page.top = (y_pos + (speed));
} else {
if (direction == "top") {
page.top = 10;
      }
   }
}
scrolltimer = setTimeout("verScroll(direction,speed)", 1);
   }
}
function stopScroll() {
loop = false;
clearTimeout(scrolltimer);
}

