$(document).ready(function() {
	var hVal = 660;
	var h;

	function resizeMovie() {
		h = $(window).height();
		if (h < hVal) {
			$("html, body").css({
				overflow: "auto"
			});
			$("#flashcontent, #movie").css({
				height: hVal + 1 + "px"
			});
		}
		else
		{
			$("body, html").css({
				overflow: "hidden"
			});
			$("#flashcontent, #movie").css({
				height: "100%"
			});
		}
	}
	
	$(window).resize(function(){
		resizeMovie();
	});
	
	resizeMovie();
	
	$("#tm_win").click(function(){
		tm_Win();
		return false;	
	});

});

function tm_Win() {
	var newWin = window.open("trade_media/", "popWin", "width=700,height=600,scrollbars=yes,status=yes,toolbar=no");
	newWin.focus();
}

function getAnchor() {
	var page = document.location.toString();
	if (page.match('#')) { // the URL contains an anchor
		myAnchor = page.split('#')[1];
		if (myAnchor == "founders_club") {
			window.location.href = "http://www.ranchoarroyograndewines.com/#wine_clubs";
		}
	} else {
	  myAnchor = 0;
	}
	return myAnchor;
}

function changeAnchor(url) {
	var page = document.location.toString();
	page = page.split('#')[0];
	page = page + "#" + url;
	window.location.href = page;
	pageTracker._trackPageview("/"+url);
}