var win_opened =	0;
var win_offset =	5;
function get_href(e) {
	var targ;
	var ev =	(!e) ?	window.event :	e;
	if (ev.target) {
		targ =	ev.target;
	} else if (ev.srcElement) {
		targ =	ev.srcElement;
	}
	if ((targ.nodeType == 3) || (targ.getAttribute("src"))) {
		targ =	targ.parentNode;
	}
	return targ.getAttribute("href");
}
function opn_get(e, w, h, lo, sc, tb, me, o_l) {
	var saH =	screen.availHeight;
	var saW =	screen.availWidth;
	h =	(document.all) ? h - 25 :	h;
	var e_w =	Math.min(saW - 10, w);
	var e_h =	Math.min(saH - 10, h);
	var url =	get_href(e);
	var l =	Math.max(parseInt((saW - e_w) / 4, 10) + win_opened * win_offset, 0) + o_l;
	var t =	(saH - e_h > 100) ?	Math.max(parseInt((saH - e_h) / 5, 10), 0) - parseInt(o_l / 5, 10) :	0;
	var win =	window.open(url, 'bswin_' + new Date().getTime(), ',width=' + e_w + ',height=' + e_h + ',left=' + l + ',top=' + t + ',location=' + lo + ',scrollbars=' + sc + ',toolbar=' + tb + ',menubar=' + me + ',status=yes,resizable=yes');
	win_opened++;
	return (win) ?  false :	true;
}
function opn_extL1(e) {
	return opn_get(e, 566, 622, 'no', 'yes', 'no', 'yes', 0);
}
function opn_extD3(e) {
	return opn_get(e, 857, 630, 'yes', 'yes', 'yes', 'yes', 0);
}
function opn_ext64(e) {
	return opn_get(e, 698, 550, 'no', 'yes', 'no', 'yes', 0);
}
function opn_parW(e) {
	if ((window.name.indexOf("bswin") != -1) && (window.opener) && ((!window.opener.closed) || (window.opener.closed === false))) {
		return opn_extD3(e);
	} else if ((window.name.indexOf("bswin") == -1) && (window == window.top)) {
		window.location.href =	get_href(e);
		return false;
	} else {
		return opn_extD3(e);
	}
}
function pg_start() {
	var anch, i;
	if (!document.getElementsByTagName) {
		return true;
    }
    if (window.name.indexOf("bswin_") != -1) {
    	if (window.outerWidth) {
			window.outerHeight =	Math.min(screen.availHeight - 80, document.body.clientHeight + 140, 710);
		} else if (document.body.clientHeight) {
			window.resizeTo(document.body.clientWidth + 50, Math.min(screen.availHeight - 80, document.body.clientHeight + 140, 710));
		}
    }
    for (i = 0; (anch = document.getElementsByTagName("a")[i]); i++) {
    	if (anch.getAttribute("href")) {
    		if (anch.getAttribute("rel")) {
        		switch (anch.getAttribute("rel")) {
        		case "external_L1":
					anch.onclick =	opn_extL1;
					break;
        		case "external_D3":
            		anch.onclick =	opn_extD3;
            		break;
        		case "external_Pic":
            		anch.onclick =	opn_ext64;
            		break;
        		}
        	}
    	}
    }
    if (document.forms[0]) {
        document.forms[0].onsubmit =	function() {
			pageTracker._linkByPost(this);
        }
    }
    return true;
}
window.onload = pg_start;