//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * @package Starweb Webshop System
 * @version See version-file
 * @copyright Copyright (c) 2000 - 2008, Ehandelslogik i Lund AB
 * 
 * @author Ehandelslogik i Lund AB, org.no 556696-9019  (Starweb)
 *  Country: Sweden
 *  Homepage: www.starweb.se
 *  E-mail: support@starweb.se
 * 
 * License:
 * This program is not "free" software and restrictions apply!
 * This file as well as all other files containing the code to our software may ONLY be used and/or redistributed with written permission from us.
 * You'll find information regarding our conditions and pricing on our homepage. Contact us immediately if any of these conditions are not clear.
 */
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * @name Function: Freight- And Payment Type First Selected
 * @access public
 */
function PayAndFreightTypeFirstSel()
{
   // Get: Shipping field list
   var oFldTotalList = document.forms["frmCheckOutStepOne"].elements;
   
   
   if(oFldTotalList)
   {
      // Get: Settings
      var bIsFoundPayType = false, bIsFoundFreightType = false;
      
      
      // Loop: Through ALL fields in form
      for(var iFldNr=0; iFldNr<oFldTotalList.length; iFldNr++)
      {
         // Get: Field name
         var sFldId = oFldTotalList[iFldNr].id;
         
         
         // Check: Find shipping fields of interest
         if(sFldId.indexOf("aCheckOutItem") != -1)
         {
            // Get: Field object
            var oFld = document.getElementById(sFldId);
         
         
            if(oFld)
            {
               if(oFld.getAttribute('type') == 'radio')
               {
                  switch(true)
                  {
                     // SET: Payment type
                     case (sFldId.indexOf("iPayType_Id") != -1):
                        if(bIsFoundPayType == false)
                        {
                           bIsFoundPayType = true;
                           oFld.checked    = true;
                        }
                        break;
                        
                        
                     // SET: Freight type
                     case (sFldId.indexOf("iFreightType_Id") != -1):
                        if(bIsFoundFreightType == false)
                        {
                           bIsFoundFreightType = true;
                           oFld.checked        = true;
                        }
                        break;
                  }
               }
            }
         }
      }
   }
}
