function changeBackground(t)
{
	id = $(t).attr('id').substr(3); 

	if($(t).attr('src') == 'images/checkbox_bg.gif'){
		$('#reportBlock'+id).addClass('reportBlockActive'); 
		$(t).attr('src','images/checkbox_bg_o.gif'); 
		$('input[type="checkbox"]#chk'+id).attr('checked',true); 
	} else {
		$('#reportBlock'+id).removeClass('reportBlockActive'); 
		$(t).attr('src','images/checkbox_bg.gif'); 
		$('input[type="checkbox"]#chk'+id).attr('checked',false); 
	}
}
function validateAdd()
{
	var obj = document.frmReport;
	var reportSel = false;
	for(i = 0; i < obj.elements.length; i++)
	{
		if(obj.elements[i].type == "checkbox" && obj.elements[i].name.substr(0,7) == "reports" && obj.elements[i].checked == true)
		{
			reportSel = true;
			break;
		}
	}
	for(i = 0; i < obj.elements.length; i++)
	{
		if(obj.elements[i].type == "checkbox" && obj.elements[i].name.substr(0,7) == "reports" && obj.elements[i].checked == true)
		{
			if(document.getElementById('quantity_'+obj.elements[i].value).value == '' || isNaN(document.getElementById('quantity_'+obj.elements[i].value).value))
			{
				alert("Please enter a valid Quantity for the Report.");
				document.getElementById('quantity_'+obj.elements[i].value).focus();
				document.getElementById('quantity_'+obj.elements[i].value).select();
				return;
			}
		}
	}
	if(!reportSel)
	{
		alert("Please select at least one Report to Add to Shopping Cart.");
		return;
	}

	//Validation
	obj.action = '#';
	obj.submit();
}
function validateOrder()
{
	var obj = document.frmReport;

	if(obj.payment_type[0].checked)
	{
		opt = 'check';
		if(obj.name_on_check.value == '')
		{
			alert("Please enter Name on Check.");
			obj.name_on_check.focus();
			return;
		}
		if(obj.check_address.value == '')
		{
			alert("Please enter Address on your check.");
			obj.check_address.focus();
			return;
		}
		if(obj.check_city.value == '')
		{
			alert("Please enter City on your check.");
			obj.check_city.focus();
			return;
		}
		if(obj.check_state.selectedIndex == 0)
		{
			alert("Please select your State on Check.");
			obj.check_state.focus();
			return;
		}
		if(obj.check_zip.value == '')
		{
			alert("Please enter your Zip on check.");
			obj.check_zip.focus();
			return;
		}
		if(obj.land_phone.value == '')
		{
			alert("Please enter your Land Phone Number.");
			obj.land_phone.focus();
			return;
		}
		if(obj.check_email.value == '')
		{
			alert("Please enter your Email Address.");
			obj.check_email.focus();
			return;
		}
		if(obj.check_routing.value == '')
		{
			alert("Please enter your Check Routing Number.");
			obj.check_routing.focus();
			return;
		}
		
		if(obj.check_account.value == '')
		{
			alert("Please enter your Check Account Number.");
			obj.account_number.focus();
			return;
		}
		if(obj.check_number.value == '')
		{
			alert("Please enter Check Number.");
			obj.check_number.focus();
			return;
		}
	}
	else
	{
		opt = 'place';
		if(obj.b_first_name.value == '')
		{
			alert("Please enter First Name in Billing Information.");
			obj.b_first_name.focus();
			return;
		}
		if(obj.b_last_name.value == '')
		{
			alert("Please enter Last Name in Billing Information.");
			obj.b_last_name.focus();
			return;
		}
		if(obj.b_address.value == '')
		{
			alert("Please enter Address in Billing Information.");
			obj.b_address.focus();
			return;
		}
		if(obj.b_city.value == '')
		{
			alert("Please enter City in Billing Information.");
			obj.b_city.focus();
			return;
		}
		if(obj.b_state.selectedIndex == 0)
		{
			alert("Please select State in Billing Information.");
			obj.b_state.focus();
			return;
		}
		if(obj.b_zip.selectedIndex == 0)
		{
			alert("Please select Zip in Billing Information.");
			obj.b_zip.focus();
			return;
		}
		if(obj.cc_type.selectedIndex == 0)
		{
			alert("Please select a Credit Card Type.");
			obj.cc_type.focus();
			return;
		}
		if(obj.cc_num.value == "")
		{
			alert("Please enter the Credit Card Number.");
			obj.cc_num.focus();
			return;
		}
		if(obj.exp_month.selectedIndex == 0 || obj.exp_year.selectedIndex == 0)
		{
			alert("Please select Credit Card Expiration Month and Year.");
			if(obj.exp_month.selectedIndex == 0)
				obj.exp_month.focus();
			else
				obj.exp_year.focus();
			return;
		}
		if(obj.security_code.value == "")
		{
			alert("Please enter the Security Code.");
			obj.security_code.focus();
			return;
		}
	}
	obj.action = '#';
	obj.submit();
}
function showPaymentBox()
{
	obj = document.frmReport;
	if(obj.payment_type[0].checked)
	{
		document.getElementById('cc_blk').style.display = 'none';
		document.getElementById('check_blk').style.display = 'none';
		document.getElementById('po_blk').style.display = 'block';
	}else if(obj.payment_type[1].checked)
	{
		document.getElementById('cc_blk').style.display = 'none';
		document.getElementById('check_blk').style.display = 'block';
		document.getElementById('po_blk').style.display = 'none';
	}
	else
	{
		document.getElementById('cc_blk').style.display = 'block';
		document.getElementById('check_blk').style.display = 'none';
		document.getElementById('po_blk').style.display = 'none';
	}
}

