


//toggle the favorite icon, and make an ajax call to update this favorite in the database
function toggleFavorite(listingID,imageObject)
{
	
	//get the image object
	//var rowObject = document.getElementById('tr-listing-' + listingID);
	//alert(imageObject.src);

	//if the object is fav-empty, make it fav, and visa versa
	//alert(imageObject.className);
	if(imageObject.className == 'fav-empty')
	{
		//fav
		imageObject.className = 'fav';	
		
		//mark as a favorite in the DB
		sendAJAXRequest('/xml_gen.php?action=favorite&listing_ID=' + listingID + '&favorited=1');
		
	}
	else
	{
		//invisible
		imageObject.className = 'fav-empty';	//invisible
		
		//unmark as a favorite in the DB
		sendAJAXRequest('/xml_gen.php?action=favorite&listing_ID=' + listingID + '&favorited=0');
		
	}	
}


function sendAJAXRequest(url)
{
	var http_request;
	var url;
	
	
	
	
	if (window.XMLHttpRequest) 
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
	} 
	else if (window.ActiveXObject) 
	{ // IE
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	http_request.onreadystatechange = null;
	http_request.open('GET', url, true);
	http_request.send(null);
}	


function toggleListingDetailRow(listingID,imageObject)
{
	//get the row object
	var rowObject = document.getElementById('tr-listing-' + listingID);
	//alert(imageObject.src);

	//if the object is visible, make it invisible, and visa versa
	if((rowObject.style.display).toLowerCase() == 'none')
	{
		//visible
		rowObject.style.display = '';	//visible
		
		//set the contents of the appropriate td object to be an iframe
		var cellObject = document.getElementById('td-listing-' + listingID);
		
		var frameContents = '<iframe src="/tax_data.php?listing_ID=' + listingID + '" width="100%" height="400" scrolling="NO"></iframe>';
		cellObject.innerHTML = frameContents;
		
		imageObject.src = '/images/contract.gif';	//toggle image
	}
	else
	{
		//invisible
		rowObject.style.display = 'none';	//invisible
		imageObject.src = '/images/expand.gif';	//toggle image
	}

}


/*
//BEGIN Mouse capturing code
//from http://www.codelifter.com/main/javascript/capturemouseposition1.html

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
var mousePositionX = 0;
var mousePositionY = 0;
// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  
  mousePositionX = tempX;
  mousePositionY = tempY;
  //alert(tempX);
  //alert(tempY);
  return true
}

//END Mouse capturing code
*/



//complete the purchase with credits from the users account
function checkout_complete_purchase(total_credit, applied_credit)
{
	if(applied_credit == "")
	{
		applied_credit = 0;
	}
	
	if(total_credit == "")
	{
		total_credit = 0;
	}
	
	var response = confirm('This will complete the transaction. Subtract $' + applied_credit + ' from my account?  ($' + (total_credit - applied_credit) +  '  will remain)' );
	
	if (response == true)
	{
		window.location = './emptycart.php?act=purchasecartcontents&fundingsource=credits'
	}
}

function insta_debit_warn(amt)
{
	if(amt != "")
	{
		var response = confirm('WARNING: Subtract $' + amt + ' from my account?');
		
		if (response == true)
		{
			window.location = './debit.php?act=insta-debit&amt=' + amt;
		}
	}

}
function insta_credit_warn(amt)
{
	if(amt != "")
	{
		var response = confirm('Add $' + amt + ' to my account?');
		
		if (response == true)
		{
			window.location = './credit.php?act=insta-credit&amt=' + amt;
		}
	}

}
function ee_confirm_purchase_debit(amt,cap_id)
{
	var response = confirm('Warning: Debit my account for $' + amt + '?');
	
	if (response == true)
	{
		window.location = './debit.php?act=buy&item=cap&cap_id=' + cap_id;
	}
}

function showdetail(list_id)
{

	//pop up a window showing detail for this particular list_id
	popUp('viewlistingdetail.php?list_id=' + list_id)
	
}



