$(document).ready(function(){
	



	

	/* MENU */
	$('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

	/* BACKGROUND IMAGES */
 

$('#bgpic').cycle({ 
    fx:     'fade',
    timeout: 4000, 
    pager:  '#nav' 
});


	/* SLIDER */

$(function() {   
    $('#slider').cycle({
        fx:     'fade',
        speed:  1000,
		timeout: 10000,
        startingSlide: 0,
        pager:  '#nav'
    });
    
});



	/* PRODUCT TABS */

$(function() {   
    $('.tabtitles strong').click( function(){
	$('.tabtitles strong').removeClass('act');									   
		$(this).addClass('act');								   
       var tab =($(this).attr('rel'));
	   $('.tab').hide();
	   $('.tab'+tab).css({visibility: "visible",display: "none"}).slideDown(300);
	   
    });
    
});


$(function() {

  //vars
  var conveyor = $("#postcontainer", $("#slidercontent")),
  item = $(".post", $("#slidercontent"));


  //set length of conveyor
  conveyor.css("width", item.length * parseInt(item.css("width")));

  //config
  var sliderOpts = {
	max: (item.length * parseInt(item.css("width"))) - 740,
	slide: function(e, ui) {
	  conveyor.css("left", "-" + ui.value + "px");
	  //comprueba(ui.value);
	}
  };

  //create slider
  $("#slider1").slider(sliderOpts);

});
	
var ieVer=/*@cc_on function(){ switch(@_jscript_version){ case 1.0:return 3; case 3.0:return 4; case 5.0:return 5; case 5.1:return 5; case 5.5:return 5.5; case 5.6:return 6; case 5.7:return 7; case 5.8:return 8; }}()||@*/8;
if(/MSIE 6.0/i.test(navigator.userAgent)) {ieVer=6;}
 
	/* DOCK LINEA */
if (ieVer<=7) {
	$('#dock2').Fisheye({
		maxWidth: 0,
		items: 'a',
		container: '.dock-container2',
		itemWidth: 70,
		itemsText: 'span', 
		proximity: 0,
		alignment : 'left',
		valign: 'bottom',
		halign : 'center'
	});
}else{
$('#dock2').Fisheye({
		maxWidth: 100,
		items: 'a',
		container: '.dock-container2',
		itemWidth: 70,
		itemsText: 'span', 
		proximity: 100,
		alignment : 'left',
		valign: 'bottom',
		halign : 'center'
	});
}
	/* CUFON */
	
	Cufon.replace('h2'); 
	Cufon.replace('.cufon'); 
	Cufon.replace('.dock-item2 span'); 
	Cufon.replace('#menu li a'); 
	Cufon.replace('#hometext'); 
	 
/* JB GALLERY*/

	

  

	
	function supersizeImage(image) {
       var imagewidth = $(image).width();
       var imageheight = $(image).height();
       var browserwidth = $(window).width();
       var browserheight = $(window).height();

       var ratio = imageheight/imagewidth;

       if ((browserheight/browserwidth) > ratio){
               $(image).height(browserheight);
               $(image).width(browserheight / ratio);
       } else {
               $(image).width(browserwidth);
               $(image).height(browserwidth * ratio);
       }
       $(image).css('left', (browserwidth - $(image).width())/2);
       $(image).css('top', (browserheight - $(image).height())/2);
}
 

									
									
		jQuery(".jbgallery").jbgallery({
			menu : false, 
			style: "zoom", 			
			slideshow : true,
			caption : false,
			timers : { 
				interval : 6000
			} ,
            load : function(){
               supersizeImage(jQuery("#jbgallery-target"));
			   

            } 

			
			

		});
		 
		$('#logo a').mouseover(function() {
			 
			$('#hometext').animate({"left": "+20px"}, "slow");
		  }).mouseout(function(){
			 
			$('#hometext').animate({"left": "-60px"}, "slow");
		  });
		
		// CONTACT ES
		
		$('#contact_es #name').focus(function(){ if(this.value=='Nombre')this.value = '' });
		$('#contact_es #name').blur(function(){ if(this.value=='')this.value = 'Nombre' });
		
		$('#contact_es #surname').focus(function(){ if(this.value=='Apellido')this.value = '' });
		$('#contact_es #surname').blur(function(){ if(this.value=='')this.value = 'Apellido' });
		
		$('#contact_es #phone').focus(function(){ if(this.value=='Telefono')this.value = '' });
		$('#contact_es #phone').blur(function(){ if(this.value=='')this.value = 'Telefono' });
		
		$('#contact_es #mail').focus(function(){ if(this.value=='E-Mail')this.value = '' });
		$('#contact_es #mail').blur(function(){ if(this.value=='')this.value = 'E-Mail' });
		
		$('#contact_es #message').focus(function(){ if(this.value=='Mensaje')this.value = '' });
		$('#contact_es #message').blur(function(){ if(this.value=='')this.value = 'Mensaje' });
		
		// CONTACT EN
		
		$('#contact_en #name').focus(function(){ if(this.value=='Name')this.value = '' });
		$('#contact_en #name').blur(function(){ if(this.value=='')this.value = 'Name' });
		
		$('#contact_en #surname').focus(function(){ if(this.value=='Last name')this.value = '' });
		$('#contact_en #surname').blur(function(){ if(this.value=='')this.value = 'Last name' });
		
		$('#contact_en #phone').focus(function(){ if(this.value=='Phone')this.value = '' });
		$('#contact_en #phone').blur(function(){ if(this.value=='')this.value = 'Phone' });
		
		$('#contact_en #mail').focus(function(){ if(this.value=='E-Mail')this.value = '' });
		$('#contact_en #mail').blur(function(){ if(this.value=='')this.value = 'E-Mail' });
		
		$('#contact_en #message').focus(function(){ if(this.value=='Message')this.value = '' });
		$('#contact_en #message').blur(function(){ if(this.value=='')this.value = 'Message' });
	
});  /*document ready*/

