$(document).ready(function() {
	
	/* NAVIGATION */
	
	/* LOGO */
	$('#navi li#logo a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -5px)"}, {duration:200})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "0 0"})
			}})
		})
	
	/* END LOGO */
	
	
	/* TOP NAVI */	
	$("#navi li.main_nav a")
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			if($(this).hasClass('active')) {
			} else {
				$(this).stop().animate({backgroundPosition:"(0 -17px)"}, {duration:200})
			}
		})
		.mouseout(function(){
			if($(this).hasClass('active')) {
			} else {
				$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:200, complete:function(){
					$(this).css({backgroundPosition: "0 0"})
				}})
			}
		})
		
	
	$('ul.sub_navi li a, #ft_navi li a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -12px)"}, {duration:200})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "0 0"})
			}})
		})
		
	$('ul.cart_sec li a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -15px)"}, {duration:200})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "0 0"})
			}})
		})
		
	$("#send_form")
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			if($(this).hasClass('active')) {
			} else {
				$(this).stop().animate({backgroundPosition:"(0 -11px)"}, {duration:200})
			}
		})
		.mouseout(function(){
			if($(this).hasClass('active')) {
			} else {
				$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:200, complete:function(){
					$(this).css({backgroundPosition: "0 0"})
				}})
			}
		})
		
	/* END NAVIGATION */
	
	
	/* SEARCH BOX */
	var orsT = $("#search_field").attr('value');
	$("#search_field").focus(function() {
		if($(this).val() == orsT) {
			$(this).val('');
		}
	});
	
	$("#search_field").blur(function() {
		if($(this).val() == '') {
			$(this).val(orsT);
		}
	});
	/* END SEARCH BOX */
	
	/* ROTATOR */
	//if(isSSL == false) {
	if($('#rotator').length > 0) {
		$('#rotator').cycle({
				fx			: 'fade',
				prev		: '#rotator-prev', 
			    next		: '#rotator-next',
			    pager 	: '#rotator-nav .rnav_holder'
		});
	//}
	
	// IF IE 7
		if (Browser.Version() <= 7) {
			var aWidth = 0;
			$('.rnav_holder a').each(function() {
				aWidth += $(this).outerWidth();
				aWidth += 10;
			});
		
			$('.rnav_holder').css({'width' : aWidth, 'margin' : '0 auto', 'text-align' : 'center'});
		}
		
		$('#rotator-frame').mouseenter(function() {
			 $('#rotator').cycle('pause');
		});
		
		$('#rotator-frame').mouseleave(function() {
			 $('#rotator').cycle('resume');
		});
		
		
		/* SET CLICK EVENT ON FRAME */
		
		$('#rotator-frame').click(function(){
			var activeLink = $('#rotator a:visible').attr('href');
			window.location = activeLink;
		});
	}
		/* END ROTATOR */

	

	
	
});


/* SUSTANING FUNCTIONS */ 


var Browser = {
  Version: function() {
    var version = 999; // we assume a sane browser
    if (navigator.appVersion.indexOf("MSIE") != -1)
      // bah, IE again, lets downgrade version number
      version = parseFloat(navigator.appVersion.split("MSIE")[1]);
    return version;
  }
}


