// JavaScript Document for Olay UK Buy now page.

$(document).ready(function(){
			
	// Rollovers to black out other buy now links when rolling over one.
	$('#rightColumn ul#stores li').hover(
			
		function(){
			
			$(this).addClass('buyOn');
			
			$('#rightColumn ul#stores li').each(function(){			
														
					if (!($(this).hasClass('buyOn'))) {
						
						$(this).children('a').children('img').after('<div class="blackout"></div>');
						
					}
					
			});
			
			$('.blackout').css('opacity', '0.50');
			$('.blackout').fadeIn('slow');
			
		},
		
		function(){
			
			$(this).removeClass('buyOn');
			$('.blackout').remove();
			
		}
		 
	);
	
	
	if($('.blockProductSelector').length > 0){
		initBlockRetailerHeight();
	}
	
	if($('.blockRetailersContainer').length > 0 ){
		window.setTimeout('initTableLayout()',5000);
	}
	
});

function initTableLayout(){
	$('.blockRetailersContainer .ciibody').parent().children('td').addClass('tdBorderBottom');
	$('.blockRetailersContainer .ciibody font').attr('color','#ffffff');
	$('.blockRetailersContainer .ciibody:eq(0)').attr('align','left');
	initBlockRetailerHeight();
}

function initBlockRetailerHeight(){
	//background opacity on div absolute with same height and widht, if js is disabled background 000000
	var containerHeight = $('.blockProductSelector:eq(0)').height(); 
	var containerWidth = $('.blockProductSelector:eq(0)').width(); 
	$('.blockProductSelectorContent:eq(0)').css('background','none');
	$('.bgProdSelector:eq(0)').css({ width: containerWidth , height: containerHeight - 11}).animate({ opacity: "0.5" },0);
	
	var containerHeight1 = $('.blockProductSelector:eq(1)').height(); 
	var containerWidth1 = $('.blockProductSelector:eq(1)').width(); 
	$('.blockProductSelectorContent:eq(1)').css('background','none');
	$('.bgProdSelector:eq(1)').css({ width: containerWidth1 , height: containerHeight1 - 11}).animate({ opacity: "0.5" },0);

}

function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) { 
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}
