// Initialisierung benoetigter Variablen
var flock = new Array();
var product = new Array();
var specialflock = new Array();
var sizes = new Array();
var availdates = new Array();
var extracode = new Array();
var amounts = new Array();

function check12length(formname, id, alerttext, alerttext2)
{
    var maxlength = 13;
    var objForm = document[formname];

    var length = objForm[id+'_nr12'].value.length;
    var flockVal = objForm[id+'_nr12'].value;

    var flockTmp=flockVal.split("");
    var flockNew = '';
    var characterSet = '';

    // Zeichen nicht zulassen .. es sind noch keine eingetragen
    for (i=0; i<length;i++ ) {
        reg_ex=/^[-a-zA-Z. ]+$/;
        // keine Sonderzeichen, daher Zeichen aufnehmen.. mittlerweile mit Umlaute
        if(reg_ex.test(flockTmp[i]) || flockTmp[i] == 'ß' || flockTmp[i] == 'ä' || flockTmp[i] == 'ö' || flockTmp[i] == 'ü'  || flockTmp[i] == 'Ä' || flockTmp[i] == 'Ö' || flockTmp[i] == 'Ü') {
            flockNew = flockNew + flockTmp[i];
            characterSet = 'done';
        } else if (characterSet != 'done') {
            alert(alerttext2);
        }
        characterSet = '';
    }
    // nur Großbuchstaben
    objForm[id+'_nr12'].value = flockNew.toUpperCase();

    // Zeichen-Länge abfragen
    if (length > maxlength) {
        alert(alerttext);
        objForm[id+'_nr12'].value = objForm[id+'_nr12'].value.substring(0, maxlength);
    }

    //Formatierung
    if (objForm[id+'_nr12'].value == label12) {
        objForm[id+'_nr12'].style.color = '#CC0033';
    } else {
        objForm[id+'_nr12'].style.color = '#000000';
    }
}


function check12Val(formname, id, alerttext)
{
  var maxlength = 13;
  var objForm = document[formname];

  var length = objForm[id+'_nr12'].value.length;
  var flockVal = objForm[id+'_nr12'].value;

  alert (flockVal);

  if (length > maxlength) {
    alert(alerttext);
    objForm[id+'_nr12'].value.length = maxlength;
  }
}



/* check_for_zoom
# Checks wether we view the magnifier or not
#
# required params:
# * img (string)
*/
function check_for_zoom(img)
{
  if (zooms[img]) {
  	document.getElementById('zoom_image').style.visibility = 'visible';
    zoom = zooms[img];
  } else {
		document.getElementById('zoom_image').style.visibility = 'hidden';
    zoom = 'null';
  }
}


/* check_for_zoom
# Checks wether we view the magnifier or not
#
# required params:
# * img (string)
*/
function check_for_zoom(img)
{
  if (zooms[img]) {
  	document.getElementById('zoom_image').style.visibility = 'visible';
    zoom = zooms[img];
  } else {
		document.getElementById('zoom_image').style.visibility = 'hidden';
    zoom = 'null';
  }
}

/* openZoom
# open the popup including the zoom version of the current article image
*/
function openZoom(pid, action, lang)
{
    var zoom_win = window.open('/zoom.php?pid=' + pid + '&lang=' + lang + '&action=' + action, 'zoomwin','width=680,height=600,top=250,left=250');
    zoom_win.focus();
}
/* get_price_string
# Transforms the given integer into a user readable output string
#
# required params:
# * cent (int)
*/




function get_price_string(cent)
{
  var price = '000' + String(cent);
  var cent = price.substring(price.length-2, price.length);
  var euro = price.substring(0, price.length-2);
  euro = euro.replace(/^0*/, '');
  if (euro == '') {
      euro = '0';
  }

  var new_price = euro+','+cent+' &euro;';

  if (price == 0)
    new_price = '0,00 &euro;';

  return new_price;
}

