/******************************************************************************
 AjaxPortal  v. 3.0
 Copyright (c) 2006 by Angel Stoitsov and Mario Stoitsov,
 http://myiosoft.com
*******************************************************************************/
/************************************************************************************
 Start inline edit  script initially based on http://cyberdummy.co.uk by Tom Westcott
*************************************************************************************/
function togglehidebox(id) {if (document.getElementById) { bb= document.getElementById(id).style.display; if (bb == "none"){ document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none'; } } else { if (document.layers) { if (document.id.display == "none"){ document.id.display = 'block'; } else { document.id.display = 'none'; } } else { if (document.all.id.style.visibility == "none"){ document.all.id.style.display = 'block'; } else { document.all.id.style.display = 'none'; } } } }
function searchonblur(a){document.getElementById(a).style.display = 'none';  return false;  }
function searchonfocus(a){document.getElementById(a).style.display = 'inline';  return false; }
function clearDefault(el) {if (el.defaultValue==el.value) el.value = ""}
function fadeId(fid) { document.getElementById(fid).style.display = 'block';  Fat.fade_element(fid,null,3000,'#D62408','#ffffff');}
function confirmation(){window.status = 'Ajax boxes updated'; }
function bgSwitch(ac, bc) { if (ac == 'on'){ bc.style.background = '#ffc'; } else if (ac == 'off'){ bc.style.background = ''; } }
function textChanger(result) {var result_array=result.split("~~|~~"); document.getElementById(result_array[1]).innerHTML = result_array[0]; Fat.fade_element(result_array[1], 30, 1500, "#EEFCC5", "#FFFFFF"); }
function parseForm(TTxT,cellID, inputID) {
    var temp = document.getElementById(inputID).value;
    var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
    document.getElementById("loading").style.display = 'block';
    if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
    var obj = /  /g;
    while (temp.match(obj)) { temp = temp.replace(obj, " "); }
    if (temp == " ") { temp = ""; }
    if (! temp) {alert("This field must contain at least one non-whitespace character.");return;}
    var st = document.getElementById(inputID).value + '~~|~~' + cellID;
    document.getElementById(cellID).innerHTML = "<span class=\"update\">Updating...</span>";
    x_changeText(TTxT,st,textChanger);
    document.getElementById("loading").style.display = 'none';
}
function editCellT(id, cellSpan) {
    var inputWidth  = 60; //(document.getElementById(id).offsetWidth/ 7);
    var oldCellSpan = cellSpan; //cellSpan.innerHTML;
    document.getElementById("loading").style.display = 'block';
    document.getElementById(id).innerHTML = "<form  name=\"activeForm\" onsubmit=\"parseForm('0','"+id+"', '"+id+"input'); return false;\" action=\"\"><input type=\"text\" size=\""+ inputWidth + "\"  id=\""+id+"input\"  onblur=\"parseForm('0','"+id+"', '"+id+"input'); return false;\"><noscript><input value=\"OK\" type=\"submit\"></noscript></form>";
    document.getElementById(id+"input").value = oldCellSpan;
    document.getElementById(id+"input").focus();
    document.getElementById(id+"input").style.background = '#ffc';
    document.getElementById("loading").style.display = 'none';
}
function editCellTxT(id, cellSpan) {
    var inputWidth  = 60; //(document.getElementById(id).offsetWidth / 3);
    var inputHeight = 20; //(document.getElementById(id).offsetHeight / 10 );
    var oldCellSpan = cellSpan.innerHTML;
    document.getElementById(id).innerHTML = "<form  name=\"activeForm\" onsubmit=\"parseForm('1','"+id+"', '"+id+"input'); return false;\" action=\"\"><textarea cols=\""+ inputWidth + "\" rows=\""+ inputHeight +"\" id=\""+id+"input\"  onblur=\"parseForm('1','"+id+"', '"+id+"input'); return false;\"></textarea><noscript><input value=\"OK\" type=\"submit\"></noscript></form>";
    document.getElementById(id+"input").value = oldCellSpan;
    document.getElementById(id+"input").focus();
    document.getElementById(id+"input").style.background = '#ffc';
}
/*******************************************************************************
 End the script initially based on http://cyberdummy.co.uk by Tom Westcott
*******************************************************************************/

/*******************************************************************************
 Start admin script initially based on http://www.mp3act.net by Jon Buda
*******************************************************************************/
function save_boxes(){var  dataseq=''; var  databid=''; var  datai=''; for(i=0;i<BoxNumber;i++){xy=document.getElementById('m_'+BoxId[i]).offsetLeft+document.getElementById('m_'+BoxId[i]).offsetTop; dataseq+=xy; databid+=BoxId[i]; datai+= i;if(i!=BoxNumber-1) {dataseq+=':'; databid+=':'; datai+=':';}   }data=dataseq + ',' + databid + ',' + datai + ',' + draggedapmodule_col + ':' + draggedapmodule_id; x_update_boxes(data,confirmation);return false;  }
function expandBoxes(a,b){document.getElementById("pagetitle").innerHTML = a; document.getElementById("info").innerHTML = b; clearbc = 1; return false; }
function closeDropDown(){ul = document.getElementById("browse_ul"); ul.style.display = 'none'; ul.innerHTML = ''; }
function setMsgText(text){document.getElementById("breadcrumb").innerHTML = "<span class='error'>"+text+"</span>"; Fat.fade_element('breadcrumb',null,2000,'#F5C2C2','#ffffff'); }
function searchBoxes(form){if(form.searchbox.value == '' || form.searchbox.value == '[enter your search terms]'){ switchPage('search'); setPageTitle(); setMsgText("Sie m&uuml;ssen etwas eingeben, wonach gesucht werden soll");   } else{ document.getElementById("breadcrumb").innerHTML = ""; setPageTitle();  x_searchBoxes(form.searchbox.value,form.search_options.value,form.searchlocs.value,updateBox_cb);  } return false; }
function switchPage(newpage){document.getElementById("nhdr").innerHTML = "";   document.getElementById("breadcrumb").innerHTML = "";  prevpage = page; page = newpage; updateBox(page,0); setPageTitle();}

// function switchPage(newpage){ admin=document.getElementById("nhdr").innerHTML; document.getElementById("nhdr").innerHTML ='';  document.getElementById("info").style.display ='block'; document.getElementById("breadcrumb").innerHTML = "";  prevpage = page; page = newpage; updateBox(page,0); setPageTitle();}

function setPageTitle(){
   var pages= new Array()
   pages["expand"]="Expand the box";
   pages["register"]="Ajax Portal Registration";
   pages["search"]="Hofbr&auml;uhaus Termine durchsuchen";
   pages["prefs"]="User Account Preferences";
   pages["stats"]="Server Statistics";
   pages["admin"]="Ajax Portal Administration";
   pages["about"]="About Ajax Portal";
   pages["login"]="Login";
   pages["password"]="Passwort vergessen";
   document.getElementById("pagetitle").innerHTML = pages[page];
}
function updateBox(type,itemid){
   document.getElementById("loading").style.display = 'block';
   x_adpLookup(type,itemid,updateBox_cb);
   if(type == 'search' || type == 'about' || type == 'prefs'  || type == 'admin'  || type == 'stats'){
      bc_parenttype = ''; bc_parentitem = ''; itemid=''; type='';
   }else{
      bc_parenttype = bc_childtype;
      bc_parentitem = bc_childitem;
   }
   bc_childitem = itemid;
   bc_childtype = type;
}
function updateBox_cb(new_data){
   document.getElementById("info").innerHTML = new_data;
   document.getElementById("loading").style.display = 'none';
   if(clearbc!=1) { breadcrumb(); }
   clearbc = 1;
   if(new_data=="Sucsess!") { makeRequest("ajaxp_backend.php","?"); }
}
function breadcrumb(){x_buildBreadcrumb(page,bc_parenttype,bc_parentitem,bc_childtype,bc_childitem,breadcrumb_cb); }
function breadcrumb_cb(new_data){if(new_data!="") { document.getElementById("breadcrumb").innerHTML = new_data; } }
function loginADP(form){
   if(form.username.value == '' || form.password.value == ''){
      setMsgText("Login Failed. Enter both, Username and Password, and Try Again.");
   }
   else{
      document.getElementById("breadcrumb").innerHTML = "";
      setMsgText("Logged in ...");  setPageTitle();
      x_loginADP(form.username.value,form.password.value,form.remember.value,updateBox_cb);
   }
   return false;
}
function registerADP(form){
  var x = document.getElementById('newuser');
  var y = x.getElementsByTagName('input');
  for (var i=0;i<y.length;i++){
    if(y[i].value == ""){
      document.getElementById("password").value = "";
      document.getElementById("password2").value = "";
      setMsgText("You Are Missing Fields.");
      return false;
    }
  }
  if(document.getElementById("email").value.indexOf(".") <= 0 || document.getElementById("email").value.indexOf("@") <= 0){
      setMsgText("Email Address is Not Valid.");
    return false;
  }
  if(document.getElementById("new_username").value.length < 3 || document.getElementById("new_username").value.length > 11){
      setMsgText("Username Must Be Between 3 and 11 characters.");
    return false;
  }
  if(document.getElementById("password").value != document.getElementById("password2").value){
    document.getElementById("password").value = "";
    document.getElementById("password2").value = "";
      setMsgText("Passwords Do Not Match.");
    return false;
  }
  setMsgText("Registered ...");
  x_registerADP(document.getElementById("firstname").value,document.getElementById("lastname").value,document.getElementById("email").value,document.getElementById("new_username").value,document.getElementById("password").value,document.getElementById("password2").value,updateBox_cb);
  return false;
}
function passwordADP(form){
  if(document.getElementById("email").value == ""){
    setMsgText("Email Address is Blank");
    return false;
  }
  if(document.getElementById("email").value.indexOf(".") <= 0 || document.getElementById("email").value.indexOf("@") <= 0){
    setMsgText("Email Address is Not Valid.");
    return false;
  }
  setMsgText("Password ...");
  x_passwordADP(document.getElementById("email").value,updateBox_cb);
  return false;
}
function adminAddUser(form){
 document.getElementById("breadcrumb").innerHTML = "";
 if(form!=""){
   if(form.firstname.value == '' || form.lastname.value == '' || form.username.value == '' || form.password.value == '' || form.password2.value == '' || form.email.value == ''){
     setMsgText("Required Fields Are Empty");
     return false;
   }
   if(form.password.value != form.password2.value){
     setMsgText("Password Do Not Match");
     document.getElementById("password").value = "";
     document.getElementById("password2").value = "";
     return false;
   }
   if(form.email.value.indexOf(".") <= 2 && form.email.value.indexOf("@") <= 0){
     setMsgText("Email Address is Invalid");
     document.getElementById("email").focus();
     return false;
   }
   x_adminAddUser(form.firstname.value,form.lastname.value,form.username.value,form.email.value,form.perms.value,form.password.value,adminAddUser_cb);
   return false;
 }else{
   x_adminAddUser('','','','','','',updateBox_cb);
 }
 return false;
}
function adminAddUser_cb(new_data){
   clearbc=0;
   if(new_data==1){
     updateBox('admin',0);
      setMsgText("User Successfully Added");
   }else{
     setMsgText("Username is Already Taken. Try Another.");
     document.getElementById("username").value = "";
     document.getElementById("username").focus();
   }
}
function adminEditUsers(user,action,form){
   document.getElementById("breadcrumb").innerHTML = "";
   if(user!=0){
      if(action == 'del'){
         if(confirm('Are you Sure you want to DELETE THE USER?')){
            x_adminEditUsers(user,action,adminEditUsers_cb);
         }
      }
      else if(action == 'mod'){
         x_adminEditUsers(user,'mod',form.active.value,form.perms.value,adminEditUsers_cb);
      }else{
         x_adminEditUsers(user,'user',updateBox_cb);
      }
   }
   else{
      x_adminEditUsers(updateBox_cb);
   }
   return false;
}
function adminEditUsers_cb(new_data){
   clearbc=0;
   x_adminEditUsers(updateBox_cb);
   if(new_data==1){
      setMsgText("User Successfully Deleted");
   }
   if(new_data==2){
      setMsgText("User Successfully Updated");
   }
}
function editSettings(key,form){
 if(key != 0){
  document.getElementById("breadcrumb").innerHTML = "";
   colwlength = form.elements['colw[]'].length;
   colww=form.maxic.value;
   if (! colww  || colww < 1 || parseInt(colww) != colww)  {alert("The Number of Columns must be just a number greater than zero!"); return false;}
   for (var i = 0; i <form.maxic.value; i++) {
    if(colwlength==null) {
     aa0=form.elements['colw[]'].value;
     if (! aa0  || aa0 < 1 || parseInt(aa0) != aa0)  {alert("The column width need non negative number!"); return false;}
     aaa=aa0+form.elements['units[]'].value;
    } else {
     if(i > colwlength - 1 ) { aaa='1%'; } else {
      aa0=form.elements['colw[]'][i].value;
      if (! aa0  || aa0 < 1 || parseInt(aa0) != aa0)  {alert("All column widths need non negative numbers!"); return false;}
      aaa=aa0+form.elements['units[]'][i].value;
     }
    }
    colww+= '~~|~~' + aaa;
  }
  // validation
  if (! form.title.value) {alert("The Page Title is missing!"); return false;}
  if (! form.wpage.value  || form.wpage.value < 10 ) {alert("The Page Width must be just a number and greater than 10!"); return false;}
  if (! form.dypage.value || form.dypage.value < 0 ) {alert("The Sell Spacing must be just a nonnegative number!"); return false;}
  x_editSettings(1,form.id.value,form.title.value,form.wpage.value,form.dypage.value,colww,form.hidden.value,form.torder.value,form.oldtorder.value,editSettings_cb);
 } else{
  document.getElementById("breadcrumb").innerHTML = "";
  x_editSettings(0,form.id.value,'','','','','','','',updateBox_cb);
 }
 return false;
}
function editSettings_cb(new_data){
 if(new_data == 1){
  clearbc = 0; updateBox('admin',0); setMsgText("New Settings Saved");
 }
}
function editUser(type,form){
   if(form != 0){
      if(type == 'info'){
         x_editUser(type,form.firstname.value,form.lastname.value,form.email.value,0,'','','',editUser_cb);
      }
      else if(type == 'settings'){
         setMsgText("New Settings Saved");
         x_editUser(type,form.theme_id.value,'','',0,'','','',editUser_cb);
      }
      else if(type == 'pass'){
         if(form.new_password.value=='' || form.new_password2.value==''){
            setMsgText("You must fill all fiellds");
            return false;
         }
         if(form.new_password.value != form.new_password2.value){
            setMsgText("New Passwords Do Not Match");
            return false;
         }else{
            document.getElementById("breadcrumb").innerHTML = "";
            x_editUser(type,form.new_password.value,form.new_password.value,'',0,'','','',editUser_cb);
         }
      }
   }else{
      x_editUser(type,'','','',0,'','','',updateBox_cb);
   }
   return false;
}
function editUser_cb(new_data){if(new_data == 1){ clearbc = 0; updateBox('prefs',0); setMsgText("New Settings Saved"); } }
 var page = 'search'; var bc_parenttype = ''; var bc_parentitem = ''; var bc_childtype = ''; var bc_childitem = '';
 var prevpage = '';  var clearbc = 1;
/*******************************************************************************
 End the script initially based on http://www.mp3act.net by Jon Buda
*******************************************************************************/

/*******************************************************************************
   Start content boxes script initially based on google/ig
*******************************************************************************/
function getID(a){return document.getElementById?document.getElementById(a):null} function apgelstn(a){return document.getElementsByTagName?document.getElementsByTagName(a):new Array()} function apuc(a){return a.toUpperCase()} function aptrim(a){return a.replace(/^\s*|\s*$/g,"")} function apesc(a){return window.encodeURIComponent?encodeURIComponent(a):escape(a)}var aO=function(a){return window.decodeURIComponent?decodeURIComponent(a):unescape(a)};var _unesc=aO;function _hesc(a){return a.replace(/</g,"&lt;").replace(/>/g,"&gt;")}var aN=0;function _uid(){return"obj"+aN++} function _min(a,aa){return a<aa?a:aa} function _max(a,aa){return a>aa?a:aa}var aI=navigator.userAgent.indexOf("Safari")>=0;function _sendx(a,aa){var ab=aP();if(!ab||aI&&!aa){(new Image()).src=a}else{ab.open("GET",a,true);if(aa){ab.onreadystatechange=function(){if(ab.readyState==4){aa(ab.responseText)}}}ab.send(null)}} function _uhc(a,aa,ab){var ac="m_"+a+"_"+aa;var ad=getID(ac);if(!ad){ad=document.createElement("INPUT");ad.type="hidden";ad.disabled=true;ad.name=ac;getID("m_"+a+"_form").appendChild(ad)}ad.value=ab;ad.disabled=false} function aP(){var a=null;if(window.ActiveXObject){a=new ActiveXObject("Msxml2.XMLHTTP");if(!a){a=new ActiveXObject("Microsoft.XMLHTTP")}}else if(window.XMLHttpRequest){a=new XMLHttpRequest()}return a}var apet="";var appid="";var as="";function an(a,aa,ab){var ac=document.createElement("input");ac.type="hidden";ac.name=aa;ac.value=ab;a.appendChild(ac)} function aF(){var a=new Object();var aa=document.location.search.substring(1);var ab=aa.split("&");for(var ac=0;ac<ab.length;ac++){var ad=ab[ac].indexOf("=");if(ad==-1)continue;var ae=ab[ac].substring(0,ad);var af=ab[ac].substring(ad+1);af=af.replace(/\+/g," ");a[ae]=_unesc(af)}return a} function ar(){var a={pid:1,host:1,hl:1};var aa=aF();var ab="?";for(var ac in aa){if(a[ac]){ab+=ac+"="+apesc(aa[ac])+"&"}}return ab} function _xsetp(a){_sendx(as+ar()+"et="+apet+"&pid="+appid+"&"+a,null)} function apdlsetp(a,aa){if(!aa){aa=apesc(document.location)}document.location=as+ar()+"et="+apet+"&pid="+appid+"&url="+aa+"&"+a} function _ssbc(a,aa,ab){var ac=apgelstn("*");for(var ad=0;ad<ac.length;ad++){if(ac[ad].className==a){ac[ad].style[aa]=ab}}} function aM(a){_xsetp("pnlo="+(a?1:0))}var apuli;var apnlo;var appl;var apmod;var az=false;var apcols=new Array(); function apupc(){_ssbc("medit","display",apnlo||apuli?"":"none");_ssbc("panelo","display",apnlo?"":"none");_ssbc("panelc","display",apnlo?"none":"");_ssbc("mod","display",apmod?"":"none");_ssbc("unmod","display",apmod?"none":"");if(appl&&(apuli||apnlo)){if(!az){aH(apcols);az=true}_ssbc("mttl","cursor","move")}}var aq=0;function _tp(a){if(aq>0)clearInterval(ap);apnlo=a;apmod=true;aM(a);apupc();var aa=getID("cpnl");var ab=getID("cpnls");var ac=getID("cpnlc");var ad=getID("nhdr");var ae=getID("ehdr");var af=aa.offsetWidth;var ah;var ai;if(a){ah=ac.offsetWidth;ai="visible";ae.style.display="";ad.style.display="none"}else{ah=1;ai="hidden";ae.style.display="none";ad.style.display=""}aa.style.overflow="hidden";var ak=100;var at=10;var au=0;aq=setInterval(function(){var av=au/at;var aA=af+(ah-af)*av;ab.width=(aa.style.width=aA);au++;if(av>=1){clearInterval(aq);aq=0;ab.width=(aa.style.width=ah);aa.style.overflow=ai}},ak/at);return false} function _ts(a,aa){var ab=getID(a+aa);var ac;if(ab.className=="mlist_open"){ab.className="mlist_closed";ac="pnlsc"}else{ab.className="mlist_open";ac="pnlso"}_xsetp(ac+"="+apesc(aa));return false} function _add_m(a){apdlsetp(a)} function _add_m_confirm(a,aa){if(confirm(aa)){_add_m(a)}} function _add_f(a){apdlsetp("n_25="+apesc("url="+apesc(a)))}var aw=/^_add_m(_confirm)?\(\"[^"]+\"(, *\"[^"]+\")?\)$/; function aB(a){var aa=/^alert\(\"[^"]+\"\)$/;if(a.match(aw)!=null||a.match(aa)!=null){eval(a)}} var aj=[];  var ap=0;var am=null;function ag(){if(!am){am=document.createElement("DIV");am.style.display="none";am.style.position="absolute";am.style.cursor="move";am.style.backgroundColor="#ffffff";am.style.paddingBottom="0px";document.body.appendChild(am)}return am}var al={obj:null,init:function(a){a.onmousedown=al.start;if(isNaN(parseInt(ag().style.left)))ag().style.left="0px";if(isNaN(parseInt(ag().style.top)))ag().style.top="0px";a.onDragStart=new Function();a.onDragEnd=new Function();a.onDrag=new Function()},start:function(a){var aa=al.obj=this;a=al.fixE(a);var ab=parseInt(ag().style.top);var ac=parseInt(ag().style.left);aa.onDragStart(ac,ab,a.clientX,a.clientY);aa.lastMouseX=a.clientX;aa.lastMouseY=a.clientY;document.onmousemove=al.drag;document.onmouseup=al.end;  return false}, drag:function(a){a=al.fixE(a);var aa=al.obj;var ab=a.clientY;var ac=a.clientX;var ad=parseInt(ag().style.top);var ae=parseInt(ag().style.left);var af,ah;af=ae+ac-aa.lastMouseX;ah=ad+ab-aa.lastMouseY;ag().style.left=af+"px";ag().style.top=ah+"px";aa.lastMouseX=ac;aa.lastMouseY=ab;aa.onDrag(af,ah,a.clientX,a.clientY);   return false}, end:function(){document.onmousemove=null;document.onmouseup=null;al.obj.onDragEnd(parseInt(ag().style.left),parseInt(ag().style.top)); ;al.obj=null},fixE:function(a){if(typeof a=="undefined")a=window.event;if(typeof a.layerX=="undefined")a.layerX=a.offsetX;if(typeof a.layerY=="undefined")a.layerY=a.offsetY;return a}};var ax=false;function aH(a){if(ax)return;ax=true;  aj=a;  for(var aa=0;aa<aj.length;aa++){for(var ab=0;ab<aj[aa].childNodes.length-1;ab++){  var ac=aj[aa].childNodes[ab];  var ad=getID(ac.id+"_h");  if(!ad)continue;ad.module=ac;al.init(ad);  var ae=getID(ac.id+"_url");  if(ae){ae.h=ad;ae.onmousedown=function(){this.h.href=this.href;this.h.target=this.target;} }ad.onDragStart=function(af,ah){clearInterval(ap);var ai=this.module;aC(ai);ai.origNextSibling=ai.nextSibling;var ak=ag();ak.style.left=ao(ai,true);ak.style.top=ao(ai,false);ak.style.height=ai.offsetHeight;ak.style.width=ai.offsetWidth;ak.style.display="block";ak.style.opacity=0.8;ak.style.filter="alpha(opacity=80)";ak.innerHTML=ai.innerHTML;ak.className=ai.className;this.dragged=false} ;ad.onDrag=function(af,ah){aJ(this.module,af,ah);this.dragged=true} ;ad.onDragEnd=function(af,ah){if(this.dragged){ap=aG(this.module,150,15); draggedapmodule_col=this.module.parentNode.id.replace(/c_/,"")-1;draggedapmodule_id=this.module.id.replace(/m_/,"");draggedapmodule_top=this.module["offsetTop"]; save_boxes();   }else{ay();if(this.href){if(this.target){window.open(this.href,this.target);}else{document.location=this.href}}}  this.target=null;  this.href=null;   } }}} function ay(){ag().style.display="none"} function aG(a,aa,ab){var ac=parseInt(ag().style.left);var ad=parseInt(ag().style.top);var ae=(ac-ao(a,true))/ab;var af=(ad-ao(a,false))/ab;return setInterval(function(){if(ab<1){clearInterval(ap);ay();return}ab--;ac-=ae;ad-=af;ag().style.left=parseInt(ac)+"px";ag().style.top=parseInt(ad)+"px"},aa/ab)} function aC(a){for(var aa=0;aa<aj.length;aa++){var ab=0;for(var ac=0;ac<aj[aa].childNodes.length;ac++){var ad=aj[aa].childNodes[ac];if(ad==a)ab=ad.offsetHeight;ad.pagePosLeft=ao(ad,true);ad.pagePosTop=ao(ad,false)-ab}}} function ao(a,aa){var ab=0;while(a!=null){ab+=a["offset"+(aa?"Left":"Top")];a=a.offsetParent}return ab} function aJ(a,aa,ab){var ac=null;var ad=100000000;for(var ae=0;ae<aj.length;ae++){for(var af=0;af<aj[ae].childNodes.length;af++){var ah=aj[ae].childNodes[af];if(ah==a)continue;var ai=Math.sqrt(Math.pow(aa-ah.pagePosLeft,2)+Math.pow(ab-ah.pagePosTop,2));if(isNaN(ai))continue;if(ai<ad){ad=ai;ac=ah}}}if(ac!=null&&a.nextSibling!=ac){ac.parentNode.insertBefore(a,ac);aK(a)}} function aK(a){a.parentNode.style.display="none";a.parentNode.style.display=""}
/*******************************************************************************
 End the script initially  based on google/ig
*******************************************************************************/

/*******************************************************************************
 Start fade script  based on  http://www.axentric.com/aside/fat/ by Adam Michela
*******************************************************************************/
 var Fat = {make_hex : function (r,g,b)  { r = r.toString(16); if (r.length == 1) r = '0' + r; g = g.toString(16); if (g.length == 1) g = '0' + g; b = b.toString(16); if (b.length == 1) b = '0' + b; return "#" + r + g + b; }, fade_all : function () { var a = document.getElementsByTagName("*"); for (var i = 0; i < a.length; i++)  { var o = a[i]; var r = /fade-?(\w{3,6})?/.exec(o.className); if (r) { if (!r[1]) r[1] = ""; if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]); } } }, fade_element : function (id, fps, duration, from, to)  { if (!fps) fps = 30; if (!duration) duration = 3000; if (!from || from=="#") from = "#FFFF33"; if (!to) to = this.get_bgcolor(id);  var frames = Math.round(fps * (duration / 1000)); var interval = duration / frames; var delay = interval; var frame = 0; if (from.length < 7) from += from.substr(1,3); if (to.length < 7) to += to.substr(1,3);        var rf = parseInt(from.substr(1,2),16); var gf = parseInt(from.substr(3,2),16); var bf = parseInt(from.substr(5,2),16); var rt = parseInt(to.substr(1,2),16); var gt = parseInt(to.substr(3,2),16); var bt = parseInt(to.substr(5,2),16);        var r,g,b,h; while (frame < frames) { r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames)); g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames)); b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames)); h = this.make_hex(r,g,b);        setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);  frame++; delay = interval * frame;  } setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay); }, set_bgcolor : function (id, c) { var o = document.getElementById(id); o.style.backgroundColor = c; }, get_bgcolor : function (id) { var o = document.getElementById(id); while(o) { var c; if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color"); if (o.currentStyle) c = o.currentStyle.backgroundColor; if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; } o = o.parentNode; } if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF"; var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/); if (rgb) {c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));} return c; } }; window.onload = function () { Fat.fade_all(); };
