$(document).ready(function(){
	   // Added 2008 11 05
	    $('.Button').mouseover(function () {
			$(this).css('color','#FF0000').css('cursor','pointer');
	    });
	    $('.Button').mouseout(function () {
			$(this).css('color','#555555').css('cursor','normal');
	    });
	    // END: Button JS
});

$(document).ready(function(){
	$(".Search").mouseover(function () {	$(this).css('background-position','0px -26px').css('cursor','pointer');	});
	$(".Search").mouseout(function () {	$(this).css('background-position','0px 0px').css('cursor','normal');		});
});

//Initialize: ICON Doc At Bottom of Page
$(document).ready(function(){ 
	$(function(){
		var jqDockOpts = {align: 'top', duration: 360,  labels: 'bc', size: 36, distance: 36, coefficient:2.2}; // labels: 'tc',
		$('#div_icon_dock').jqDock(jqDockOpts);
	});
});

// Adjust Page
$(document).ready(function(){
	var Current_Page_Height = $(window).height();
	var Current_Content_Height = $('#Main_Body').height();
	var Adjusted_Body_Height = Current_Page_Height - $('#Main_Header').height() + 70; // - $('#Main_Footer').height();
	$("#Message_Functionality").html("Joe<br>Page Height: " + Current_Page_Height + "<br>Body Height: " + Adjusted_Body_Height );
	var Content_Sidebar = $("#Content_SideBar").height();
	var Content_Main = $("#Content_Main").height();
	if ( Adjusted_Body_Height > Content_Main )
	{	$("#Main_Body").height( Adjusted_Body_Height ); 	
	// alert('overlap' + "\nSize Content_Main: " + Content_Main + "\nAdj Body Height: " + Adjusted_Body_Height);
	}	else    // Adjusted_Body_Height < Content_Main
	{		$("#Main_Body").height( Content_Main + 50 );	}
	
	if ( Content_Sidebar > Content_Main )
	{	$("#Content_Main").height( Content_Sidebar ); }
	else
	{	$("#Content_Sidebar").height( Content_Main ); }
	$(".Content_Main").equalHeight();
});

$(window).load(function(){
	$('#catfish').catfish({
		closeLink: '#catfish-close',
		height:72
	});
});



//For changing Chinese to Strings
function convertToEntities(Inp_str) 
{
		var Conv_str = '';
		for(i = 0; i < Inp_str.length; ++i)
		{
			if(Inp_str.charCodeAt(i) > 127)
			{
				Conv_str += '&#' + Inp_str.charCodeAt(i) + ';';
			}
			else
			{
				Conv_str += Inp_str.charAt(i);
			}
		}
		return Conv_str;
}


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');
    });
};
