// JavaScript Document
jQuery(window).ready(function(){
	// Global Search Form
	$('#zoom_query').focus(function() {
		checkDefaultText('zoom_query', 'Search...');
	});
	
	$('#zoom_query').blur(function() {
		checkDefaultText('zoom_query', 'Search...');
	});
	// END Global Search Form
	
	// Global Overlay
	$('#globalExpand > a').click(function() {
		if ($('#dropdownOverlay').height() == 0) {
			$('#dropdownOverlay').stop().animate({height: '402px'}, 250, function() {});
			$('#globalExpand').stop().animate({top: 414}, 250, function() {});
		}
		else {
			$('#dropdownOverlay').stop().animate({height: '0px'}, 250, function() {});
			$('#globalExpand').stop().animate({top: 12}, 250, function() {});
		}
	});
	// END Global Overlay
}); 

// Checks for default text in a textbox
// If value is same as default text, it'll change to empty
// If value is empty, it'll change to default text
function checkDefaultText(id, defaultText) {
	if ($('#'+id).val() == defaultText) {
		$('#'+id).val("");
	}
	else if ($('#'+id).val() == "") {
		$('#'+id).val(defaultText)
	}
}
// sidebar
//jQuery(window).ready(function(){
//	if (document.getElementById('maincontent')) {
//   	$('#maincontent').ready(function() {            
//            if ($('#sidebar').height() < $('#maincontent').height()) {
//                $('#sidebar').height($('#maincontent').height());
//            }
//        });
//    }
//});

jQuery(window).ready(function(){
	if (document.getElementById('maincontent')) {
    	$('#maincontent').ready(function() {
	   var maxHeight = $('#maincontent').height();
			
	   var padding = $('#maincontent').css("padding-top");
	   var extraHeight = padding.replace("px", "");
            
            maxHeight += parseFloat(extraHeight);
            
            padding = $('#maincontent').css("padding-bottom");
			extraHeight = padding.replace("px", "");
            
            maxHeight += parseFloat(extraHeight);

            if ($('#sidebar').height() < maxHeight) {
                $('#sidebar').height(maxHeight);
            }
        });
    }
});

