
	function popupWindow(url,w,h) {

		windowprops = "height="+h+",width="+w+",location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no,titlebar=no,status=no"
		window.open(url, "Picture" + w + h, windowprops);
	}
	
	function popupScrolerWindow(url,w,h) {
		windowprops = "height="+h+",width="+w+",location=no,scrollbars=yes,menubar=no,toolbar=no,resizable=yes,titlebar=no,status=no";
	 	window.open(url, "Picture" + w + h, windowprops);
	}

		
	function popupSurvey(form,operate) {

		optionid=0
		h=387
		w=500
		windowprops = "height="+h+",width="+w+",location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no,titlebar=no,status=no"
		
	    for (i=0; i<form.answerid.length; i++) {
			if (form.answerid[i].checked) {
				optionid = form.answerid[i].value
			}
		}		
	
		if (operate==2) optionid=0
		window.open(form.action + "?surveyid=" + form.surveyid.value + "&optionid=" + optionid + "&operate=" + operate + "&comment=" + form.surveycomment.value , "Anketa", windowprops);
	}

	function resizetext(action) 			
	{
		if (action == 1) {	
			if (document.getElementById("bodytext").style.fontSize == '13px') 
				{ document.getElementById("bodytext").style.fontSize = 11; }
			if (document.getElementById("bodytext").style.fontSize == '16px') 
				{ document.getElementById("bodytext").style.fontSize = 13; }
			if (document.getElementById("bodytext").style.fontSize == '20px') 
				{ document.getElementById("bodytext").style.fontSize = 16; }					
		} else {
			if (document.getElementById("bodytext").style.fontSize == '16px') 
				{ document.getElementById("bodytext").style.fontSize = 20; }
			if (document.getElementById("bodytext").style.fontSize == '13px') 
				{ document.getElementById("bodytext").style.fontSize = 16; }
			if (document.getElementById("bodytext").style.fontSize == '11px') 
				{ document.getElementById("bodytext").style.fontSize = 13; }
		}
	}			

	
function check_number(e)
	{
		var ns = (navigator.appName == "Netscape");

		if(ns) var key_index = e.which;
		else var key_index = window.event.keyCode;

		// status = 'key pressed = '+key_index;
		// only allow numbers and backspace
		if(key_index>47 && key_index<58 )
		return true;
		else
		return false;
	}	
		
function replaceImage(mainimage,sourceimage,src,value) 
	{
		document.images[document.images[mainimage].orgsrc].src = document.images[document.images[mainimage].orgsrc].orgsrc;
		document.images[mainimage].src = src;
		document.images[mainimage].value = value;
		document.images[sourceimage].src = 'images/transparent.gif';
		document.images[mainimage].orgsrc = sourceimage
		
	}
	
function showLargeImage(mainimage)
	{
		h = 600;
		w = 500;
		url = "largeimage.aspx" + document.images[mainimage].value;
		windowprops = "height="+h+",width="+w+",location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no,titlebar=no,status=no";
	 	window.open(url, "Image", windowprops);
	}

function imgErrorFunc(jdocid) 
	{   
		jdocid.src = 'images/transparent.gif';
	}	
	
var StayAlive = 10; // Number of seconds to keep window open
function KillMe()
{
	setTimeout("self.close()",StayAlive * 1);
}	

// menu bar
	
	
function InitMenu()
   {
     var bar = menuBar.children     

     for(var i=0;i < bar.length;i++) 
        {
          var menu=eval(bar[i].menu)
          menu.style.visibility = "hidden"
          bar[i].onmouseover = new Function("ShowMenu("+bar[i].id+")")
          var Items = menu.children
          for(var j=0; j<Items.length; j++)
            {
              var menuItem = eval(Items[j].id)
                
                if(menuItem.menu != null)
                   { 
                    menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow class='Arrow'>4</Span>"
                    //var tmp = eval(menuItem.id+"_Arrow")
                    // tmp.style.pixelLeft = menu.getBoundingClientRect().Right //- tmp.offsetWidth - 15
                    FindSubMenu(menuItem.menu)}
               
                 if(menuItem.cmd != null) 
                   {
                   menuItem.onclick = new Function("Do("+menuItem.id+")") } 
                   
              menuItem.onmouseover = new Function("highlight("+Items[j].id+")")
            
            }    
        
        }  
   }
   function FindSubMenu(subMenu)
   {
         var menu=eval(subMenu)
         var Items = menu.children
          for(var j=0; j<Items.length; j++)
            {
              menu.style.visibility = "hidden"
              var menuItem = eval(Items[j].id)
              
              
              if(menuItem.menu!= null)
                 {
                    menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow class='Arrow'>4</Span>"
                    // var tmp = eval(menuItem.id+"_Arrow")
                    //tmp.style.pixelLeft = 35 //menuItem.getBoundingClientRect().right - tmp.offsetWidth - 15
                    FindSubMenu(menuItem.menu)
                 }

                 if(menuItem.cmd != null) 
                   {
                   menuItem.onclick = new Function("Do("+menuItem.id+")") } 
                  
              menuItem.onmouseover = new Function("highlight("+Items[j].id+")")
                 
            }  
   } 
   function ShowMenu(obj)
   {
     HideMenu(menuBar)
     var menu = eval(obj.menu)
     var bar = eval(obj.id)
     bar.className="barOver"
     menu.style.visibility = "visible"
     menu.style.pixelTop =  obj.getBoundingClientRect().top + obj.offsetHeight + Bdy.scrollTop - 2
     menu.style.pixelLeft = obj.getBoundingClientRect().left + Bdy.scrollLeft - 9
   }
   
   function highlight(obj)
   {
     var PElement = eval(obj.parentElement.id)
     if(PElement.hasChildNodes() == true)
     {  var Elements = PElement.children
       for(var i=0;i<Elements.length;i++)
       {
          TE = eval(Elements[i].id)
          TE.className = "menuItem"
       }
      } 
     obj.className="ItemMouseOver"
     window.defaultStatus = obj.title
     ShowSubMenu(obj)
   }
   
   function Do(obj)
   {
    var cmd = eval(obj).cmd	
    window.navigate(cmd)
     
   }
   
   function HideMenu(obj)
   {
          if(obj.hasChildNodes()==true)
              {  
                 var child = obj.children     
                 
                 for(var j =0;j<child.length;j++)
                  {
                     if (child[j].className=="barOver")
                     {var bar = eval(child[j].id)
                      bar.className="Bar"}
                      
                     if(child[j].menu != null)
                       {
                          var childMenu = eval(child[j].menu)
                          if(childMenu.hasChildNodes()==true) 
                               HideMenu(childMenu)
                          
                           childMenu.style.visibility = "hidden" 
                         }
                  }
              
              }
   }
  function ShowSubMenu(obj)
  {
     PMenu = eval(obj.parentElement.id)
      HideMenu(PMenu)
     if(obj.menu != null)
     {
     var menu = eval(obj.menu)
     menu.style.visibility = "visible"
     menu.style.pixelTop =  obj.getBoundingClientRect().top + Bdy.scrollTop
     menu.style.pixelLeft = obj.getBoundingClientRect().right + Bdy.scrollLeft
     if(menu.getBoundingClientRect().right > window.screen.availWidth )
       menu.style.pixelLeft = obj.getBoundingClientRect().left - menu.offsetWidth 
    }
  } 
	