function CC_blurAll() {
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++) {	
		x[i].onfocus = function () { this.blur(); }	
		if(x[i].getAttribute('target') == '_blank') {
			x[i].className = x[i].className+' extLink';
			x[i].title = x[i].title+' ( link opens in new window) ';
		}
	}
}
function CC_saveEmail() {
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++) {	
		if(x[i].href.indexOf('mailto:') != -1) {
			x[i].innerHTML = x[i].innerHTML.replace("@remove this part", "");
			x[i].href = x[i].href.replace("@remove this part", "");
			x[i].href = x[i].href.replace("@remove%20this%20part", "");
		}
	}
}
function CC_checkFill(whtfld, fldname) {
	if (!document.getElementById) return false; 
	var frmfld = document.getElementById(whtfld).value;
	if(frmfld == '') {
		return '- You forgot enter '+fldname+';\n';
	}
	return '';			
}
function CC_checkMail(whtfld, fldname) {
	if (!document.getElementById) return false; 
	var mailfld = document.getElementById(whtfld).value;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,})$/;
	if (!filter.test(mailfld)) {
		return '- You forgot to enter a correct '+fldname+';\n';
	}
	return '';
}
function CC_sendMail(btn, form) {
	if (!document.getElementById) return false; 
	var warn = '';
	warn += CC_checkFill('sender_name', 'your name');
	warn += CC_checkMail('sender_mail', 'email address');
	warn += CC_checkFill('sender_text', 'your comment');
	if(warn!='') {
		warn = 'Your request could not be send due to the following reason(s):\n\n'+warn;
		alert(warn);
		return false;
	}
	trgt = document.getElementById(btn);
	setTimeout("trgt.disabled = true;", 10);
	setTimeout("trgt.value = 'please wait...';", 10);
	return true;
}
function CC_loadImage(i) {
	if(!page_loaded) {
		return false;
	}
	current_image = i;
	document.getElementById('gallery_large').style.display = 'block';
	document.loader = new Image();
	document.loader.src = gallery_images[i];
	document.loader.onload = function() {
		setTimeout("document.getElementById('gallery_large_holder').src = document.loader.src;", 100);
		setTimeout("document.getElementById('gallery_large_holder').className = 'gallery_large_holder_img'", 100);
	}
	return true;
}
function CC_unloadImage(i) {
	document.getElementById('gallery_large').style.display = 'none';
	document.getElementById('gallery_large_holder').src = 'gfx/loading.gif';
	document.getElementById('gallery_large_holder').className = '';
	document.loader = new Image();
	document.loader.src = 'gfx/loading.gif';
	document.loader.onload = function() {
		setTimeout("document.getElementById('gallery_large_holder').src = document.loader.src;", 100);
	}
}
var current_image;
var page_loaded;
window.onload = function() { CC_saveEmail(); CC_blurAll(); page_loaded = true;};
document.ondragstart=document.oncontextmenu=new Function("return false");


