function disable()
    {
    if (document.getElementById('VoucherDisabler').checked)
        {
        /*
        document.getElementById('VoucherShippingName').value=document.getElementById('VoucherContactName').value;
        document.getElementById('VoucherShippingStreet').value=document.getElementById('VoucherContactStreet').value;
        document.getElementById('VoucherShippingNumber').value=document.getElementById('VoucherContactNumber').value;
        document.getElementById('VoucherShippingPost').value=document.getElementById('VoucherContactPost').value;
        document.getElementById('VoucherShippingCity').value=document.getElementById('VoucherContactCity').value;
        */

        document.getElementById('VoucherShippingSalutation').disabled=true;
        document.getElementById('VoucherShippingName').disabled=true;
        document.getElementById('VoucherShippingStreet').disabled=true;
        document.getElementById('VoucherShippingNumber').disabled=true;
        document.getElementById('VoucherShippingPost').disabled=true;
        document.getElementById('VoucherShippingCity').disabled=true;
        }
    else
        {
        document.getElementById('VoucherShippingSalutation').disabled=false;
        document.getElementById('VoucherShippingName').disabled=false;
        document.getElementById('VoucherShippingStreet').disabled=false;
        document.getElementById('VoucherShippingNumber').disabled=false;
        document.getElementById('VoucherShippingPost').disabled=false;
        document.getElementById('VoucherShippingCity').disabled=false;
        }
    }

function disable_update()
    {
    document.getElementById('VoucherShippingSalutation').disabled=true;
    document.getElementById('VoucherShippingName').disabled=true;
    document.getElementById('VoucherShippingStreet').disabled=true;
    document.getElementById('VoucherShippingNumber').disabled=true;
    document.getElementById('VoucherShippingPost').disabled=true;
    document.getElementById('VoucherShippingCity').disabled=true;
    }

function _(id) { return document.getElementById(id); }

function openCenteredWindow(url, n, w, h) {
    var l = (screen.availWidth / 2) - (w / 2);
    var t = (screen.availHeight / 2) - (h / 2);
    return openWindow(url, n, w, h, l, t);
}

function openWindow(url, n, w, h, l, t) {
    if(l == undefined) l = 200;
    if(t == undefined) t = 100;

    var params = new Array();

    if(w > 0) params.push('width='  + w);
    if(h > 0) params.push('height=' + h);
    params.push('left=' + l);
    params.push('top='  + t);

    params.push('location=no');
    params.push('statusbar=no');

    return window.open(url, n, params.join(','));
}

function swapProductImage(productId, imageName, fileId, zoomWidth, zoomHeight, fullsizeWidth, fullsizeHeight)
    {
    document.getElementById('fullsizeImage').src = '/images/' + fileId + '/' + fullsizeWidth + 'x' + fullsizeHeight + '.jpg';
    document.getElementById('fullsizeLink1').setAttribute('onclick', 'openCenteredWindow(\'/pages/productImagePopup/' + productId + '/' + imageName + '\', \'ProductImagePopup\', ' + zoomWidth + ', ' + zoomHeight + ');');
    document.getElementById('fullsizeLink2').setAttribute('onclick', 'openCenteredWindow(\'/pages/productImagePopup/' + productId + '/' + imageName + '\', \'ProductImagePopup\', ' + zoomWidth + ', ' + zoomHeight + ');');
    }

// Bestellformular abschicken
function action(form, id, action)
    {
    document.getElementById(id).value = action;
    document.getElementById(form).submit();
    }

// Produktansicht: Bild austauschen
function swap(id, fullsizeWidth, fullsizeHeight, zoomWidth, zoomHeight)
    {
    document.getElementById('fullsizeImage').src = '/file/file/image/' + id + '?img[w]=' + fullsizeWidth + '&img[h]=' + fullsizeHeight;
    document.getElementById('fullsizeLink1').setAttribute('onclick', 'zoom(' + id + ', ' + zoomWidth + ', ' + zoomHeight + ');');
    document.getElementById('fullsizeLink2').setAttribute('onclick', 'zoom(' + id + ', ' + zoomWidth + ', ' + zoomHeight + ');');
    }

// Produktansicht: Bild aufpoppen
function zoom(id, width, height)
    {
    window.open('/file/file/image/' + id + '?img[w]=' + width + '&img[h]=' + height, 'PopUp', 'left=300, top=50,width=' + width + ',height=' + height + ',status=no,scrollbars=no,resizable=yes');
    }

// IE form submit ohne submit-Button fixen
function refreshImprintForm(formId, imprintSelectId, colorSelectId)
{
    var eImp = _(imprintSelectId);
    if(!eImp || imprintTypes[eImp.value] == undefined) return;

    var imp = imprintTypes[eImp.value];
    var hasColors = (imp.has_colors != 0);
    var div = _(colorSelectId);

    var inputs = div.getElementsByTagName('input');
    for(var i=0; i < inputs.length; i++) {
        if(hasColors) {
            inputs[i].removeAttribute('disabled');
        } else {
            inputs[i].setAttribute('disabled', 'disabled');
        }
    }
}


function ajaxNews(page) {
	
	dojo.xhrGet( {
      
        url: "/events/news/0/"+page+"/1",
        handleAs: "text",

        timeout: 5000, 
     
        load: function(response, ioArgs) { // ➃
          dojo.byId("ajaxContent").innerHTML = response;
          return response; 
        },

      
        error: function(response, ioArgs) { 
          console.error("HTTP status code: ", ioArgs.xhr.status); 
          return response;
          }
        });
      }

		


