/* 
Generiek JavaScript voor De Webmees
Laatste wijziging: 29-10-03 17:44:31
*/


/* frames killertje */

if (self != top) top.location.href = window.location.href;

/* standaard variabelen en strings */

var d = document;
wm = (" - De Webmees van Hans Werksman") // t.b.v. navigatie

/* browser check script */

var WIN = navigator.userAgent.indexOf("Win") != -1;
var MAC = navigator.userAgent.indexOf("Mac") != -1;
var liN = navigator.userAgent.indexOf("Lin") != -1;

var M2 = (navigator.userAgent.indexOf("Mozilla/2") != -1);
var M3 = (navigator.userAgent.indexOf("Mozilla/3") != -1);
var M4 = (navigator.userAgent.indexOf("Mozilla/4") != -1);
var M5 = (navigator.userAgent.indexOf("Mozilla/5") != -1);

var OP   = (navigator.userAgent.indexOf("Opera") != -1);
var OP3  = (navigator.userAgent.indexOf("Opera/3") != -1) && MOZ3;
var OP35 = (navigator.userAgent.indexOf("Opera/3") != -1) && MOZ4;
var OP36 = (navigator.userAgent.indexOf("Opera 3") != -1) && MOZ4;
var OP4  = (navigator.userAgent.indexOf("Opera 4") != -1) || (navigator.userAgent.indexOf("Opera/4") != -1);
var OP5  = (navigator.userAgent.indexOf("Opera 5") != -1) ||           (navigator.userAgent.indexOf("Opera/5") != -1);
var OP6  = (navigator.userAgent.indexOf("Opera 6") != -1) ||           (navigator.userAgent.indexOf("Opera/6") != -1);
var OP7  = (navigator.userAgent.indexOf("Opera 7") != -1) ||           (navigator.userAgent.indexOf("Opera/7") != -1);

var IE   = (navigator.userAgent.indexOf("MSIE") != -1) && !OP;
var IE3  = navigator.userAgent.indexOf("MSIE 3") != -1;
var IE4  = navigator.userAgent.indexOf("MSIE 4") != -1;
var IE50 = navigator.userAgent.indexOf("MSIE 5.0") != -1;
var IE55 = navigator.userAgent.indexOf("MSIE 5.5") != -1;
var IE60 = navigator.userAgent.indexOf("MSIE 6.0") != -1;


/* check voor minstens IE 4 */
var IE4more = IE && (parseInt(navigator.appVersion) >= 4);
/* check voor minstens Opera 4 */
var OP4more = OP && (parseInt(navigator.appVersion) >= 4);

var NN   = (navigator.appName == "Netscape") && !OP;
var NN2  = (navigator.appName == "Netscape") && M2 && !OP;
var NN3  = (navigator.appName == "Netscape") && M3 && !OP;
var NN4  = (navigator.appName == "Netscape") && M4 && !OP;
var NN6  = (navigator.userAgent.indexOf("Netscape6") != -1) && M5 && !OP;
var NN7  = (navigator.userAgent.indexOf("Netscape/7") != -1) && M5 && !OP;
var MOZ1 = M5 && (navigator.userAgent.indexOf("Netscape") == -1) && !OP && (navigator.userAgent.indexOf("Gecko") != -1) && (navigator.userAgent.indexOf("rv:1") != -1);

var NN6more  = NN && (parseInt(navigator.appVersion) >= 5);

var IE3m  = IE3 && MAC;
var IE4m  = IE4 && MAC;
var IE50m = IE50 && MAC;
var IE55m = IE55 && MAC;
var NN4m  = NN4 && MAC;
var NN6m  = NN6 && MAC;

var IE3w  = IE3 && WIN;
var IE4w  = IE4 && WIN;
var IE50w = IE50 && WIN;
var IE55w = IE55 && WIN;
var IE60w = IE60 && WIN;
var NN4w  = NN4 && WIN;
var NN6w  = NN6 && WIN;


/* centreer popups */

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

// maak passend venster voor popups

PositionX = 100;
PositionY = 100;


defaultWidth  = 750;
defaultHeight = 500;


var AutoClose = true;


if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Even geduld ...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["webmees"].width;');writeln('window.innerHeight=document.images["Webmees"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="Webmees" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

/* style sheet switcher */

function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}

function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
}
return null;
}

function getpreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

window.onload = function(e) {
var cookie = readCookie("style");
var title = cookie ? cookie : getpreferredStyleSheet();
setActiveStyleSheet(title);
}

window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getpreferredStyleSheet();
setActiveStyleSheet(title);


/*
scriptje voor het selecteren van voorbeeld codes
*/

var copytoclip=1

function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Alle tekst geselecteerd en naar het prikbord gestuurd!"
setTimeout("window.status=''",6400)
}
}

// roll over print knop

var iversion = -1;
var roll=false;

function version() {
    if (iversion != -1) return roll;

        if (navigator.appName.indexOf("Netscape") != -1) { 
                if (navigator.userAgent.indexOf("Mozilla/") != -1)
                        iversion = parseFloat(navigator.appVersion)
                else
                        iversion = 1;
                roll = (iversion>=3);
        } else {  
                if (navigator.appName.indexOf("Internet Explorer") != -1) {
                        if (navigator.userAgent.indexOf("Mozilla/") != -1) 
                                iversion = parseFloat(navigator.appVersion)
                        else
                                iversion = 1;
                } else {
                        iversion = 1;
                }
                roll = (iversion>3);
        }
        return roll;
}

if (version()) {
            butprn        = new Image(81,14);
            butpro        = new Image(81,14);
            butprn.src    = "img/trans.gif";
            butpro.src    = "img/print_02.gif";
			
            but1prn        = new Image(81,14);
            but1pro        = new Image(81,14);
            but1prn.src    = "../img/trans.gif";
            but1pro.src    = "../img/print_02.gif";			
}

function chimg(pic,name) {
                if (roll) {
                        pic.src = name.src;
                } 
}

