function MM_swapImgRestore() { //v3.0
	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() { //v3.0
	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) { //v3.0
	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() { //v3.0.0
    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];} 
}




  // opens a new window for the image. scrolling=yes, resizing=true
  function MBImagePopup( URL, width, height )
  {

    var my_height, my_width, my_style, newwin;
    my_height = height;
    my_width = width;

    my_style = "menubar=no,status=no,scrollbars=yes,resizable=yes";

    if(my_height<=0) my_height=400;
    if(my_height>750) my_height = 750;
    if(my_width<=0) my_width=600;
    if(my_width>1000) my_width = 1000;

    if( width>0 ) // use given width
      my_style += ",width=" + my_width;

    if( height>0 ) // use given height
      my_style += ",height=" + my_height;

  
     newwin = window.open(URL , 'mbimagepopup', my_style );
     newwin.focus();

    //return newwin;
  }


  // opens a new window for storing conditions
  function MBConditionPopup( URL )
  {
    var newwin; 
    window.open( URL, 'mbconditionpopup', 'menubar=no,status=no,scrollbars=yes,resizable=yes,width=520,height=250' );
    return newwin; 
  }



function openTab(theDivId){
	var theid=document.getElementById(theDivId);
	var theidP=document.getElementById(theDivId + 'p');
	var theidM=document.getElementById(theDivId + 'm');
	if (theid.style.display=="block")
	{
		theid.style.display="none";
		theidP.style.display="block";
		theidM.style.display="none";
	}
	else
	{
		theid.style.display="block";
		theidP.style.display="none";
		theidM.style.display="block";
	}
}


function winOpen(URL, target, options)
{
    var newwin; 
    window.open( URL, target, options);
    return newwin; 
}


function openTabStem(theStemId){
	var theid=document.getElementById(theStemId);
	var theid1=document.getElementById(1);
	var theid2=document.getElementById(2);
	var theid3=document.getElementById(3);

	if (theStemId != 1) theid1.style.display="none";
	if (theStemId != 2) theid2.style.display="none";
	if (theStemId != 3) theid3.style.display="none";

	if (theid.style.display=="block")
	{
		theid.style.display="none";
	}
	else
	{
		theid.style.display="block";
	} 
	
}

function openTabnoPics(theStemId, maxId){
	var theid=document.getElementById(theStemId);
	var i;
	theidA = new Array(); 
	
	for(i=1;i<=maxId;i++)
	{
	    theidA[i]=document.getElementById(i);
    	if (theStemId != i) theidA[i].style.display="none";
	    
    	if (theStemId == i) document.getElementById(i + 'a').className = 'folder_link_active';
    	if (theStemId != i) document.getElementById(i + 'a').className = 'folder_link';
	}

	if (theid.style.display=="block")
	{
//		theid.style.display="none";
	}
	else
	{
		theid.style.display="block";
	} 
	
}

function openTabAbout(theStemId, maxId){
	var theid=document.getElementById(theStemId);
	var i;
	theidA = new Array(); 
	
	for(i=1;i<=maxId;i++)
	{
	    theidA[i]=document.getElementById(i);
    	if (theStemId != i) theidA[i].style.display="none";
	    
    	if (theStemId == i) document.getElementById(i + 'a').className = 'folder_link_active';
    	if (theStemId != i) document.getElementById(i + 'a').className = 'folder_link';
    	if (theStemId == i) document.getElementById(i + 'p').style.display="block";
    	if (theStemId != i) document.getElementById(i + 'p').style.display="none";
	}

	if (theid.style.display=="block")
	{
//		theid.style.display="none";
	}
	else
	{
		theid.style.display="block";
	} 
	
}

function HideElement(idStart, idEnd){
         for(i=idStart;i<=idEnd;i++) document.getElementById(i).style.display = 'none';
}
/*
function HideElement(idEnd){
         for(i=0;i<idEnd;i++) document.getElementById(i+1).style.display = 'none';
}
*/
