
//grab value of item by id
function getVal(theItem)
	{
	return document.getElementById(theItem).value;
	}

//grab handle on item by id
function get(theItem)
	{
	return document.getElementById(theItem);
	}

//matches vb trim() function
function Trim(theStr){
theStr = LTrim(theStr);
return RTrim(theStr);
}

function RTrim(theStr){
while(theStr.charAt((theStr.length -1))==" "){
theStr = theStr.subtheStr(0,theStr.length-1);
}
return theStr;
}

function LTrim(theStr){
while(theStr.charAt(0)==" "){
theStr = theStr.replace(theStr.charAt(0),"");
}
return theStr;
}

//grab x left chrs
function leftChr(theStr,CHARACTER_COUNT){

return theStr.substring(0,CHARACTER_COUNT);

}

//grab x right chrs
function rightChr(theStr,CHARACTER_COUNT){
return theStr.substring((theStr.length - CHARACTER_COUNT),theStr.length);
}

function intOnly(i) {
	if(i.value.length>0) {
		i.value = i.value.replace(/[^\d]+/g, '');
	}
if(i.value.length==0) 
	{
	i.value = 0;
	}
}

function checkTradioForm()
{
if(Trim(get('tr_contact').value).length==0){alert("Please supply a contact name");}
else if(Trim(get('tr_email').value).length==0){alert("Please supply an email");}
else if(Trim(get('tr_tel').value).length==0){alert("Please supply a telephone number");}
else if(Trim(get('tr_title').value).length==0){alert("Please supply an item title");}
else 
	{
	get('tradioform').action = "/process/tradio_add.php";
//	get('tradioform').target = "_blank";
	get('tradioform').submit();
//	setMain('tradio_popped');
	alert("PAYPAL POST");
	}
}
