$(document).ready(function(){

	$('#box_Icon').remove();
	$('#outerwrapper').parent().prepend(
		'<div style="display: none;" class="box" id="box_Icon"> <!-- using code from http://teamtutorials.com/web-development-tutorials/jquery-pop-over-effects --><div id="quickLook_Icon" class="quickLook"><div class="listItemPopup"><div class="popupMainArea"><div class="popupHead"><img src="/site/images/sl-close.gif" alt="close" id="close_Icon" class="close"></div><div class="popupFill" style="background-color:#ffffff;"></div><!-- .popupFill --></div><!-- .popupMainArea --></div><!-- .listItemPopup --></div><!-- .quickLook --></div><!-- .box--><div class="popover_mask modal_mask close" style="display:none;margin:0"></div><!-- .modal_mask -->'
	);

	$('.popup').click(function(event){
		if (typeof lsBoxWidth === 'undefined') {lsBoxWidth = '400';}

		event.preventDefault();
		var lsURL = $(this).attr("href");
		var lsTop = parseInt($(window).scrollTop());
		lsTop += 92;
		$('#quickLook_Icon .popupMainArea').css({'height' : '405px','width' : lsBoxWidth + 'px'});
		$('#quickLook_Icon').css({'height' : '405px','width' : lsBoxWidth + 'px'});
		$('#box_Icon').show();
		$('.popover_mask').show();
		$('#box_Icon .popupFill').load(lsURL);
		$("#slb_menu_tabs div").css({'z-index' : '1'}); // tabs showing up over mask
		var lsLeft = ($(window).width() - lsBoxWidth)/2 - 5;
		if(!$.browser.msie){lsLeft = lsLeft + 15;}
		$('#box_Icon').css({'left' : lsLeft});
		var lsHeight = $('#outerwrapper').height() + 20;
		$('.popover_mask').css({'background' : '#000','height' : lsHeight,'left' : '0','margin' : '0', 'opacity' : '0.2','position' : 'absolute','top' : '0','width' : $(window).width(),'z-index' : '2'});
		$('#box_Icon').css({'top' : lsTop + 'px', 'z-index' : '3'});
	});
	$('.close').click(function(){
		$('#box_Icon').hide();
		$('.modal_mask').hide();
		$('#box_Icon .popupFill').empty();
	});

	$('.scene_7_popup_cust').click(show_scene7_popup);
//	$('.scene7Popup'       ).click(show_scene7_popup);

	$('.popup_window'      ).click(show_popup_window);
});

function show_scene7_popup(event) {
	event.preventDefault();
	var lsURL = $(this).attr('href');
	var laSKUFull = lsURL.split("&");
	var laSKU = laSKUFull[1].replace(/sku=/,"").split("_");
	var lsSKU = "sku=" + laSKU[0];
	laSKUFull[1] = lsSKU;
	lsURL = laSKUFull.join("&");
	window.open(lsURL,'_blank','width=810,height=810');
}

function show_popup_window(event) {
	event.preventDefault();
	var lsURL = $(this).attr('href');
	window.open(lsURL,'_blank','width=400,height=400,scrollbars=yes');
}

