
//jQuery.noConflict();

jQuery.fn.equalHeight = function () {
    var height        = 0;
    var maxHeight    = 0;

    // Store the tallest element's height
    this.each(function () {
        height        = jQuery(this).outerHeight();
        maxHeight    = (height > maxHeight) ? height : maxHeight;
    });

    // Set element's min-height to tallest element's height
    return this.each(function () {
        var t            = jQuery(this);
        var minHeight    = maxHeight - (t.outerHeight() - t.height());
        var property    = jQuery.browser.msie && jQuery.browser.version < 7 ? 'height' : 'min-height';

        t.css(property, minHeight + 'px');
    });
};

	
$(document).ready(function() {
	
	//jQuery('#main, .box').equalHeight();
	
	(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:'35px'},{queue:false,duration:300});
		}, function() {
				$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:300});
		});
		
		jQuery.preloadImages = function() {
			for(var i = 0; i<arguments.length; i++) {
    			jQuery("<img>").attr("src", arguments[i]);
  			}
		}

		// $.preloadImages("image1.gif", "/path/to/image2.png","some/image3.jpg");
		
		function disableLink(e) {
	    	// cancels the event
	    	e.preventDefault();
	    	return false;
		}
		
		$('body.home #logo').bind('click', disableLink);
		
		function browserhack() {

			var browserWidth = $('body').width();
			var browserHeight = $('body').height();

			if ((browserWidth) <= '640') {

				$(".box").addClass("box-640");
				$(".box").removeClass("box-800");

				$("#wrapper").addClass("wrapper-640");
				$("#wrapper").removeClass("wrapper-800");
				$("#wrapper").removeClass("wrapper-1024");

			} else if ((browserWidth) <= '800') {

				$(".box").addClass("box-800");
				$(".box").removeClass("box-640");

				$("#wrapper").addClass("wrapper-800");
				$("#wrapper").removeClass("wrapper-640");
				$("#wrapper").removeClass("wrapper-1024");

			} else if ((browserWidth) > '800') {

				$(".box").removeClass("box-440");
				$(".box").removeClass("box-800");

				$("#wrapper").addClass("wrapper-950");
				$("#wrapper").removeClass("wrapper-640");
				$("#wrapper").removeClass("wrapper-800");

			}
			
			if ((browserHeight) <= '600') {
				$("#wrapper").addClass("wrapper-height-600");
			} else if ((browserHeight) > '600') {
				$("#wrapper").removeClass("wrapper-height-600");
			}
		}

		browserhack();// Triggers when document first loads

		$(window).bind("resize", function() {// Adjust when resizing
					browserhack();
				});

	})(jQuery);
});