var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

Ext.onReady( function() {
	
	var links  = Ext.select('.first'); 
	links.each ( function (el) {
		
if (el.dom.tagName == "A"){
	
	if (el.dom.innerHTML == "Start" || el.dom.innerHTML == "Startseite"){
		
		elem = Ext.get(el); 
		elem.addClass("startnoroot");
		/*elem.dom.style.background = "none !important";
		elem.dom.style.paddingLeft = "0px !important";
		elem.dom.style.marginLeft = "-10px !important";*/
	}
}

	}); 
	
	var box;
	var initlink = Ext.select('.extwndowlink');
	initlink.each( function(el) {
		var lnk = el.dom;
		var conf_title = 'Weitere Informationen';
		var conf_modal = true;
		var conf_width = 640;
		var conf_height = 480;
		var conf_display_header = false;
		Ext.MessageBox.maxWidth = 800;
		lnk.onclick = function() {
			box = Ext.MessageBox.show( {
				title :conf_title,
				msg :'<img src=\"' + basepath + '_/scripts/ext/resources/images/default/grid/loading.gif\" alt=\"\" style=\"border:0; vertical-align:middle;\"> Loading...',
				animEl :lnk,
				modal :conf_modal,
				fn : function() {
					Ext.MessageBox.hide();
				}
			});
			//
			if (conf_display_header == false) {
				box.getDialog().header.dom.style.display = 'none';
			}
			var url = lnk.href;
			Ext.Ajax.request( {
				url :url,
				success : function(req) {
					var treg = /<!--\sINHALT\s-->(.+)<!--\sINHALT\s-->/gi;
					var bd = treg.exec(req.responseText.split(/\n/).join(''));
				    if (bd && bd[1]) {
					    var txt = bd[1];
					    var dlg = box.getDialog();
					    var swfs = {};
					    txt.extractScripts().each( function(script) {
						    var swfreg = /\('([^']+)',\s'([^']+)',\s'([^']+)'\)/;
						    var movie = script.match(swfreg);
						    if (movie) {
						    	var w = movie[2];
						    	var h = movie[3];
						    	if (w > conf_width)conf_width = parseInt(w); 
						    	if (h > conf_height) {
						    		conf_height = parseInt(h);
						    		conf_height = conf_height + 100;
						    	}
						    	var src = movie[1];
						    	
							    var id = getUniqueID();
							    txt += '<div style="text-align:center;" id="flash' + id + '"></div>';
							    var swf = new SWFObject(basepath + '_/flash/moviePlayer.swf', "flash" + id + "obj", w, h, "8");
							    swf.addParam('wmode', 'transparent');
							    swf.addVariable("skinSource", basepath + '_/flash/SteelExternalAll.swf');
							    swf.addVariable("streamSource", src);
							    swf.useExpressInstall(basepath + '_/flash/expressinstall.swf');
							    swfs[id] = swf;
						    }
					    });
					    box.updateText('<div style=\"width:' + (conf_width -40) + 'px; overflow:auto; overflow-x: hidden;\">' + txt + '</div>');
					    
					    var evalscripts = true; 
					    for (var ids in swfs){
					    	evalscripts = false; 
					    }
					    if (evalscripts === true){
					    txt.evalScripts();
					    }
					    
						var dlg = Ext.MessageBox.getDialog();
						dlg.center();
						dlg.refreshSize();
				
					    dlg.resizeTo( conf_width, conf_height); 
					    for (var id in swfs) {
					    	swfs[id].write("flash" + id);
					    }
				    }
				}
			});
			return (false);
		}
	});
});





Ext.onReady( function() {
	var initBlocks = Ext.select('.defaultansicht_feste_hoehe');

	var totalCount = initBlocks.elements.length;
	var initCount  = 0;

	if (totalCount > 1){
		Ext.get('pagerspecial').dom.style.display = "block";
		Ext.get('inhaltleft').dom.style.height = "310px";

	} else if (totalCount == 1){
		Ext.get('inhaltleft').dom.style.height = "310px";
	} else {
		var pager =  Ext.get('pagerspecial'); 
		if (pager) pager.dom.style.display = "none";
	}

	initBlocks.each( function(el) {

		//debugger;

		if (initCount > 0){
			el.setStyle("display","none");
		} else {
			el.setStyle("display","block");

		}
		initCount++;

	});



});


