$(document).ready(function () {
	$('#CustomerServiceLink').click(function (e) {
		e.preventDefault();
		$('body').css('cursor', 'wait');
		$.get("/store/customer-service-popup", function(data){
			$('body').css('cursor', 'auto');
			$(data).modal({
				closeHTML: "<a href='#' title='Close' class='modalCloseX simplemodal-close'>x</a>",
				position: ["10%",]
			});
			var CustomerServiceLink = $('#CustomerServiceLink');
			if(CustomerServiceLink.data('evalAfterPopup')) {
				eval(CustomerServiceLink.data('evalAfterPopup'));
				CustomerServiceLink.removeData('evalAfterPopup');
			}
			$('#RepairInstructionsLink').click(function(e) {			
				var InstructionsLink = $('#RepairInstructionsLink').get(0);
				var ScrollContainer = $('#CustomerServiceInner').get(0);
				$('#RepairInstructionsPopup')
					.css('top', InstructionsLink.offsetTop - ScrollContainer.scrollTop - 170)
					.css('left', InstructionsLink.offsetLeft - 260)
					.show();
			});
			$('#RepairInstructionsPopup').mouseleave(function(e) {
				$('#RepairInstructionsPopup').hide();
			});
			$('#RepairInstructionsCloseX').click(function(e) {
				$('#RepairInstructionsPopup').hide();
			});
		});
	});
});