/**
/*
 * TechDivision_RitterSportTheme
 *
 * NOTICE OF LICENSE
 *
 * TechDivision_RitterSportTheme is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TechDivision_RitterSportTheme is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TechDivision_RitterSportTheme. If not, see <http://www.gnu.org/licenses/>.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade TechDivision_RitterSportTheme to newer
 * versions in the future. If you wish to customize TechDivision_RitterSportTheme for your
 * needs please refer to http://www.techdivision.com for more information.
 *
 * @category   	TechDivision
 * @package    	TechDivision_RitterSportTheme
 * @copyright  	Copyright (c) 2011 <info@techdivision.com> TechDivision GmbH
 * @license    	<http://www.gnu.org/licenses/>
 *			  	GNU General Public License (GPL 3)
 * @author      Thomas Kalteis <tk@techdivision.com>
 **/
/**
 * js/global.js
 *
 * Global JS functionality used in the Theme
 *
 * @category   	TechDivision
 * @package    	TechDivision_RitterSportTheme
 * @copyright  	Copyright (c) 2011 <info@techdivision.com> TechDivision GmbH
 * @license    	<http://www.gnu.org/licenses/>
 *			  	GNU General Public License (GPL 3)
 * @author      Elias Erckens-Platsch <e.erckens-platsch@techdivision.com>
 */

jQuery(document).ready(function(){
		//Tooltip control    
		jQuery('div.product-1 a.product-image, div.product-2 a.product-image, li.active a.product-image').hover(
				function () {
					var position = jQuery(this).children('.img-product').position();
					
					var topPosition;
					//fix tooltip position
					if (jQuery(this).children('.tooltip-wrapper.bottom').length > 0)
					{
						topPosition = position.top - (jQuery(this).children('.tooltip-wrapper.bottom').height() - jQuery(this).children('.img-product').height());
					}
					else if (jQuery(this).children('.tooltip-wrapper.top').length > 0)
					{
						topPosition = position.top - (jQuery(this).children('.img-product').height() / 2);														
					}
					else
					{
						topPosition = position.top + (jQuery(this).children('.img-product').height() / 2) - (jQuery(this).children('.tooltip-wrapper').height() / 2);
					}
					var marginLeft = jQuery(this).children('.img-product').width() / 2;
					jQuery(this).children('.tooltip-wrapper').css({'top' : topPosition+'px', 'margin-left' : marginLeft + 'px'});			
					(jQuery.browser.msie) ? jQuery(this).children('.tooltip-wrapper').show() : jQuery(this).children('.tooltip-wrapper').fadeIn(175,function(){jQuery(this).fFix();});
				}, 
				function () {
				    (jQuery.browser.msie) ? jQuery(this).children('.tooltip-wrapper').hide() : jQuery(this).children('.tooltip-wrapper').fadeOut(175,function(){jQuery(this).fFix();});
				});
	});
