function send_to_friend(product_id){
	var ds = document.getElementById('div_send_to_friend');
	ds.style.left = 0;
	ds.style.top = 0;
	ds.style.display = 'block';
	document.getElementById('send_to_friend_product_id').value = product_id;
}

function filter_numeric(textbox, val){
	val = val.replace(/[^0-9.]/g, ''); // strip non-digit chars
	val = stripDuplicateChars(val, '.', 1, 0); // strip excess decimals
	val = stripDuplicateChars(val, '-', 0, 1); // strip excess minus signs
	textbox.value = val; // replace textbox value
}

function isFloatingPointNumber(val){
	var fpnum = /^-{0,1}\d*\.{0,1}\d*$/g;
	if (fpnum.test(val)){return true;} else {return false;}
}

function stripDuplicateChars(str, strip, n, s){
	var count=0; var stripped=str.substring(0, s); var chr;
	for (var i=s; i<str.length; i++){ chr = str.substring(i, i+1);
	if (chr == strip){ count++; if (count<n+1){ stripped = stripped + chr;}}
	else {stripped = stripped + chr;}} return stripped;
}
