/************************************************************************/
/*                          template.js                                 */
/*                                                                      */
/* Generic JavaScript functions for use on the UQ template.             */
/* Version 1.0                                                          */
/* 5th October 2003                                                     */
/*                                                                      */
/************************************************************************/


// For the Quick links pulldown-menu of the left hand side menu of the site
function changepage(formObject)
{
    var url;
    
    url = formObject.options[formObject.options.selectedIndex].value;

    if(url != "empty")
        {
        window.location = url;
        url = "";
        }
}   


// For the Header Search form
function goto_url(form) 
{

    if (form.search_text.value == "") 
    {
        alert("Please enter some text and then press Search");
        return false;
    }

    var url = form.search_select[form.search_select.selectedIndex].value +
    escape(form.search_text.value);


    // Uncomment this lines if you want the current window to change
    document.location = url;

    // Uncomment this line if you want the search in a new window
    //search_window = window.open(url);

    return false;
}

function basic_search(form) 
{

    if (form.search_text.value == "") 
    {
        alert("Please enter some text and then press Search");
        return false;
    }

    var url = form.search_select.value + escape(form.search_text.value);


    // Uncomment this lines if you want the current window to change
    document.location = url;

    // Uncomment this line if you want the search in a new window
    //search_window = window.open(url);

    return false;
}

// Add any more functions below

function checkAll(form, check) 
{
    for(i=0;i<form.elements.length;i++) {
        if (form.elements[i].type=='checkbox') {
            if (form.elements[i].checked!=check) {
                form.elements[i].checked=check;
            }
        }
    }
}

function popup(mylink, windowname, width, height)
{
	if (width <= 0)
	{
		width=600;
	}

	if (height <= 0)
	{
		height=400;
	}
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
       window.open(href, windowname, 'left=50,top=50,width=' + width + ',height=' + height + ',resizable=yes,scrollbars=no');
//    return false;
}

