$(document).ready(function(){ 
			$('.qta-versioni').ajaxForm(function() { 
            tb_show('',pathassoluta+'modules/carrello.php?height=550&amp;width=560');
			$("#quote").load(pathassoluta+"cesto.php"); 
			return false;
            }); 
$("#inner_nav").tabs(); 
		$('#forUsers').accordion({
			active: '.active',
			selectedClass: 'active',
			collapsible:true,
			header: 'h3.head',
			navigation: true,
		 	autoHeight: false,
		  alwaysOpen: false
	});
	if ( $("#menuNav").length > 0 ) {	
		$('#menuNav').accordion({
			active: '.active',
			selectedClass: 'active',
			collapsible:true,
			header: 'a.head',
			alwaysOpen: false,
			autoHeight:false,
			navigation: true
	});
	}

	$('#cose_accordion').accordion({
			active: 3,
			selectedClass: 'active',
			collapsible:false,
			header: 'h3',
			event: 'mouseover',
            animated: 'bounceslide',
			alwaysOpen: false,
			autoHeight:false,
			navigation: true
	});
		 
		 
		 $(".addToCart a").click(function(){ $(function dosubmit() {
         $(".qta-versioni").submit();
	 
            });
		 });
	
	$(function() {
		$("#googlemaps").tabs();
	
	});

	$("#faq").accordion({
			active: '.active',
			selectedClass: 'active',
			collapsible:true,
			header: 'h3.head',
			navigation: true,
		 	autoHeight: false,
		  alwaysOpen: false
		});

$('#menu li a').hover(function(){
				$(this).animate({marginTop:'6px'},{queue:false,duration:200});
					},function(){
				$(this).animate({marginTop:'0'},{queue:false,duration:200});
					});
$('#menu li.selected a').hover(function(){
				$(this).animate({marginTop:'10px'},{queue:false,duration:200});
					},function(){
				$(this).animate({marginTop:'10px'},{queue:false,duration:200});
					});

$('.forLogin').hoverIntent(function() {  
     $('.loginForm').fadeIn('fast');  
     }, function() {  
     $('.loginForm').fadeOut('slow');  
 }); 

$('.forNewsletter').hoverIntent(function() {  
     $('.newsletterForm').fadeIn('fast');  
     }, function() {  
     $('.newsletterForm').fadeOut('slow');  
 }); 

$('.toCustomize').toggle(function() {  
     $('.customize').fadeIn('fast');  
	  $('.writeComment').css('display','none');  
     }, function() {  
     $('.customize').fadeOut('slow');  
	
 })

$('.toComment').toggle(function() {  
     $('.writeComment').fadeIn('fast');  
	   $('.customize').css('display','none');  
     }, function() {  
     $('.writeComment').fadeOut('slow');  
	 
 })

$('#type-1').click(function(e){
if($('#type-1').attr("checked"))$('.writeMessage').fadeIn('fast');
$('.radio_hidden').css('display','inline');
$('.radio_hidden').addClass('radio_visible');
$('.radio_hidden').removeClass('radio_hidden');
});

$('#type-2').click(function(e){
if($('#type-2').attr("checked"))$('.writeMessage').fadeOut('slow');
$('.radio_visible').css('display','none');
$('.radio_visible').addClass('radio_hidden');
$('.radio_visible').removeClass('radio_visible');
});


/*
$('#type-2').click(function(e){
if($('#type-2').attr("checked"))$('.writeComment').fadeIn('fast');
});

$('#type-3').click(function(e){
if($('#type-3').attr("checked"))$('.writeComment').fadeIn('fast');
});

$('#type-4').click(function(e){
if($('#type-4').attr("checked"))$('.writeComment').fadeIn('fast');
});

$('#type-5').click(function(e){
if($('#type-5').attr("checked"))$('.writeComment').fadeIn('fast');
});

$('#type-6').click(function(e){
if($('#type-6').attr("checked"))$('.writeComment').fadeOut('slow');
});
*/

		function onAfter() { 
    /*$('.linkTo').html("") .append('<a href="index.php?m=progetti">' + this.alt + '</a>'); */
	$('.linkTo').html("") .append(this.alt); 
	}
    if(document.getElementById('slideshow')){
	    $('#slideshow').before('<div id="pager">').cycle({ 
           // fx:     'Fade', 
            speed:  'slow', 
            timeout: 8000 , 
	        pager:  '#pager',
			next:   '#next', 
			after:   onAfter,
   			prev:   '#prev' 
       }); 
	}

	
 $("#s").autocomplete("search.php", {
		width: 260,
        selectFirst: false
	});

	$("#s").result(function(event, data, formatted) {
		if (data)
			$(this).parent().next().find("input").val(data[1]);
	});

$("#contributor").validate();
$("#search").validate();
$("#newsletter-form form").validate();

$('.addToCart_error a').tooltip({ 
    track: true, 
    delay: 0, 
    showURL: false, 
    showBody: " - ", 
    fade: 250 
});
   // jQuery('#photogallery ul').jcarousel();


 }); 





