var login_str_check = new Array();

function init() {
   //Slider auf ersten Bottomlink Positionieren
   slider_obj = document.getElementById('bottom_slider');
   slider_obj.style.left = get_element_position('bottom_menu_link_1').left;
}
function check_global_writing_srt(e) {
   if(login_str_check.length == 0) {
      if(e.keyCode == 69) login_str_check.push("e");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 1) {
      if(e.keyCode == 73) login_str_check.push("i");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 2) {
      if(e.keyCode == 78) login_str_check.push("n");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 3) {
      if(e.keyCode == 76) login_str_check.push("l");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 4) {
      if(e.keyCode == 79) login_str_check.push("o");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 5) {
      if(e.keyCode == 71) login_str_check.push("g");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 6) {
      if(e.keyCode == 71) login_str_check.push("g");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 7) {
      if(e.keyCode == 69) login_str_check.push("e");
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   } else if(login_str_check.length == 8) {
      if(e.keyCode == 78) {
         login_str_check.push("n");
         load_page('admin_area');
         login_str_check = null;
         login_str_check = new Array();
      }
      else {
         login_str_check = null;
         login_str_check = new Array();
      }
   }
}
function set_bottom_menu_slider(link_id) {
   slide_obj_horizontal_smooth('bottom_slider', get_element_position('bottom_menu_link_'+link_id).left);
   //slider_obj = document.getElementById('bottom_slider');
   //first_bottom_menu_link_obj = document.getElementById('bottom_menu_link_'+link_id);
   //slider_obj.style.left = get_element_position('bottom_menu_link_'+link_id).left;
}
function blend_in_content_container(width, height) {
   content_div_obj = document.getElementById('content_div');
   content_div_obj.style.width = '0px';
   content_div_obj.style.height = '0px';
   content_div_obj.style.padding = '5px';

   content_div_obj.style.width = width;
   content_div_obj.style.height = height;

   document.getElementById('content_div').style.left = get_element_middle('main_div').left - (width / 2);
   document.getElementById('content_div').style.top = get_element_middle('main_div').top - (height / 2);


   content_div_obj.style.display = 'block';

}
function blend_out_content_container() {
   content_div_obj.style.display = 'none';
}
function load_page(page_id, get_parameters) {

   document.getElementById('content_div').innerHTML='Lade...';

   if(page_id == 'contact') blend_in_content_container(700, 400);
   else if(page_id == 'impress') blend_in_content_container(400, 250);
   else if(page_id == 'admin_area') blend_in_content_container(270, 200);
   else if(page_id == 'blog') blend_in_content_container(700, 400);
   else if(page_id == 'blog_search') blend_in_content_container(500, 300);
   else if(page_id == 'blog_search_results') blend_in_content_container(500, 300);
   else if(page_id == 'blog_newest_entries') blend_in_content_container(700, 350);
   else if(page_id == 'new_blog_entrie') blend_in_content_container(700, 450);
   else if(page_id == 'archiv') blend_in_content_container(700, 350);
   else if(page_id == 'main') blend_in_content_container(700, 350);
   else if(page_id == 'logout') { blend_in_content_container(270, 100); document.getElementById('bottom_menu_obj_6').innerHTML = '';}
   else if(page_id == 'archiv_edit') blend_in_content_container(500, 250);
   else if(page_id == 'contact_successful') blend_in_content_container(270, 100);
   else { page_id = 'main'; blend_in_content_container(700, 350); }
   //Ajax Load

   var currentTime = new Date();
   var c_time = currentTime.getTime();
   
   if(window.XMLHttpRequest) {
      ol = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
   try {
      ol = new ActiveXObject('Msxml2.XMLHTTP');
   } catch(e1) {
      try {
         ol = new ActiveXObject('Microsoft.XMLHTTP');
      } catch(e2) {  }
      }
   }

   function schreibeText() {
      if(ol.readyState == 4 && ol.status == 200) {
         response = ol.responseText;     
         document.getElementById('content_div').innerHTML = '<div style="width:100%;text-align: right;"><img src="img/icons/cross_red.gif" border="0" style="cursor:pointer;" onclick="blend_out_content_container();"></div>';
         document.getElementById('content_div').innerHTML += response;
      }
   }

   if(ol != null) {    
      ol.open('GET',page_id+'.php?t='+c_time+'&'+get_parameters,true);
      ol.onreadystatechange = schreibeText;
      ol.send(null);
   }  

}


function login_successf_show_admin_menu() {
   document.getElementById('bottom_menu_obj_6').innerHTML = "<a id=\"bottom_menu_link_6\" href=\"#\" onclick=\"set_bottom_menu_slider(6);load_page('logout', '');\" style=\"color: #FF8080;\">Ausloggen</a>";
}
