﻿//top-nav:
function topMenu(){
	var $this = $('ul.nav-top li.item');
	$this.hover(
		function(){
			$(this).children('.extended-panel').css({'display':'block'});
			$(this).children().children('.extended-panel-wrapper').css({'float':'right'});
		},
		function(){
			$(this).children('.extended-panel').css({'display':'none'});
		}
	);
	$('.extended-panel a.s-m:last-child').css({'background':'none'});
};
//discountBar:
function discountBar(){
	var $close = $('#activityBar .close');
	var $show = $('#activityBar .show');
	var $content = $('#activityBar .activity_content');
	$close.click(function(){
		$content.hide();
		$show.show();
	});
	$show.click(function(){
		$content.show();
		$(this).hide();
	});
};
$(function(){
if ($.browser.msie && parseInt($.browser.version) == 6)		//if the browser is IE6 or IE7;	
    {
        if (!window.XMLHttpRequest)                  		//if the browser is really IE6;
        {
            var $img = $('.content img');
			var maxWidth = 797;		
			$img.each(function(){		   
				var imgWidth = $(this).width();
				var imgHeight = $(this).height();						  
				var condiction = $(this).parent().is('.banner');
				if(imgWidth>0 && imgHeight>0)
				{
					if(condiction)
					{
						if(imgWidth==maxWidth)
						{
							$(this).attr({'width':imgWidth,'height':imgHeight});
						}
						else
						{
							$(this).attr({'width':maxWidth,'height':maxWidth*imgHeight/imgWidth});
						}
					}
					else
					{
						if(imgWidth>maxWidth)
						{	
							$(this).attr({'width':maxWidth-34,'height':(maxWidth-34)*imgHeight/imgWidth}); 
						}
						else
						{
							$(this).attr({'width':imgWidth,'height':imgHeight});
						}
					}
				}
			});
        }
	}
//eliminate button outline:	
$('a,input[type="button"],input[type="submit"],button[type="button"]').bind('focus',function(){
	if(this.blur){
		this.blur();
	}
});
});


