<!--

//------- break out
function breakOut() {
	if (top.frames.length != 0) {
		top.location = self.document.location;
	}
}
//------- break out

//------- check for numeral string
function isNum(str) {
	var test = "0123456789";
	for (i=0; i <= str.length-1; i++) {
		if (test.indexOf(str.charAt(i)) == -1) return false;
	}
	return true;
}
//------- check for numeral string

//------- pop-up window
function popUp(URL, w, h, scroll) {
	scroll = (typeof(scroll) == 'undefined') ? 0 : scroll;
	var top = (window.screen.height - h) / 2;
	var left = (window.screen.width - w) / 2;
	window.open(URL, "", "top=" + top + ", left=" + left + ", width=" + w + ", height=" + h + ", toolbar=0, scrollbars=" + scroll + ", location=0, statusbar=0, menubar=0, resizable=0");
}
//------- pop-up window

//------- check if variable exists and is defined (isdefined v1.0 http://www.jehiah.com)
function isDefined(variable) {
	return (typeof(window[variable]) == 'undefined') ?  false : true;
	// syntax voor gebruik: if (isDefined(myvar) == true) { ...
}
//------- check if variable exists and is defined (isdefined v1.0 http://www.jehiah.com)

//------- bereken canvasbreedte
function calculateCanvasWidth() {
	var canvasWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		//Non-IE
		canvasWidth = window.innerWidth;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
		canvasWidth = document.documentElement.clientWidth;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		canvasWidth = document.body.clientWidth;
	}
	return canvasWidth;
}
//------- bereken canvasbreedte

//------- copyright
var message = "";
function clickIE() {
	if (document.all) {
		(message);
		window.status = '';
		return false;
	}
}
function clickNS(e) {
	if (document.layers || (document.getElementById && !document.all)) {
		if (e.which == 2 || e.which == 3) {
			(message);
			window.status = '';
			return false;
		}
	}
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown = clickNS;
} else {
	document.onmouseup = clickNS;
	document.oncontextmenu = clickIE;
}
document.write('<meta http-equiv="imagetoolbar" content="no">'); //tegen image toolbar (IE6+)
//------- copyright

//------- blur links
function blurLinks() {
	var allLinks;
	if (document.all) {
		allLinks = document.links;
	} else if (document.getElementsByTagName) {
		allLinks = document.getElementsByTagName('a');
	}
	if (typeof(allLinks) != 'undefined') {
		for (var i=0; i < allLinks.length; i++) {
			allLinks[i].onfocus = function() {
				this.blur();
			}
			/*
			allLinks[i].onclick = function() { // is oorspronkelijke syntax
				this.blur();
			}
			*/
		}
	}
}
//------- blur links

//------- show titles in statusbar
function showTitles() {
	// default status
	var sMsg = 'different look . : ontwerp- en adviesbureau voor kleur en vorm';
	window.defaultStatus = sMsg;
	// show image titles in statusbar
	var allImages;
	if (document.all) {
		allImages = document.images;
	} else if (document.getElementsByTagName) {
		allImages = document.getElementsByTagName('img');
	}
	if (typeof(allImages) != 'undefined') {
		for (var i=0; i < allImages.length; i++) {
			allImages[i].onmouseover = function() {
				window.status = this.title;
				return true;
			}
			allImages[i].onmouseout = function() {
				window.status = sMsg; // alt. ''
				return true;
			}
		}
	}
}
//------- show titles in statusbar

//------- bookmarkscript
function addBookmark() {
	var title = "different look . : ontwerp- en adviesbureau voor kleur en vorm";
	var url = "http://www.differentlook.nl";
	if (document.all) {
		window.external.AddFavorite(url, title);
	} else {
		if (window.sidebar) {
			window.sidebar.addPanel(title, url, "");
		} else {
			alert("Helaas, uw browser ondersteunt deze functie niet! Probeer te bookmarken door Ctrl+D of Ctrl+T te gebruiken.");
		}
	}
}
//------- bookmarkscript

