   function FormatNumber(num)
   {
     if(isNaN(num)) { num = "0"; }
     sign = (num == (num = Math.abs(num)));
     num = Math.floor(num*100+0.50000000001);
     cents = num%100;
     num = Math.floor(num/100).toString();
     if(cents<10) { cents = "0" + cents; }
     for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
     {
       num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
     }
     return (((sign)?'':'-') + num + '.' + cents);
   }

  function showPrice(form)
  {  
    var myTotalPrice = 0;
    var showUP = 0;
    var myMathProblem = "";
    myItemPrice = parseFloat(form.nuPrice.value);

    for (var i = 0; i < form.elements.length; i++)
    {
      var e = form.elements[i];
      if ( e.type == 'select-one' )
      {
        showUP = 1;
        Item = e.selectedIndex;
        myPrice = e.options[Item].text;
        myDollarSign = myPrice.indexOf("£",0)
        if ( myDollarSign != "-1" )
        {
          myParSign = myPrice.indexOf(")", myDollarSign);
          myAttributeString = myPrice.substring(myDollarSign+1, myParSign);
          myAttributeString = myAttributeString.replace(/,/,"");
          myAttributePrice = parseFloat(myAttributeString);
          myMathProblem = myPrice.charAt(myDollarSign - 1);
        } 
        else //the code above must be dealing with multiple attributes! on the for statement
        { 
        	myAttributePrice = 0; 
        }
        
		//Would need to Reinsert my math problem IF here if I started using attributes with + and -        	
        myTotalPrice =  myTotalPrice + myAttributePrice;
      }
    }  
    if ( showUP )
    {
		  if (myTotalPrice == 16.63)
		  {
			  document.getElementById("productRRP").innerHTML = "£19.95";
		  }
		  
		  if (myTotalPrice == 44.97)
		  {
			  document.getElementById("productRRP").innerHTML = "£59.85";
		  }

			document.getElementById("productNEWprice").innerHTML = "£" + myTotalPrice;
    }
    else
    {
        document.getElementById("productNEWprice").innerHTML = ' <?php echo $products_price; ?> ';
    }
  }  

	function popupWindow(url) 
	{
	  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
	}
