if (navigator.userAgent.match(/Firefox\/[4-5]/)) {
	runOnLoadFinish(function() {
		Ext.select('form').each(function(f) {
			foreach(f.dom.elements, function(el) {
				var pattern = el.getAttribute ? el.getAttribute('pattern') : null, reg = '.*';
				if (pattern) {
					reg = '.*';
					switch (pattern) {
						case "pass" :
							reg = '^.{7,}$';
							break;
						case "text" :
							reg = '^[a-zA-Z0-9äöü&szlig;]+$';
							break;
						case "int" :
							reg = '^[0-9]+$';
							break;
						case "lt" :
							reg = '^[0-9]+$';
							break;
						case "gt" :
							reg = '^[0-9]+$';
							break;
						case "plz" :
							reg = '\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b';
							break;
						case "mail" :
							reg = '[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}\b';
							break;
						case "date" :
							reg = '\b(((0?[1-9]|[12][0-9])\.(0?[1-9]|1[0-2])\.)|(30\.((0?[13-9])|(1[0-2]))\.)|(31\.(0?[13578]|1[02])\.))(\d{2}|(19|20)\d{2})\b';
							break;
						case "alldates" :
							reg = '^\b((((0?[1-9]|[12][0-9])\.(0?[1-9]|1[0-2])\.)|(30\.((0?[13-9])|(1[0-2]))\.)|(31\.(0?[13578]|1[02])\.))(\d{2}|(19|20)\d{2}))|((0?[1-9]|1[0-2])\.((19|20)\d{2}|\d{2}))\b';
							break;
						case "time" :
							reg = '\b([01][0-9]|2[0-3]):[0-5][0-9]\b';
							break;
					};
					el.setAttribute('pattern', reg);
				}
			});
		});
		cmslogin = function(f) {
			if (f.elements['username'].value.length && f.elements['password'].value.length) {
				f.elements['response'].value = MD5(f.elements['password'].value);
				f.elements['password'].value = "";
				f.elements['password'].setAttribute('valid', 'true');
				f.elements['password'].removeAttribute('required');
				return (true);
			};
			return (false);
		};
	});
};
if (navigator.userAgent.match(/MSIE\s9/)) {
	if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment) {
		Range.prototype.createContextualFragment = function(html) {
			var frag = document.createDocumentFragment(), div = document.createElement("div");
			frag.appendChild(div);
			div.outerHTML = html;
			return frag;
		};
	};
	Ext.Element.prototype.getAttributeNS = function(ns, name) {
		var d = this.dom;
		return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];
	};
};

if (document.location.href.match(/goeller\.de\/index/)) {
	/*
	 * permanent auf false setzen wenn Animation nur einmalig laufen soll
	 */
	var permanent = true;
	var pl = getCookie('fl');
	if (pl == '' || permanent) {
		document.write('<style>#maincontent{display:none;}#headlogo{display:none;}#headline{display:none;}#logotop{display:none;}#logobottom{display:none;}</style>');
	};
	runOnLoad(function() {
		var c = Ext.get('maincontent');
		if (pl == '' || permanent) {
			Ext.DomHelper.insertAfter(c, {
				tag : 'div',
				id : 'intro'
			});
			var id = getUniqueID();
			var w = 950;
			var h = 700;
			var v = 8;
			var src = '/__/flash/loader.swf';
			var swf = new SWFObject(src, "flash" + id + "obj", w, h, v || "8");
			swf.addParam('wmode', 'transparent');
			swf.addParam('allowscriptaccess', 'always');
			swf.addParam('allowfullscreen', 'true');
			swf.useExpressInstall(basepath + '_/flash/expressinstall.swf');
			swf.write("intro");
			setCookie('fl', 'yepp', false, '/');
		}
	});
};
var showHead = function() {
	if (Ext.isIE) {
		Ext.get('headline').dom.style.display = 'block';
	} else {
		Ext.get('headline').fadeIn({
			duration : 2
		});
	}
};
var skipIntro = function() {
	var i = Ext.get('intro');
	var h = Ext.get('headline');
	if (!h.isVisible()) {
		if (Ext.isIE) {
			h.dom.style.display = 'block';
		} else {
			h.fadeIn({
				duration : 2
			});
		}
	};
	var hl = Ext.get('headlogo');
	if (!hl.isVisible()) {
		if (Ext.isIE) {
			hl.dom.style.display = 'block';
		} else {
			hl.fadeIn({
				duration : 2
			});
		}
	};
	if (i) {
		if (Ext.isIE) {
			i.remove();
			Ext.get('maincontent').dom.style.display = 'block';
			Ext.get('logotop').dom.style.display = 'block';
			Ext.get('logobottom').dom.style.display = 'block';
		} else {
			i.fadeOut({
				duration : 2,
				callback : function() {
					Ext.get('intro').remove();
					Ext.get('maincontent').fadeIn({
						duration : 2
					});
					Ext.get('logotop').fadeIn({
						duration : 2
					});
					Ext.get('logobottom').fadeIn({
						duration : 2
					});
				}
			});
		}
	}
};
var gkey = 'ABQIAAAAy-MfgKvKUTrUdcDeLLAi0RQt2P-76k5Z8QVaj1uGuXRb673NdhT4FlJ17WznElXiqxPeqZZjIvutxA';
var initMap = function() {
	if (!this.maps.gmap_anfgmap) {
		window.setTimeout(initMap.createDelegate(this), 100);
		return;
	};
    this.maps.gmap_anfgmap.map.setZoom(8);
    this.maps.gmap_anfgmap.mapMarkers['default'][0].openInfoWindowTabsHtml([
        new google.maps.InfoWindowTab('Adresse', this.config.points[0].customtext),
        new google.maps.InfoWindowTab('Route', this.directionsTxt(this.config.points[0].point, this.config.id, this.config.points[0].loc_street + ',' + this.config.points[0].loc_ort))
    ]);            
};
runOnLoad(function() {
	var anf = Ext.get('gmap_anfgmap');
	if (anf) {
	    runOnLoadFinish(function() {
	        var mconfig = {
	            id : 'gmap_anfgmap',
	            mt : '',
	            lat : '10.58183',
	            lon : '50.014365',
	            zl : '6',
	            pl : '',
	            points : []
	        };
	        mconfig.points.push({
	            "customtext":"<div style='font-weight:bold;'>Brauerei G&ouml;ller &quot;Zur Alten Freyung&quot;</div><div>Wildgarten 12</div><div>97475 Zeil am Main</div><div>Tel: 09524 / 3004-0</div><div><a href='mailto:info@brauerei-goeller.de'>info@brauerei-goeller.de</a></div><div><a href='http://www.brauerei-goeller.de/' target='_blank'>http://www.brauerei-goeller.de/</a></div>","lat":"50.014365","lng":"10.58183","loc_land":"Deutschland","loc_plz":"97475","loc_ort":"Zeil am Main","loc_street":"Wildgarten 12","loc_street_alt":""
	        });
	        gMap.create = gMap.create.createSequence(initMap, gMap);
	        initGMap(mconfig);
	    });
	}
});
