$scrollTop = 212;

$(function() {
	/*
	if (document.getElementById && document.createTextNode){
		var siteFrame = document.getElementById('siteFrame');
		addEvent(siteFrame,'load', doIframe);
	}
	*/
});

function addAdjustScrollEvent(scrollTop) {
	
	if (scrollTop != null) $scrollTop = scrollTop; 
	if (document.getElementById && document.createTextNode){
		var siteFrame = document.getElementById('siteFrame');
		addEvent(siteFrame,'load', adjustScroll);	
	}
}

function removeAdjustScrollEvent() {
	if (document.getElementById && document.createTextNode){
		var siteFrame = document.getElementById('siteFrame');
		removeEvent(siteFrame,'load', adjustScroll);	
	}
}


function adjustScroll() {
	$('html, body').animate({scrollTop:$scrollTop}, 'fast');
}

function setPageHeight(h, resetScroll) {
	
	if (resetScroll == null) resetScroll = true;
	
	$('#siteWrapper').css({height: h});	
	
	//$('html, body').scrollTop(0);
	if (resetScroll) $('html, body').animate({scrollTop:0}, 'fast');
}

function popUp(url, width, height) {
	
	if (width == null) width = 800;
	if (height == null) height = 600;
	
	var centeredY = (screen.height - height)/2;
	var centeredX = (screen.width - width)/2;
	
	prevWin=window.open(url,"spop","left="+ centeredX+",top="+ centeredY+",scrollbars=YES,resizable=yes,width=" +width +",height="+height);
	if(prevWin.opener == null) prevWin.opener=self;
	prevWin.focus();
}

function showSiteFrame(visible) {
	if (visible) {
		$("#siteFrame").show();
	}
	else { 
		$("#siteFrame").hide();
	}
}

function showRightNav(visible) {
	if (visible) {
		$("#rightNav").show();
	}
	else {
		$("#rightNav").hide();
	}
}

function setSiteFrameUrl(url) {
	
	$("#siteFrame").attr('src', url);
		
}

function setFrameHeight(h) {
	$('#siteFrame').css({height: h});	
}



