var pop_page_features = "toolbar=1,location=1,statusbar=1,menubar=1,scrollbars=1,resizable=1,width=600,height=500";
var pop_page_name = "resource";

function popPage(url) {
	newwindow=window.open(url.getAttribute('href'),pop_page_name, pop_page_features);
	if (window.focus) {
		newwindow.focus();
	}
	return false;
}

var pop_img_features = "width=600,height=400";
var pop_img_name = "resourceimage";

function popImg(url, imgwidth, imgheight) {
	newwindow=window.open(url.getAttribute('href'),pop_img_name,"width="+imgwidth+",height="+imgheight+",scrollbars=yes");
	if (window.focus) {
		newwindow.focus();
	}
	return false;
}

// function to open a pop-up, resize it and center
function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
// example link: <a href="somewhere.html" onclick="newWindow(this.href, 'popup', 640, 480, 1, 1, 1, 1, 1, 1, 0);">
	// test for set window width and height
	if( (a_int_windowWidth != 640) || (a_int_windowHeight != 480) ){
		// set default width and height
		a_int_windowWidth = 640;
		a_int_windowHeight = 480;
	}
	// test for window size and calculate 70%/60% of width/height
	if (window.screen) {
		 ww = parseInt(window.screen.width * 0.70);
		 wh = parseInt(window.screen.height * 0.60);
		// test if window size and use either default or 80% width and height
		(ww < 640) ? a_int_windowWidth = 640 : a_int_windowWidth = ww;
		(wh < 480) ? a_int_windowHeight = 480 : a_int_windowHeight = wh;
	}
	// calculate window position
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
	// open window
	var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
}