/**********************************
* Window Popping Functions
********************************/
function popWindow( url, width, height )
{
	var wnd = window.open( url,
			       '_blank', 
			       'height=' + height + ',width=' + width + ',location=no,menubar=no,scrollbars=yes,resizable=no,toolbar=no'
			       );
	wnd.focus();	
} // popWindow

function popOnLoad( url, width, height )
{
        var x = (screen.width - width)/2;
        var y = (screen.height - height)/2;
	var wnd = window.open( url,
			       '_blank', 
			       'height=' + height + ',width=' + width + ',left=' + x + ',top=' + y + ',location=no,menubar=no,scrollbars=no,resizable=no,toolbar=no'
			       );
	wnd.focus();	
} // popOnLoad


/**********************************
* Form Control Functions
********************************/
function changeAction( formName, actionValue )
{
	document.forms[formName].elements['action'].value = actionValue;
} // changeAction

function disableFor()
{
  // do nothing
}

/**********************************
* Custom UI Functions
********************************/
function handleDRover( element )
{
    // change the CSS class
    element.className = 'dr_over';
} // handleDRover()

function handleDRout( element )
{
    // change the CSS class
    element.className = 'dr_out';
} // handleDRout()

function handleDRclick( element, fieldName, fieldValue )
{
    // find the checkbox element with the value of answerId
    var frm = document.forms['frm_main'];
    for( var i = 0; i < frm.elements.length; i++ )
    {
	var e = frm.elements[i];
	if( e.type == 'checkbox' ) // then this is a checkbox
	{
	    if( (e.name == fieldName) &&
		(e.value == fieldValue) )
	    {
		// flip the checkmark
		e.checked = !e.checked;
	    }
	}
    }
} // handleDRclick()

function pop_terms()
{
	return popWindow( '/recipe_terms.html', 350, 400 );
} // pop_terms()
