$(function(){
  // Hide all elements (it's possible to create Stars from hidden elements too)
  $(".multiField").children().hide();

  // Cost
  $("#cost").stars({inputType: "select"});

  // Design
  $("#design").stars({inputType: "select"});

  // Reliability
  $("#reliability").stars({inputType: "select"});

  // Material
  $("#material").stars({inputType: "select"});

  // Performance
  $("#performance").stars({inputType: "select"});

  // Ease of Use
  $("#easeofuse").stars({inputType: "select"});

  // Cleaning
  $("#cleaning").stars({inputType: "select"});

  // Transport
  $("#transport").stars({inputType: "select"});

  // Aftersales
  $("#aftersales").stars({inputType: "select"});

  // Maintenance
  $("#maintenance").stars({inputType: "select"});

//  $("#stars-wrapper2").stars({
//     inputType: "select"
//  });
});

// **************************************************************
// Function:    areYouSure()
// Description: confirm user action
// Inputs:      none
// Outputs:     true or false
// **************************************************************
function areYouSure()
{
  return confirm("Are you sure you want to delete this item?")
}

// **************************************************************
// Function:    popupWindow( URL )
// Description: pop up a new browser window
// Inputs:      URL - the page to open in the new window
// Outputs:     none
// **************************************************************
function popupWindow( URL )
{
  day = new Date();
  id = day.getTime();

  eval( "pagemanageimages = window.open( URL, 'manageimages', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=500,left=100,top=100' );" );
}

// **************************************************************
// Function:    ButtonRollOver( styleChange, item )
// Description: form button rollover
// Inputs:      styleChange
//              item
// Outputs:     none
// **************************************************************
function ButtonRollOver( styleChange, item )
{
  item.className = styleChange;
}

// **************************************************************
// Function:    writeCategory( page )
// Description: refresh the current page to show the models of the selected make
// Inputs:      page - the page currently in view
// Outputs:     none
// **************************************************************
function writeCategory( page, productID )
{
  if ( page )
  {
    // get the selected make
    sectionID = document.getElementById( 'sectionid' ).value;

    link = page + ".php?id=" + productID + "&sectionid=" + sectionID;

    window.location = link;
  }
}
