<!--

	var pric=3.75;

	var Subtotal1=0;

	var Subtotal2=0;

	

	var totalChar = 0;

//*************************************************

//Connect to SCart for secure payment

//*************************************************

function makeQS()

{

	getMyPrices(0);

	

	var wholeQS="http://www.cartserver.com/sc/cart.cgi?gobackto=http://www.butterflyalphabet.com&";

	var ctr=1;

	

	if (Subtotal1 == 0 && Subtotal2 == 0) 

	{

		alert("You haven't added anything to your cart.")

		return false;

	}

	else

	{

		for (x=0;x<40;x=x+4)

		{

			Namelgth = countChar(document.form1.elements[x].value);

			if (Namelgth)

			{

				wholeQS += makeItemQS(ctr,"NAME : "+document.form1.elements[x].value, DollarsAndCents(Namelgth*pric), 1,Namelgth*0.01);

			ctr++;

  			}

		}		

	}

    window.location = wholeQS;

	return true;

}



//*************************************************

//Build query string for SCart

//*************************************************

function makeItemQS(name, desc, uprice, qty, weight)

{

	desc = escape(desc);

	var myQS = "item" + name + "=b-5006^"+name+"^" + desc + "^" + uprice+ "^" + qty + "^" + "^" + "^" + "^" + weight+"&";

return myQS; 

}



function getMyPrices(id)

{

	

     //i = 0;

	//for (i=0; i<4; i=i+4) 

	//{

		nameLength = countChar(document.form1.elements[id].value);

		document.form1.elements[id+2].value = nameLength;	

		document.form1.elements[id+3].value = "$" + DollarsAndCents(nameLength*pric);

		totalChar = totalChar + nameLength;	

	//}	

	

	totalChar = 0;				

	for (i=2; i < 40; i = i + 4)

	{

		//totalChar = totalChar + 1;

		totalChar = totalChar + eval(document.form1.elements[i].value);

		//alert(totalChar)

	}

	

	document.form1.elements[40].value = totalChar;

	document.form1.elements[41].value = "$" + DollarsAndCents(totalChar*pric);

	Subtotal1 = totalChar;



/*

	

	//if (nameLength) {

		document.form1.elements[id+2].value = nameLength;	

		document.form1.elements[id+3].value = "$" + DollarsAndCents(nameLength*pric);

		totalChar = totalChar + nameLength;

		document.form1.elements[40].value = totalChar;

		document.form1.elements[41].value = "$" + DollarsAndCents(totalChar*pric);

		//alert(totalChar)

	//}

			//Subtotal1=Subtotal1+Namelgth;

			*/

}



function getPrices()

{



	Subtotal1=0;

	for (x=0;x<20;x=x+4)

	{

	

		Namelgth = countChar(document.form1.elements[x].value);

		if (Namelgth)

		{

  			document.form1.elements[x+2].value = Namelgth;

			document.form1.elements[x+3].value = DollarsAndCents(Namelgth*pric);

			Subtotal1=Subtotal1+Namelgth;

  		}

		else 

		{ 

    			document.form1.elements[x+2].value = 0;

			document.form1.elements[x+3].value = DollarsAndCents(0.00);

  		}

	}

	document.form1.elements[20].value = Subtotal1;

	document.form1.elements[21].value = DollarsAndCents(Subtotal1*pric);

	};

	

function DollarsAndCents(ttl)

{  

  ttl = "" + ((Math.round(ttl * 100)) / 100);

  var dec1 = ttl.substring(ttl.length-3, ttl.length-2);

  var dec2 = ttl.substring(ttl.length-2, ttl.length-1);

  if (dec1 != '.') 

  { 

    if (dec2 == '.') ttl += "0";

    else ttl += ".00";

  }

  return ttl;

};



function clearMyName(id)

{

   document.form1.elements[id].value = "";

   getMyPrices(id);

//   alert("TEST");

}



function clr(idx)

{

	document.form1.elements[idx*4].value = "";

	getPrices();

};



function countChar(tempstr)

{

	var count =0;

 	for(i=0; i< tempstr.length; i++)

	{

		var tempc = tempstr.charAt(i);

		if (((tempc >='a') && (tempc <='z')) || ((tempc >='A') && (tempc <='Z')) || (tempc >='0' && tempc <= '9') || tempc == '*' || tempc == '#' || tempc == '%' || tempc == '$' || tempc == '~' || tempc == '!')

			count++;

	}

	return count;

};



function NoEdit(box)

{

  alert("You can't edit this field.");

  box.blur();

  return true;

}







//-->



