// JavaScript Document

function savePage(){
	
	var xHtmlBody;
	xHtmlBody = oPage.getXHTMLBody();
	document.forms[0].onsubmit();
	document.forms[0].submit();
	
}

function resizeEditorHeight(){	
	
	var userScreenY;
	userScreenY = document.body.clientHeight;	
	yOffset = "60"	
	newEditorHeight = userScreenY - yOffset + "px";
	oPage.height = newEditorHeight;	
	eval("idAreaoPage").style.height = oPage.height;

}
function make_tree_sortable(){	
	//This will eventually fix the bug of when a new page is created it isn't sortable unless refreshed.
	//More research to follow...
	Sortable.create("tree_nodes", {onUpdate:function(){new Ajax.Request('/pages/sort/167', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("tree_nodes",{});}, parameters:Sortable.serialize("tree_nodes")})}})
}
function getNumPages(){
	var someNodeList = $('tree_nodes').getElementsByTagName('li');
	var nodes = $A(someNodeList);
	return nodes.length;
}



function file_uploading() {
	$('form-upload-button').disabled = true;
	Element.show('spinner2');	
}