$(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:400});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:400});
				});
				//Horizontal Sliding
				$('.boxgrid.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgrid.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgrid.peek').hover(function(){
					$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
				});
				
				
				
				$('.boxgridpro.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'185px'},{queue:false,duration:400});
				}, function() {
					$(".cover", this).stop().animate({top:'6px'},{queue:false,duration:400});
				});
				//Horizontal Sliding
				$('.boxgridpro.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgridpro.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgridpro.peek').hover(function(){
					$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgridpro.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgridpro.caption').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
				});
			});
			
/* Fancybox */				
$(document).ready(function() {
			/*
			*   Examples - images
			*/

			$("a#example1").fancybox();

			$("a#example2").fancybox({
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$("a#example3").fancybox({
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'	
			});

			$("a#example4").fancybox({
				'opacity'		: true,
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'none'
			});

			$("a#example5").fancybox();

			$("a#example6").fancybox({
				'titlePosition'		: 'outside',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9
			});

			$("a#example7").fancybox({
				'titlePosition'	: 'inside'
			});

			$("a#example8").fancybox({
				'titlePosition'	: 'over'
			});
			
			$("a[rel=example_group]").fancybox({
				'opacity'		    : true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Examples - various
			*/

			$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$("#various2").fancybox();

			$("a[rel=grupolink]").fancybox({
				'width'				: '99%',
				'height'			: '99%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">  ' + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			
			$("a[rel=grupolink2]").fancybox({
				'width'				: '99%',
				'height'			: '99%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">  ' + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			
			$("a[rel=grupolink3]").fancybox({
				'width'				: '99%',
				'height'			: '99%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">  ' + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			
			$("a[rel=grupolink4]").fancybox({
				'width'				: '99%',
				'height'			: '99%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">  ' + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			$("#various4").fancybox({
				'padding'			: 0,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		});
/* Fancybox -FECHA */	


var last_project_published=null;function scrollBind(){$(window).scroll(function(){var c=$(window).scrollTop();var b=$(document).height();var d=$(window).height();if((c+d)>(b-200)){scrollUnbind();var a=$(".portfolio-project-type").attr("id").split("-")[1];$.ajax({url:swiths_language+"/ajax/get_project",data:{last_published:last_project_published,project_type:a},type:"post",dataType:"json",success:function(e){if(e.status=="ok"){last_project_published=e.last_published;$("#portfolio-projects").append(e.html);$(".project a").lightBox({txtImage:"",txtOf:"/"});$(".box-countainer.hidden").fadeIn("normal");scrollBind()}}})}})}function scrollUnbind(){$(window).unbind("scroll")}$(document).ready(function(){$("#portfolio-more").css("display","none");$(".project").hover(function(){$(this).fadeTo("fast",0.7)},function(){$(this).fadeTo("fast",1)});$(".project a").lightBox({txtImage:"",txtOf:"/"});$("#admin-button").click(function(){$.ajax({url:swiths_language+"/ajax/admin_login",type:"post",dataType:"json",success:function(c){if(c.status=="ok"){$("body").append(c.html);$("#admin-login-close").click(function(){$("#admin-login-coutainer").remove();return false});$("#admin-login-form form").submit(function(){var d=$("input[name='admin-user']").val();var e=$("input[name='admin-password']").val();if(d&&e){$.ajax({url:swiths_language+"/ajax/admin_check_login",data:{user:d,password:e},type:"post",dataType:"json",success:function(f){if(f.status=="ok"){window.location="admin"}else{alert(f.error)}}})}return false})}}});return false});if(screen.width>=1440){var b=["additional-phone-first","additional-cup-first","additional-phone-second","additional-cup-second","additional-phone-third","additional-cup-third"];for(i in b){$("#"+b[i]).attr("id",b[i]+"-light")}}else{$(".index-spacer").hide();$("#additional-sticker").hide();$("#additional-aureole").hide();$("#additional-wing-left").hide();$("#additional-wing-right").hide()}var a=0;$(".project-name").each(function(){a++;last_project_published=$(this).parent().parent().parent().parent().attr("id").split("_")[1]});if(a>=5){scrollBind()}if($.browser.msie&&$.browser.version.substr(0,1)<7){}else{$("#like").css("display","block");$("#like").hover(function(){$("#like").animate({left:"0px"},500)},function(){$("#like").animate({left:"-205px"},300)})}$(".box a.details").click(function(){var c=$(this).parent().parent().children(".extend");$(this).parent().fadeOut("normal",function(){$(c).fadeIn("normal")});return false});$("#contact-form form").submit(function(){var d,c,e,f;if(d=$('#contact-form input[name="name"]').val()){$('#contact-form input[name="name"]').removeClass("input-failed").addClass("input-ok")}else{$('#contact-form input[name="name"]').removeClass("input-ok").addClass("input-failed")}if(c=$('#contact-form input[name="email"]').val()){$('#contact-form input[name="email"]').removeClass("input-failed").addClass("input-ok")}else{$('#contact-form input[name="email"]').removeClass("input-ok").addClass("input-failed")}if(e=$('#contact-form input[name="subject"]').val()){$('#contact-form input[name="subject"]').removeClass("input-failed").addClass("input-ok")}else{$('#contact-form input[name="subject"]').removeClass("input-ok").addClass("input-failed")}if(f=$('#contact-form textarea[name="text"]').val()){$('#contact-form textarea[name="text"]').removeClass("textarea-failed").addClass("textarea-ok")}else{$('#contact-form textarea[name="text"]').removeClass("textarea-ok").addClass("textarea-failed")}if(d&&c&&e&&f){$.ajax({url:swiths_language+"/ajax/send_message",data:{name:d,email:c,subject:e,text:f},type:"post",dataType:"json",success:function(g){if(g.status=="ok"){$("#contact-form").parent().fadeOut("normal",function(){$(this).html(g.html);$(this).fadeIn("normal")})}else{for(i in g.errors){alert(g.errors[i])}}}})}return false})});
