/**
 * Selects the first checkbox inside the given element.
 * the given element is usually a table or a div containing the table or tables
 *
 * @param    container    DOM element
*/

function toggleCheckAllRows( container_id ) {

    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;

    var checkbox;


    for ( var i = 0; i < rows.length; i++ ) {
        checkbox = rows[i].getElementsByTagName( 'input' )[0];


        if ( checkbox && checkbox.type == 'checkbox' ) {

            unique_id = checkbox.name + checkbox.value;
            if ( checkbox.disabled == false ) {
                if ( checkbox.checked == false )
                    checkbox.checked = true;
                else
                    checkbox.checked = false;
            }
        }

    }


    return true;

}
function toggle_visibility(form, btn) {
	var f = document.getElementById(form);
	var b = document.getElementById(btn);
    if (f.style.display == 'block') {
		f.style.display = 'none';
		b.src="/g2/plus.jpg";
	} else {
		f.style.display = 'block';
		b.src="/g2/minus.gif";
	}
}
function hide(id) {
	var f = document.getElementById(id);
	f.style.display = 'none';
}
function show(id) {
	var f = document.getElementById(id);
	f.style.display = 'block';
}

function PopupPic(sPicURL) {
	win=window.open("/popup.htm?"+sPicURL, "", 'height=150,width=150,directories=no,location=no,menubar=no,resizable=yes,scrollbar=yes,status=no'); 
}
function popup(url) 
{
	var width  = 620;
	var height = 440;
	var left   = (screen.width  - width)/2;
	var top    = (screen.height - height)/2;
	var params = 'width='+width+', height='+height;
	params += ', top='+top+', left='+left;
	params += ', directories=no';
	params += ', location=no';
	params += ', menubar=no';
	params += ', resizable=yes';
	params += ', scrollbars=yes';
	params += ', status=no';
	params += ', toolbar=no';
	newwin=window.open(url,'', params);
	if (window.focus) {
		newwin.focus()
	}
	return false;
}

