$(document).ready(function(){
	
	/*
	----------------------------------------------------------
	GENERAL
	---------------------------------------------------------- */

	// CLEAR VALUE ON FOCUS
	$('.labelvalue').each(function() {
	    var default_value = this.value;
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	        }
	    });
	});
	
	
	// EXTERNAL WINDOWS
	$('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });


	// MAKE ENTIRE AREA CLICKABLE
	$(".highlight").click(function(){
		if($(this).find("a").attr("rel") == "external") {
		    window.open($(this).find("a").attr("href"))
		} else{
		    window.location=$(this).find("a").attr("href"); return false;
		    return;
		}
	});
	
	
	// MONCUR LOGO ANIM
	$("#moncur a").hover(function() {
		$(this).next("span").animate({opacity: "show"}, "slow");
	}, function() {
		$(this).next("span").animate({opacity: "hide"}, "fast");
	});
	

	// NEWS TICKER
	
			
			$(function () {
			    $('#js-news').ticker({
					displayType: 'fade',
					fadeInSpeed: 800,
					titleText: ''
			    });
			});
	
	// else if($("body").attr("id") != "products") { 
	// 		
	// 		$(function () {
	// 		    $('#js-news').ticker({
	// 				displayType: 'fade',
	// 				titleText: ''
	// 		    });
	// 		});
	// 	}
	
	
	// FANCYBOX
	$("a#fancybox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'fade',
		'speedIn'		:	200, 
		'speedOut'		:	200,
		'titlePosition'	:   'over'
	});
	
	$("a[rel=fancybox]").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'fade',
		'speedIn'		:	200, 
		'speedOut'		:	200,
		'titlePosition'	:   'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ': &nbsp; ' + title : '') + '</span>';
				}
	});
	
	// FORM VALIDATION
	$("#contact-form").validate();
	
	
	
});
// END ON READY


$(window).load(function() {
	$('#carousel').nivoSlider({
		effect:'fade',
		directionNav:false,
		captionOpacity:1
	});
});
