// JavaScript Document
function newsletter()
{
	if(document.getElementById('newsletterEmail').value=='Hier Ihre E-Mail-Adresse eingeben')
	{
		alert('Bitte geben Sie eine E-Mail Adresse ein!');
	}
	else
	{
		document.getElementById('newsletterForm').submit();
	}
}


function popup(url)
{
	popup = window.open(url, "popup", "width=750,height=800,status=no,scrollbars=yes,resizable=no");
	popup.focus();
}
function popup2(url)
{
	popup = window.open(url, "popup", "width=500,height=370,status=no,scrollbars=yes,resizable=no");
	popup.focus();
}
function contact()
{
	if(document.getElementById('form_contact_email').value=='')
	{
		document.getElementById('form_contact_email').focus();
		alert('Bitte füllen Sie alle Pflichtfelder aus!');	
	}
	else if(document.getElementById('form_contact_telefon').value=='')
	{
		document.getElementById('form_contact_telefon').focus();
		alert('Bitte füllen Sie alle Pflichtfelder aus!');	
	}
	else
	{
		document.getElementById('form_contact').submit();
	}
}
/*var fcn = {
    basePath: window.basePath,
    checkForm: function(formId){
        var fields = window.fields;
        var returnValue = true;
        fields.each(function(f){
            var id = [formId, '_', f].join('');
            $(id + '_error').hide();
            
            if ($F(id).length < 1) {
                $(id + '_error').show();
                returnValue = false;
            }
        });
        if (returnValue === true) {
            $(formId).submit();
        }
    },
    
    calculate: function(size, weight, amount){
        parameters = {
            method: 'post',
            postBody:['size=',escape(size),'&weight=',weight,'&amount=',amount] .join(''),
            onComplete: function(t){
                fcn.updatePrice(t.responseText);
            }
        };
        new Ajax.Request(fcn.basePath + 'backend/?action=calculate', parameters);
    },
    
    updatePrice: function(p){
        $('finalResult').innerHTML = fcn.numberFormat(Number(p).toFixed(2), ',', '.') + ' €';
    },
    
    numberFormat: function (num, decpoint, sep){
        // check for missing parameters and use defaults if so
        if (arguments.length == 2) {
            sep = ",";
        }
        if (arguments.length == 1) {
            sep = ",";
            decpoint = ".";
        }
        // need a string for operations
        num = num.toString();
        // separate the whole number and the fraction if possible
        a = num.split(decpoint);
        x = a[0]; // decimal
        y = a[1]; // fraction
        z = "";
        
        if (typeof(x) != "undefined") {
            // reverse the digits. regexp works from left to right.
            for (i = x.length - 1; i >= 0; i--) {
                z += x.charAt(i);
            }
            
            // add seperators. but undo the trailing one, if there
            z = z.replace(/(\d{3})/g, "$1" + sep);
            if (z.slice(-sep.length) == sep) {
                z = z.slice(0, -sep.length);
            }
            
            x = "";
            // reverse again to get back the number
            for (i = z.length - 1; i >= 0; i--) {
                x += z.charAt(i);
            }
            
            // add the fraction back in, if it was there
            if (typeof(y) != "undefined" && y.length > 0) {
                x += decpoint + y;
            }
            
        }
        return x;
    }
};

var mailservice = {
    sliderChanged: function (value) {
        console.log(value);
    }
}
*/