function resize_iframe(id)
{
	var height=window.innerHeight;//Firefox
	if (document.body.clientHeight)
	{
		height=document.body.clientHeight;//IE
	}
	//resize the iframe according to the size of the
	//window (all these should be on the same line)
	document.getElementById(id).style.height=parseInt(height-document.getElementById(id).offsetTop-95)+"px";
}

function resize_width(id)	//IE width fix
{
	var width=window.innerWidth;
	
	if (document.body.clientWidth){
		width=document.body.clientWidth;	
	}
	
	document.getElementById(id).style.width=parseInt(width-document.getElementById(id).offsetLeft-380)+"px";
}


function getHeight(){
	return parseInt($(window).height() - 85) + "px";
}

function load_contents(e, loadFile){
	var myTitle;
	$(e).empty().html('<div class="loading"></div>');
	$(e).load('ajax/' + loadFile, function(){
		myTitle = $(e).find("h1").text();
		if(myTitle != null){
			document.title = myTitle + " | VIP Studios";
		}
		$(e).height(getHeight());
	});
}

function load_hash(init){
	var ajaxPage = window.location.hash;
	ajaxPage = ajaxPage.replace("#","");
	load_page(ajaxPage, init);
}

function init_pages(){
	load_hash(true);
	
	$(window).hashchange(function(){
		load_hash();
	});
	
	$(window).resize(function() {
		$("#thumbsFrame").height(getHeight());
		$("#mainFrame").height(getHeight());
	});
	
	$("#thumbFrame a, a.ajax").live( 'click', function(){
		location.hash = $(this).attr('rel');
		return false;
	});
	
	$(".submenu a").click(function(){
		load_contents("#thumbFrame", $(this).attr('rel'));
		return false;
	});
	
	$(".headerMenu a").live( 'click', function(){
		location.hash = $(this).attr('rel');
		$(".headerMenu a").removeClass('selected');
		$(this).addClass('selected');
		return false;
	}).hoverIntent({
		over: function(){
			$(this).find("div").show().animate({
				top: [-5, 'easeOutBounce'],
				color: ["#ffffff", 'easeOutQuad']
			}, 300);
		},
		out: function(){
			$(this).find("div").animate({
				top: -61,
				color: "#3399ff"
			}, 200);
		},
		interval: 150
	});
}

