
if(window.addEventListener)
window.addEventListener('load',
function() // global window onload
{
    var a = document.getElementsByTagName("a");
    for(var i=0;i<a.length;i++)
        if(hasClass(a[i],"new_window"))
            a[i].onclick = openNew;
},false);
else if(window.attachEvent)
window.attachEvent('onload',
function()
{
    var a = document.getElementsByTagName("a");
    for(var i=0;i<a.length;i++)
        if(hasClass(a[i],"new_window"))
            a[i].onclick = openNew;
});

function openNew()
{	
	var winName = this.className.match(/popup_(\S+)/);
	var win;
	if (this.className && winName && winName.length==2)
		win = window.open(this.href,winName[1],
'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=547,height=610,left=400,top=90');
	else
	    win = window.open(this.href,"_blank"+(new Date()).getTime(),
'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=547,height=610,left=400,top=90');

    if (win) win.focus();
	return !!!win;
}

function hasClass(e,c)
{
    if (!e.className)
        return false;
    if (e.className==c)
        return true;

    return (new RegExp("(^|\\s+)"+c+"(\\s+|$)")).test(e.className);
    //return (new RegExp("(^|\\s+)"+(c.replace(/([.?*+^$[\]\\(){}-])/g, "\\$1"))+"(\\s+|$)")).test(e.className);
}