/* set_allover_summary
# Calculates the summary including all dependencies
#
# required params:
# * formname (string)
*/
function set_allover_summary(formname)
{
  summaryProducts = get_allover_summary_products(formname);

  // Add the delivery costs
  if (document[formname]['delivery_price'].value) {
    // update the deliverytype-selection based on the full price. If the price
    // changes above 100 EUR the prices of delivery change.
    if (document.deliveryPreview.buildTypeSelection) {
      document.deliveryPreview.buildTypeSelection(document[formname]['delivery_country'].value);
    }

    summaryShipping = summaryProducts + Number(document[formname]['delivery_price'].value);
  }

  if (document.getElementById('allover_summary'+(formname=='notepadform'?'_notepad':''))) {
    document.getElementById('allover_summary'+(formname=='notepadform'?'_notepad':'')).innerHTML = get_price_string(summaryShipping);
  }

  if (set_rebate_notice) {
    set_rebate_notice(formname, summaryProducts);
  }
}

// Get the price of all pruducts.
function get_allover_summary_products (formname)
{
  var id = 1;
  var summary = 0;

  while (document.getElementById('a'+id+'_summary'+(formname=='notepadform'?'_notepad':''))) {
    summary+= Number(document[formname]['a'+id+'_hidden_summary'].value);
    id++;
  }

  return summary;
}

function set_rebate_notice(formname, priceProducts) {
  var id = 1;
  var threshold    = 0;
  var rebate_limit = 10000;
  var difference   = 0;
  var total        = 0;
  var price_input  = null;

  if (document[formname]['delivery_country'].value == 'DE'
    && document[formname]['delivery_type'].value == 'n'
  ) {
    freeDeliveryPossible = true;

  } else {
    freeDeliveryPossible = false;
  }

  if ((priceProducts > threshold) && (priceProducts < rebate_limit)) {
    difference = rebate_limit - priceProducts;

    $('.entry.notice').each(function () {
      $('.rebate_notice b', this).html(get_price_string(difference));
      $('.rebate_notice_nodelivery b', this).html(get_price_string(difference));
      $('.rebate_notice', this).toggle(freeDeliveryPossible);
      $('.rebate_notice_nodelivery', this).toggle(!freeDeliveryPossible);

      $(this).css('display', 'inline');
    });

  } else {
    // don't show the green info string.
    $('.entry.notice').each(function () {
      $(this).css('display', 'none');
    });
  }
}



/* set_price
# Calculates the price for the current product including all dependencies
#
# required params:
# * formname (string)
# * id (int)
*/
function set_price(formname,id)
{
  var objForm = document[formname];
  var from = '';
  if (objForm[id+'_variant'])
  {
    var material = objForm[id+'_material'].value;
    var selected_variant = objForm[id+'_variant'][objForm[id+'_variant'].selectedIndex].value;
    // neutral prices get a prefix.
    if (selected_variant.indexOf('-') != -1) {
        if (language == 'de') {
            from = 'ab ';

        } else {
            from = '<span style="font-size: 14px;">from </span>';
        }
        selected_variant = selected_variant.split('-')[0];
    }

    // Grundpreis
    var price = product[material][selected_variant]['price'];
    if (objForm[id+'_logo'] && objForm[id+'_logo'].checked)
    {
      price = price + Number(objForm[id+'_logo_price'].value);
    }

    if (objForm[id+'_flock'] && objForm[id+'_flock'][objForm[id+'_flock'].selectedIndex].value != 0)
    {
      var flock_material = product[material][selected_variant]['flock'];

      for (value in flock[flock_material])
      {
        if (value == 'price')
        {
          price = price + flockprice[flock_material][objForm[id+'_flock'][objForm[id+'_flock'].selectedIndex].value];
          break;
        }
      }
    }
    if (typeof(availdates[material]) != 'undefined' && typeof(availdates[material][selected_variant]) != 'undefined') {
      $('#' + id + '_availability'+(formname=='notepadform'?'_notepad':'')).html(availdates[material][selected_variant]);
    }
    if (typeof(extracode[material]) != 'undefined' && typeof(extracode[material][selected_variant]) != 'undefined') {
      eval(extracode[material][selected_variant]);
    }

    document.getElementById(id+'_price'+(formname=='notepadform'?'_notepad':'')).innerHTML = from + get_price_string(price);
  } else {
    var price = objForm[id+'_price_raw'].value;
  }
  set_summary(formname,id,price,from);
}

