function _PopUpParam (iwidth, iheight, mb, rs, sb, st, tb) {
	var strProperties;
	if ( screen ) {
		var iPosL = (screen.width-iwidth)/2;
		var iPosT = (screen.height-iheight)/2;
	} else {
		var iPosL = 100;
		var iPosT = 100;
	}
	if ( (navigator.appVersion.indexOf("MSIE") != -1) && sb )
		iwidth = iwidth+26;
	strProperties = "width=" + iwidth + ",height=" + iheight;
	strProperties+= ",left=" + iPosL + ",top=" + iPosT + ",directories=0";
	strProperties+= ",hotkeys=1,location=0,menubar=" + mb;
	strProperties+= ",resizable=" + rs + ",scrollbars=" + sb;
	strProperties+= ",status=" + st + ",titlebar=0,toolbar=" + tb;
	return strProperties;
}

function PopUpSimpleNoScroll(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,0,0,0,0,0));
}

function PopUpStatus(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,0,0,1,1,0));
}

function PopUpSimple(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,0,0,1,0,0));
}

function PopUpMenuNoScroll(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,1,0,0,0,0));
}

function PopUpMenu(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,1,0,1,0,0));
}

function PopUpMenuToolBar(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,1,0,1,0,1));
}

function PopUpMenuStatus(PageURL, strName, iwidth, iheight) {
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,1,0,1,1,0));
}

function PopUpMenuReSize(PageURL, strName, iwidth, iheight, realPageURL) {
	var tmp  	= document.location.pathname;
	var b 		= tmp.split("/");
	var val 	= "";

	if ( arguments.length < 5 ) {
		realPageURL = PageURL;
		PageURL = "";
	}

	if ( ! realPageURL.match("about:") ) {
		var bAOL = (b[1] == "aol");
		
		if ( bAOL ) {
			if(b.length < 3){
				b[2]="";
			}
			if(b.length < 4){
				b[3]="";
			}
			if(b.length < 5){
				b[4]="";
			}
			realPageURL = realPageURL + "&_aol=1&_univ=" + b[2] + "&_rub=" +  b[3] + "&marque=" + b[4];
		} else {
			var a = document.location.search.match(/_univ=([0-9]*)/gi);
			if ( a ) {
				realPageURL = realPageURL + "&" + a[0];
				var a = document.location.search.match(/_rub=([0-9]*)/gi);
				if ( a ) {
					realPageURL = realPageURL + "&" + a[0];
				} else {
					realPageURL = realPageURL + "&_rub=";
				}
				realPageURL = realPageURL + "&marque=";
			} else {
				if(b.length < 4){
					b[2]="";
				}
				if(b.length < 5){
					b[3]="";
				}
				realPageURL = realPageURL + "&_univ=" + b[1] + "&_rub=" +  b[2] + "&marque=" + b[3];
			}
		}
	}
	
	if ( PageURL == "" ) {
		PageURL = realPageURL;
	} else {
		PageURL = PageURL + escape(realPageURL);
	}
	return window.open(PageURL, strName, _PopUpParam(iwidth,iheight,1,1,1,0,0));
}

function PMR(PageURL, strName, iwidth, iheight, realPageURL) {
	if ( arguments.length < 5 ) {
		return PopUpMenuReSize(Base64.decode(PageURL), strName, iwidth, iheight);
	} else {
		return PopUpMenuReSize(Base64.decode(PageURL), strName, iwidth, iheight, Base64.decode(realPageURL));
	}
}


function PopUpWindows(PageURL, strName) {	
	return window.open(PageURL, strName,'directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,width=750,height=730');
}

function CheckWindow (obj) {
	if ( obj && !obj.closed )
		obj.close();
}