<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=850,height=720,left = 0,top = 0');");
}
// End -->

//insert an item in the specified object, at the specified position
function insertOption(selectObject,optionText,optionValue,position)
{
	//alert('inserting ' + optionText + ' into the list with value ' + optionValue + ' at position ' + position);
	
	if(position < 0)	//dont move off the top of the list!
	{
		return;
	}
	else if(position > selectObject.options.length + 1)
	{
		return;
	}
	
	//save what's currently in the list temporarily
	var list_text = new Array();
	var list_values = new Array();
	var list_selected = new Array();
	
	var list_text2 = new Array();
	var list_values2 = new Array();
	var list_selected2 = new Array();
	
	var x;
	//store whats in the list currently in the arrays
	for(x=0;x < selectObject.options.length;x++)
	{
		list_text[x] = selectObject.options[x].text;
		list_values[x] = selectObject.options[x].value;
		list_selected[x] = selectObject.options[x].selected;
	}
	
	//move everything that is at the target position up by one item, so there is room at 'position'
	for(x=0;x<selectObject.options.length;x++)
	{
		
		if(x < position)
		{
			list_text2[x] = list_text[x];
			list_values2[x] = list_values[x];
			list_selected2[x] = list_selected[x];
		}
		else if(x >= position)
		{
			list_text2[x + 1] = list_text[x];
			list_values2[x + 1] = list_values[x];
			list_selected2[x + 1] = list_selected[x];
		}
	}
	
	
	
	//insert the new value into the list
	list_text2[position] = optionText;
	list_values2[position] = optionValue;
	list_selected2[position] = true;
	
	
	//debug: alert what is in each place in the list_ arrays
	for(x=0;x<list_text2.length;x++)
	{
		//alert(list_text2[x] + ' : ' + list_values2[x] + ' : ' + list_selected2[x]);
	}
	

	
	//clear the list
	while(selectObject.options.length != 0)
	{
		//alert('delteting: ' + selectObject.options[0].text);
		deleteOption(selectObject,0);
	}
	
	//add everything back in from the new list values
	for(x=0;x<list_text2.length;x++)
	{
		//alert('adding:' + list_text2[x]);
		addOption(selectObject,list_text2[x],list_values2[x],list_selected2[x]);
	}
	
	
}


//move an item up in the list
function upitem()
{

	//find which item is selected
	var x;
	for(x=0; x < document.filter.right.options.length; x++)
	{
		if(document.filter.right.options[x].selected == true)
		{
			temptext = document.filter.right.options[x].text
			tempval = document.filter.right.options[x].value
			
			if(x - 1 >= 0)	//dont move off the top of the list!
			{
				deleteitem();
				insertOption(document.filter.right,temptext,tempval,x-1);
			}
			break;
		}
	}
}

//move an item down in the list
function downitem()
{
	//find which item is selected
	var x;
	for(x=0; x < document.filter.right.options.length; x++)
	{
		if(document.filter.right.options[x].selected == true)
		{
			temptext = document.filter.right.options[x].text
			tempval = document.filter.right.options[x].value
			
			if(x + 1 < document.filter.right.options.length)	//dont move off the bottom of the list!
			{
				deleteitem();
				insertOption(document.filter.right,temptext,tempval,x+1);
			}
			break;
		}
	}
}

function additem()
{
	//alert('additem')
	// Pristine: alert('value = ' + document.filter.left.value + ', text = ' + document.filter.left.options[document.filter.left.selectedIndex].text)
	//alert('value = ' + document.filter.left.value + ', text = ' + document.filter.left.options[document.filter.left.selectedIndex].text)
	
	
	//add every selected item
	var temptext = '';
	var tempval = '';
	var x;
	for(x=0; x < document.filter.left.options.length; x++)
	{
		if(document.filter.left.options[x].selected == true)
		{
			temptext = document.filter.left.options[x].text
			tempval = document.filter.left.options[x].value
			addOption(document.filter.right,temptext,tempval,false)
		}
		//document.filter.right.options[x].selected = true
		//allcolstext = allcolstext + ',' + document.filter.right.options[x].value 
	}
	
	/*
	//add only one item at a time
	var val = document.filter.left.value
	var text = document.filter.left.options[document.filter.left.selectedIndex].text
	
	addOption(document.filter.right,text,val,false)
	*/
}

