//Submit contactenos
$(document).ready(function() {
	if ($('#form').length) {
		$("#form").submit(function() {
			if ($("#form_message").val() != '') {
					$('#plataform-procesando').css('display','block');
					return true;
			}
			else{
				$('.error').show("slow");
			return false;
			}
		});	
	}
});//PAGEFLIP
$(document).ready(function(){
if ($('#pageflip').length) {
	$("#pageflip").hover(function() {
		$("#pageflip img , .msg_block").stop()
			.animate({ //Animate and expand the image and the msg_block (Width + height)
				width: '307px',
				height: '319px'
			}, 500);
		} , function() {
		$("#pageflip img").stop() //On hover out, go back to original size 50x52
			.animate({
				width: '50px',
				height: '52px'
			}, 220);
		$(".msg_block").stop() //On hover out, go back to original size 50x50
			.animate({
				width: '50px',
				height: '50px'
			}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
	});
}
});	
//Slide Carrusel - Portada
function mycarousel_initCallback(carousel){
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
$(document).ready(function(){
if ($('#carrucel-content').length) {						   
    $('#carrucel-content').jcarousel({
        auto: 2,
        wrap: 'both',
		scroll: 1,
		size: 4,
        initCallback: mycarousel_initCallback
    });
}
});
//Slide Page
$(document).ready(function(){
if ($('#scroll_page').length) {						   
	$('#scroll').localScroll({
		target: '#scroll', // could be a selector or a jQuery object too.
		lazy: true,
		axis:'x',
		duration:3000,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});
}
});

//BLURMOTION PHONE
$(document).ready(function(){
if ($('.phone').length) {	
	var obj = $(".phone");
	var animeframe = 0;
	var myOpacity;
	
	function animation(){
		setTimeout(function(){
			if(animeframe == 0) {
				myOpacity = 0.6;
				animeframe = 1;
			}
			else if(animeframe  == 1) {
		 		myOpacity = 1;
				animeframe  = 0;
			}
			obj.animate({ opacity:myOpacity}, 500);
			animation();
			}, 500);
		}
	{animation();}  
}
});
//BLURMOTION PHONE
$(document).ready(function(){
if ($('#navigation_item a').length) {
	$('#navigation_item a').mouseenter(function(){
		$(this).animate({ opacity:0.6}, 500);
	}).mouseleave(function(){	$(this).animate({ opacity:1}, 500);});
}
});
//CORTINA
function cortina(){if($("#cortina").length){$("#cortina").animate({height:0},{duration: 4000,complete:function(){$("#cortina").hide();}});}}
//SIDEBAR
function sidebar(){$("#main").css({"width":"100%","clear":"both"});};
//SEND MESSAGE CONTACTACT US
