// JavaScript Document
jQuery(function(){     
jQuery('.easy-form').EasyForms();
jQuery('.lista-proposte li,.standard-list li,.lista-itinerari li,.lista-escursioni li,.lista-hotels li').mouseover(function() {jQuery(this).addClass("over");}).mouseout(function() {jQuery(this).removeClass("over");}).click(function() {window.location = jQuery(this).find("a").get()});
jQuery('.lista-programmi-descrizione ul li:odd').addClass("alt");
jQuery('#menu-1').mouseover(function() {jQuery('#navbar').attr("class","menu1");return false});
jQuery('#menu-2').mouseover(function() {jQuery('#navbar').attr("class","menu2");return false});
jQuery('#menu-3').mouseover(function() {jQuery('#navbar').attr("class","menu3");return false});
jQuery('#menu-4').mouseover(function() {jQuery('#navbar').attr("class","menu4");return false});
jQuery('#menu-5').mouseover(function() {jQuery('#navbar').attr("class","menu5");return false});
jQuery('#menu-6').mouseover(function() {jQuery('#navbar').attr("class","menu6");return false});
jQuery('.conferma').confirm_prompt("Sei sicuro? Questa operazione sar&agrave; irreversibile.");


jQuery('#nozze-online-toggle').click(function() {jQuery('.baloon1').fadeIn('fast');$(this).addClass('over');jQuery("#tb_baloon").show();});
jQuery('#viaggio-online-toggle').click(function() {jQuery('.baloon').toggle('fast');$(this).addClass('over');jQuery("#tb_baloon").show();});
jQuery("#tb_baloon").click(function() {jQuery('.baloon, .baloon1').fadeOut('fast');jQuery('#viaggio-online-toggle,#nozze-online-toggle').removeClass('over');$(this).hide()});


jQuery('.special-opera').click(function() {if(PopupBlocked('http://www.dimtriade.it/operaontheweb/asp/start.asp','OPERA','scrollbars=yes,width=710,height=550')){showPopBlock()};return false;});
jQuery('#pin-programma').click(function() {if(PopupBlocked('http://www.dimtriade.it/operaontheweb/asp/startpin.asp?pin='+jQuery('#codice-programma').val() ,'OPERA','scrollbars=yes,width=710,height=550')){showPopBlock()};return false;});


ava:


if (jQuery('#lista-offerte').length > 0){
	// first simple Accordion with special markup
		jQuery('#lista-offerte').accordion({
			header: '.off-title',
			active: false,			
			event: "mouseover"
			//navigation: true 
			//animated: false
		});
}
jQuery("#tablelist").tablesorter({ 
    widgets: ['zebra'] 
});

if (jQuery('#search-container').length > 0){
jQuery('#search-container').tabs();
}
if (jQuery('#accordion').length > 0){
    jQuery("#accordion").tabs(); 
}


jQuery("#q").autocomplete('/ricerca.asp?mode=ajax', {		
		matchContains: true,		
		minChars: 3,
		width:210
		

	});

//if(PopupBlocked()){alert('Ouch')}else{alert('OK')}
});



// More usable Forms V 2.3  By Oliver Astrologo
jQuery.fn.EasyForms=function(){
this.submit( function() {
			var submitForm = this;
			jQuery(submitForm).find("label").not(".radiolabel").each(function(){
				var current=jQuery(this);
				var targetForm =  jQuery('#'+current.attr("for"));				
				if (targetForm.val() == current.html()){
				targetForm.val('');
				};																			  
			});
		return true;
	});	
	this.find("label").not(".radiolabel").each(function(){
		var current=jQuery(this);		
		var targetForm = jQuery('#'+current.attr("for"));	   
	   if (targetForm.val() == ''){
			targetForm.val(current.html());		
			}	   
	   targetForm.click(function(){		
		if (jQuery(this).val() == current.html()){
			jQuery(this).val('');			
			}
		});
		targetForm.blur(function(){		
		if (jQuery(this).val() == ''){
			jQuery(this).val(current.html());			
			}
		});
		current.hide();	
	});			
}

jQuery.fn.confirm_prompt = function(stringa) {
newlocation = jQuery(this).get(0);	
this.click(function() {
	 if (confirm(stringa)) {
      window.location = newlocation;
    }else{
	return false;
	}});
}


// Open popup
function PopupBlocked(theURL,winName,features) {
var PUtest = window.open(theURL,winName,features);
if (PUtest){return false;}else{return true;}
}


function showPopBlock(){
alert('Rivelato blocco popup, per poter accedere è necessario disabilitare il blocco dei popup per questo sito.');
}

