var theVersion = parseInt(navigator.appVersion);
var theClient = "low";
var theBrowser = "";

function GetBrowser()
{
	theVersion	= parseInt(navigator.appVersion);
	
	if (navigator.userAgent.indexOf("Opera")!=-1) {
		theClient="opt";
		theBrowser="ie";
		return;
	}

	if (navigator.appName=="Netscape") {
		if (theVersion>3 && theVersion<5) {
			theClient="low";		
			theBrowser="ns";
			return;
		} else {
			theClient="opt";		
			theBrowser="ie";
			return;		
		}
	}
	
	if (navigator.appName=="Microsoft Internet Explorer" && theVersion>=4) {
		theClient="opt";	
		theBrowser="ie";
		if (navigator.appVersion.indexOf("5.")!=-1) theVersion=5;
	}
}

GetBrowser();


var nScrollSpeed = 60;


function MoveLayer(strLayerID,strDirection)
{

	var nFaktor = 1;
	
	if(strDirection=='up') { nFaktor = 1; } else { nFaktor = -1; }
		
	var outerContent = eval("window.document.l"+strLayerID);
	var innerContent = eval("window.document.l"+strLayerID+".document.sl"+strLayerID);
	
	nGetHeight = innerContent.clip.height;
	nClipHeight = outerContent.clip.height;
	
	nCurrentTop = innerContent.top;
	iScroll = nFaktor * nScrollSpeed;
	
//		innerContent.visibility="hide";
						
	if(nFaktor>0) {
		if((nCurrentTop<0) && (nCurrentTop!=0)){
			if(nCurrentTop+iScroll>0) {
				innerContent.moveTo(0,0);
			}	else {
				innerContent.moveBy(0,iScroll);
			}
		}
	}
	
	if(nFaktor<0) {
		if (Math.abs(nCurrentTop)<Math.abs(nGetHeight-nClipHeight)) {
			if (Math.abs(nCurrentTop+iScroll)>Math.abs(nGetHeight-nClipHeight)) {
			  innerContent.moveTo(0,nClipHeight-nGetHeight);
	    }	else {
				innerContent.moveBy(0,iScroll);
			}
		}
	}		
//	innerContent.visibility="show";			
}


function WriteDivHeader(nID,nLeft,nTop,nWidth,nHeight,strColor,strImage)
{
	var strTemp = "";
	if (theBrowser=="ie")	{		
		if (strColor!=null) {
			strTemp = "<div id=\"l"+nID+"\" style=\"position:absolute;background-color:"+strColor+";left:"+nLeft+";top:"+nTop+";width:"+nWidth+";height:"+nHeight+";clip:rect(0 "+nWidth+" "+nHeight+" 0)";
		} else {
			strTemp = "<div id=\"l"+nID+"\" style=\"position:absolute;left:"+nLeft+";top:"+nTop+";width:"+nWidth+";height:"+nHeight+";clip:rect(0 "+nWidth+" "+nHeight+" 0)";
		}
		if (strImage==null) strTemp += "\">\n";
		else strTemp += ";background-image:url("+strImage+");\">\n";
	} else {
		if (strColor!=null) {
			strTemp = "<layer id=\"l"+nID+"\" left=\""+nLeft+"\" top=\""+nTop+"\" width=\""+nWidth+"\" height=\""+nHeight+"\" bgcolor=\""+strColor+"\" clip=\""+0+","+0+","+nWidth+","+nHeight+"\"";
		} else {
			strTemp = "<layer id=\"l"+nID+"\" left=\""+nLeft+"\" top=\""+nTop+"\" width=\""+nWidth+"\" height=\""+nHeight+"\" clip=\""+0+","+0+","+nWidth+","+nHeight+"\"";
		}
		if (strImage==null) strTemp += "\">";
		else strTemp += " background=\""+strImage+"\">";
	}
	return(strTemp);
}
			
function WriteDivTrailer()		
{
	var strTemp = "";

	if (theBrowser=="ie")	strTemp = "</div>";
	else strTemp = "</layer>";
	
	return(strTemp);
}

function WriteIncHeader(nID,strSource,nWidth,nHeight,strColor,bScrolling)
{
	var strTemp = ""
	var strArgs = document.URL;
	var gifWidth = 16;
	var gifHeight = 16;
	var srcGifUp = "/images/b_scroll_up.gif";
	var srcGifDown = "/images/b_scroll_down.gif";
		
	//var nPos = strArgs.indexOf("?");
	//if (nPos==-1) strArgs=""; else strArgs = strArgs.slice(nPos);
		
	//	strSource += strArgs;						
	
	if (theBrowser=="ie")	{		
		strTemp = "<iframe id=\"sl"+nID+"\" border=\"0\" frameborder=\"no\" framespacing=\"0\" width=\""+nWidth+"\" height=\""+nHeight+"\"src=\""+strSource+"\" style=\"background-color:#"+strColor+"\"";					
			
		if (bScrolling==true) strTemp += " scrolling=\"auto\"></iframe>";
		else strTemp += " scrolling=\"no\"></iframe>"; 
	} else {
		if(bScrolling) { nNewWidth = nWidth - gifWidth; }
		else { nNewWidth = nWidth; }
		
		strTemp += "<layer id=\"sl"+nID+"\" width=\""+nNewWidth+"\" height=\""+nHeight+"\" bgcolor=\""+strColor+"\"";
	
		if(strSource=="") {
			strTemp += "></layer>";
		}	else {
			strTemp += " src=\""+strSource+"\"></layer>";
		}
			
		if (bScrolling) {
			strTemp += "<layer id=\"scroll"+nID+"\" left=\""+(nWidth-gifWidth)+"\" width=\""+gifWidth+"\" height=\""+nHeight+"\">";
			strTemp += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
			strTemp += "<TR><TD><a href=\"javascript:void(0);\" onclick=\"MoveLayer('"+nID+"','up');\"><img src=\""+srcGifUp+"\" border=\"0\" width=\""+gifWidth+"\" height=\""+gifHeight+"\"></A></TD></TR>";
			strTemp += "<TR><TD bgcolor=\"#cccccc\"><img src=\"/images/p.gif\" border=\"0\" width=\"1\" height=\""+(nHeight-2*gifHeight)+"\"></TD></TR>";
			strTemp += "<TR><TD><a href=\"javascript:void(0);\" onclick=\"MoveLayer('"+nID+"','down');\"><img src=\""+srcGifDown+"\" border=\"0\" width=\""+gifWidth+"\" height=\""+gifHeight+"\"></A></TD></TR>";
			strTemp += "</table>";
			strTemp += "</layer>";
		}
	}			
	return(strTemp);
}	


