$(document).ready(function() { 
    
    $("#opengooglemaps").fancybox({
        frameWidth: 700,
        frameHeight: 500,
        hideOnContentClick: false,
        callbackOnShow: initPopupGoogleMaps        
    });
    
    if (_PAGE == 'find-us') {
        initGoogleMaps();
    }
});


function initPopupGoogleMaps(){           

    $("#fancy_div").css({
        'width': '700px',
        'height': '500px'
    });

    var popupmap = new GMap2(document.getElementById("fancy_div"));            
    var center = new GLatLng(52.630797, -7.248874);                            
    popupmap.setUIToDefault();        
    popupmap.setCenter(center, 14);
    popupmap.addOverlay(new GMarker(center));                
}

function initGoogleMaps(){           
        
    var map = new GMap2(document.getElementById("contentgooglemaps"));            
    var center = new GLatLng(52.630797, -7.248874);                            
    map.setUIToDefault();        
    map.setCenter(center, 13);
    map.addOverlay(new GMarker(center));            
}

function ValidateContactForm() {
    var missinginfo = "";
    if ($("#contact_name").val() == "") {
        missinginfo += "\n - Full name";
    }
    if ($("#contact_email").val() == "") {
        missinginfo += "\n - E-mail";
    }
    if ($("#contact_message").val() == "") {
        missinginfo += "\n - Message";
    }
    
    if (missinginfo != "") {
        missinginfo ="Following fields are required:" + missinginfo;
        alert(missinginfo);
        return false;
    }
    else {
        return true;
    }
}

function ExtendReadmore(link) {
    $(link).hide();
    $('#readmorecut').slideDown('slow');
    return false;
}