window.onload=intercetta;
function intercetta() {
for (var i=0; i<document.links.length; i++)
if(document.links[i].rel=="blank"){
document.links[i].target="_blank";
}
}

function altezza_light()	{
	
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	
	return windowHeight+20;	
		
}

function larghezza_light()	{
	
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	} else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		} else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	
	return windowWidth;	
		
}


function apri_light(id,pathassoluta){

var altezza=altezza_light();
//alert(altezza);
var larghezza=larghezza_light();
var link=pathassoluta+"configuratore/index.php?height="+altezza+"&amp;width="+larghezza+"&id="+id;
//var link="http://www.alberodellavita.org/test_configratore/index.html?height=1000&amp;width=1280";
tb_show("",link,"",1);

}

function apri_light_mod(id,pathassoluta){
var altezza=altezza_light();
var larghezza=larghezza_light();
var link=pathassoluta+"configuratore/mod.php?height="+altezza+"&amp;width="+larghezza+"&id="+id;
//var link="http://www.alberodellavita.org/test_configratore/index.html?height="+altezza+"&amp;width="+larghezza;
tb_show("",link,"",1);
}


function apri_light_biglietti(id,pathassoluta){

var altezza=altezza_light();
//alert(altezza);
var larghezza=larghezza_light();
var link=pathassoluta+"configuratore/biglietti.php?height="+altezza+"&amp;width="+larghezza+"&id="+id;
//var link="http://www.alberodellavita.org/test_configratore/index.html?height=1000&amp;width=1280";
tb_show("",link,"",1);

}

function apri_light_mod_biglietti(id,pathassoluta){
var altezza=altezza_light();
var larghezza=larghezza_light();
var link=pathassoluta+"configuratore/mod_biglietti.php?height="+altezza+"&amp;width="+larghezza+"&id="+id;
//var link="http://www.alberodellavita.org/test_configratore/index.html?height="+altezza+"&amp;width="+larghezza;
tb_show("",link,"",1);
}


function apri_light_lettere(id,pathassoluta){

var altezza=altezza_light();
//alert(altezza);
var larghezza=larghezza_light();
var link=pathassoluta+"configuratore/lettere.php?height="+altezza+"&amp;width="+larghezza+"&id="+id;
//var link="http://www.alberodellavita.org/test_configratore/index.html?height=1000&amp;width=1280";
tb_show("",link,"",1);

}

function apri_light_mod_lettere(id,pathassoluta){
var altezza=altezza_light();
var larghezza=larghezza_light();
var link=pathassoluta+"configuratore/mod_lettere.php?height="+altezza+"&amp;width="+larghezza+"&id="+id;
//var link="http://www.alberodellavita.org/test_configratore/index.html?height="+altezza+"&amp;width="+larghezza;
tb_show("",link,"",1);
}