/* set_summary
# Write the summary string depending on the amount into the page
#
# required params:
# * formname (string)
# * id (int)
# * price (int)
*/
function set_summary(formname,id,price,prefix)
{
  var summary = document[formname][id+'_amount'].value * price;
  if (!prefix) {
      prefix = '';
  }

  if (document.getElementById(id+'_summary'+(formname=='notepadform'?'_notepad':''))) {
    document.getElementById(id+'_summary'+(formname=='notepadform'?'_notepad':'')).innerHTML = get_price_string(summary);
    // funktioniert nicht !
    if (document[formname][id+'_hidden_summary']) {
      document[formname][id+'_hidden_summary'].value = summary;
    }
  } else {
    document.getElementById(id+'_price'+(formname=='notepadform'?'_notepad':'')).innerHTML = prefix + get_price_string(summary);
  }
}

/* set_flocks
# Creates the available printing options
#
# required params:
# * formname (string)
# * noflocktext (string)
# * id (int)
# * highlight (int)
*/
function set_flocks(formname,noflocktext,id,highlight)
{
  var selectIndex = 0;
  var objForm = document[formname];

  if (objForm[id+'_flock'])
  {
    var selected_flock = objForm[id+'_flock'][objForm[id+'_flock'].selectedIndex].text;
    var selected_variant = objForm[id+'_variant'][objForm[id+'_variant'].selectedIndex].value;
    if (selected_variant.indexOf('-') != -1) {
        selected_variant = selected_variant.split('-')[0];
    }
    var material = objForm[id+'_material'].value;
    var flock_material = product[material][selected_variant]['flock'];
    
    //Wenn kein Flock gewaehlt, nehmen wir das voreingestellte
    if (selected_flock == noflocktext)
        selected_flock = preSelectedFlock;
    preSelectedFlock = '';
    if (selected_flock == '' && typeof(flock[flock_material][highlight])!='undefined')
        selected_flock = flock[flock_material][highlight];

    // Wir leeren das alte Feld
    objForm[id+'_flock'].length=0;

    // Workaround fuer IE-Bug (Vorselektion geht nicht)
    // Das selektierte Feld wird als erstes dargestellt.
    // if (highlight != undefined && flock[flock_material][highlight]) {
      // newOption = new Option(flock[flock_material][highlight],highlight);
      // objForm[id+'_flock'][0] = newOption;
    // }

    // Der erste Punkt (nach Bugfix der zweite) ist "ohne Flock"
    newOption = new Option(noflocktext,'');
    objForm[id+'_flock'][objForm[id+'_flock'].length] = newOption;
    for (value in flock[flock_material])
    {
      if (value == 'price') continue;

      newOption = new Option(flock[flock_material][value],value,false,false);
      if (!selectBoxHasValue(objForm[id+'_flock'], newOption.value))
        objForm[id+'_flock'][objForm[id+'_flock'].length] = newOption;
    }
    if(selected_flock != "") {
      for (i = 0; i < objForm[id+'_flock'].options.length; i++)
          if (objForm[id+'_flock'].options[i].text.indexOf(selected_flock) != -1)
              objForm[id+'_flock'].selectedIndex = i;
    }
  }
}
function selectBoxHasValue(boxId, value) {
    for (i = 0; i < boxId.options.length; i++)
        if (boxId.options[i].value == value)
            return true;
    return false;
}

