// noAdmin.js
// Version 1.1.1.1

var urlBase;
var language;
var pbs;

function initJS(base, lang) {
  urlBase = base;
  language = lang;
  Lightbox.init();
  initMenu();
  initGooglemaps();
  if (Object.isElement($('pbs'))) {
    window.pbs = new pbsObject();
  }
}

/*function includeFiles(base) {
  include_js(base + "js/lightbox.js");
  include_js(base + "js/menu.js");
  include_js(base + "js/recommendation.js");
}

function include_js(src) {
  var script = document.createElement('script');
  script.src = src;
  script.type = 'text/javascript';
  (document.getElementsByTagName('head')[0] || document.body).appendChild(script);
}*/

////////////////////////////////////////
// AJAX
/////////////////////////////////////////

function ajaxCM(command, param) {  // "ajaxContentManagement"
    var http = createHTTPRequestObject_toIndex();
    var parameters = "contentManagement=" + command;
    parameters += "&lang=" + language;
    parameters += "&" + param;
    http.send(parameters);
    //http.onreadystatechange = checkHTTPData(http);
    return http.responseText;
}

function createHTTPRequestObject_toIndex() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    } else{
        ro = new XMLHttpRequest();
    }
    ro.open("POST", urlBase + 'index.php', false);
    ro.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    return ro;
}

function checkHTTPData(http) {
  	if (http.readyState != 4)
      alert("Wrong HTTP-ReadyState (" + http.readyState + ")");
}