function deleteitem()
{
	//alert('deleteitem')
	if(document.filter.right.selectedIndex != -1)
	{
		//delete all selected values
		//we have to move BACKWARDS through the list to avoid screwing up the listindex properties
		var x;
		for(x = document.filter.right.options.length - 1; x >= 0; x--)
		{
			if (document.filter.right.options[x].selected == true)
			{
				deleteOption(document.filter.right,x)
			}
		}
 		
		/*
		//old, only delete one value
		//deleted the currently selected item
		deleteOption(document.filter.right,document.filter.right.selectedIndex)
		*/
	}
	else
	{
		//nothing in the right hand box was selected!
		//alert('Nothing is selected to be removed in the right hand box!')
	
	}
}

function selectallright()
{
	//alert(document.filter.right.options.length)	
	var allcolstext = ''
	var x=0
	var rightlength = document.filter.right.options.length
	for(x=0; x < rightlength; x++)
	{
		//document.filter.right.options[x].selected = true
		allcolstext = allcolstext + ',' + document.filter.right.options[x].value 
	}
	
	document.filter.allcols.value = allcolstext
	
}


//The following is modified from http://www.experts-exchange.com/Web/Web_Languages/Q_20916437.html:



function addOption(selectObject,optionText,optionValue,optionSelected) {
    var optionObject = new Option(optionText,optionValue)
    var optionRank = selectObject.options.length
    selectObject.options[optionRank]=optionObject
	
	selectObject.options[optionRank].selected = optionSelected;
}

function deleteOption(selectObject,optionRank) {
    if (selectObject.options.length!=0) { selectObject.options[optionRank]=null }
}

function testAdd() {
	var formObject = document.filter
    if (formObject.optionText.value!="" && formObject.optionValue.value!="") {
        addOption(formObject.fruitList,formObject.optionText.value,formObject.optionValue.value,false)
    } else {
        alert("Fill form and click Add")
    }
	
	/*
	var formObject = document.testForm
    if (formObject.optionText.value!="" && formObject.optionValue.value!="") {
        addOption(formObject.fruitList,formObject.optionText.value,formObject.optionValue.value,false)
    } else {
        alert("Fill form and click Add")
    }
	*/
}

function testDelete() {
    var formObject = document.testForm
    if (formObject.fruitList.selectedIndex!=-1) {
        deleteOption(formObject.fruitList,formObject.fruitList.selectedIndex)
    } else {
        alert("Select an option and click Delete")
    }
}

//end modified code from http://www.experts-exchange.com/Web/Web_Languages/Q_20916437.html:



//Javascript CC verification
//The JavaScript Source!! http://javascript.internet.com

