// JavaScript Document
$(document).ready(function(){

  $(".StoresProvince").click(function(){
  	var prov = $(this).attr("id");
		var show = $("#store"+prov).css("display");
		//alert (show);
		if (show == "none") {
		  $("#store"+prov).slideDown("slow");
		} else {
			$("#store"+prov).fadeOut("normal");
			$("#store"+prov).css("display","none")
		}
	});

  $(".StoreProvinceUp").click(function(){
  	var prov = $(this).attr("id");
	  $("#store"+prov).slideUp("normal");
		$(this).toggleClass("StoreProvinceDown");
		$(this).toggleClass("StoreProvinceUp");
		//alert ($(this).attr("class"));
	});

  $(".popstoremap").click(function(){
  	var storeid = $(this).attr("alt");
	  
  	$("#StoreGoogleMap").fadeOut("fast");

		$.ajax({
			type: "GET",
			url: "/include/popmap.php",
			data: "store="+storeid,
			success: function(data){
      	$("#StoreGoogleMap").html(data);
        $("#StoreGoogleMap").fadeIn("normal");
			},
			error: function(data, status, error) {
        $("#StoreGoogleMap").html("<div class='boxError'>Error: "+error+"</div>"+data);
        $("#StoreGoogleMap").fadeIn("normal");
			}
		});
		

	});	
	
});	