function strTrim(tmpStr)
{
	tmpStr = tmpStr.replace(/^\s+/,"");//remove leading
	tmpStr = tmpStr.replace(/\s+$/,"");//remove trailing
	return tmpStr;
}
//------------------------------------------------------------------------------------
function trimFields()
{
	for(var i=0; i < obj.elements.length; i++)
	{
		if(obj.elements[i].type == "text" || obj.elements[i].type == "textarea" || obj.elements[i].type == "password")
		{
			obj.elements[i].value = strTrim(obj.elements[i].value);
		}
	}
}
//------------------------------------------------------------------------------------
function validateLogin()
{
	trimFields();
	if(obj.user_name.value == '')
	{
		alert("Please enter User Name");
		obj.user_name.focus();
		return false;
	}
	if(obj.password.value == '')
	{
		alert("Please enter Password");
		obj.password.focus();
		return false;
	}
	//All Fine?
	return true;
}
//------------------------------------------------------------------------------------
function validateForm()
{
	trimFields();
	if(obj.coupon.selectedIndex == 0)
	{
		alert("Please Select Coupon");
		obj.coupon.focus();
		return;
	}
	if(tinyMCE.getContent('coupon_text') == "")
	{
		alert("Please enter Coupon Text.");
		return;
	}
	obj.action = 'manage_coupons.php';
	obj.submit();
}
//------------------------------------------------------------------------------------
function printWindow()
{
	var wnd = window.open('print_coupon.php','','height=320,width=654,top=20,left=20,location=0,menubar=0,scrollbars=0');
	wnd.focus();
}