// JavaScript Document
function cmsCode()
{
	$('ul#cms li.inactive').fadeIn(1, function (){
		$('ul#cms li.active').fadeOut(2499, 'linear', function () {
			$('ul#cms li.active').fadeIn(1225, function (){
				$('ul#cms li.inactive').fadeOut(1225, 'linear', function (){
					//window.alert("ciclato 1");
				});
			});

//					window.alert("ciclato 1");
		});
	});
}



$(document).ready(function() {
   // do stuff when DOM is ready
   /**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);
$('a[name=internal]').css('cursor', 'pointer');
  
// var xmlhttp;
//function stateChange()
//{
////  if (xmlhttp.status == 200)
////    {
//    // process whatever has been sent back here
////    }
////  else
////    {
////    window.alert("Pagina non trovata!");
////	document.getElementById("loader").style.display = "none";
//////	document.getElementById("content").style.display = "block";
////    }
////  }
//}
function loadPage(url)
{

$('#content').hide('slow', function()
									{
	$('#loader').show('slow', function()
									   {
	    $.get(url, function(data)
							{
			$('#content').html(data);
			//	$('#content img').load(function()
				//				{
								$('#loader').hide('slow', function()
																   {
									$('#content').show('slow', function()
																		{
										$('a[name=internal]').css('cursor', 'pointer');
//										$('a[name=internal]').click(function()
//																			 {
//																			pageToLoad = $(this).attr('rel');
//																			loadPage(pageToLoad);
//																			//return false;
//																		  	 });
//
										
																		});
																   });
								//});
							});
									   });
									});
}

  
//  
// $('img[alt=Home]').click(function() {
//								   
//	loadPage('home_i.php');				  
//					  });
//
// $('img[alt=Il Gruppo]').click(function() {
//
//    loadPage('present_i.php');
//								   });
//
// $('li[title=Web Design]').click(function() {
//    loadPage('web_i.php');
//								   });
//
// $('li[title=Concept]').click(function() {
//    loadPage('conc_inc_i.php');
//								   });
//
// $('li[title=Graphic]').click(function() {
//    loadPage('grafi_inc_i.php');
//								   });
//
// $('li[title=Industrial]').click(function() {
//    loadPage('indu_inc_i.php');
//								   });
//
// $('li[title=Illustrazione]').click(function() {
//    loadPage('illu_inc_i.php');
//								   });
//
// $('img[alt=Portfolio]').click(function() {
//    loadPage('proj_i.php');
//								   });
//
// $('img[alt=Contatti]').click(function() {
//    loadPage('contatti.php');
//								   });
//
// $('img[alt=Downloads]').click(function() {
//    loadPage('wall_i.php');
//								   });
//

$('table[id=preventivi] td').hoverIntent(function(e) {
	
	//
	var myId = $(this).attr('id');
	if(myId != ''){
	$('div[class=' +myId+ ']').css({'display' : 'block', 'left' : e.pageX+2, 'top' : e.pageY+2});
	
	}
									},
									
									function() {
	var myId = $(this).attr('id');
	if(myId != ''){
	$('div[class=' +myId+ ']').css({'display' : 'none'});	
	}
									});
setInterval("cmsCode()", 5000);
	
});