//------- navigatie mouseover
var timeoutID = null;
function navigate(imgId,mEvent) {
	var imgElement;
	var disabledElement;
	if (document.images) { // DOM 0
		imgElement = document.images['m' + imgId];
		disabledElement = document.images['disabled'];
	} else if (document.getElementById) { // DOM 1
		imgElement = document.getElementById('m' + imgId);
		disabledElement = document.getElementById('disabled');
	}
	// actie voor de uitgeschakelde button
	if (typeof(disabledElement) != 'undefined') {
		if (mEvent == 'over') { // onMouseOver
			if (timeoutID != null) { // eventueel bestaande time-out flushen
				window.clearTimeout(timeoutID);
			}
			disabledElement.src = eval('mDisabled_' + mEvent).src; // uitgeschakelde button (direct) actief maken
		} else if (mEvent == 'out') { // onMouseOut
			timeoutID = window.setTimeout(function() { disabledElement.src = eval('mDisabled_' + mEvent).src; timeoutID = null; }, 1000); // time-out starten voor switch van de uitgeschakelde button (in milliseconden)
		}
	}
	// actie voor de button in kwestie
	if (typeof(imgElement) != 'undefined') {
		imgElement.src = eval('m' + imgId + '_' + mEvent).src;
	}
}
/* ------- OUD
eval('document.images.m'+imgId+'.src = m'+imgId+'_'+mEvent+'.src');
if (document.images.disabled) {
	eval('document.images.disabled.src = mDisabled_'+mEvent+'.src');
}
------- OUD */
//------- navigatie mouseover

//------- scrollen DIV in Firefox
function ff_scroll() {
	if (!document.all) {
		document.getElementById('setFocus').focus();
	}
}
//------- scrollen DIV in Firefox

//------- thumbing
function popImage(img) {
	var foto = new Image();
	foto.src = img;
	var header = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\n\n<html>\n<head>\n\t<title>different look . : beeldvergroting<\/title>\n';
	header += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n<link rel="stylesheet" href="http://www.differentlook.nl/resources/basics.css">\n<script language="JavaScript" type="text/javascript" src="http://www.differentlook.nl/resources/script.js"><\/script>\n<\/head>\n\n<body class="thumbing" onload="blurLinks();">\n\n';
	header += '<img src="'+img+'" width="'+foto.width+'" height="'+foto.height+'" border="0" class="foto_uitvergroting">\n';
	var footer = '\n\n<\/body>\n<\/html>';
	if (foto.width != 0 && foto.height != 0) {
		var left = (window.screen.width - foto.width) / 2;
		var top = (window.screen.height - foto.height) / 2;
		var imgWin = window.open('','_blank','top='+top+',left='+left+',width='+(foto.width+20)+',height='+(foto.height+60)+',toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0');
		if (!imgWin) {
			var oNewDoc = document.open("text/html"); // alt. document.open("text/html", "replace");
			var sMarkup = header+'&laquo; <a href="javascript:history.back();">Ga terug<\/a>'+footer;
			oNewDoc.write(sMarkup);
			oNewDoc.close();
		}
		imgWin.document.write(header+'&raquo; <a href="javascript:window.close();">Venster sluiten<\/a>'+footer);
		imgWin.document.close();
		if (imgWin.focus) { imgWin.focus(); }
	} else {
		functie = "popImage('"+img+"')";
		interval = setTimeout(functie,20);
	}
}
//------- thumbing

//------- highlighten form-elementen
function focus_form(status,input_id) {
	if (status == 1) {
		document.getElementById(input_id).className='veldactive';
		document.getElementById('label_'+input_id).className='active';
	} else if (status == 0) {
		document.getElementById(input_id).className='veld';
		document.getElementById('label_'+input_id).className='';
	}
}
//------- highlighten form-elementen

