/*
 * Copyright 2007 The Australian National University
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 
 * file except in compliance with the License. You may obtain a copy of the License at 
 *
 *    http://www.apache.org/licenses/LICENSE-2.0 
 *
 * Unless required by applicable law or agreed to in writing, software distributed under 
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
 * KIND, either express or implied. See the License for the specific language governing 
 * permissions and limitations under the License.
 */

var loadingPanel;

function initLoadingPanel() {
    loadingPanel = new YAHOO.widget.Panel("wait",   
                        { width:"85px",
                          close:false,
                          visible:false
                        }  
                    ); 
    loadingPanel.setHeader("&nbsp;Loading..."); 
    loadingPanel.render(); 
}

function togglehide(anchor) {
	var display = document.getElementById('helpcontent').style.display;
	if( display == "" ){
		hide(anchor,true);
	}else{
		hide(anchor,false);
	}
}

function hide(anchor,hide) {
	if(hide){
		document.getElementById('helpcontent').style.display = "none";
		anchor.title = "Show search tips";
		anchor.innerHTML = anchor.innerHTML.replace(/downarrow/,"rightarrow");
		anchor.innerHTML = anchor.innerHTML.replace("Hide","Show");
	}else{
		document.getElementById('helpcontent').style.display = "";
		anchor.title = "Hide search tips";
		anchor.innerHTML = anchor.innerHTML.replace(/rightarrow/,"downarrow");
		anchor.innerHTML = anchor.innerHTML.replace("Show","Hide");
	}
}

/* wide screen frame row distribution */
var lefthidden = "*,100%";
var splitrows = "30%,*";
var righthidden = "100%,*";

function toggleleft(anchor) {
	var cols = parent.document.getElementById('mainframe').cols;
	if( cols == splitrows ){
		slideleft(anchor,true);
	}else{
		slideleft(anchor,false);
	}
}

function toggleright(anchor) {
	var cols = parent.document.getElementById('mainframe').cols;
	if( cols == lefthidden ){
		slideright(anchor,true);
	}else{
		slideright(anchor,false);
	}
}

function slideleft(anchor,slide) { 
	if(slide){
		parent.document.getElementById('mainframe').cols = righthidden;
		anchor.title = "Show the study description";
		anchor.innerHTML = anchor.innerHTML.replace(/rightslide/,"leftslide");
	}else{
		parent.document.getElementById('mainframe').cols = splitrows;
		anchor.title = "Hide the study description";
		anchor.innerHTML = anchor.innerHTML.replace(/leftslide/,"rightslide");
	}
}

function slideright(anchor,slide) { 
	if(slide){
		parent.document.getElementById('mainframe').cols = splitrows;
		anchor.title = "Hide the search panel";
		anchor.innerHTML = anchor.innerHTML.replace(/rightslide/,"leftslide");
	}else{
		parent.document.getElementById('mainframe').cols = lefthidden;
		anchor.title = "Show the search panel";
		anchor.innerHTML = anchor.innerHTML.replace(/leftslide/,"rightslide");
	}
}