var color = 1;

function window_o(link,v_w,v_h) {

	if (!v_w) {
		v_w = 640;
	}
	if (!v_h) {
		v_h = 530;
	}

	if (link != "") {
		window.open('' + base_href + link + '','','width=' + v_w + ' ,height=' + v_h + ' ,scrollbars=yes');
	}
}

function help(a,b,v_w,v_h) {

	if (!v_w) {
		v_w = 400;
	}
	if (!v_h) {
		v_h = 300;
	}

	if (a != "" && b != "") {
		window.open('' + base_href + 'help?a=' + a + '&b=' + b + '','','width=' + v_w + ' ,height=' + v_h + ' ,scrollbars=no');
	}
}

function st_txtc(status) {

	if (status == "n") {
		txt_c = "m_tn";
	} else {
		txt_c = "m_t";
	}
}

function t_item(status,link,header) {

	st_txtc(status);

	var header_length = header.length
	if (header_length > 20) {
		var header_s = header.substring(0,20) + "...";
	} else {
		var header_s = header;
	}
	header = header.replace(/\'/g, "");

	document.write("<a class='" + txt_c + "' href='" + link + "' acronym title='" + header + "'>" + header_s + "</a><br>");
}

function event_subs(SubsID, EventID, UserID, UserName, status, desc, betaald) {

	var desc_length = desc.length;
	if (desc_length > 25) {
		var desc_s = desc.substring(0,25) + "...";
	} else {
		var desc_s = desc;
	}

	if (color == 1) {
		var bg_color = "#EEEEEE";
	} else {
		var bg_color = "#FFFFFF";
	}

	document.write("<tr bgcolor='" + bg_color + "' valign=top>");
	document.write("<td class='body' width='20'><a href='event/subs_edit?SubsID=" + SubsID + "'><img src='img/post/edit.gif' border='0'></a></td>");
	document.write("<td class='body' width='150'><a class='c_l' href='user/" + UserID + "'>" + UserName + "</a></td>");
	document.write("<td class='body' width='150'>" + status + "</td>");
	document.write("<td class='body' width='180'><a acronym title='" + desc + "'>" + desc_s + "</a></td>");
	document.write("<td class='body' width='100'>" + betaald + "</td></tr>");

	color = color * -1
}

function img_resize(max_width){

	if (max_width == undefined) max_width = 500;

	var i = 0;
	while (document.images.length > i) {
		
		var img = document.images[i]
		if (img.width > max_width && !img.src.match(/(img\/c\/s.gif)/) && !img.src.match(/(img\/c\/dot.gif)/)) {
			
			img.width = max_width; img.height = Math.floor(img.height/(img.width/max_width));
			img.style.borderStyle = "dashed"; img.style.borderWidth = "2"; img.style.borderColor = "#0088FF"; img.style.cursor = "pointer";
			if (img.parentNode.tagName.toLowerCase() != "a")	img.onclick = img_open;
						
		}		
		i++;
	}
}

function img_open() {
	
	window.open(this.src);
	
}