	
	var light_start_top = '20%';
	var light_start_height = '210px';
	
	var light_start_height_ie6 = '235px';
	
	
	$(document).ready(function() {

		// load lightbox base html before the rest of the HTML.
		$("body").prepend('<div id="light" class="white_content"><iframe src="' + kmart_store_locator.iframe_src + '" width="100%" height="100%" frameborder="0" id="kmrx_store_locator_iframe" name="kmrx_store_locator_iframe"></iframe><a id="light_close"><span>Close</span></a></div>');
		$("body").prepend("<div id=\"fade\" class=\"black_overlay\"></div>");

		
		$("#kmrx_store_locator, .kmrx_store_locator").click(function() {
			launch_kmrx_search();
			return false;
			
		});
		
		$("#fade").click(function() {
			close_search();
		});

	});
	
	function close_search() {
		$("#light, #fade").css('display', 'none');
	}
		
	
	function largeHeight() {
		
		$("#light").stop().animate({
			height: '450px',
			top: '10%'
		}, 400, 'linear', function() {
			//$("a#light_close").css('top', '-35px');
		});
	}
	
	function noResultsHeight() {
		if ($.browser.msie) {
			$("#light").stop().animate({
				height: '295px'
			}, 400);
		} else {
			$("#light").stop().animate({
				height: '275px'
			}, 400);
		}	
	}
	
	function waitHeight() {
		if ($.browser.msie) {
			$("#light").stop().animate({
				height: '265px'
			}, 400);
		} else {
			$("#light").stop().animate({
				height: '240px'
			}, 400);
		}
	}
	
	
	function rx_locator_omniture(tracking_text) {
		var s = s_gi("Searskmartcom");
		s.prop22 = 'Pharmacy > Locator > ' + tracking_text;
		s.tl(null, 'o');
		
		//alert('tracked: ' + tracking_text);
	}
	
	function launch_kmrx_search() {
		rx_locator_omniture('Lightbox load');
		
		//scroll to top (IE6 does not render position:fixed)
		if ($.browser.msie && $.browser.version == '6.0') {
			self.scrollTo(0,0);
		}

		// ie6 renders search box w/ a little larger height.
		var h = ($.browser.msie) ? light_start_height_ie6 : light_start_height;
											
		$("#light").css({
			top: light_start_top,
			height: h
		});

		top.frames['kmrx_store_locator_iframe'].init_page();

		$("#light, #fade").css('display', 'block');	// show	
	}

	