/* openFlockView
# Opens the lightbox with the preview
#
# required params:
# * formname (string)
# * id (int)
# * tnr (int)
# * alerttext (string)
*/
function openFlockView(formname, id, tnr, alerttext)
{
    var objForm = document[formname];
    var flock_variant = objForm[id+'_flock'][objForm[id+'_flock'].selectedIndex].value;
    if (specialflock[flock_variant]) {
        var val = objForm[id+'_nr12'].value;
        var val_name = 'val';
        if (val == label12)
            val = '';
    } else {
        var player = $(':input[name=' + id + '_flock] :selected').text();
        var val_name = 'pnr';
        var val = player.substr(4, 2);
    }
    
    $.prettyPhoto.open('/?action=misc&misc_url=jersey_preview.html&tnr=' + tnr + '&' + val_name + '=' + val + '&lang=' + (typeof(gallery_lang) == 'undefined' ? 'de' : gallery_lang) + '&layerview=1&iframe=true&noscroll=1&width=640&height=640','','');
}



/* check12
# Disables/Enables user input to the nr.12 input field
#
# required params:
# * formname (string)
# * id (int)
*/
function check12(formname,id)
{
  var objForm = document[formname];
  var flock_variant = objForm[id+'_flock'][objForm[id+'_flock'].selectedIndex].value;

  if (specialflock[flock_variant]) {
    // Menge ist bei Nr.12 auf 1 begrenzt
    if (objForm[id+'_amount']) {
      objForm[id+'_amount'].length = 1;
    }
    // Wir erlauben die Usereingabe
    if (objForm[id+'_nr12']) {
      objForm[id+'_nr12'].disabled = false;
      objForm[id+'_nr12'].style.backgroundColor = '#FFFFFF';
      $('.container_'+id+' .links.player').fadeOut();
      $('.container_'+id+' .links.custom').fadeIn();
    }
    if (document.getElementById('flocki')) {
      document.getElementById('flocki').style.display = 'block';
    }
    if (objForm[id+'_nr12'].value.search(/12/) != -1) {
        objForm[id+'_nr12'].value = label12;
        objForm[id+'_nr12'].defaultValue = label12;
    }

  } else {
    // Menge ist bei Nr.12 auf 1 begrenzt
    if (objForm[id+'_amount'] && objForm[id+'_amount'].length < 10) {
      for(i=2; i<=10; i++) {
        newOption = new Option(i,i,false,false);
        objForm[id+'_amount'][objForm[id+'_amount'].length] = newOption;
      }
    }
    // Wir verhindern die Usereingabe
    if (objForm[id+'_nr12']) {
      objForm[id+'_nr12'].disabled = true;
      objForm[id+'_nr12'].style.backgroundColor = '#AAAAAA';
      objForm[id+'_nr12'].value = label12_inactive;
      objForm[id+'_nr12'].defaultValue = label12_inactive;
      
      $('.container_'+id+' .links.custom').fadeOut();
      //Wenn ein Spieler-Flock gewaehlt, den Vorschau-Link anzeigen
      if (flock_variant != '')
        $('.container_'+id+' .links.player').fadeIn();
      else
        $('.container_'+id+' .links.player').fadeOut();
    }
    if (document.getElementById('flocki')) {
      document.getElementById('flocki').style.display = 'none';
    }
  }
  
  if (objForm[id+'_nr12'].value == label12) {
    objForm[id+'_nr12'].style.color = '#CC0033';
  } else {
    objForm[id+'_nr12'].style.color = '#000000';
  }

  // selektiertes flock
  objForm[id+'_flock'][objForm[id+'_flock'].selectedIndex].text.match(/([^,]+\b)/);
  //preSelectedFlock = RegExp.$1;
}

