/* ===================  GMF WebSeiten spezifische Funktionen ========================= */
GMF.PageTools = {
	confirmDelete:function () {
		if (confirm('Soll der Datensatz wirklich gelöscht werden?')) {
			GMF.$("actionform").do_delete.value = 1;
			return true;
		} else {
			return false;
		}
	},
	displayColor:function(colorID, COLORS) {
		if(!COLORS[colorID]) return true;
		GMF.$('color').value = colorID;
		GMF.$("actionform").submit();
		return false;
	},
	displayColorName:function (colorID, COLORS) {
		if(!COLORS[colorID]) return true;
		GMF.$("color_label").innerHTML = COLORS[colorID];
		return true;
	},
	resetShadow:function() {
		var layer = GMF.$('bglayer_allumfassend');
		layer.removeChild(GMF.$("bglayer_oben"));
		layer.removeChild(GMF.$("bglayer_inhalt"));
		layer.removeChild(GMF.$("bglayer_unten"));
		return true;
	},
	createShadow:function()
	{
		var layerHeight = GMF.getDivHeight(GMF.$('bglayer_allumfassend'));
		var ce;
		ce = GMF.ce('div');
		ce.id = "bglayer_oben";
		ce.style.background = "url(images/layer.png) no-repeat -3720px top";
		ce.style.height = "10px";
		ce.style.width = "710px";
		ce.style.fontSize = "1px";
		ce.style.lineHeight = "1px";
		ce.style.margin = "0";
		ce.style.padding = "0";
		ce.style.position = "absolute";
		ce.style.top = "10px";
		ce.style.zIndex = "0";
		GMF.$('bglayer_allumfassend').appendChild(ce);

		ce = GMF.ce('div');
		ce.id = "bglayer_inhalt";
		ce.style.background = "url(images/layer.png) repeat-y -4430px top";
		ce.style.height = (layerHeight-40) + "px";
		ce.style.width = "710px";
		ce.style.margin = "0";
		ce.style.padding = "0";
		ce.style.position = "absolute";
		ce.style.top = "20px";
		ce.style.overflow = "hidden";
		ce.style.zIndex = "0";
		GMF.$('bglayer_allumfassend').appendChild(ce);

		ce = GMF.ce('div');
		ce.id = "bglayer_unten";
		ce.style.background = "url(images/layer.png) no-repeat -3720px -10px";
		ce.style.height = "10px";
		ce.style.width = "710px";
		ce.style.fontSize = "1px";
		ce.style.lineHeight = "1px";
		ce.style.margin = "0";
		ce.style.padding = "0";
		ce.style.position = "absolute";
		ce.style.top = (layerHeight-20) +"px";
		ce.style.zIndex = "0";
		GMF.$('bglayer_allumfassend').appendChild(ce);
		return true;
	},
	createButtonEvents:function()
	{
		var inputs = GMF.tag("input");
		var curr;
		for(i in inputs) {
			if(inputs[i].type == "submit") {
				inputs[i].onmouseover = this.buttonHover;
				inputs[i].onmousedown = this.buttonPressed;
				inputs[i].onmouseout = this.buttonOut;
			}
		}
		return true;
	},
	buttonHover:function(e)
	{
		GMF.PageTools.buttonReset(this);
		this.className = this.className+"_hover";
		return true;
	},
	buttonPressed:function(e)
	{
		GMF.PageTools.buttonReset(this);
		this.className = this.className+"_pressed";
		return true;
	},
	buttonOut:function(e)
	{
		GMF.PageTools.buttonReset(this);
		return true;
	},
	buttonReset:function(e)
	{
		e.className = e.className.replace(/_hover/gi, "");
		e.className = e.className.replace(/_pressed/gi, "");
		return true;
	}
};