<!--//
	
	if(window.name != 'privatkunden' && window.name != 'unternehmen') {
		window.name = 'privatkunden';
	}

	if(window.focus) {
		window.focus();
	}

	Event.observe(window, 'load', function() {
		
		window.quickitems = [{
			'quickaccess': $('quickaccess').getStyle('height'),
			'quickcontact': $('quickcontact').getStyle('height'),
			'quicklogin': $('quicklogin').getStyle('height')
		
		}];

		for(items in quickitems[0]) {
			if(getCookie('boxid') != items) {
				$(items).setStyle({height: '0px'});
			}
			else {
				$(items).previous().addClassName('openheader');
			}
		}

		/*
		if($('showpflicht')) {
			toggle_pflicht('0', 'rightnote');
			$('rightnote').toggleClassName('fussnoteread');
		}
		*/
		

		if($('startloader')) {
			$('startloader').style.display='none';
		}

		if($('QpageId')) {
			$('QpageId').onchange = function() {
				if($('QpageId').selectedIndex != 0) {
					$('zugriffForm').submit();
				}
			};
		}

		
	});

	Event.observe(window, 'unload', function() {
		if($('startloader')) {
			$('startloader').style.display='';
		}
	});

	
	function getCookie(Name) {
		var re = new RegExp(Name+"=[^;]+", "i");
		if(document.cookie.match(re)) {
			return document.cookie.match(re)[0].split("=")[1];
		}
		return null;
	}

	function setCookie(name, value) {
		document.cookie = name + "=" + value + ";path=/;";
	}

	function stopscroll() {
		window.clearTimeout(activeelement);
	}

	function $N(elmname){
		return document.getElementsByName(elmname);
	}

	function startscroll(yitem) {
		var hideelement = '',
		showelement = '';

		if(window.quickitems[0]) {
			for(xitem in window.quickitems[0]) {
				if(xitem != yitem) {
					hideelement += ", boxscroll('" + xitem + "', '0px', 'scrollup')";
				}

				if(xitem == yitem) {
					showelement += "boxscroll('" + xitem + "', '" + window.quickitems[0][xitem] + "', 'scrolldown')";
				}
			}
			eval("activeelement = window.setTimeout(\"" + showelement + hideelement + "\", 300);");
		}
	}

	function boxscroll(boxid, boxheight, boxdirection) {
		var actboxheight = $(boxid).getStyle('height');

		if(boxdirection == 'scrolldown' && actboxheight.replace('px', actboxheight) <= boxheight.replace('px', boxheight)) {
			$(boxid).morph('height: ' + boxheight + '; margin-top: 0px;', { duration: 0.5 });
			$(boxid).previous().addClassName('openheader');
			setCookie('boxid', boxid);
		}

		if(boxdirection == 'scrollup' || actboxheight.replace('px', actboxheight) >= boxheight.replace('px', boxheight)) {
			$(boxid).morph('height: 0px; margin-top: -10px;', { duration: 0.5 });
			$(boxid).previous().removeClassName('openheader');
		}
	}
	
	

	

	function makeCall(what) {
		var xitem,
			prodslice = [{"showPhone": "h_tef_einzel", "showWeb": "h_i12_einzel", "showTV": "h_dka_einzel", "showduo": "h_duo_einzel", "showduof": "h_duof_einzel"}],
			hideelement = '',
			showelement = '';

		for (xitem in prodslice[0]) {
			if(xitem != what && what != 'showNothing') {
				hideelement += ", fadebox('" + prodslice[0][xitem] + "', 'hidecont')";
			}

			if(xitem == what && what != 'showNothing') {
				showelement += "fadebox('" + prodslice[0][xitem] + "', 'showcont')";
			}
		}

		if(what != 'showNothing') {
			eval("activeelement = window.setTimeout(\"" + showelement + hideelement + "\", 300);");
		}

		if(what == 'showNothing') {
			stopscroll();
		}
		
	}

	function fadebox(what, action) {
		var hidecont = Effect.BlindUp,
		showcont = Effect.BlindDown,
		delaysec = 0,
		durationsec = 0.3;

		if(action == 'hidecont') {
			new hidecont($(what), {
				duration: durationsec,
				delay: delaysec
			});
			Element.addClassName.delay(delaysec, $(what), 'hidden');
		}

		if(action == 'showcont' && $(what).offsetHeight == 0) {
			$(what).removeClassName('hidden');
			new showcont($(what), {
				duration: durationsec,
				delay: delaysec
			});
		}
	}
	
	
	function showprods(formid) {
		new Ajax.Updater('log', 'http://www.cixity.de/service/rfs_test_ajax_detail.php',
			{ parameters: $(formid).serialize() }
		);
	}
	

	function toggle_pflicht(durationsec, what) {
		var delaysec = 0;
		if(!durationsec) {
			var durationsec = 0.2;
		}

		/*
		if(what == 'rightnote') {
			new Effect.toggle('showpflicht', 'blind', {
				duration: durationsec,
				delay: delaysec
			});
			$('rightnote').toggleClassName('fussnoteread');
		}
		*/

		if($('secondnote') && what == 'secondnote') {
			new Effect.toggle('secondpflicht', 'blind', {
				duration: durationsec,
				delay: delaysec
			});
			$('secondnote').toggleClassName('fussnoteread');
		}
	}
	

	function showloader() {
		Event.observe(window, 'focus', function() {
			if($('loader').hasClassName('shown')) {
				hideloader();
			}
		});

		Event.observe(window, 'submit', function() {
			Form.Element.disable('getchargesubmit');
		});

		$('getchargesubmit').addClassName('disabled');
		$('loader').removeClassName('hidden');
		$('loader').addClassName('shown');
	}

	function hideloader() {
		Form.Element.enable('getchargesubmit');
		$('getchargesubmit').removeClassName('disabled');
		$('loader').addClassName('hidden');
		$('loader').removeClassName('shown');
		Event.stopObserving(window, 'focus');
		Event.stopObserving(window, 'submit');
	}

	//-->