function verifyCCFormInfo()
{
	// Begin CC verification
	var Cards = new makeArray(4);
	Cards[0] = new CardType("MasterCard", "51,52,53,54,55", "16");
	var MasterCard = Cards[0];
	Cards[1] = new CardType("VisaCard", "4", "13,16");
	var VisaCard = Cards[1];
	Cards[2] = new CardType("AmExCard", "34,37", "15");
	var AmExCard = Cards[2];
	Cards[3] = new CardType("DiscoverCard", "6011", "16");
	var DiscoverCard = Cards[3];
	
	
	
	//get the expiration month and year from the form.
	var x_exp_date = document.getElementById("x_exp_date").value;
	temp = x_exp_date.split("/");
	var ExpMonth = "" + temp[0] + "";
	var ExpYear = "" + temp[1] + "";
	//alert("ExpMonth is " + ExpMonth + ", ExpYear is " + ExpYear);
	//alert("ExpYear is " + ExpYear);
	
	var CardNumber = document.getElementById("x_card_num").value;
	
	//Make sure that all fields are set.
	if(trim(document.getElementById("x_first_name").value) == "")
	{
		alert("First Name can not be blank");
		document.getElementById("x_first_name").focus();
		return false;
	}
	else if(trim(document.getElementById("x_last_name").value) == "")
	{
		alert("Last Name can not be blank");
		document.getElementById("x_last_name").focus();
		return false;
	}
	else if(trim(document.getElementById("x_card_num").value) == "")
	{
		alert("Card Number can not be blank");
		document.getElementById("x_card_num").focus();
		return false;
	}
	else if(trim(document.getElementById("x_exp_date").value) == "")
	{
		alert("Expiration Date can not be blank");
		document.getElementById("x_exp_date").focus();
		return false;
	}
	else if(trim(document.getElementById("x_state").value) == "")
	{
		alert("State can not be blank");
		document.getElementById("x_state").focus();
		return false;
	}
	else if(trim(document.getElementById("x_zip").value) == "")
	{
		alert("Zip Code can not be blank");
		document.getElementById("x_zip").focus();
		return false;
	}
	//verify zip and cc numbers are numeric
	else if(!isNum(trim(document.getElementById("x_zip").value)))
	{
		alert("Zip Code must be numeric.");
		document.getElementById("x_zip").focus();
		return false;
	}
	//verify that the card number is valid
	else if(!CheckCardNumber(CardNumber,ExpMonth,ExpYear,MasterCard,VisaCard,AmExCard,DiscoverCard,Cards))
	{
		//alert("The card no was not valid.");
		document.getElementById("x_card_num").focus();
		return false;
	}
	return true;
}
/*
Cards[3] = new CardType("DinersClubCard", "30,36,38", "14");
var DinersClubCard = Cards[3];
Cards[4] = new CardType("DiscoverCard", "6011", "16");
var DiscoverCard = Cards[4];
Cards[5] = new CardType("enRouteCard", "2014,2149", "15");
var enRouteCard = Cards[5];
Cards[6] = new CardType("JCBCard", "3088,3096,3112,3158,3337,3528", "16");
var JCBCard = Cards[6];
var LuhnCheckSum = Cards[7] = new CardType();
*/

