jQuery.fn.jHeights = function() {
  var tallest = 0;
  this.children().each(function(){
    if ($(this).outerHeight() > tallest) {
      tallest = $(this).outerHeight(); 
    }
  });
  $(this).children().height(tallest);
};	


$(document).ready(function() {

	//MATCH COLUMN HEIGHTS
	//$(".cols").equalHeights();
	
	//DEFAULT POPUP
	$("a.popup").fancybox({
		'type'			: 'iframe',
		'titleShow'		: true,
		'overlayOpacity':  	0.7,
		'overlayColor'	:	'#000'
	});
	
	//LOGIN POPUP
	$("a.popup_login").fancybox({
		'padding'		:  0,
		'scrolling'		: 'no',
		'titleShow'		: false,
		'overlayOpacity':  	0.7,
		'overlayColor'	:	'#000',
		'onClosed'		: function() {
	    	$("#login_error").hide();
		}
	});
	
	//Login Validation
	$("#login_form").bind("submit", function() {
		if ($("#un").val().length < 1 || $("#pw").val().length < 1) {
		    $("#login_error").fadeIn();
		    $.fancybox.resize();
		    return false;
		}
	});
	
	//VALIDATION HIGHLIGHTING
	$.validator.setDefaults({
		highlight: function(input) {
			$(input).addClass("form-highlight");
		},
		unhighlight: function(input) {
			$(input).removeClass("form-highlight");
		}
	});
	
	//TESTING
	$("#pricing #continue").click(function() {
		alert("TEST");
	});
		
});



//DW Functions
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
