﻿// JavaScript Document

function fnBildwechsel (Bildelement,Bildneu) {
 Bildelement.src = Bildneu.src;
}
function fnTitelSetzen (T) {
	window.document.title = T;
}
function fnFokus (F) {
  F.focus();
}
function fnCheckboxSet(form,requester) {
	// form -> formname
	// requester -> anfordernde Checkbox
	var f = document.forms[form];
	for (var i = 0; i < f.elements.length; i++) {
		if (f.elements[i].type == 'checkbox' && f.elements[i] != requester)
			f.elements[i].checked = requester.checked;
	}
}
function fnZindex(elementid,zIndex) {
 document.getElementById(elementid).style.zIndex=zIndex;
}
function fnMsecod() {
	var jetzt = new Date();
	return (jetzt.getUTCHours()*3600*1000+jetzt.getUTCMinutes()*60*1000+jetzt.getUTCSeconds()*1000+jetzt.getUTCMilliseconds());
}
function fnSimpleMail(Sin,Char) {
	var S="";
	var i=Sin.length;
	for (j=0;j<i;++j) {
		if (Sin.substr(j,1)==Char) {
			S = S + '@';
		}
		else {
			S = S + Sin.substr(j,1);
		} 
	}
	location.href = 'mailto:' + S;
}
function fnModObj(obj,Msec,ModXpos,ModYpos,ModHeight,ModWidth,ModOpacity) { // modify object
	if (parseInt(obj.style.left) == ModXpos
	&& parseInt(obj.style.top) == ModYpos
	&& parseInt(obj.style.height) == ModHeight 
	&& parseInt(obj.style.width) == ModWidth
//	&& parseFloat(obj.style.opacity) == ModOpacity
	) 
		return;
	if (!Msec) {
		obj.style.left = ModXpos;
		obj.style.top = ModYpos;
		obj.style.height = ModHeight;
		obj.style.width = ModWidth;
		return;
	}
	if (ModXpos - parseInt(obj.style.left))
		obj.style.left = (ModXpos - parseInt(obj.style.left)) / (Msec / 40) + "px";
	if (ModYpos - parseInt(obj.style.top))
		obj.style.top = (ModYpos - parseInt(obj.style.top)) / (Msec / 40) + "px";		
	if (ModHeight - parseInt(obj.style.height))
		obj.style.height = (ModHeight - parseInt(obj.style.height)) / (Msec / 40) + "px";
	if (ModWidth - parseInt(obj.style.width))
		obj.style.width = (ModWidth - parseInt(obj.style.width)) / (Msec / 40) + "px";
	Msec -= 40;
	if (Msec < 0) Msec = 0;
	setTimeout("fnModObj(obj,Msec,ModXpos,ModYpos,ModHeight,ModWidth,ModOpacity)",40);
}
