// JavaScript Document
function launchCenter(url, name, height, width) {
var str = "height=" + height + ",innerHeight=" + height;
str += ",width=" + width + ",innerWidth=" + width;
if (window.screen) {
	var ah = screen.availHeight - 30;
	var aw = screen.availWidth - 10;
    var xc = (aw - width) / 2;
	var yc = (ah - height) / 2;
	str += ",left=" + xc + ",screenX=" + xc;
	str += ",top=" + yc + ",screenY=" + yc;
	str += ",scrollbars=yes,resizable=no";
	}
	return window.open(url, name, str);
}
				
function avaAken(url,frmname,width,height)
{
	if(!width)width=560;
	if(!height)height=590;
	var artikkel = launchCenter(url, frmname, width,height);
}



function jumpSeaded(type){ 

var width=560;
var height=590;
var frmname = 'Seaded';
var selObj = findObj(type);
if(selObj.value)
	{
		var conf = findObj('conf'+selObj.options[selObj.selectedIndex].value);		
		//var conf = findObj('conf'+selObj.options[selObj.selectedIndex].value);		
		var url = '../system/'+conf.value+'/seaded.php';
		var artikkel = launchCenter(url, frmname, width,height);
	}
else{
		alert('Vali moodul!');
	}
}


function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function changeView(hide)
{
obj = findObj(hide);
 if (obj)
  {
  	if(obj.className=='hide')
		{
		obj.className='show';	
		}
	else{
		obj.className='hide';
	}
  
  }
}

function hide(hide,show,hide2)
{
obj = findObj(hide);
obj2= findObj(show);
obj3= findObj(hide2);
obj4= findObj('sisu3');
 if (obj)
  {
  	if(obj.className=='hide')
		{
		obj2.className='hide';
		//obj3.className='hide';
		obj.className='show';	
		obj4.disabled="true";	
		obj3.disabled="";	
		}
	else{
		obj.className='hide';
		obj2.className='show';
		obj3.className='show';
		obj3.disabled="true";	
	}
  
  }
}

function hideThis(hide)
{
obj = findObj(hide);
 if (obj)
  {
  	obj.filters[0].Apply();
	obj.className='hideMenu';
	obj.filters[0].Play();
  }
}


function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj+"'");
  if (restore) selObj.selectedIndex=0;
}


function ShowMenu(object)//menüü näitamiseks
{
obj = findObj(object);
if (obj)
  {
  	if(obj.className=='hideMenu')
		{
		obj.filters[0].Apply();
		obj.className='showMenu';
		obj.filters[0].Play();	
		return true;
			}
	else{		
		obj.filters[0].Apply();
		obj.className='hideMenu';
		obj.filters[0].Play();
	return true;
			} 

  }
}

function menuOut(Menu) {

	if(Menu){
		timeOn = setTimeout("hideThis('"+Menu+"')", 500);
	}
	else{
 	timeOn = setTimeout("hideAllMenus()", 500);
	}
}

function menuOver() {
 clearTimeout(timeOn);
 timeOn=null;
}

function hideAllMenus(def, numMenusDef, menuDef) {
	if(!numMenusDef){numMenusDef=10}
	else{numMenusDef=numMenusDef;}
	if(!def){def='a';}
	else{def='a'+def;}
	if(!menuDef){menuDef='';
			for(counter = 1; counter <= numMenusDef; counter++) {
				hideThis(def + counter);
		   }
	   }
	else{hideThis(menuDef);}
    
}
var timeOn = null;

function onOver(object) {

	obj = findObj(object);
	obj.className='showMenu';
	
	
}

function remote2(url){
window.opener.location=url;
}

