//// begin script ////

//// local debug vars ////
var debug = false;

// check browser ///////////////////////
agent = navigator.userAgent.toLowerCase(); 
mac = (agent.indexOf("mac")!=-1);
win = (!this.mac) ?true:false;
w3c = (document.getElementById) ?true:false;
iex = (document.all) ?true:false;
ns4 = (document.layers) ?true:false;

if(debug) {
	if(w3c) alert("w3c");
	if (iex) alert("iex");
	if (ns4) alert("ns4");
}

//// verplaats achtergrond image script //////////////
function move_col_bg(margin,h,m,t,f1,f2,col1,col2,pos1) {
	var boxHeight = 0;
	var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
	if (h) boxHeight += document.getElementById('header').offsetHeight;
	if (m) boxHeight += document.getElementById('menu').offsetHeight;
	if (t) boxHeight += document.getElementById('thumbs').offsetHeight;
	if (f1) boxHeight += f1;
	if (f2) boxHeight += f2;
	/// alert(col1);
	col1.style.top=boxHeight-margin;
	if (col2) col2.style.backgroundPosition=pos1 + (boxHeight-margin);
}

function move_col_hmt_bg(margin) {
	var boxHeight = document.getElementById('header').offsetHeight;
	boxHeight += document.getElementById('menu').offsetHeight;
	boxHeight += document.getElementById('thumbs').offsetHeight;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_hm_bg(margin) {
	var boxHeight = document.getElementById('header').offsetHeight;
	boxHeight += document.getElementById('menu').offsetHeight;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_h_bg(margin) {
	var boxHeight = document.getElementById('header').offsetHeight;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_mt_bg(margin) {
	var boxHeight = document.getElementById('menu').offsetHeight;
	boxHeight += document.getElementById('thumbs').offsetHeight;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_m_bg(margin) {
	var boxHeight = document.getElementById('menu').offsetHeight;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_hmtff_bg(margin,fade) {
	var boxHeight = document.getElementById('header').offsetHeight;
	boxHeight += document.getElementById('menu').offsetHeight;
	boxHeight += document.getElementById('thumbs').offsetHeight;
	boxHeight += 2*fade;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_hmf_bg(margin,fade) {
	var boxHeight = document.getElementById('header').offsetHeight;
	boxHeight += document.getElementById('menu').offsetHeight;
	boxHeight += fade;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_hmff_bg(margin,fade) {
	var boxHeight = document.getElementById('header').offsetHeight;
	boxHeight += document.getElementById('menu').offsetHeight;
	boxHeight += 2*fade;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_hf_bg(margin,fade) {
	var boxHeight = document.getElementById('header').offsetHeight;
	boxHeight += fade;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_mtff_bg(margin,fade) {
	var boxHeight = document.getElementById('menu').offsetHeight;
	boxHeight += document.getElementById('thumbs').offsetHeight;
	boxHeight += 2*fade;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_mf_bg(margin,fade) {
	var boxHeight = document.getElementById('menu').offsetHeight;
	boxHeight += fade;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

function move_col_mff_bg(margin,fade) {
	var boxHeight = document.getElementById('menu').offsetHeight;
	boxHeight += 2*fade;
	document.getElementById('abs_cols_box_id').style.top=boxHeight-margin;
}

//// anti-spam script //////////////
function safemail(name, domain, display) {
    displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
    document.write('<a class="sub" href=mailto:' + name + '@' + domain + '>' + displayed + '</a>');
}

//// opens a window ////////////////
function openWin(url, name, width, height, kind) {
	var my_win;
	if (kind == "ws") {
	 	w = ((screen.width - 40) - 10);
	 	h = ((screen.height - 40) - 75);
	 	l = 20;
	 	t = 20;
	 	full = 0;
	 } else if (kind == "fs") {
	 	if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
   			w = screen.width;
   			h = screen.height;
   			l = 0;
   			t = 0
	 		full = 1;
	 	} else {
	 		h = screen.height - 40;
	 		w = screen.width;
	 		l = 0;
	 		t = 0;
	 		full = 0;
	 	}
	 } else {
	 	h = height;
	 	w = width;
	 	l = ((screen.width - w) / 2);
	 	t = ((screen.height - h) / 2 - 40);
	 	full = 0;
	 }
	my_win = open(url, name, "width="+ w +",height="+ h 
		+",left=" + l + ",top=" + t 
		+ ",directories=0,location=0,menubar=0,scrollbars=0"
		+ ",status=0,toolbar=0,fullscreen=" + full 
		+ ",resizable=1");
	my_win.focus();
}

//// move and resize window /////			
function moveAndResize(w,h) {
	if (w == null) {
    	w = 600;
    	h = 450;
	}
    l = ((screen.width - w) / 2);
    t = ((screen.height - h) / 2 - 40);
    window.moveTo(l,60);
    window.resizeTo(w,h);
}

//// controle scripts ////
function checkForm(form, question, answer, questionError, email, emailError) {
	var ret = true;

	if (question) {

		ret = checkQuestion( form.sec_answer.value, answer, questionError);
	}
	if ( ret && email) {
		ret = checkEmail( form.from.value, emailError);
	}
	return ret;
}
function checkQuestion(guess, answer, error) {
	if (guess.toUpperCase() != answer.toUpperCase()) {
		alert(error);
		return false;
	}
	return true;
}
function checkEmail(mail,error) {
	if (mail.match('^[A-z0-9._%+-]+@[A-z0-9.-]+\.[A-z]{2,6}$')) {
		return true;
	}
	alert(error);
	return false;
}


//// end script ////