//change image on click
function display(index)
{
   // alert("display");
    //alert("index"+index);
     var image_id =arrCmp[index][2]+'_image';
    /*document.images[index].src=pic;*/
    document.getElementById(image_id).src=arrCmp[index][3];
    width='100px';
    document.getElementById(image_id).style.width=width;

}

// Calculate the total for items in the form which are selected.
function calculateTotal(index,margin) {

//alert("calculateTotal");
//alert("index"+index);
      //new total
      var calculatedtotal=0;
      //price selected
      var price = arrCmp[index][0];

           // get previous price in category
      var prevselectbutt = previouslySelectedRadioButton_array[arrCmp[index][2]];

      // Subtract the previously selected radio button value from the total.
      calculatedtotal = eval(currenttotal - prevselectbutt);


      // Save the current radio selection value.
      prevselectbutt = arrCmp[index][0];
      previouslySelectedRadioButton_array[arrCmp[index][2]] = prevselectbutt;

      // Add the current radio button selection value to the total.

      var new_total = eval(calculatedtotal) + eval(arrCmp[index][0]);

      //new_total = formatCurrency(new_total);


        currenttotal = new_total;
     


      document.getElementById('calculatedTotal').innerHTML = "&pound;"+new_total.toFixed(2);

    // Return total value.
    //return(formatCurrency(calculatedTotal.value));
   // return(formatCurrency(calculatedtotal));

}

//update the spec on the right hand-side
function update_spec(index,type)
{
   // var arrCmp = new Array()
//arrCmp[0] = new Array("d_81473","586012","0.00","I do not need an operating system pre-installed (without OS)","586012");
    var name = arrCmp[index][1];
    var category = arrCmp[index][2];
    var category_name = type+'_type';

    document.getElementById(type).innerHTML = name;
    //document.getElementById(category_name).innerHTML = category;
    //document.getElementById(category_name).setAttribute("class", "spec_category_title");

}
