nav = navigator.appName.indexOf("Microsoft")!= -1 ? 1 : 2;

function popup(url, name, width, height, scroll, modal, resizable) {
	width=Math.min(screen.availWidth,width);
	height=Math.min(screen.availHeight-40,height);
	var poz_x=(screen.availWidth-width)/2;
	var poz_y=(screen.availHeight-height-30)/2;
	newwin=window.open(url, name, 'scrollbars='+scroll+', menubar=no, width='+width+', height='+height+', resizable='+(resizable ? 'yes' : 'no')+',toolbar=no, left='+poz_x+', top='+poz_y+', location=no, status=no');

	if(modal){
		popInt=setInterval(function(n){
			if(typeof(newwin.name)=="string"){
				if(newwin.document.body){
					openerfocus=function(){
						if(typeof(newwin.name)=="string"){
							newwin.focus();
						}else{
							document.body.onfocus=null;
						}
					}
					document.body.onfocus=openerfocus;
					newwin.window.document.body.onunload=function(){alert(66)}
					newwin.focus();
					/*with(newwin){
						self.focus()
						opener.document.body.onfocus=function(){self.focus();opener.alert(4);}
						self.document.body.onunload=function(){opener.document.body.onfocus=null}
					}*/
					clearInterval(popInt);
				}
			}else{
				clearInterval(popInt)
			}
		},1)
	}
}

function rand( min, max ) {
	var argc = arguments.length;
	if (argc == 0) {
		min = 0;
		max = 2147483647;
	} else if (argc == 1) {
		throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
	}
	return Math.floor(Math.random() * (max - min + 1)) + min;
}

function meniu(tip,cod_categorie){
	if(tip=="over"){
		if(document.getElementById('a'+cod_categorie)){
			document.getElementById('a'+cod_categorie).style.display='';
		}
	}else{
		if(document.getElementById('a'+cod_categorie)){
			document.getElementById('a'+cod_categorie).style.display='none';
		}
	}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
