﻿function switchImg(obj,par){
	if(document.getElementById(obj))
		obj=document.getElementById(obj);
	imgName=obj.src;
	imgName=imgName.split("/");
	imgName=imgName[(imgName.length)-1];
	imgPath=obj.src.split(imgName);
	imgPath=imgPath[0];
	imgName=imgName.split(".");
	imgSuffix=imgName[1];
	imgName=imgName[0];
	if(par==1)
		imgName=imgName+"_over."+imgSuffix;
	else{
		imgName=imgName.split("_");
		imgName=imgName[0]+"."+imgSuffix;
	}
	obj.src=imgPath+imgName;
}

function findPosition(obj){
	x=0; y=0; w=0; h=0; var el,temp;
	if(typeof(obj)=="string")
		obj=getE(obj);
	if(obj.offsetParent){
		temp=obj;
		while(temp.offsetParent){
			temp=temp.offsetParent; 
			x+=temp.offsetLeft;
			y+=temp.offsetTop;
		}
	}
	x+=obj.offsetLeft;
	y+=obj.offsetTop;
	w=obj.offsetWidth;
	h=obj.offsetHeight;
	return [x,y,w,h];
}

function extLinks(){ 
	if(!document.getElementsByTagName)
		return; 
	var anchors=document.getElementsByTagName("a"); 
	for(var i=0;i<anchors.length;i++)				
		if(anchors[i].getAttribute("href")&&anchors[i].getAttribute("rel")) 
			anchors[i].target=anchors[i].getAttribute("rel");
}

function bookmark(title,url){
	if(window.sidebar)
		window.sidebar.addPanel(title,url,"");
	else if(window.opera && window.print){
		el=document.createElement('a');
		el.setAttribute('href',url);
		el.setAttribute('title',title);
		el.setAttribute('rel','sidebar');
		el.click();
	}
	else if(document.all)
		window.external.AddFavorite(url,title);
}

function getE(obj){
	return document.getElementById(obj);	
}

function getEe(e){
	return e?e.target:window.event.srcElement;
}

function showE(obj,par){
	if(typeof(obj)=="string")
		obj=getE(obj);
	if(par==1)
		obj.style.display=obj.style.display=="block"?"none":"block";
	else
		obj.style.display="block";	
}

function hideE(obj){
	if(typeof(obj)=="string")
		obj=getE(obj);
	obj.style.display="none";	
}

function isDigit(e){
	e=e||event;
	iCode=(e.keyCode||e.charCode);
	return((iCode>=48&&iCode<=57)||(iCode>=37&&iCode<=40)||iCode==8||iCode==46);
}

function sendMessage(str1,str2,str3){
	tmp="ma" +"ilto:";
	tmp+=str3+"&#";
	tmp+="64;";
	tmp+=str2;
	window.location=tmp+"."+str1;
	return false;
}

var wm=null;

onload=function(){
	menu_onload();
	extLinks();
	if(wm)webmin_init();
	if(getE("wm_search")){
		getE("wm_search").onfocus=function(){
			if(this.value==this.title)
				this.value='';
		}
		getE("wm_search").onblur=function(){
			if(this.value=='')
				this.value=this.title;
		}
	}			
};

/*  */
function showMenu(obj){
	el=obj.nextSibling;
	el.className=el.className=="off"?"on":"off";
}

function addReply(tid,qid){
	window.name="openerWin";
	win=open("","replyWin","width=500,height=316,top="+((screen.height/2)-(316/2))+",left="+((screen.width/2)-(500/2))+",toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no");	
	var content='<html><head><title>'+document.title+' - Reagieren</title><style>body{font-family:arial}form{margin:0px;}input,textarea{width:100%;border:solid 1px #bfbfbf;}input.forum_button{background-color:#ffffff;width:auto;cursor:pointer;color:#9c3032;font-weight:bold;margin-top:4px;}</style></head><body><div style="background-color:#9f060b;color:#ffffff;padding:5px;">Forum - Reagieren</div><br /><form method="post" action="'+absPath+'/forum/" target="openerWin" onsubmit="window.close();">Titel:<br /><input type="text" name="title" /><br />Text:<br /><textarea name="txt" style="height:150px"></textarea><br /><input type="submit" value="Eintragen" class="forum_button" /><input type="hidden" name="tid" value="'+tid+'" /><input type="hidden" name="qid" value="'+qid+'"><input type="hidden" name="action_type" value="post_reply"></form></body></html>';
	win.document.open();
	win.document.write(content); 
	win.document.close();

}