jQuery.noConflict();

jQuery(document).ready(function(){	
	jQuery("#slider").easySlider();
});

jQuery(function($) {
		var slide = false;
		var height = jQuery('#footer_content').height();
		jQuery('#footer_button').click(function() {
			var docHeight = $(document).height();
			var windowHeight = $(window).height();
			var scrollPos = docHeight - windowHeight + height;
			jQuery('#footer_content').animate({ height: "toggle"}, 1000);
			if(slide == false) {
				if(jQuery.browser.opera) {
					jQuery('html').animate({scrollTop: scrollPos+'px'}, 1000);
				} else {
					jQuery('html, body').animate({scrollTop: scrollPos+'px'}, 1000);
				}
				slide = true;
			} else {
				slide = false;
			}
		});
	});
	
	
jQuery(document).ready(function(){
	jQuery('#contact-form').jqTransform();

	jQuery("button").click(function(){

		jQuery(".formError").hide();

	});

	var use_ajax=true;
	jQuery.validationEngine.settings={};

	jQuery("#contact-form").validationEngine({
		inlineValidation: false,
		promptPosition: "centerRight",
		success :  function(){use_ajax=true},
		failure : function(){use_ajax=false;}
	 })

	jQuery("#contact-form").submit(function(e){

			if(!jQuery('#subject').val().length)
			{
				jQuery.validationEngine.buildPrompt(".jqTransformSelectWrapper","* This field is required","error")
				return false;
			}
			
			if(use_ajax)
			{
				jQuery('#loading').css('visibility','visible');
				jQuery.post('submit.php',$(this).serialize()+'&ajax=1',
				
					function(data){
						if(parseInt(data)==-1)
							jQuery.validationEngine.buildPrompt("#captcha","* Wrong verification number!","error");
							
						else
						{
							jQuery("#contact-form").hide('slow').after('<h1>Thank you!</h1>');
						}
						
						jQuery('#loading').css('visibility','hidden');
					}
				
				);
			}
			e.preventDefault();
	})

});
	
jQuery(function(){
	jQuery('span.view-large').hide();
	myOp = 1;
	
	jQuery(window).load(function(){
		
		// Grid jQuery plugin: http://desandro.com/resources/jquery-masonry/
		
		jQuery('#sort').masonry({ 
			columnWidth: 350,
			animate: true,
			itemSelector: '.box'
			//easing: 'linear'
		}, 
		function() { jQuery(this).css({
			margin: '10px'
			});
		});
		
		// MouseOver Events
		
		jQuery('.box').hover(function(){
			jQuery('img', this).fadeTo("fast", 0.75).addClass('box-hover');
			jQuery('span.view-large', this).fadeTo("fast", 1)},
			function(){
			jQuery('img', this).fadeTo("fast", myOp).removeClass('box-hover');
			jQuery('span.view-large', this).fadeTo("fast", 0)
		});
		
		// Colorbox
		jQuery("a[rel='gallery']").colorbox();
		
	});
});


