function hideMenu(num)
{
	divname = 'popup'+num;
	eval(layerRef+divname+layerPostfix+styleSwitch+".visibility=(isNC4?'hide':'hidden')");
	mName = "m"+num;
	if (document.images) document[mName].src = menuOff[num].src;
}

function showMenu(num)
{
	for(i=1;i<=menuCount;i++)
		if (i!=num) hideMenu(i);

	divname = 'popup'+num;
	eval(layerRef+divname+layerPostfix+styleSwitch+".visibility=(isNC4?'show':'visible')");
}

function st(s)
{
	if(!s) s='';
	window.status=s;
}

timeId = '';

function timer(num)
{
	timeId = setTimeout("hideMenu("+num+")",timeOut);
}

function cl()
{
	if(timeId) clearTimeout(timeId);
}

function che(menuId,strId,action)
{
	var divname = 'menu'+menuId+'_'+strId;
	
	cl();
	if(action==1) className = 'menu2';
	else className = 'menu1';
	
	eval(layerRef+"menu"+menuId+"_"+strId+layerPostfix+".className='"+className+"';");
}

function mOn(num)
{
	mName = "m"+num;
	if (document.images) document[mName].src = menuOn[num].src;
	cl();
	showMenu(num);
}

function mOff(num)
{
	mName = "m"+num;
	var timeOut = 2000; /*ms*/
	if (document.images) document[mName].src = menuSel[num].src;
	timeId = setTimeout("hideMenu("+num+")",timeOut);
}

function bigfoto(id,title)
{
	//LeftPosition=(screen.width)?Math.round((screen.width-w)/2):100;
	//TopPosition=(screen.height)?Math.round((screen.height-h)/2):100;
	//alert(LeftPosition + ' ' + TopPosition);
	//if ( (screen.height-h-20 < 0) || (screen.width-w-16 < 0) ) scrstate=1; else scrstate=0;
	scrstate = 0;
	//opts='top=' + TopPosition + ',left=' + LeftPosition + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+scrstate+',resizable=0';
	opts='top=20,left=20,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0';
	str="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"><html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">\n<title>"+title+"</title>\n</head>\n<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>\n<img name=\"pic\" src='"+id+"' alt='"+title+"\n(click to close)' onclick='javascript: self.close();'>\n</body>\n</html>";
	f_win = window.open("","BigFoto",opts);
	f_win.document.writeln(str);
	f_win.document.close();
	f_win.resizeTo(f_win.document.pic.width,f_win.document.pic.height);
	f_win.focus();
}
function PopupPic(sPicURL) { 
  f_win = window.open( "./popup.html?"+sPicURL, "",  
  "resizable=1,scrollbars=1,HEIGHT=600,WIDTH=800,top=10,left=50"); 
} 

function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function acePopup(mypage,myname,w,h,isscrollbars,pos,infocus)
{
  if (isNaN(w)) w = 640;
  if (isNaN(h)) h = 430;
	if(isscrollbars == 'undefined' ) isscrollbars ='no';
	if(pos == 'undefined' ) pos = 'center';
	if(infocus == 'undefined' ) infocus = '';
				
	var scroll = ",scrollbars=no,resizable=no";	

	if (isscrollbars == 'yes'){
		scroll = ",scrollbars=yes,resizable=yes";}

	if(pos=='random')
	{
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=='center')
	{
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else
		if((pos!='center' && pos!='random') || pos==null)
		{
			LeftPosition=100;
			TopPosition=100;
		}


		settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + scroll + ',location=no,directories=no,menubar=no,toolbar=no,status=no,dependent=no';

		acePopupWindow=window.open('',myname,settings);
		if(infocus=='back')
		{
			acePopupWindow.blur();
			acePopupWindow.location=mypage;
			acePopupWindow.blur();
		}
		else
		{
//			acePopupWindow.focus();
 			acePopupWindow.location=mypage;
 		}
}

function changeselection(id_pref, cnt)
{
	for(i = 0; i < cnt; i++){
		eval(layerRef+id_pref+i+layerPostfix+'.checked = !'+layerRef+id_pref+i+layerPostfix+'.checked');
	}
}

function isChecked(id_pref, cnt){
	for(i = 0; i < cnt; i++){
		if (eval(layerRef+id_pref+i+layerPostfix+'.checked == true')) {return true; break};
	}
	alert('At least one item should be checked !');
	return false;
}