// JavaScript Document
function ispricesizechecked()
{
	var rg = document.getElementsByName("rg1");
	if (rg.length <= 0 )
	{
		return true;
	}
	for (var i = 0; i < rg.length; i++)
	{
		if (rg[i].checked == true)
			{return true;}
	}
	alert('Please select a length/size - price combination');
	return false;
}

function ispricesizecheckedsel()
{
	var rg = document.getElementsByName("rg1")[0];
	if (rg.options.length <= 0 )
	{
		return true;
	}
	for (var i = 1; i < rg.options.length; i++)
	{
		if (rg.options[i].selected == true)
			{return true;}
	}
	alert('Please select a size');
	return false;
}
function myput(elem)
{
var size_price =  elem.parentNode.parentNode.getElementsByTagName("input")[1].value;
x = size_price.split("_");
document.product_form.myLength.value = x[0];
document.product_form.myPrice.value = x[1];
//dollarVal = format_number(txt,2);
document.product_form.upgradePrice.value= "$" + formatAsMoney(x[1]);
//alert(formatAsMoney(txt))
document.product_form.UnitPrice.value=parseFloat(x[1])
//alert(parseFloat(txt))
document.product_form.flag.value='true'
}
function put()
{

txt=document.product_form.Lengths.options[document.product_form.Lengths.selectedIndex].value
//alert(txt);
// Split the length and price up
var xSub1 = txt.split("07' Length")
//alert(xSub1);
var x = txt.split("_");
//alert(x);
//split length / size
//alert(x[0]);
document.product_form.myLength.value = x[0];
//split price
//alert(x[1]);
document.product_form.myPrice.value = x[1];
//dollarVal = format_number(txt,2);
document.product_form.upgradePrice.value= "$" + formatAsMoney(x[1]);
//alert(formatAsMoney(txt))
document.product_form.UnitPrice.value=parseFloat(x[1])
//alert(parseFloat(txt))
document.product_form.flag.value='true'
}

function formatAsMoney(mnt) {
    mnt -= 0;
    mnt = (Math.round(mnt*100))/100;
    return (mnt == Math.floor(mnt)) ? mnt + '.00' 
              : ( (mnt*10 == Math.floor(mnt*10)) ? 
                       mnt + '0' : mnt);
}

function popUp(URL,w,h) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + w + ',height=' + h + 'left = 150,top = 25');");
}
function addbookmark(bookmarkurl, bookmarktitle )
{
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}
