document.getElementsByClassName = function(cl){
	var retnode = [];
	var myclass = new RegExp('\\b' + cl + '\\b');
	var elem = this.getElementsByTagName('*');
	for(var i = 0; i < elem.length; i++){
		var classes = elem[i].className;
		if(myclass.test(classes)){
			retnode.push(elem[i]);
		}
	}
	return retnode;
};

function getRef(id){
	if(document.getElementById){
		return(document.getElementById(id));
	}else if(document.all){
		return(document.all[id]);
	}else if(document.layers){
		return(document.layers(id));
	}
	return(null);
}

function hasClass(ele, cls){
	if(ele.className){
		return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
	}else{
		return false;
	}
}

function addClass(ele, cls){
	if(! this.hasClass(ele, cls)){
		ele.className += " "+cls;
	}
}

function removeClass(ele, cls){
	if(hasClass(ele, cls)){
		var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
		ele.className = ele.className.replace(reg, ' ');
	}
}

function calselected(day, month, year){
	document.location = "?get_path=xnyraqre/&amp;day=" + day + "&amp;month=" + month + "&amp;year=" + year;
}

function openWindow(id){
	if(id.length < 1){
		id = 'christuskircheTermin';
	}
	window.open('about:blank', id, 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=640,height=500');
}

function styleAbbr(){
	var oldBodyText, newBodyText, reg;
	if(navigator.userAgent.indexOf('MSIE') != -1){
		oldBodyText = document.body.innerHTML;
		reg = /<abbr([^>]*)>([^<]*)<\/abbr>/ig;
		newBodyText = oldBodyText.replace(reg, '<abbr $1><span class=\"abbr\" $1>$2</span></abbr>');
		document.body.innerHTML = newBodyText;
	}
}

function makeInfo(){
	try {
		var oldDiv;
		var closeDiv = document.getElementsByClassName("close");
		for(var i = 0; i < closeDiv.length; i++){
			oldDiv = closeDiv[i].innerHTML;
			closeDiv[i].innerHTML =
				"<div style=\"text-align:right;width:100%\">" +
				"<img alt=\"\" src=\"resources/pics/close_button.png\" " +
					"title=\"Fermer/Schließen\" " +
					"width=\"17\" height=\"17\" onclick=\"closeInfo(this);\" " +
					"style=\"" +
						"padding-right:0px;" +
						"padding-top:0px;" +
						"text-align:right;" +
						"cursor:pointer;" +
						"float:right;" +
					"\"/>" + 
				"<div style=\"text-align:left;margin-right:20px;\">" +
				oldDiv + 
				"</div>" +
				"</div>";
		}
	}catch(e){
	}
}

function closeInfo(img){
	try{
		var node = img.parentNode.parentNode;
		addClass(node, "hidden");
		node = node.nextSibling;
		while(node && (node.nodeType != 1)){
			node = node.nextSibling;
		}
		if(node && (node.nodeType == 1)){
			removeClass(node, "hidden");
		}
	}catch(e){
	}
}

function documentLoaded(){
	try{
		styleAbbr();
		makeInfo();
		initializeIframeObject();
		if(getRef('index') != null){
			getRef('index').target = "christuskircheTermin";
		}
	}catch(e){
	}
	try{
		mainblockLoaded();
	}catch(e){
		//alert(e.description);
	}
}

function getSelectedValue(id){
	if((getRef(id) != null) && (getRef(id).selectedIndex != null)){
		if((getRef(id).options[getRef(id).selectedIndex].title != null) &&
			(getRef(id).options[getRef(id).selectedIndex].title.length > 0)){
			return(getRef(id).options[getRef(id).selectedIndex].title);
		}else{
			return(getRef(id).options[getRef(id).selectedIndex].text);
		}
	}else{
		return(null);
	}
}

function getSelectedIdValue(id){
	if(getRef(id).selectedIndex != null){
		var id_value = getRef(id).options[getRef(id).selectedIndex].id;
		if(id_value != null){
			id_value = id_value.replace(/.*_/, '');
			return(id_value);
		}
	}
	return(null);
}

function setSelectedValue(id, valueId){
	if((getRef(id) != null) && (getRef(valueId) != null)){
		for(var i=0; i<getRef(id).options.length; i++){
			if(getRef(id).options[i].id == valueId){
				getRef(id).options[i].selected = "selected";
			}else{
				getRef(id).options[i].selected = "";
			}
		}
	}
}

function indexValidate(){
	return true;
}

function initializeIframeObject(){
	if(navigator.userAgent.indexOf('MSIE') != -1){
		var oPlaceHolder = getRef("fixIeObjectBug");
		if(oPlaceHolder != null){
			var objectElement = oPlaceHolder.getElementsByTagName("object")[0];
			objectElement.style.display = "none";
			var iframeElement = document.createElement("iframe");
			iframeElement.className = objectElement.className;
			iframeElement.src = objectElement.data;
			iframeElement.height = objectElement.height;
			iframeElement.width = objectElement.width;
			if(iframeElement.style.setAttribute != null){
				iframeElement.style.setAttribute("border", "0px solid inherit");
				iframeElement.style.setAttribute("height", "400px");
				iframeElement.style.setAttribute("min-height", "400px! important");
				iframeElement.style.setAttribute("min-width", "600px! important");
				iframeElement.style.setAttribute("width", "600px! important");
			}
			oPlaceHolder.appendChild(iframeElement);
		}
	}
}

function zeige(url, name, width, height){
	var mbar, sbar, tbar, lbar;
	var base = document.getElementsByTagName('base');
	mbar = sbar = tbar = lbar = 'no';
	width = width + 50;
	height = height + 50;
	if(base && base[0] && base[0].href){
		url = document.getElementsByTagName('base')[0].href + url;
	}
	window.open(url, name, 'resizable=yes,scrollbars=yes,status='+sbar+',toolbar='+tbar+',location='+lbar+',menubar='+mbar+',height='+height+',width='+width);
}

/* Get rid of the pre-text search in inputs */
function onFocusCheckEntry(which, cont, colorChange) {
	if((cont != "dummy") && (which.value == cont)){
		which.value = "";
	}
}

function onBlurCheckEntry(which, cont, colorChange){
	if((cont != "dummy") && (which.value == "")){
		which.value = cont;
	}
}
 
// vim: fileencong=latin1

