function show_login_form()
{
	$("#register_form").effect("blind", {mode: 'hide', easing: 'swing'}, 500);
	$('#login_form').effect('blind', {mode: 'show', easing: 'swing'}, 500);
}

function show_register_form()
{
	$('#login_form').effect('blind', {mode: 'hide', easing: 'swing'}, 500);
	$('#register_form').effect('blind', {mode: 'show', easing: 'swing'}, 500);
}

function clear_product_selections()
{
	var inputs = document.getElementsByTagName('input');
	var num = inputs.length;
    var i = 0;
    for(; i < num; i++)
    {
		if(inputs[i].name.substring(0, 13) == 'subscription_')
		{
			inputs[i].checked = '';
		}
	}
}

function toggle_issue_div(prod_id)
{
	var issues_div = document.getElementById(prod_id + '_issues');
	if(issues_div.style.display == 'none') issues_div.style.display = 'block';
	else issues_div.style.display = 'none';
}

var issues = 1;

function add_issue(prod_id)
{
	var issues_div = document.getElementById(prod_id + '_issues');
	
	//store the response in a temporary element...
	var tmp = document.createElement('div');
	tmp.innerHTML = '<div id="issue_div_' + issues + '">Issue Number:&nbsp;<input type="text" maxlength="3" size="3" name="' + prod_id + '_issue_number[]" />&nbsp;Qty:&nbsp;<input type="text" maxlength="3" size="3"" name="' + prod_id + '_qty[]" />&nbsp;<img src="img/remove.png" alt="Remove Issue" title="Remove Issue" onclick="remove_issue(' + issues + ');" style="cursor: pointer;" /><br /></div>';
	
	//rip the inner div from the temporary element and append it to the existing list of nodes
	//it had to be done this way because simply setting the innerHTML of the nodes list caused the form fields to reset their values!
	var new_node = issues_div.appendChild(tmp);
	
	issues++;
}

function remove_issue(issue_id)
{
	//remove the specified node from the HTML
	var e = document.getElementById('issue_div_' + issue_id);
	e.parentNode.removeChild(e);
}
