/* for interactive map on homepage */

function show(url) {
newwin =top.window.open(url, '_blank', 'toolbar=no,location=no,status=no,menubar=no,resizable=no,directories=no,scrollbars=no,width=620,height=450');
}

function MyF(partN) {
window.document.usa_locator.SetVariable("perem1", "state" + partN);
}

$(document).ready(function(){


	/* preload images */

	jQuery.preloadImages = function() {
		for(var i = 0; i<arguments.length; i++) {
			jQuery("<img>").attr("src", arguments[i]);
		}
	}
    
    /* donate tab slide */
    
    $("#donatetab").hover(function() {
        $("#donatepull").animate({"top":"0px"}, 500 );
    });
    $("#donatetab").click(function() {
        $("#donatepull").animate({"top":"0px"}, 500 );
    });
    $("#donatepull_in a.close").click(function() {
        $("#donatepull").animate({"top":"-300px"}, 500 );
    });
    
    
    /* homepage bottom box hovers */
	
	$("#hbot1").hover(function() {
        $(this).addClass("hbot1_on");
      },function() {
        $(this).removeClass("hbot1_on");
      }
    );
    $("#hbot2").hover(function() {
        $(this).addClass("hbot2_on");
      },function() {
        $(this).removeClass("hbot2_on");
      }
    );
    $("#hbot3").hover(function() {
        $(this).addClass("hbot3_on");
      },function() {
        $(this).removeClass("hbot3_on");
      }
    );
    
    $("#hbot3").hover(function() {
        $(this).addClass("hbot3_on");
      },function() {
        $(this).removeClass("hbot3_on");
      }
    );
    
    /* merch hovers */
    $("div.product").hover(function() {
        $(this).addClass("merch_on");
        $(this).find('img.embiggen').show();
      },function() {
        $(this).removeClass("merch_on");
        $(this).find('img.embiggen').hide();
      }
    );
    
    /* pulldown navigation in popups */
    
    $("#stateselect").change(function() {
    	var theUrl = $("#stateselect :selected").val();
		//window.location.href = buyUrl;
		window.location.href = theUrl;
		return false;
	});
	var currpage = location.pathname.substring(13);
	$("#stateselect option[value='" + currpage + "']").attr("selected", "selected");
	
	var pageheight = $(document.window).height();
	var pageinheight = pageheight - 6
	$("#popwrap_in").css({"min-height":pageinheight});
	
	
});