$(document).ready(function(){
	//Popup
	$(".popup_link").click(function(e){
		e.preventDefault();
		var janela;
		var url = $(this).attr("href");
		var name = "listings";
		var width = 800;
		var height = 600;
		var top = (screen.availHeight - height) / 2;
		var left = (screen.availWidth - width) / 2;
		var scroll = 'yes';
		var resize = 'yes';
		pop = window.open(url, name, 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', scrollbars=' + scroll + ', resizable=' +  resize + ', statusbar=no');
		pop.focus();
		return false;
		return false;
	});
	
	// search field
	$("#searchField").focus(function(){
		if($(this).attr("value") == "SEARCH"){
			$(this).attr("value", "");
		}
	});
	$("#searchField").blur(function(){
		if($(this).attr("value") == ""){
			$(this).attr("value", "SEARCH");
		}
	});

	// show or hide left navigation
	if ($("#sideNav ul li").size() == 0) {
		$("#sideNav").remove();
		$("#content").removeClass("split");
		$("#contentSplit").removeAttr("id");
	}else{
		$("#content").addClass("split");
	}

	// menu
	$("#sideNav>ul>li>a.selected").next().show();
	$("#sideNav>ul>li>ul>li>a.selected").parent().parent().show();

	// update view cart
	/*if (store_code) {
		$.get("http://www.attest-zeemedical.com/mm5/merchant.mvc?Store_code="+store_code+"&Screen=cart_template", function(data){
			$("#divCart").html(data);
		});
	}
	*/
});
