﻿
function is_class(obj,cn) {
 	return new RegExp('\\b'+cn+'\\b').test(obj.className);
}


function pop_find_links(className) {
	if(!document.getElementsByTagName)
		return;
	var links = document.getElementsByTagName('a');
	for(var x=links.length - 1; x>=0; x--) {
		if(is_class(links[x], className)) {
			links[x].onclick = pop_click;
		}
	}
}

function pop_click() {

	var pop;
	if(!is_class(this, "internal"))
		pop = window.open(this.getAttribute('href'), 'popup');
	else
		pop = window.open(this.getAttribute('href'), 'popup', 'width=520,height=600,status=yes,scrollbars=yes');
	
	if (pop == null || typeof(pop)=="undefined") {
		return true;
	} else {
		return false;	
	}
}

pop_find_links('pop');

