BROWSER = new Object();
BROWSER.isOpera = navigator.userAgent.indexOf("Opera") > -1;
BROWSER.isIE    = navigator.userAgent.indexOf("MSIE") > 1 && !BROWSER.isOpera; 
BROWSER.isMoz   = navigator.userAgent.indexOf("Mozilla/5.") == 0 && !BROWSER.isOpera;

if (typeof($) != "function") $ = function(ID){ return document.getElementById(ID); }

function redirect(id) {
   alert("This link works only in front-end site!")
}

function popupimg(img) {
    var d = new Date()
    var ID = d.getDate()+""+d.getMonth()+1+""+d.getFullYear()+""+d.getHours()+""+d.getMinutes()+""+d.getSeconds();

    var loc = "/enlarge.php?src="+img;
	var win = window.open(loc, "_new"+ID,"toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=200");
	win.location.href = loc;
	win.focus();
}

/* highlist elements onmouse over event
 */
function highlight(groupElements, classOver) {
   var i, j, Obj, groupObjects = [];
   for(j=1; j<100; j++) {
   	   for(i in groupElements) {
   	   	   Obj = $(groupElements[i]+j);
           if (Obj) {
               Obj.ind = j; 
               groupObjects[groupObjects.length] = Obj;
           }
       }
   }
   
   for(i in groupObjects) {
      Obj = groupObjects[i];
      Obj.classDefault = Obj.className;
      Obj.classOver = classOver;
      Obj.groupObjects = groupObjects;
      
      Obj.onmouseover = function() {
      	  this.className = this.classOver;
      	  for(var i in this.groupObjects){
      	      var Obj = this.groupObjects[i]; 
      	  	  if (Obj.ind == this.ind) Obj.className = Obj.classOver;
      	  }
      }
      Obj.onmouseout = function() {
      	  this.className = this.classDefault;
      	  for(var i in this.groupObjects){
      	  	  var Obj = this.groupObjects[i];
      	  	  if (Obj.ind == this.ind) Obj.className = Obj.classDefault;
      	  }
      }
   }
}

function openLink(link) {
   location.href = link;
}

function initMenuRange(menuName, smenuName, sInd, eInd, initPos) {
   var Obj, x, y;
   for(var i=sInd; i<=eInd; i++){
       Obj = document.getElementById(menuName+i);
       sObj = document.getElementById(smenuName+i);
       if (Obj && sObj){
           if (initPos) {
	      	   sObj.style.left = (Obj.offsetLeft + (BROWSER.isMoz ? 40 : 43)) +  "px";
	      	   sObj.style.top = "-24px";
	       }
	       
       	   Obj.submenu = sObj;
       	   Obj.otheronmouseover = Obj.onmouseover;
       	   Obj.otheronmouseout = Obj.onmouseout;
		   Obj.onmouseover = function () {
		   	   this.submenu.style.display = "block";
		   	   if (this.otheronmouseover) this.otheronmouseover();
		   }
		   Obj.onmouseout = function () {
		   	   this.submenu.style.display = "none";
		   	   if (this.otheronmouseout) this.otheronmouseout();
		   }
		   
		   sObj.mainmenu = Obj;
		   sObj.onmouseover = function() {
		   	   this.style.display = "block";
		   	   this.mainmenu.onmouseover();
		   }
		   sObj.onmouseout = function () {
		   	   this.style.display = "none";
		   	   this.mainmenu.onmouseout();
		   }
       }
   }
}