var zoomwindow;

function deplace(window,width,height) {
	var scr_x = screen.width;
	var scr_y = screen.height;
	if (is.v >= 4) {
		if (!is.ie) {
			window.moveTo((scr_x/2)-(width/2), (scr_y/2)-(height/2));
		} else {
			window.moveTo(parent.window.screenLeft+300, parent.window.screenTop+150);
		}
	}
}
	
var movePopup = 1;
var scrollPopup = 1;
var modalDialog = 0;
var windowName = "ZOOMWINDOW";

function openPopup(url,width,height, pathname) {
	var reg = new RegExp("[/]+", "g");
	var result = pathname.split(reg);
	
	movePopup = 0;
	scrollPopup = 1;
	modalDialog = 0;
	
	result.reverse();
	url = url + "?page=" + result[1] + "/" + result[0];
	
	if (openPopup.arguments.length >= 4) {
		if (openPopup.arguments[3] != "") {
			windowName = openPopup.arguments[3];
		}
	}
	if (openPopup.arguments.length >= 5)
		movePopup = (openPopup.arguments[4]) ? 1:0; // MOVE ON/OFF
	if (openPopup.arguments.length >= 6)
		scrollPopup = (openPopup.arguments[5]) ? 1:0; // SCROLL ON/OFF
	if (openPopup.arguments.length >= 7)
		modalDialog = (openPopup.arguments[6]) ? 1:0; // MODALDIALOG ON/OFF
	if (url != "") {
		var features;
		if (zoomwindow != null) {
			if (!zoomwindow.closed)
				zoomwindow.close();
		}
		if (modalDialog) {
			width += 6;
			height += 25;
			features = "center:" + movePopup + "; help:0; unadorned:1; status:off; scroll:no; resizable:no; dialogWidth:" + width + "px; dialogHeight:" + height + "px";
			zoomwindow = window.showModalDialog(url,"",features);
		} else {
			features = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + scrollPopup + ",resizable=0,width=" + width + ",height=" + height + "'";
			
			zoomwindow = window.open(url, "serl", "menubar=no, status=no, scrollbars=yes, menubar=no, width=760, height=760");
			
			if (movePopup) deplace(zoomwindow,width,height);
		}
	}
}
