function updateFormsAction(formName, basicPath){
  //alert(basicPath);
  /*
  result = basicPath+"/"+document.getElementById('id_select_chosenBrand').value+
                     "/"+document.getElementById('id_select_chosenModel').value+
                     "/"+document.getElementById('id_select_chosenColor').value+
                     "/"+document.getElementById('id_select_chosenMaterial').value;
  return(result); 
  */
  
  var extraText = ""; 
  
  if(document.getElementById('id_select_chosenBrand').value > -1){
    var sel = document.getElementById("id_select_chosenBrand");
    var pos = sel.selectedIndex;
    extraText = sel.options[pos].text;
  }

  if(document.getElementById('id_select_chosenModel').value > -1){
    var sel = document.getElementById("id_select_chosenModel");
    var pos = sel.selectedIndex;
    if(extraText == ""){
      extraText = sel.options[pos].text;
    }
    else{
      extraText = extraText+"_"+sel.options[pos].text;
    }
  }

  if(document.getElementById('id_select_chosenColor').value > -1){
    var sel = document.getElementById("id_select_chosenColor");
    var pos = sel.selectedIndex;
    if(extraText == ""){
      extraText = sel.options[pos].text;
    }
    else{
      extraText = extraText+"_"+sel.options[pos].text;
    }
  }
  
  if(document.getElementById('id_select_chosenMaterial').value > -1){
    var sel = document.getElementById("id_select_chosenMaterial");
    var pos = sel.selectedIndex;
    if(extraText == ""){
      extraText = sel.options[pos].text;
    }
    else{
      extraText = extraText+"_"+sel.options[pos].text;
    }
  }  

  if(extraText == ""){
    extraText = "0";
  }

//  var extraText = brandText+"_"+modelText+"_"+colorText;

  extraText = extraText.replace(/[\/\s\&.]/g, "_");
  extraText = extraText.replace(/undefined/g, "");
  extraText = extraText.replace(/___/g, "_");
  extraText = extraText.replace(/__/g, "_");

  result = basicPath+"/"+extraText+"/"+document.getElementById('id_select_chosenBrand').value+
                     "/"+document.getElementById('id_select_chosenModel').value+
                     "/"+document.getElementById('id_select_chosenColor').value+
                     "/"+document.getElementById('id_select_chosenMaterial').value;
  return(result);   
}

function is_checkBox_set(id){
  var res = 0;
  if(document.getElementById(id).checked){
    res = 1;
  }

  return(res);
}


function updateShoppingStatusBanner(nr){
  var id = "id_shoppingStatusStep"+nr;
  for(var i=1; i<nr; i++) {
    var passed_id = "id_shoppingStatusStep"+i;
    document.getElementById(passed_id).className = "passed";
  }
  document.getElementById(id).className = "active";
}

function checkUseShipTo(){
  document.getElementById('id_use_ship_to').checked = "checked";
}


function updateATag(id, PRODUCTNAME_TO_URL, productId, variantId, colorId, Language){
  document.getElementById(id).href= "javascript: void window.open('/"+Language+"/viewProductsDetails/"+PRODUCTNAME_TO_URL+"/"+productId+"/"+variantId+"/"+colorId+"/1', 'popup_viewProductsDetails', 'width=600, height=900, top=0, left=0, location=no, scrollbars=no, resizable=no')";
}

function updateMenuLeftCart(product_sum, shipping_amount, total_amount, currency){
  var prodSum = parseInt(product_sum);
  var totSum = parseInt(total_amount);
  
  if(prodSum > 0 && totSum > 0){  
    document.getElementById("td_productTotal_currency").innerHTML = currency;
    document.getElementById("td_shippingTotal_currency").innerHTML = currency;
    document.getElementById("td_allTotal_currency").innerHTML = currency;
    document.getElementById("td_productTotal_amount").innerHTML = product_sum;
    document.getElementById("td_shippingTotal_amount").innerHTML = shipping_amount;
    document.getElementById("td_allTotal_amount").innerHTML = total_amount;
  }
}

function updateTopMenuStatus(index, count){

  if(index == -1){
    //Reset (left)top menu
    for(var i=0; i<count; i++) {
      document.getElementById("index_topMenu_active_"+i).className = "FormHidden";
      document.getElementById("index_topMenu_"+i).className = "FormShow";
    }
  }
  else{
    // Updates top menu (left side)
  
    var activeItem = "index_topMenu_active_"+index;
    document.getElementById(activeItem).className = "FormShow";
    for(var i=0; i<count; i++) {
      if(index != i){
      document.getElementById("index_topMenu_active_"+i).className = "FormHidden";
      }
      if(index != i){
        document.getElementById("index_topMenu_"+i).className = "FormShow";
      }
      else{
        document.getElementById("index_topMenu_"+i).className = "FormHidden";
      }
    }
  }
 
}


function updateTopMenu_RIGHT_Status(index, count){

  if(index == -1){
    //Reset (right)top menu
    for(var i=1; i<=count; i++) {
      document.getElementById("index_topMenu_right_active_"+i).className = "FormHidden";
      document.getElementById("index_topMenu_right_"+i).className = "FormShow";
    } 
  }  
  else{
    // Updates top menu (right side)
    
    var activeItem = "index_topMenu_right_active_"+index;
    //alert(activeItem);
    document.getElementById(activeItem).className = "FormShow";
    for(var i=1; i<=count; i++) {
      if(index != i){
        document.getElementById("index_topMenu_right_active_"+i).className = "FormHidden";
      }
      if(index != i){
        document.getElementById("index_topMenu_right_"+i).className = "FormShow";
      }
      else{
        document.getElementById("index_topMenu_right_"+i).className = "FormHidden";
      }
    }
  }
  
}




function isStrLengthOK(str, str_length){
	if(str.length > str_length){
		res = false;
	}
	else{
		res = true;
    }
    return(res);
}


function updateShipToNames(ID_to_show){

  // First hidde all
  document.getElementById('tr_shipTo_company_1').className = "FormHidden";
  document.getElementById('tr_shipTo_company_2').className = "FormHidden";
  document.getElementById('tr_shipTo_private_1').className = "FormHidden";
  document.getElementById('tr_shipTo_private_2').className = "FormHidden";
  // Reset all fields
  document.getElementById('id_ship_to_name').value = "";
  document.getElementById('id_ship_to_contact').value = "";
  document.getElementById('id_ship_to_firstname').value = "";
  document.getElementById('id_ship_to_lastname').value = "";
    
  var fullID_1 = ID_to_show + '_1';
  var fullID_2 = ID_to_show + '_2';
  document.getElementById(fullID_1).className = "FormShow";
  document.getElementById(fullID_2).className = "FormShow";
  
   

}

function updateChosenRadio(){
  var chosenRadio = document.getElementById('id_radio_ship_to_company').checked;
//  alert(chosenRadio);
  if(chosenRadio){
    // Company chosen
    document.getElementById('id_chosen_radio').value = "company";
  }
  else{
    // Private chosen
    document.getElementById('id_chosen_radio').value = "private";
  }
}
