// Copyright 2002 ePark Labs, Inc. ALL RIGHTS RESERVED

////////////////////////////
// General
////////////////////////////

var content_change = false;

function winOpen(url,name)
{
    // Window vars
    // Size
    var win_height = Math.min(screen.availHeight - 100, 720);
    var win_width = Math.min(screen.availWidth - 50, 720);
    // Position (center)
    var win_position_x = (screen.availWidth - win_width) / 2;
    var win_position_y = (screen.availHeight - win_height) / 4;
    var win = window.open(url,name,'toolbar=1,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width='+win_width+',height='+win_height+',left='+win_position_x+',top='+win_position_y);
    win.focus();
}

// Select or deselect all of the checkboxes
function selectAll(true_false,start,finish) {
    var f = document.rfqform;
    if(finish == 'all')
    {
        var finish = f.elements.length;
    }
    for(var i = start; i < finish; i++)
    {
        if(f.elements[i].type == "checkbox")
        {
            f.elements[i].checked = true_false;
        }
    }
}

function checkboxToggle(form)
{
	with (form)
	{
		var true_false = all.checked;
		for(var i = 0; i < elements.length; i++)
		{
			if(elements[i].type == "checkbox")
			{
				elements[i].checked = true_false;
			}
		}
	}
}

function confirmClose(ok,cancel)
{
    if(content_change)
    {
        if(!confirm('You have made changes to the data. Are you sure you want to discard the changes?\r\rClick \"Ok\" to discard changes and close the window.\rClick \"Cancel\" to return to the form.'))
        {
            eval(cancel);
            return;
        }
    }
    eval(ok);
}

///////////////////////
// Password
///////////////////////

function password()
{
    pass_win = open('/admin/password','pw','height=200,width=300,scrollbars=no,resizable=yes,location=no,toolbar=no,status=yes');
    pass_win.focus();
}

