function doOnLoad(){
 	if(typeof(isTextMenu)!="undefined"){setTextMenu();}
	if(typeof(isClickGalerie)!="undefined"){setGalerieTextLayer();}
}
function doOnResize(){
	if(bw.ns4){location.reload();}
	if(typeof(isTextMenu)!="undefined"){setTextMenu();}
	if(typeof(isClickGalerie)!="undefined"){setGalerieTextLayer();}
}
function makeBrowser(){
        this.ver=navigator.appVersion;
        this.dom=document.getElementById?1:0;
        this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
        this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
        this.ie4=(document.all && !this.dom)?1:0;
        this.ns6=(this.dom && !document.all)?1:0;
        this.ns5=(this.dom && parseInt(this.ver) >= 5 && !this.ver.indexOf("Netscape6")) ?1:0;
        this.ns4=(document.layers && !this.dom)?1:0;
    this.opera = (navigator.userAgent.indexOf("Opera") != -1);
        this.mac=(navigator.platform.indexOf("Mac")!= -1);
        if (this.ie6) this.ie5=true;
        this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ns6 || this.opera);
        return this;
}
bw=makeBrowser();
function mark(inName)
{
  if (bw.ns4)
    document.write('<ilayer name="'+inName+'">&nbsp;</ilayer>');
  else 
    document.write('<div id="'+inName+'">&nbsp;</div>');
}
function setLayerToLayer(inSource,inDestination)
{
  if (bw.ns4) {
   var derlayer = document.layers[inDestination];
    var anzlayer = document.layers[inSource];
    anzlayer.pageX = derlayer.pageX;
    anzlayer.pageY = derlayer.pageY;
    anzlayer.visibility = 'show';
   
  }else  if(document.all){
     var derlayer = document.all[inDestination];
    var anzlayer = document.all[inSource];
    anzlayer.style.posLeft = getLeft(derlayer);
    anzlayer.style.posTop = getTop(derlayer);
    anzlayer.style.visibility = 'visible';
  }else{
     var derlayer = document.getElementById(inDestination);
    var anzlayer = document.getElementById(inSource);
    anzlayer.style.left = getLeft(derlayer);
    anzlayer.style.top = getTop(derlayer);
    anzlayer.style.visibility = 'visible';
  }
}
function getLeft(l)
{
  if (l.offsetParent) return (l.offsetLeft + getLeft(l.offsetParent));
  else return (l.offsetLeft);
}
function getTop(l)
{
  if (l.offsetParent) return (l.offsetTop + getTop(l.offsetParent));
  else return (l.offsetTop);
}
function setLayerToImg(inSource,inDestination,inOffx,inOffy)
{

 if(bw.ns4){
  	var pos = document.images[inDestination];
  	document.layers[inSource].pageX = pos.x+inOffx;
     document.layers[inSource].pageY = pos.y+inOffy;
     document.layers[inSource].visibility = 'show';
 }else if(document.all){
  	var pos = document.all[inDestination];
  	document.all[inSource].style.posLeft = getLeft(pos)+inOffx;
  	document.all[inSource].style.posTop = getTop(pos)+inOffy;
  	document.all[inSource].style.visibility='visible';
 }else{
  	if(document.images){
  		pos=document.images[inDestination];
	}else{
		pos=document.getElementById(inDestination);
	}
  	document.getElementById(inSource).style.left = getLeft(pos)+inOffx;
  	document.getElementById(inSource).style.top = getTop(pos)+inOffy;
  	document.getElementById(inSource).style.visibility='visible';
 }
}

var curVisible=-1;
var c=0;
var lastCellId=-1;
var firstDiv=-1;
var pagesAr=new Array();
var isValidBrowser =document.getElementById;

var browsePrevImg;
var browseNextImg;

function initDivs(inId){
 if(!isValidBrowser){return(false);}
 document.getElementById(inId).style.display="none";
 if(firstDiv==-1){firstDiv=inId};
}

function showDiv(inId){
	if(!isValidBrowser){return(false);}
    if(document.getElementById("button_"+inId)){
            if (curVisible!=-1){
              document.getElementById(curVisible).style.display="none";
                document.getElementById("button_"+curVisible).style.fontWeight="normal";
             }
			 
     	document.getElementById("button_"+inId).style.fontWeight="bold";
		
     	document.getElementById(inId).style.display="block";
     	curVisible=inId;
    }
}


function addToPagesAr(inId){
	if(!isValidBrowser){return(false);}
	pagesAr[pagesAr.length]=inId;
}

function makePagesMenu(){
	if(!isValidBrowser){return(false);}	
	var str="<table width='366' border='0' class='newsTextMenu'>"
	var c=0;
	for(var i=0;i<pagesAr.length;i++){
		
		var theId=pagesAr[i];
		var h=document.getElementById("head_"+theId);
 
	  	var d =document.createElement("div");
		var theAdd="";
		theAdd="onClick='showDiv(" + String.fromCharCode(34)+ theId + String.fromCharCode(34)+ ")'";
		if(c==0){
			str+="<tr><td width='6'>&nbsp;</td><td width='170' class='newsTextButton'><a id='button_"+theId+"' class='f11darkblue' href='javascript:void(0);' "+theAdd+">"+h.innerHTML+"</a></td><td width=2></td>";
			if(i==pagesAr.length-1){str+="<td width='170' class='f11white'>&nbsp;</td><td width='6'>&nbsp;</td></tr>";}
		}
		if(c==1){
			str+="<td width=170 class='newsTextButton'><a id='button_"+theId+"' class='f11darkblue' href='javascript:void(0);' "+theAdd+">"+h.innerHTML+"</a></td><td width=6>&nbsp;</td></tr>";
		}
	    
		c+=1;
		if (c>1){c=0;}
	}
	str+="</table>"
	document.getElementById("textMenu").innerHTML=str;
	 if(document.getElementById("textMenu").hasChildNodes()){
        if(document.getElementById("textMenu").childNodes.length>0){
			if(pagesAr.length>1){
            	document.getElementById("textMenu").style.display="block";
			}
        }
    }
}