/*************************************************************************\
CheckCardNumber(form)
function called when users click the "check" button.
\*************************************************************************/
function CheckCardNumber(CardNumber,ExpMon,ExpYear,MasterCard,VisaCard,AmExCard,DiscoverCard,Cards) {
	
	var tmpyear;
	if (CardNumber.length == 0) {
		alert("Please enter a Card Number.");
		document.getElementById("x_card_num").focus();
		return false;
	}
	if (ExpYear.length == 0) {
		alert("Please enter the Expiration Year.");
		document.getElementById("x_exp_date").focus();
		return false;
	}
	if (ExpYear > 96)
		tmpyear = "19" + ExpYear;
	else if (ExpYear < 21)
		tmpyear = "20" + ExpYear;
	else {
		alert("The Expiration Year is not valid.");
		return false;
	}
	tmpmonth = ExpMon;
	// The following line doesn't work in IE3, you need to change it
	// to something like "(new CardType())...".
	// if (!CardType().isExpiryDate(tmpyear, tmpmonth)) {
	if (!(new CardType()).isExpiryDate(tmpyear, tmpmonth)) {
		alert("This card has already expired.");
		return false;
	}
	card = document.getElementById("CardType").value;
	var retval = eval(card + ".checkCardNumber(\"" + CardNumber +	"\", " + tmpyear + ", " + tmpmonth + ");");
	cardname = "";
	
	
	if (retval)
	{	
		// comment this out if used on an order form
		//alert("This card number appears to be valid.");
		return true;
	}	
	else {
		// The cardnumber has the valid luhn checksum, but we want to know which
		// cardtype it belongs to.
		for (var n = 0; n < Cards.size; n++) {
			if (Cards[n].checkCardNumber(CardNumber, tmpyear, tmpmonth)) {
				cardname = Cards[n].getCardType();
				break;
			}
		}
		if (cardname.length > 0) {
			alert("This looks like a " + cardname + " number, not a " + card + " number.");
			return false;
		}
		else {
			alert("This card number is not valid.");
			return false;
		}
	}
	
}
/*************************************************************************\
Object CardType([String cardtype, String rules, String len, int year, 
                                        int month])
cardtype    : type of card, eg: MasterCard, Visa, etc.
rules       : rules of the cardnumber, eg: "4", "6011", "34,37".
len         : valid length of cardnumber, eg: "16,19", "13,16".
year        : year of expiry date.
month       : month of expiry date.
eg:
var VisaCard = new CardType("Visa", "4", "16");
var AmExCard = new CardType("AmEx", "34,37", "15");
\*************************************************************************/
function CardType() {
	var n;
	var argv = CardType.arguments;
	var argc = CardType.arguments.length;
	
	this.objname = "object CardType";
	
	var tmpcardtype = (argc > 0) ? argv[0] : "CardObject";
	var tmprules = (argc > 1) ? argv[1] : "0,1,2,3,4,5,6,7,8,9";
	var tmplen = (argc > 2) ? argv[2] : "13,14,15,16,19";
	
	this.setCardNumber = setCardNumber;  // set CardNumber method.
	this.setCardType = setCardType;  // setCardType method.
	this.setLen = setLen;  // setLen method.
	this.setRules = setRules;  // setRules method.
	this.setExpiryDate = setExpiryDate;  // setExpiryDate method.
	
	this.setCardType(tmpcardtype);
	this.setLen(tmplen);
	this.setRules(tmprules);
	if (argc > 4)
		this.setExpiryDate(argv[3], argv[4]);
	
	this.checkCardNumber = checkCardNumber;  // checkCardNumber method.
	this.getExpiryDate = getExpiryDate;  // getExpiryDate method.
	this.getCardType = getCardType;  // getCardType method.
	this.isCardNumber = isCardNumber;  // isCardNumber method.
	this.isExpiryDate = isExpiryDate;  // isExpiryDate method.
	this.luhnCheck = luhnCheck;// luhnCheck method.
	return this;
}

/*************************************************************************\
boolean checkCardNumber([String cardnumber, int year, int month])
return true if cardnumber pass the luhncheck and the expiry date is
valid, else return false.
\*************************************************************************/
function checkCardNumber() {
	var argv = checkCardNumber.arguments;
	var argc = checkCardNumber.arguments.length;
	var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
	var year = (argc > 1) ? argv[1] : this.year;
	var month = (argc > 2) ? argv[2] : this.month;
	
	this.setCardNumber(cardnumber);
	this.setExpiryDate(year, month);
	
	if (!this.isCardNumber())
	return false;
	if (!this.isExpiryDate())
	return false;
	
	return true;
}
/*************************************************************************\
String getCardType()
return the cardtype.
\*************************************************************************/
function getCardType() {
	return this.cardtype;
}
/*************************************************************************\
String getExpiryDate()
return the expiry date.
\*************************************************************************/
function getExpiryDate() {
	return this.month + "/" + this.year;
}
/*************************************************************************\
boolean isCardNumber([String cardnumber])
return true if cardnumber pass the luhncheck and the rules, else return
false.
\*************************************************************************/
function isCardNumber() {
	var argv = isCardNumber.arguments;
	var argc = isCardNumber.arguments.length;
	var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
	if (!this.luhnCheck())
	return false;
	
	for (var n = 0; n < this.len.size; n++)
	if (cardnumber.toString().length == this.len[n]) {
		for (var m = 0; m < this.rules.size; m++) {
			var headdigit = cardnumber.substring(0, this.rules[m].toString().length);
			if (headdigit == this.rules[m])
				return true;
		}
		return false;
	}
	return false;
}

