var base = "/";function goTo(url) {
	window.location = url;
}
$(function() {
	if($(window).height() < 900) $('.aximum').height(900);
	else $('.aximum').height($(window).height());
	$('.iframe').live('click',function() {
		openFB($(this).attr('href'));
		return false;
	});
});
function trackPage(page_name) {
	_gaq.push(['_trackPageview', '/virtual/'+page_name]);
}
function popOpen(url) {
	url = url.substring(1,url.length-1);
	var build = "http://www.youtube.com/embed/"+url;
	//tb_show(null,build+"&rel=0&hd=1&KeepThis=true&TB_iframe=true&height=400&width=600",null);
	openFB(build+"&rel=0&hd=1&height=400&width=600");
} 
function openFB(url) {
	$.fancybox({
			//'orig'			: $(this),
			'padding'		: 0,
			'href'			: url,
			'title'   		: '',
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'type'				: 'iframe',
			'overlayColor'	: '#000'
		});
}
function zoomIn(img) {
	//url = url.substring(1,url.length-1);
//	tb_show(null,img,null);
	$.fancybox({
			//'orig'			: $(this),
			'padding'		: 0,
			'href'			: img,
			'title'   		: '',
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'overlayColor'	: '#000',
			'margin'		: '0'
	});
}
function loadContent(url) {
	console.log(url);
	if(url == "index" || url == "index/" || url == '' || url == '/') {
		$('#contenth').hide();
		$('#watch-slider').show();
		$('body').removeClass('sub').addClass('main');
		updateUrls(url);
	} else {
		$('#contenth').load(url+' #content',function() {
			$('#watch-slider').hide();
			$('#contenth').show();
			$('body').removeClass('main').addClass('sub');
			updateUrls(url);
		});
	}
}
function updateUrls(url) {
	url = url.replace(/^\/|\/$/g, '');
	if(url.indexOf('watches/') >= 0) {
		// detail page
		$('.accordionContent').hide();
		$('#nav a').removeClass('active');
		$('#nav #index').addClass('active');
		startShow();
		$('.dots img').hover(function() {
			var dot_pos = $(this).position();
			$('#hovers h3').html($(this).attr('alt')).parent().css({top: dot_pos.top+5,left:dot_pos.left+10}).show().find('#img'+this.id).show();
		}, function() {
			$('#hovers').hide().find("img").hide();
		});
		$('.zoom').click(function() {
			var id = $('#slideshow-controls').find('.active').attr('id');
			var img = $('#photo-'+id+' a').attr('href');
			zoomIn(base+img);
			return false;
		});
	} else {
		$('#nav a').removeClass('active');
		$('#nav #'+url).addClass('active');
		if(url == "index" || url == "index/" || url == '' || url == '/') $('#nav #index').addClass('active');
	}
	Cufon.refresh();
	window.location.hash = "/"+url;
}