function liefer_popup(lang){
  var win_liefer = window.open('/inc/'+lang+'/popups/popup_liefer.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_liefer.focus();
}

function zahlen_popup(lang){
  var win_zahlen = window.open('/inc/'+lang+'/popups/popup_payment.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_zahlen.focus();
}

function shop_popup(dest){
  var win_shop = window.open(dest,'','width=570,height=476,scrollbars=yes,resizable=no');
  win_shop.focus();
}


function security_popup(lang){
  var win_secure = window.open('/inc/'+lang+'/popups/popup_sicherheit.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_secure.focus();
}

function questionary_popup(lang){
  var win_question = window.open('/survey/newquest.php','','width=570,height=890,top=20,left=20,scrollbars=yes,resizable=yes');
  win_question.focus();
}

function rueckgabe_popup(lang){
  var win_question = window.open('/inc/'+lang+'/popups/popup_rueckgabe.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_question.focus();
}

function help_popup(lang){
  var win_help = window.open('/inc/'+lang+'/popups/popup_help1.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_help.focus();
}

function quiz_popup(lang){
  var win_quiz = window.open('/inc/'+lang+'/popups/popup_gewinnspiel_teilnahme.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_quiz.focus();
}

function gutschein_popup(lang){
  var win_quiz = window.open('/inc/'+lang+'/popups/detail_gutschein.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_quiz.focus();
}

function autogramm_popup(lang){
  var win_quiz = window.open('/inc/'+lang+'/popups/detail_autogramm.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_quiz.focus();
}

function groessen_popup(lang){
  var win_quiz = window.open('/inc/'+lang+'/popups/detail_groessentabelle.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_quiz.focus();
}

function meinkonto_popup(lang){
  var win_quiz = window.open('/inc/'+lang+'/popups/detail_meinkonto.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_quiz.focus();
}

function rabatt_popup(lang){
  var win_quiz = window.open('/inc/'+lang+'/popups/detail_rabatt.php','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_quiz.focus();
}

function map_popup(id){
  var win_map = window.open('/inc/de/popups/popup_store'+id+'.php','','width=570,height=600,scrollbars=yes,resizable=yes');
  win_map.focus();
}

function vorteile_popup(lang){
  var win_vorteile = window.open('/inc/'+lang+'/popups/popup_hilfe_-_ihre_vorteile.php','','width=555,height=400,scrollbars=yes,resizable=yes');
  win_vorteile.focus();
}

function agb(lang) {
  var win_agb = window.open('/agb_'+lang+'.html','','width=570,height=500,scrollbars=yes,resizable=yes');
  win_agb.focus();
}

function impressum(lang) {
  var win_impressum = window.open('/impressum_'+lang+'.html','','width=570,height=550,scrollbars=yes,resizable=yes');
  win_impressum.focus();
}

function newsletter() {
  var win_newsletter = window.open('https://www.fcbayern.telekom.de/de/user/?action=subscribe','nlwin', 'width=570,height=660,status=no,reasizable=no,scrollbars=yes');
  //var win_newsletter = window.open('http://fcb.develop.online-skating.de/de/user/?action=subscribe','nlwin', 'width=569,height=645,status=no,resizeable=no,scrollbars=yes');
  win_newsletter.focus();
}

function popup_generic(file)
{
  var generic = window.open('/' + file,'','width=570,height=550,scrollbars=yes,resizable=yes');
  generic.focus();
}

// path to image-folder
imgPath = '/pics/';


// page init
function init() {
  // preload navigation rollovers
  //MM_preloadImages(imgPath+'head/b_konto_o.gif',imgPath+'head/b_tour_o.gif',imgPath+'head/b_direkt_o.gif', imgPath+'nav/ar1_o.gif',imgPath+'nav/b_wk_o.gif',imgPath+'nav/b_mz_o.gif');

}

// load document-background before page is displayed
//MM_preloadImages(imgPath+'main_bg.gif');


// left-navigation arrow highlights
function n_over(me) {
  me.childNodes[0].childNodes[0].src = imgPath+"nav/ar_o.gif"
}

// left-navigation arrow reset
function n_out(me) {
  me.childNodes[0].childNodes[0].src = imgPath+"nav/ar.gif"
}


// product-detail: change bg-color of product-thumbnails and show big product-image
function showBig(me,img) {
  if (document.getElementById) {
    for (i=1; i<=document.getElementById('thumbs').getElementsByTagName('td').length; i++) {
      // reset bg-color of all thumbnails
      document.getElementById("thumb"+String(i)).bgColor = "#000066";
    }
    // set bg-color of active thumbnail
    document.getElementById("thumb"+String(me)).bgColor = "#CC0033";
  }

  // if argument 'img' is set, change main-product-image to path in 'img'
  if (img) {
    MM_swapImage('p_big','',img,1);
  }

}


// standard mm functions

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) { // ns 4 resize fix
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


  function showNotepad(){
    d = document.getElementById("show_notepad");
    if(d.style.visibility == "hidden"){
      d.style.visibility = "visible";
      d.style.display = "block";
    } else {
      d.style.visibility = "hidden";
      d.style.display = "none";

    }

  }

// end standard mm functions



// tk, 2009-07-21
// top navi functions

function displayLayer(navitem, language){
  var all_items_list = new Array('herren_nav', 'damen_nav', 'kinder_nav', 'service_nav');

  for ( i=0; i < all_items_list.length; i++ ){
    var current_item = document.getElementById(all_items_list[i]);    
    if ( all_items_list[i] != navitem ){
      current_item.className = "inactive_element";
    } else {
      current_item.className = "active_element";

      var layer = document.getElementById('layer_topnavi');
      var nav_button = document.getElementById(navitem);
      
      var oldClassName = layer.className;

      switch(navitem){
        case "herren_nav" : 
          layer.className = "layer_herren";
          break;
        case "damen_nav" :
          layer.className = "layer_damen";
          break;
        case "kinder_nav" :
          layer.className = "layer_kinder";
          break;
        case "service_nav" :
          layer.className = "layer_service";
          break;
      }
      if ( layer.style.display == "none" || layer.style.display == "" || layer.className != oldClassName){
        layer.style.display = "block";
        nav_button.className = "active_element";
      } else {
        layer.style.display = "none";
        nav_button.className = "inactive_element";
      }
      ajax_send('/misc/top_navi_helper/get_layer_content.php?navname='+navitem+'&language='+language);
    }
  }

}

function changeNavimageLang(language){
  
  var herren_nav = document.getElementById('herren_nav');
  var damen_nav = document.getElementById('damen_nav');
  var kinder_nav = document.getElementById('kinder_nav');
  var service_nav = document.getElementById('service_nav');
  
  herren_nav.style.backgroundImage = "url('/pics/top_navi/herren_"+language+".gif')";
  damen_nav.style.backgroundImage = "url('/pics/top_navi/damen_"+language+".gif')";
  kinder_nav.style.backgroundImage = "url('/pics/top_navi/kinder_"+language+".gif')";
  service_nav.style.backgroundImage = "url('/pics/top_navi/service_"+language+".gif')";

}

function showNavLayer(content){
  
  layer = document.getElementById('layer_topnavi');
  head_l = document.getElementById('layer_content_left_heading');
  head_c = document.getElementById('layer_content_center_heading');
  head_r = document.getElementById('layer_content_right_heading');
  cont_l = document.getElementById('layer_content_left');
  cont_c = document.getElementById('layer_content_center');
  cont_r = document.getElementById('layer_content_right');
  cont = document.getElementById('layer_content');
  
  if ( content != "" ){
    head_l.style.display = "block"; 
    head_c.style.display = "block"; 
    head_r.style.display = "block";
    cont.style.display = "block";

    head_l.innerHTML = content.header_left;
    head_c.innerHTML = content.header_center;
    head_r.innerHTML = content.header_right;
    cont_l.innerHTML = content.content_left.join("\n");
    cont_c.innerHTML = content.content_center.join("\n");
    cont_r.innerHTML = content.content_right.join("\n");
  } else {
    head_l.style.display = "none"; 
    head_c.style.display = "none"; 
    head_r.style.display = "none"; 
    cont.style.display = "none"; 
  }

}

function disableCartButton ()
{
  $('#cartEnabled').css('display', 'none');
  $('#cartDisabled').css('display', 'inline');
  // Just in case, if this function is called before the dom is fully build.
  $(window).load(disableCartButton);
}

function enableCartButton ()
{
  $('#cartEnabled').css('display', 'inline');
  $('#cartDisabled').css('display', 'none');
  // Just in case, if this function is called before the dom is fully build.
  $(window).load(enableCartButton);
}