/*************************************************************************\
boolean isExpiryDate([int year, int month])
return true if the date is a valid expiry date,
else return false.
\*************************************************************************/
function isExpiryDate() {
var argv = isExpiryDate.arguments;
var argc = isExpiryDate.arguments.length;

year = argc > 0 ? argv[0] : this.year;
month = argc > 1 ? argv[1] : this.month;

if (!isNum(year+""))
	return false;
if (!isNum(month+""))
	return false;
today = new Date();
expiry = new Date(year, month);
if (today.getTime() > expiry.getTime())
	return false;
else
	return true;
}

/*************************************************************************\
boolean isNum(String argvalue)
return true if argvalue contains only numeric characters,
else return false.
\*************************************************************************/
function isNum(argvalue) {
	argvalue = argvalue.toString();
	
	if (argvalue.length == 0)
		return false;
	
	for (var n = 0; n < argvalue.length; n++)
		if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
			return false;

	return true;
}

/*************************************************************************\
boolean luhnCheck([String CardNumber])
return true if CardNumber pass the luhn check else return false.
Reference: http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl
\*************************************************************************/
function luhnCheck() {
	var argv = luhnCheck.arguments;
	var argc = luhnCheck.arguments.length;
	
	var CardNumber = argc > 0 ? argv[0] : this.cardnumber;
	
	if (! isNum(CardNumber)) {
		return false;
	}
	
	var no_digit = CardNumber.length;
	var oddoeven = no_digit & 1;
	var sum = 0;
	
	for (var count = 0; count < no_digit; count++) {
		var digit = parseInt(CardNumber.charAt(count));
		if (!((count & 1) ^ oddoeven)) {
			digit *= 2;
			if (digit > 9)
				digit -= 9;
		}
		sum += digit;
	}
	if (sum % 10 == 0)
		return true;
	else
		return false;
}

/*************************************************************************\
ArrayObject makeArray(int size)
return the array object in the size specified.
\*************************************************************************/
function makeArray(size) {
	this.size = size;
	return this;
}

/*************************************************************************\
CardType setCardNumber(cardnumber)
return the CardType object.
\*************************************************************************/
function setCardNumber(cardnumber) {
	this.cardnumber = cardnumber;
	return this;
}

/*************************************************************************\
CardType setCardType(cardtype)
return the CardType object.
\*************************************************************************/
function setCardType(cardtype) {
	this.cardtype = cardtype;
	return this;
}

/*************************************************************************\
CardType setExpiryDate(year, month)
return the CardType object.
\*************************************************************************/
function setExpiryDate(year, month) {
	this.year = year;
	this.month = month;
	return this;
}

/*************************************************************************\
CardType setLen(len)
return the CardType object.
\*************************************************************************/
function setLen(len) {
	// Create the len array.
	if (len.length == 0 || len == null)
		len = "13,14,15,16,19";
	
	var tmplen = len;
	n = 1;
	while (tmplen.indexOf(",") != -1) {
		tmplen = tmplen.substring(tmplen.indexOf(",") + 1, tmplen.length);
		n++;
	}
	this.len = new makeArray(n);
	n = 0;
	while (len.indexOf(",") != -1) {
		var tmpstr = len.substring(0, len.indexOf(","));
		this.len[n] = tmpstr;
		len = len.substring(len.indexOf(",") + 1, len.length);
		n++;
	}
	this.len[n] = len;
	return this;
}

/*************************************************************************\
CardType setRules()
return the CardType object.
\*************************************************************************/
function setRules(rules) {
	// Create the rules array.
	if (rules.length == 0 || rules == null)
		rules = "0,1,2,3,4,5,6,7,8,9";
	  
	var tmprules = rules;
	n = 1;
	while (tmprules.indexOf(",") != -1) {
		tmprules = tmprules.substring(tmprules.indexOf(",") + 1, tmprules.length);
		n++;
	}
	this.rules = new makeArray(n);
	n = 0;
	while (rules.indexOf(",") != -1) {
		var tmpstr = rules.substring(0, rules.indexOf(","));
		this.rules[n] = tmpstr;
		rules = rules.substring(rules.indexOf(",") + 1, rules.length);
		n++;
	}
	this.rules[n] = rules;
	return this;
}
//  End -->

function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}