// JavaScript Document

Shadowbox.init({
    language:   "it",
    players:  ['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'],
	enableKeys:			true,
	continuous:			true
 
   
});

//shadowbox per form
function apriSB(titolo, action, campi, larghezza, altezza)
{
	// legge le variabili del form
	var parametri = campi;
	$.ajax(
	{
		type: "POST",
		url: action,
		data: parametri,
		success: function(msg)
		{
				contenuto=msg;
				Shadowbox.open({player: 'html', title: titolo, content: contenuto, height: altezza, width: larghezza});
		},
		error: function() {
				return false;
		}				
	}
	);
};


/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 20;
		yOffset = 50;	
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
	
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "" + this.t : "";
		$("body").append("<p id='tooltip'><img src='"+ this.href +"' alt='Image preview' /><span>"+ c +"</span></p>");								 
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
$(document).ready(function()
{
	//tooltip
	tooltip();
	
	//apre i link in esterno in base all'url
/*	$("a[@class='ext']").click(function() {  
		window.open(this.href,'','');
		return false;
	}); 
*/
	$("a.ext").click(function() {  
		window.open(this.href,'','');
		return false;
	});
	
/*slide top*/
	$(function() {
			$('#gtop').cycle({ 
				fx:     'fade', 
				pager:	'#pager',
	 			cleartype:  1, // enable cleartype corrections
				pause:      1,     // true to enable "pause on hover" 
				timeout: 6000
			});
	});
	
// this initialises the scollpanes on the page.
		$('.holder').jScrollPane();


//dettaglio articoli
		$(function() {
				$('#fsld').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#prev', 
					next:   '#next', 
					//after:   onAfter, 
					timeout: 0
				
				});
				function onAfter() {
					$('#output1').html(this.title);
				}
		});

	
/*
//gestione dei sottomenu in interno
//slide dell'elenco news istituzionale con prev next
//masterwork
		$(function() {
				$('#slide1').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#prev1', 
					next:   '#next1', 
					after:   onAfter, 
					timeout: 0
				
				});
				function onAfter() {
					$('#output1').html(this.title);
				}
		});
//recentpost
		$(function() {
				$('#slide2').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#prev2', 
					next:   '#next2', 
					after:   onAfter, 
					timeout: 0
				});
				function onAfter() {
					$('#output2').html(this.title);
				}
		});
//studentblog
		$(function() {
				$('#slide3').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#prev3', 
					next:   '#next3', 
					after:   onAfter, 
					timeout: 0
				});
				function onAfter() {
					$('#output3').html(this.title);
				}
		});
//archivio
		$(function() {
				$('#slide4').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#prev4', 
					next:   '#next4', 
					timeout: 0
				});
//first slide
		$(function() {
				$('#fsld').cycle({ 
					fx:     'scrollHorz', 
					speed:  1500,  
					prev:   '#prevfsld', 
					next:   '#nextfsld', 
					after:   onAfter,
					timeout: 0
				});
				function onAfter() {
					$('#outputfsld').html(this.title);
					$('#outputfsldtit').html(this.title);
				}
		});
//gestione delle colonne 
	$('#txt').columnize({
				height : 200,
				width : 364
			});  				
		});
		
*/		
});