var durationSlideIn = 2;
var durationSLideOut = 2;
var onMove   = false; 

function showPrev () {

if (onMove == true ) { return false; }

	var initBlocks = Ext.select('.defaultansicht_feste_hoehe');
	var totalCount = initBlocks.elements.length;
	var initCount  = 0;
	var nextelVis   = false;
	var elSlideOut  = false;
	var elSlideIn   = false;

	for (initCount = totalCount-1; initCount >= 0; initCount-- ){
		var el = Ext.get(initBlocks.elements[initCount]);
		var vis =  el.getStyle("display");
		if (vis == "block"){
			elSlideOut = el;
			nextelVis = true;
		}

		if (nextelVis == true && vis == "none"){
			nextelVis = false;
			elSlideIn = el;
		}

	}
	if (elSlideIn == false ){
		elSlideIn = Ext.get(initBlocks.elements[totalCount-1]);
	}
	onMove = true;
	
	elSlideOut.dom.style.overflow = "hidden";
	elSlideOut.slideOut('l', {
		easing: 'easeOut',
		duration: durationSLideOut,
		remove: false,
		useDisplay: true
	});

	elSlideIn.dom.style.overflow = "hidden";
	elSlideIn.slideIn('r', {
		easing: 'easeOut',
		duration: durationSlideIn,
		remove: false,
		useDisplay: true,
		callback: function ( el ){
		el.dom.style.overflow = "auto";
		initBlocks.each (function (elems){
		if (elems.dom.id!=el.id && elems.getStyle("display")!="none")
			elems.setStyle("display","none");
		})
		onMove = false; 
		}
	});

}





function showNext () {
	
	if (onMove == true ) {	return false;}

	var initBlocks = Ext.select('.defaultansicht_feste_hoehe');
	var totalCount = initBlocks.elements.length;
	var initCount  = 0;

	var nextelVis   = false;
	var elSlideOut  = false;
	var elSlideIn   = false;

	for (initCount = 0; initCount < totalCount; initCount++){
		var el = Ext.get(initBlocks.elements[initCount]);

		var vis =  el.getStyle("display");
		if (vis == "block"){
			elSlideOut = el;
			nextelVis = true;
		}

		if (nextelVis == true && vis == "none"){
			nextelVis = false;
			elSlideIn = el;
		}


	}

	if (elSlideIn == false ){
		elSlideIn = Ext.get(initBlocks.elements[0]);
	}

	onMove = true; 
	
	
	elSlideOut.dom.style.overflow = "hidden";
	elSlideOut.slideOut('r', {
		easing: 'easeOut',
		duration: durationSLideOut,
		remove: false,
		useDisplay: true,
		callback: function (){
		
		}
	});

	elSlideIn.dom.style.overflow = "hidden";
	elSlideIn.slideIn('l', {
		easing: 'easeOut',
		duration: durationSlideIn,
		remove: false,
		useDisplay: true,
		callback: function (  el ){
		el.dom.style.overflow = "auto";
		initBlocks.each (function (elems){
			if (elems.dom.id!=el.id && elems.getStyle("display")!="none")
			elems.setStyle("display","none");
		})
		onMove = false; 
		
		}
	});

 

}








/*******************************************************************************
* function searchMaps(){ var maps = Ext.select('area');
* maps.each(function(map){ var lnk = map.dom; lnk.onclick = function(){ var url =
* lnk.href; Ext.Ajax.request({ url: url, success: function(req){ var treg = /<!--\sINHALT\s-->(.+)<!--\sINHALT\s-->/gi;
* var bd = treg.exec(req.responseText.split(/\n/).join('')); if (bd && bd[1]) {
* var txt = bd[1]; txt = '<div
* style="width:700px;height:650px;overflow-x:hidden;overflow-y:auto;">' + txt + '</div>';
* Ext.MessageBox.updateText(txt); Ext.MessageBox.getDialog().center();
* Ext.MessageBox.getDialog().resizeTo(730,700); searchMaps(); } } }); return
* (false); } }); }
******************************************************************************/