//------- disable submit
function dis_sub(formnaam) { 
    formnaam.subknop.disabled = true; 
}
//------- disable submit

//------- thumbs faden
var baseopacity = 50;
function slowhigh(which2) {
	/*
	// toevoeging om functie op 'afstand' uit te kunnen voeren (aanroepen van imgID vanuit link)
	// EDIT: niet nodig wanneer je slowhigh(this.firstChild); in de link zet
	if (typeof(which2) == "string") {
		if (document.images) {
			which2 = document.images[which2];
		} else if (document.getElementById) {
			which2 = document.getElementById(which2);
		}
	}
	*/
	imgobj = which2;
	browserdetect = which2.filters ? "ie" : typeof which2.style.MozOpacity == "string" ? "mozilla" : "";
	instantset(baseopacity);
	highlighting = setInterval("gradualfade(imgobj)", 50);
}
function slowlow(which2) {
	cleartimer();
	instantset(baseopacity);
}
function instantset(degree) {
	if (browserdetect == "mozilla") {
		imgobj.style.MozOpacity = degree / 100;
	} else if (browserdetect == "ie" && imgobj.filters.alpha != null) {
		imgobj.filters.alpha.opacity = degree;
	}
}
function cleartimer() {
	if (window.highlighting) {
		clearInterval(highlighting);
	}
}
function gradualfade(cur2) {
	if (browserdetect == "mozilla" && cur2.style.MozOpacity < 1) {
		cur2.style.MozOpacity = Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99);
	} else if (browserdetect == "ie" && imgobj.filters.alpha != null && cur2.filters.alpha.opacity < 100) {
		cur2.filters.alpha.opacity += 10;
	} else if (window.highlighting) {
		clearInterval(highlighting);
	}
}
//------- thumbs faden

//------- horizon
var nn4 = (navigator.appName.indexOf("Netscape") > -1 && navigator.appVersion.indexOf("4") > -1) ? true : false;
var ie = (document.all) ? true : false;
var nn6 = (document.getElementById) ? true : false;

function browser(id){
	var layer = (nn4) ? document.layers[id] : (ie) ? document.all[id] : document.getElementById(id);
	return layer;
}

var bannerWidth = 470;
var bannerHeight = 100;
var topVal = 0;
var rightVal = 0;
var bottomVal = bannerHeight;
var leftVal = 0;
var timeout = null;

function startSlide(id) {
	if (timeout == null) {
		slideIt(id);
	}
}

function slideIt(id) {
	var intervalSpeed = 40; // milliseconds (lower is faster)
	var clipIncrement = 2; // in pixels
	var layer = browser(id); // get path to layer depending on browser executing this code
	if (nn4) {
		if (layer.clip.right < bannerWidth) {
			layer.clip.top = 0;
			layer.clip.right += clipIncrement;
			layer.clip.bottom = bottomVal;
			layer.clip.left = 0;
			timeout = setTimeout("slideIt('"+id+"')",intervalSpeed);
		}
	} else {
		if (rightVal < bannerWidth) {
			topVal = 0;
			rightVal += clipIncrement;
			bottomVal = bannerHeight;
			leftVal = 0;
			layer.style.clip = "rect("+topVal+"px "+rightVal+"px "+bottomVal+"px "+leftVal+"px)";
			timeout = setTimeout("slideIt('"+id+"')",intervalSpeed);
		}
    } 
}
//------- horizon

//------- copyright
var message = '';
function clickIE() {
	if (document.all) {
		(message);
		return false;
	}
}
function clickNS(e) {
	if (document.layers || (document.getElementById && !document.all)) {
		if (e.which == 2 || e.which == 3) {
			(message);
			return false;
		}
	}
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown = clickNS;
} else{
	document.onmouseup = clickNS;
	document.oncontextmenu = clickIE;
}
document.oncontextmenu=new Function("return false");
document.write('<meta http-equiv="imagetoolbar" content="no">');
//------- copyright

//-->
