//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Javascript CMS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Root Pfad
http_root = 'http://www.ozb-rechtsanwaelte.ch';

// Inits
window.onload = init;
function init() {
	// document.getElementById('loginarea').style.display = 'none';
	
	
}

function display_admin() {

	document.getElementById('cms_loginarea').style.display = 'block';
	scrollTo(0,0);

}

function login() {
	
	html_code = '';	
	
	benutzername = document.login_form.input_feld_benutzername.value;
	passwort = document.login_form.input_feld_passwort.value;	

	new Ajax.Request(http_root+'/ajax/login.ajax.php?benutzername='+benutzername+'&passwort='+passwort,
		  {
			method:'get',
			onSuccess: function(transport){
				
				var login_ok = transport.responseText;
			  	
				if (login_ok == 0) {
					alert('Sie konnten nicht angemeldet werden');
					
				}
			 
			 	if (login_ok == 1) {
				
					window.open('index.php','_self');
					
				}
			  
			},
			onFailure: function(){ alert('Fehler...') }
		  });	
	
}

function logout() {
	
	html_code = '';	

	new Ajax.Request(http_root+'/ajax/logout.ajax.php',
		  {
			method:'get',
			onSuccess: function(transport){
				
				var html_code = transport.responseText;
				
				window.open('index.php','_self');

			  
			},
			onFailure: function(){ alert('Fehler...') }
		  });	
	
}

function show_iframe() {
	
	document.getElementById('cms_body_content').style.display = 'none';
	document.getElementById('cms_iframe_content').style.display = 'block';	
	
}

function show_input_iframe() {
	document.getElementById('input_content').style.display = 'none';
	document.getElementById('input_iframe_content').style.display = 'block';		
}

function show_schriftgroesse_select_div(schriftart) {
	
	if (schriftart == 'Standard') {
		document.getElementById('cms_schriftgroesse_select_div').style.display = 'none';
		document.getElementById('cms_schrift_vorschau_div').style.display = 'none';
	}
	else {
		document.getElementById('cms_schriftgroesse_select_div').style.display = 'block';
		document.getElementById('cms_schrift_vorschau_div').style.display = 'block';
	}
	
}


function show_schrift_vorschau(schriftart,anzeigeart,schriftgroesse) {

	html_code = '';	

	new Ajax.Request(http_root+'/ajax/schrift_vorschau.ajax.php?schriftart='+schriftart+'&anzeigeart='+anzeigeart+'&schriftgroesse='+schriftgroesse,
		  {
			method:'get',
			onSuccess: function(transport){
				
				var html_code = transport.responseText;

				document.getElementById('schrift_vorschau').innerHTML = html_code;

			  
			},
			onFailure: function(){ alert('Fehler...') }
		  });	
	
}


function ziel_seite_select_ajax(was,action,id) {
	
	html_code = '';	

	new Ajax.Request(http_root+'/ajax/get_ziel.ajax.php?was='+was+'&action='+action+'&id='+id,
		  {
			method:'get',
			onSuccess: function(transport){
				
				var html_code = transport.responseText;

				document.getElementById('ziel_seite_select_div').innerHTML = html_code;

			  
			},
			onFailure: function(){ alert('Fehler...') }
		  });	
	
	
}


function navigation(id) {
	
	html_code = '';	

	new Ajax.Request(http_root+'/ajax/navigation.ajax.php?id='+id,
		  {
			method:'get',
			onSuccess: function(transport){
				
				var html_code = transport.responseText;
				
				
				
				document.getElementById('cms_navigation').innerHTML = html_code;

			  
			},
			onFailure: function(){ alert('Fehler...') }
		  });	
	
}

function content(id) {
	
	html_code = '';	

	new Ajax.Request(http_root+'/ajax/content.ajax.php?id='+id,
		  {
			method:'get',
			onSuccess: function(transport){
				
				var html_code = transport.responseText;
				
				
				
				document.getElementById('cms_content').innerHTML = html_code;

			  
			},
			onFailure: function(){ alert('Fehler...') }
		  });	
	
}
