function collapse (categoryid)
{
	if (document.getElementById){
		children = document.getElementById( 'children' + categoryid ); 
		button = document.getElementById( 'button' + categoryid ); 
		
		if (children.style.display != 'none') {
			children.style.display='none';
			button.innerHTML='+';
		}
		else
		{
			children.style.display='block';
			button.innerHTML='-';
		}
	}
	
	return false;
}

function collapse_admin (section)
{
	if (document.getElementById('acp_' + section).style.display=='none') {
		document.getElementById('acp_' + section).style.display='block';	
		document.getElementById('button_acp_' + section).innerHTML='-';
	}
	else
	{
		document.getElementById('acp_' + section).style.display='none';
		document.getElementById('button_acp_' + section).innerHTML='+';
	}

	return false;
}

function collapse_custom (categoryid, button_show_text, button_hide_text)
{
	if (document.getElementById('children' + categoryid).style.display=='none') {
		document.getElementById('children' + categoryid).style.display='block'	
		document.getElementById('button' + categoryid).innerHTML=button_hide_text;
	}
	else
	{
		document.getElementById('children' + categoryid).style.display='none'
		document.getElementById('button' + categoryid).innerHTML=button_show_text;
	}
}

function toggle_checks (form)
{
	var elements = form.elements;
	var element_count = elements.length;
	
	for (var i = 0; i < element_count; i++)
	{
		if (elements[i].type == "checkbox")
		{
			if (elements[i].checked == true)
			{
				elements[i].checked = false;
			}
			else
			{
				elements[i].checked = true;
			}
		}
	}
}

function check(checkbox_id)
{
	var checkbox = document.getElementById(checkbox_id);
	
	if (checkbox.checked)
	{
		checkbox.checked = false;
	}
	else
	{
		checkbox.checked = true;
	}
}

 /*
function popup(URL, WindowName, c) {
aWindow=window.open(URL,WindowName,"toolbar=no,width=350,height=200,status=no,scrollbars=yes,resize=yes,menubar=no");
}
   */

function popup(mylink, windowname, percent)
{
if (! window.focus)return true;
var href;
var w = 350, h = 200;

if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;

/*
   
    if (window.screen) {
        w = window.screen.availWidth * percent / 100;
        h = window.screen.availHeight * percent / 100;
}        
        var winl = (screen.width-w)/2;
        var wint = (screen.height-h)/2;
        
        if (winl < 0) winl = 0;
        if (wint < 0) wint = 0;         
  
  var features = 'scrollbars=yes';  

  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
    
win = window.open(href, windowname,settings);
*/
win = window.open(href,windowname,'height=' + h + ', width=' + w);
win.window.focus();       

return false;
}


function currency()
{var winpops=window.open("/includes/ExchangeRate","","width=220,height=205,status")}

