
function chImg(n)
{
	//$('.'+c).attr('src',src);
	$('.img').css('display','none');
	$('.img'+n).css('display','block');
	$('.img'+n).css('position','absolute');
	$('.img'+n).css('top','195px');
	$('.img'+n).css('right','80px');
	$('.img'+n).css('overflow','visible');
	$('.imga').css('color','#1a77b7');
	$('.imga').css('background','transparent');
	for (var i=1; i<=10;i++){
		$('.imga'+i).css('background','url(img/'+i+'-b.gif) 0 2px no-repeat');
	}
	/*$('.imga1').css('background','url(img/due-b.gif) 0 2px no-repeat');
	$('.imga6').css('background','url(img/tre-b.gif) 0 2px no-repeat');
	$('.imga10').css('background','url(img/quattro-b.gif) 0 2px no-repeat');
	$('.imga2').css('background','url(img/cinque-b.gif) 0 2px no-repeat');
	$('.imga4').css('background','url(img/sei-b.gif) 0 2px no-repeat');
	$('.imga3').css('background','url(img/sette-b.gif) 0 2px no-repeat');
	$('.imga7').css('background','url(img/otto-b.gif) 0 2px no-repeat');
	$('.imga5').css('background','url(img/nove-b.gif) 0 2px no-repeat');
	$('.imga8').css('background','url(img/dieci-b.gif) 0 2px no-repeat');
	*/
	if($('.imga'+n).length > 0)
	{	
	$('.imga'+n).css('color','#c4161c');
	$('.imga'+n).css('background','url(img/'+n+'-r.gif) 0 2px no-repeat');
	/*$('.imga1').css('background','url(img/due-r.gif) 0 2px no-repeat');
	$('.imga6').css('background','url(img/tre-r.gif) 0 2px no-repeat');
	$('.imga10').css('background','url(img/quattro-r.gif) 0 2px no-repeat');
	$('.imga2').css('background','url(img/cinque-r.gif) 0 2px no-repeat');
	$('.imga4').css('background','url(img/sei-r.gif) 0 2px no-repeat');
	$('.imga3').css('background','url(img/sette-r.gif) 0 2px no-repeat');
	$('.imga7').css('background','url(img/otto-r.gif) 0 2px no-repeat');
	$('.imga5').css('background','url(img/nove-r.gif) 0 2px no-repeat');
	$('.imga8').css('background','url(img/dieci-r.gif) 0 2px no-repeat');
	*/}
}
function oc(n)
{
	$('.oc').css('display','none');
	$('.oc'+n).css('display','block');	
	$('.oca').css('background-image',$('.oca').css('background-image').replace('_on','_off'));
	$('.oca'+n).css('background-image',$('.oca'+n).css('background-image').replace('_off','_on'));
}

function sol(n)
{
	$('.sol'+n).css('display','block');
}
function csol()
{
	$('.sol').css('display','none');
}
$(document).ready(function(){

	$('a.blank').attr('target','_blank');
	
	
	$('a.popup').bind('click', function(e){		
		info=$(this).attr('rel').split('_');
		w=info[0];
		h=info[1];
		s=info[2];
		var l = Math.floor((screen.width-w)/2);
		var t = Math.floor((screen.height-h)/2);
		valori='width='+w+',height='+h+',top='+t+',left='+l+',scrollbars='+s+',toolbar=no,location=no,status=no,menubar=no';
		window.open($(this).attr('href'),'',valori);
		return false;
	});
//	$('#flash_home').flashembed({src: 'swf/home.swf', version: [8, 0], w3c: true, bgcolor: 'transparent', wmode: 'transparent'});
//	$('#flash_scopri').flashembed({src: 'swf/gamma_prodotti.swf', version: [8, 0], w3c: true, bgcolor: 'transparent', wmode: 'transparent'});
//	$('#flash_tv').flashembed({src: 'swf/tv.swf', version: [8, 0], w3c: true, bgcolor: 'transparent', wmode: 'transparent'});
	
	$('.menu>ul>li.withsubmenu').hover(function(){		
      $('.submenu',this).css('display','block');		
		$('>a',this).each(function() {			
			$(this).toggleClass('over');
		});
		
    },function(){
      $('.submenu',this).css('display','none');
	  $('>a',this).each(function() {			
			$(this).toggleClass('over');
		});
		
    });
	
	/*$('.menu>ul>li.withsubmenu').bind('mouseover', function(e){		
      $('.submenu',this).css('display','block');		
		$('>a',this).each(function() {			
			$(this).toggleClass('over');
		});
		
    });

	$('.menu>ul>li.withsubmenu').bind('mouseout', function(e){
      $('.submenu',this).css('display','none');
	  $('>a',this).each(function() {			
			$(this).toggleClass('over');
		});
		
    });*/
	$('.submenu>ul>li').hover(function(){		
      $('ul',this).css('display','block');	 
    },function(){
      $('ul',this).css('display','none');		
    });
	/*$('.submenu>ul>li').bind('mouseover', function(e){		
      $('ul',this).css('display','block');	 
    });

	$('.submenu>ul>li').bind('mouseout', function(e){
      $('ul',this).css('display','none');		
    });*/
	
	if($('.ticker').length > 0)
	{
		var ticker_holder = $('.ticker').get(0);
		var ticker_text = $('.ticklayer').get(0);
		var ticker_pos = ticker_text.parentNode.offsetWidth;

		var ticker_data = $(ticker_holder).html();
		$(ticker_text).parent().html('<marquee scrollamount="2" scrolldelay="40">' + ticker_data + '</marquee>');

		$('#sub-nav').hover
		(
			function() { $('marquee', this).get(0).stop();  },
			function() { $('marquee', this).get(0).start(); }
		);

	}	
	if($('.ilprodottochefaperte').length > 0)
	{
	chImg(0);
	}
	
	if($('.soluzioni .sol').length > 0)
	{	
		if(document.URL.search("id=")>0)
		{		
			sol(document.URL.substring(document.URL.search("id=")+3));
		}
	}
 
 });