/*******************************************************************************
 End the script  based on  http://www.axentric.com/aside/fat/ by Adam Michela
*******************************************************************************/

/*******************************************************************************
 Start menu script
*******************************************************************************/
function navmenu(){ var navRoot = document.getElementById("navnav").getElementsByTagName("LI"); for (var i=0; i<navRoot.length; i++) { navRoot[i].onmouseover=function() {this.className+="over"; }; navRoot[i].onmouseout=function()  {this.className=this.className.replace("over",""); } } }
/*******************************************************************************
 End menu script
*******************************************************************************/

/*******************************************************************************
 Start XMLHttpRequest script
*******************************************************************************/
 var http_request = false;
 function makeRequest(url,get_request) { document.getElementById("loading").style.display='block'; http_request = false; if (window.XMLHttpRequest) {  http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) {  try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents;  http_request.open('GET', url + get_request, true); http_request.send(null);}
 function alertContents() {
  if (http_request.readyState == 4) {
   if (http_request.status == 200) {
    result = http_request.responseText.split("~~|~~");
    // (AP)
    if(result.length==1) {
     aresult = http_request.responseText.split("::|::");
     amaxii=(aresult.length-2)/2;
     j=0;
     for(i=0;i<amaxii;i++){
      idobject=document.getElementById(aresult[j]);
      // alert(aresult[j]);
      // alert(aresult[j+1]);
      if (idobject != null) {  idobject.innerHTML = aresult[j+1];}
      j+=2;
     }
     eval(aresult[aresult.length-2]);
     document.getElementById("loading").style.display = 'none';
     return;
    }
    // (EDP)
    maxii=(result.length-1)/2;
    for(k=0;k<REQMax;k++){
     j=0;
     for(i=0;i<maxii;i++){
      idobject=document.getElementById(k+result[j]);
      if (idobject != null) {idobject.innerHTML = result[j+1]; }
      j+=2;
     }
    }
    // action (EDP)
    idobject=document.getElementById(result[result.length-3]);
    if (idobject != null) {
    idobject.innerHTML = result[result.length-2];
    Fat.fade_element(result[result.length-3],null, 1500, "#EEFCC5","#FF0000");
    }
    document.getElementById("loading").style.display = 'none';
   } else {
    alert('There was a problem with the request.');
   }
  }
 }
 function get(name,obj) {
  var getstr = "?";
  for (i=0; i<obj.childNodes.length; i++) {
   if (obj.childNodes[i].tagName == "INPUT") {
    if (obj.childNodes[i].type == "hidden")   {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; }
    if (obj.childNodes[i].type == "button")   {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; }
    if (obj.childNodes[i].type == "checkbox") {if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";  } else { getstr += obj.childNodes[i].name + "=&";  } }
    if (obj.childNodes[i].type == "radio")    {if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } }
    if (obj.childNodes[i].type == "text")     {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; }
    if (obj.childNodes[i].type == "file")     {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; }
   }
   if (obj.childNodes[i].tagName == "SELECT") {
    var sel = obj.childNodes[i]; getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
   }
   if (obj.childNodes[i].type == "textarea") {
    getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
   }
  }
  // around #-problem
  var t = /#/g;
  getstr=getstr.replace(t,"zsdiesz");
  makeRequest(name,getstr);
}
/*******************************************************************************
 End XMLHttpRequest
*******************************************************************************/
