function load() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
    }
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    var point = new GLatLng(51.512890, 7.47472);
    map.setCenter(point, 17);
    var marker = new GMarker(point);
    map.addOverlay(marker);
}

function map24_removeDefaultValues(){
    if (document.link2map24.sstreet.value == 'Straße') {
        document.link2map24.sstreet.value 	= '';
    }
    if (document.link2map24.szip.value 	  == 'PLZ') {
        document.link2map24.szip.value = '';
    }
    if (document.link2map24.scity.value   == 'Ort') {
        document.link2map24.scity.value 	= '';
    }
}

function swapImage(target,image) {
    
    document.images[target].src=image;
    
}


function viewImage(file, id, width, height) {

    var obj         = '/modules/image.php?file='+file+'&id='+id+'&width='+width+'&height='+height;
    var newWindow   = window.open(obj, '', 'width='+width+', height='+height+', top='+(screen.height-height)/2+', left='+(screen.width-width)/2+', location=no, scrollbars=no, resizable=no, menubar=no, toolbar=no, status=no');
    newWindow.focus();

}



function columns(col) {

    var obj = document.getElementById('rightBox');
    
    if(col == 2) {
        obj.setAttribute('style','float:left');
    } else {
        obj.setAttribute('style','clear:left');
    }

}

function toggleBox(item) {
   
    var obj = document.getElementById(item);
    var state = obj.style.display;

    if(state == 'block') {
       var display = 'none';
    } else {
        var display = 'block';
    }
    
    obj.style.display=display;
    
    return true;
    
}


function checkValues(obj) {

    var vorname = obj.vorname.value;
    var name    = obj.name.value;
    var email   = obj.email.value;
        
    var checksum = 0;

    
    
    
    if(name.length > 0) {
        checksum ++;
    } else {
        alert("Bitte geben Sie Ihren Namen an!");
        return false;
    }
    
    if(vorname.length > 0) {
        checksum ++;
    } else {
        alert("Bitte geben Sie Ihren Vornamen an!");
        return false;
    }
    
    if(validEmail(email)) {
        checksum ++;
    } else {
        alert("Bitte geben Sie eine korrekte Emailadresse an!");
        return false;
    }
    
    if(checksum == 3) {
        obj.submit();
    }
        
    return false;
}


function validEmail(s) {
    var a = false;
    var res = false;
    if(typeof(RegExp) == 'function') {
        var b = new RegExp('abc');
        if(b.test('abc') == true) {
            a = true;
        }
    }
    if(a == true) {
        reg = new RegExp(   '^([a-zA-Z0-9\\-\\.\\_]+)'+
                            '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                            '(\\.)([a-zA-Z]{2,4})$');
        res = (reg.test(s));
    } else {
        res = (s.search('@') >= 1 && s.lastIndexOf('.') > s.search('@') && s.lastIndexOf('.') >= s.length-5)
    }
    return(res);
}