/*-----------------------------------------------------------------------------------------------*/
/*                                      SIMPLE jQUERY TOOLTIP                                    */
/*                                      VERSION: 1.1                                             */
/*                                      AUTHOR: jon cazier                                       */
/*                                      EMAIL: jon@3nhanced.com                                  */
/*                                      WEBSITE: 3nhanced.com                                    */
/*-----------------------------------------------------------------------------------------------*/

$(document).ready(function() {
    $('.toolTip').hover(
		function() {
		    this.tip = this.title;
		    //alert(this.accessKey);
		    //alert(this.tip);
		    //alert(this.id);
		    if (this.accessKey == "r" && this.tip != null && this.tip != '') {
		        $(this).append(
			    '<div class="toolTipWrapper_related">'
				    + '<div class="toolTipTop_related"></div>'
				    + '<div class="toolTipMid_related">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm_related"></div>'
			    + '</div>'
		        );
		    }

		    if (this.accessKey == "m" && this.tip != null && this.tip!='') {
		        $(this).append(
			    '<div class="toolTipWrapper_medium">'
				    + '<div class="toolTipTop_medium"></div>'
				    + '<div class="toolTipMid_medium">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm_medium"></div>'
			    + '</div>'
		        );
		    }
		    if (this.accessKey == "s" && this.tip != null && this.tip != '') {
		        $(this).append(
			    '<div class="toolTipWrapper">'
				    + '<div class="toolTipTop"></div>'
				    + '<div class="toolTipMid">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm"></div>'
			    + '</div>'
		        );
		    }
		    if (this.accessKey == "l" && this.tip != null && this.tip != '') {
		        $(this).append(
			    '<div class="toolTipWrapper_large">'
				    + '<div class="toolTipTop_large"></div>'
				    + '<div class="toolTipMid_large">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm_large"></div>'
			    + '</div>'
		        );
		    }
		    this.title = "";
		    //		this.width = $(this).width();
		    //		$(this).find('.toolTipWrapper').css({})left:this.width-22
		    $('.toolTipWrapper').fadeIn(300);
		},
	function() {
	    $('.toolTipWrapper').fadeOut(100);
	    $(this).children().remove();
	    this.title = this.tip;
	}
	);
});

function resetTooltips() {
    $('.toolTip').hover(
		function() {
		    this.tip = this.title;
		    //alert(this.accessKey);
		    //alert(this.tip);
		    //alert(this.id);
		    if (this.accessKey == "r") {
		        $(this).append(
			    '<div class="toolTipWrapper_related">'
				    + '<div class="toolTipTop_related"></div>'
				    + '<div class="toolTipMid_related">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm_related"></div>'
			    + '</div>'
		        );
		    }

		    if (this.accessKey == "m") {
		        $(this).append(
			    '<div class="toolTipWrapper_medium">'
				    + '<div class="toolTipTop_medium"></div>'
				    + '<div class="toolTipMid_medium">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm_medium"></div>'
			    + '</div>'
		        );
		    }
		    if (this.accessKey == "s") {
		        $(this).append(
			    '<div class="toolTipWrapper">'
				    + '<div class="toolTipTop"></div>'
				    + '<div class="toolTipMid">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm"></div>'
			    + '</div>'
		        );
		    }
		    if (this.accessKey == "l") {
		        $(this).append(
			    '<div class="toolTipWrapper_large">'
				    + '<div class="toolTipTop_large"></div>'
				    + '<div class="toolTipMid_large">'
					    + this.tip
				    + '</div>'
				    + '<div class="toolTipBtm_large"></div>'
			    + '</div>'
		        );
		    }
		    this.title = "";
		    //		this.width = $(this).width();
		    //		$(this).find('.toolTipWrapper').css({})left:this.width-22
		    $('.toolTipWrapper').fadeIn(300);
		},
	function() {
	    $('.toolTipWrapper').fadeOut(100);
	    $(this).children().remove();
	    this.title = this.tip;
	}
	);
}
