"use strict";

// javascript samengesteld door Fits Seubring d.d. 17-05-2011 voor gBOU.

function right(e) {
    if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
        return false;
        }
    else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
        cprsgn='\u00A9';
        today=new Date();
   	y0=today.getFullYear();
	alert("copyright "+cprsgn+" "+y0+" gBOU.BV");
	return false;
    }
    return true;
}
document.onmousedown=right;
document.onmouseup=right;
if (document.layers) {
    window.captureEvents(Event.mousedown);
    }
if (document.layers) {
    window.captureEvents(Event.mouseup);
    }
window.onmousedown=right;
window.onmouseup=right;

var	arrTemp = self.location.href.split("?");
var	PicUrl = (arrTemp.length>0)?arrTemp[1]:"";
var	NS = (navigator.appName=="Netscape")?true:false;

function PopupPic(PicUrl) {
    window.open("popup.html?" + PicUrl, "Foto", "resizable = 0, width = 1200, height = 800, top = 25, left = 25");
} 

function FitPic() {
    var Wmax, Hmax, Wpic, Hpic, WAR, HAR, Wos, Hos, Wis, His, myWidth, myHeight;
    Wmax = screen.width  - 60;
    Hmax = screen.height - 90;
    Wpic = document.images[0].width;
    Hpic = document.images[0].height;
    if ( Wmax > 0 ) { 
        WAR = Wpic / Wmax;
    }
	else {
        WAR = 1;
    }
    if ( Hmax > 0 ) {
        HAR = Hpic / Hmax;
    }
	else {
        HAR = 1;
    }
    if ( WAR > HAR ) {
        if ( WAR < 0.7 ) {
            WAR = 0.7;
        }
        Wos = Wpic / WAR;
        Hos = Hpic / WAR;
    }
	else {
        if ( HAR < 0.7 ) {
            HAR = 0.7;
        }  
        Wos = Wpic / HAR;
        Hos = Hpic / HAR;
    }
    document.images[0].width = Wos;
    document.images[0].height = Hos;
    myWidth = 0;
    myHeight = 0;
    if ( typeof( window.innerWidth ) == 'number' ) {
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } 
        else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } 
        else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    Wis = Wos - myWidth;
    His = Hos - myHeight;
    window.resizeBy(Wis, His);
    self.focus();
}

function CloseWindow() {
    window.close();
}

function Checker(gbouinfo) {

var naam = document.getElementById('naam');
var tfoon = document.getElementById('tfoon');
var email = document.getElementById('email');
var vraag = document.getElementById('vraag');
var bellen = document.getElementById('bellen');

    if (gbouinfo.naam.value.length < "2") {
        alert("Het formulier is niet volledig: controleer Naam");
        return false;
    }
    else if (gbouinfo.tfoon.value.length < "7") {
        alert("Het formulier is niet volledig: controleer Telefoon");
        return false;
    }
    else if (gbouinfo.email.value.length < "7") {
        alert("Het formulier is niet volledig: controleer e-mail");
        return false;
    }
    else if (gbouinfo.vraag.value.length < "2") {
        alert("Het formulier is niet volledig: U heeft geen informatie gevraagd");
        return false;
    }
    else {
        gbouinfo.submit();
        if (gbouinfo.bellen.checked) {
            alert("Uw aanvraag is verzonden en in behandeling. Er wordt zo spoedig mogelijk contact met u opgenomen.");
        }
        else {
            alert("Uw aanvraag is verzonden en in behandeling. U krijgt zo spoedig mogelijk de gevraagde informatie.");
        }
    }
}

