document.write("<link rel='stylesheet' media='screen' href='/styles/javascript.css'/>");

$(document).ready(function(){
	$("#contacteFrm").validate({	
	errorPlacement: function(error, element) {
     		if (element.attr("name") == "legalnote") error.insertAfter("span.legaltext");
			else error.insertAfter(element);
		}
	});
});

/*
 * Simular target ="_blank" y abre los enlaces en ventana nueva, cerrar ventana
 */
$( function() {
	$('.external').click( function() {
		window.open($(this).attr('href'));
		return false;
	});
});

$( function() {
	function exclude(event) {
		var element = $(event.target);

		if (element.is('.clicable-exclude') || element.is('.clickable-exclude')) {
			return true;
		}
		if (event.target.tagName == 'A' || event.target.tagName == 'INPUT') {
			return true;
		}
	}

	$(".clicable, .clickable").click( function(event) {
		if (exclude(event)) {
			return true;
		}

		$(this).find("a").each( function() {
			var content = $(this);
			var url = content.attr("href");

			if (content.is('.external')) {
				window.open(url);
			} else {
				document.location = url;
			}

			return false;
		});
	});

	$(".clicable, .clickable").mouseover( function(event) {
		if (exclude(event)) {
			return true;
		}

		if ($(this).find("a").size() > 0) {
			$(this).css("cursor", "pointer");
		}
	});

	$(".clicable, .clickable").mouseout( function(event) {
		if (exclude(event)) {
			return true;
		}

		if ($(this).find("a").size() > 0) {
			$(this).css("cursor", "auto");
		}
	});
});
$( function() {
	$('ul.tabs a').click( function() {
		var element = $($(this).attr("href"));
		if(element.size() > 0) {
			// tab
			$('ul.tabs li').removeClass("on");
			$(this).parent("li").addClass("on");

			// div
			$('div.tabs-div').addClass("offleft");
			element.removeClass("offleft");
		}
		return false;
	});
	
});



/* function equal height*/

function equalHeight(group) {
	tallest = 0;
	group.each(function() {
	thisHeight = $(this).height();
		if(thisHeight > tallest) {
		tallest = thisHeight;
		}
		$(this).css("min-height",tallest)
 	});
 	group.height(tallest);
}

$(document).ready(function() {	
 	equalHeight($(".equal1"));
	equalHeight($(".equal2"));
	equalHeight($(".equal3"));
	equalHeight($(".equal4"));
});


jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        // Configuration goes here
    });
});


$(document).ready( function() {
	$('.image-gallery').click( function(event) {
		$('.image-gallery').removeClass("on");
		$(this).addClass("on");
		imageID = $(this).attr('rel');
		if(imageID) {
			$("li.image").addClass("offleftjava");
			$("#videocontainer").addClass("none");
			$("#" + imageID).removeClass("offleftjava");
		}
		return false;
	});
	$('.vervideo a').click( function(event) {
		$("li.image").addClass("offleftjava");
		$("#videocontainer").removeClass("none");
	});
});

$(function()
{
	$('.scroll-pane').jScrollPane();// this initialises the scrollBy and scrollTo links.
                $('.scroll-by-demo').bind(
                    'click',
                    function()
                    {
                        $('#opus')[0].scrollBy(parseInt($(this).attr('rel')));
                        return false;
                    }
                );

                
			});
			