
var myajax;
var myajax2;
var resizing = 0;

function fix(){
	var maxheight = Math.max(document.body.clientHeight - 330, $('content_container').offsetHeight);
	$('content').setStyle("height", maxheight+"px");
	$('sitecontainer').setStyle("height", maxheight+185+"px");
	$('site').setStyle("height", maxheight+205+"px");
	
	/*
	$('image').setStyle("display", "block");
	$('image').setStyle("top", (maxheight - $('image').offsetHeight + 141)+"px");
	$('image').setStyle("marginLeft", (839 - $('image').offsetWidth)+"px");
	*/
	//pngfix();
}

function resize_fix(){
	if(resizing == 0){
		resizing = 1;
		var maxheight = Math.max(document.body.clientHeight - 330, $('content_container').offsetHeight);
		$('content').setStyle("height", maxheight+"px");
		$('sitecontainer').setStyle("height", maxheight+185+"px");
		$('site').setStyle("height", maxheight+205+"px");
		/*
		$('image').setStyle("top", (maxheight - $('image').offsetHeight + 141)+"px");
		$('image').setStyle("marginLeft", (839 - $('image').offsetWidth)+"px");
		*/
		setTimeout("resizing = 0;", 250);
	}
}

function init_nodes(in_action_id, in_machine_id, in_doc_tree_id){
	myajax = new ajax("http://www.xerox-lsptraining.com/page=site.nodes/q=init/action_id="+in_action_id+"/machine_id="+in_machine_id+"/doc_tree_id="+in_doc_tree_id, {onComplete: function(){ load_documents(); }, update: 'nodes_content'});
	myajax.request();
}

function select_machine(in_machine_id){
	myajax = new ajax("http://www.xerox-lsptraining.com/page=site.actions/machine_id="+in_machine_id, {update: 'actions', onComplete: function(){ 
		myajax = new ajax("http://www.xerox-lsptraining.com/page=site.nodes/q=set_machine/machine_id="+in_machine_id, {onComplete: function(){ load_documents(); }, update: 'nodes_content'});
		myajax.request();
	}});
	myajax.request();
}

function select_action(in_action_id){
	myajax = new ajax("http://www.xerox-lsptraining.com/page=site.nodes/q=set_action/action_id="+in_action_id, {onComplete: function(){ load_documents(); }, update: 'nodes_content'});
	myajax.request();
}

function select_doc_tree(in_doc_tree_id){
	myajax = new ajax("http://www.xerox-lsptraining.com/page=site.nodes/q=set_doc_tree/doc_tree_id="+in_doc_tree_id, {onComplete: function(){ load_documents(); }, update: 'nodes_content'});
	myajax.request();
}

function load_documents(){
	myajax2 = new ajax("http://www.xerox-lsptraining.com/page=site.documents", {onComplete: function(){ if($("grid_grid_documents").id) grid_set_page(0, "grid_documents"); fix(); }, update: 'documents_content'});
	myajax2.request();
}

