/**
 * Important functions
 */
function validateEmail(email)
{
 var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
 return email.match(re)
}

    function preisFormat(zahl) {
        wert = zahl.replace(",",".");
        if(isNaN(wert)){
            return "-";
        }
        wert = parseInt(parseInt(wert * 1000)/10);//*1000 aufgrund rundungs fehler
        wert = wert / 100;
        wert = wert.toFixed(2);
        wert = wert.replace(/\./,",");
        while(wert.match(/^(\d+)(\d{3}\b)/)) {
            wert = wert.replace(/^(\d+)(\d{3}\b)/, RegExp.$1 + '.' + RegExp.$2);
        }
        
        return wert;
    }
    
function callFunction(funcName, paramAsArray){
    
    if(funcName.indexOf(".")>=0){
        funcName = funcName.split(".");        
        this[funcName[0]][funcName[1]].apply(this, Array.prototype.slice.call(paramAsArray));
    }
    else{
        this[funcName].apply(this, Array.prototype.slice.call(paramAsArray));
    }
    
}    

function leeren(id,text){
    if (document.getElementById(id).value == text){
        document.getElementById(id).value = "";
    }
}

function fuellen(id,text){

    if(document.getElementById(id).value == ""){
        document.getElementById(id).value = text;
    }
}

function checkOnlyNumber(id, komma){
    
    var val = document.getElementById(id).value;
    val = val.replace('.', ',');
    var pos = val.search(',');
    var end = "";
    if (pos > 0){        
        end = val.substr(pos+1, val.length);
    }    
    
    if (end.length > 2){
        document.getElementById(id).value = val.substr(0, val.length-1);
    }

    
    
}

function setHash(hash){
    window.location.hash = hash ;
}


