$(document).ready(function(){
	//Fix pngs
	$('img').livequery(function() {$(this).ifixpng(); });
	$('a.VertigoLink').livequery(function() {$(this).bind("click", function() { return false; }) });
	$('a.VideoLink').livequery(function() {$(this).bind("click", function() { 
		var vidlink = this.href;
	 $('#VideoContent').fadeOut(1200, function() { $('#VideoContent').load(vidlink, function() { $('#VideoContent').fadeIn(1500)})});
	 return false;
 	}) });
	$("#news").newsTicker(5000);
	$('#tabContainer > ul').livequery(function() {$(this).tabs({ fx: { opacity: 'toggle' } }); });
	var loaded = 0;
	$('img.rollover')
		.bind("click", function() {
			overlay.prepare(this); //Fill the overlay and bind events
		})
			.hover(function() {
			$(this).addClass("hover");
			
			var offset = $(this).position();
			offset.top = offset.top + this.parentNode.scrollTop;
			var node = $(this).clone()
				.addClass("bigthumb")
				.css({ left: offset.left, top: offset.top, position: "absolute", zIndex: 4 })
				.appendTo(this.parentNode);
			
			var modifier = 1.3;
			var animation = { height: this.offsetHeight*modifier, width: this.offsetWidth*modifier };
			var owidth = (this.offsetWidth);
			
			if((offset.left- (owidth*(modifier-1))/2) > 0)
				animation.left = offset.left - (owidth*(modifier-1))/2;
			
			if((offset.top- (this.offsetHeight*(modifier-1))/2) > 0)
				animation.top = offset.top - (this.offsetHeight*(modifier-1))/2;
			
			node.animate(animation, 150); //Let's use a very fast animation here
			$(this).css("opacity", 0);
		}, function() {
			$(this).removeClass("hover");
			$("img.bigthumb").remove();
			$(this).css("opacity", 1);
							
		});

});
var overlay = {
	prepare: function(cur) {
		if (loaded = 0) 
		{ var divelement = '#wrap'; }
		else 
		{ var divelement = '#content'; }
	$(divelement).fadeOut(1200, function() { moveMenu(); $('#content').load(cur.getAttribute('path'), function() { $(divelement).fadeIn(1500)})});
	var loaded = 1;
	 return false;

	}
}

function moveMenu(){ 
$('div.gallery img.rollover').css('margin-top', 8);
$('.menuItemLeft').css('height', 170).css('margin-top', 10).css('padding-left', 90);
$('.menuItemRight').css('height', 170).css('margin-top', 10).css('padding-right', 90);
$('#top').css('visibility', 'visible');
 if ( ($.browser.msie) && ($.browser.version < 7)) {  $('#bot').css('margin-top', 0);
 	 }  else
	 { $('#bot').css('padding-top', 170);
 }
}
 // .css('text-align', 'left')  menuItem bit 
