/************************************/
/*	CONTENT			JS HELPER	*/
/************************************/
/**
 * show loading bar 
 */
function showLoadingBar(){	
	var loadingWindow = document.getElementById("loadingBar");
	loadingWindow.style.position = "absolute";
	loadingWindow.style.fontweight = "bold";
	loadingWindow.style.color = "#ffffff";
	loadingWindow.style.width = "760px";
	loadingWindow.style.margin = "0px auto 0px auto";
	loadingWindow.style.left = "10%";
	loadingWindow.style.top = "150px";	
	loadingWindow.style.display = 'block';
	loadingWindow.style.zIndex = 3;		
	hideBackground();
}
/**
 * hide background
 */
function hideBackground(){
	var backgroundLayer = document.getElementById("backgroundLayer");
	backgroundLayer.style.backgroundColor = "#000000";
	backgroundLayer.style.opacity = 0.60;
	backgroundLayer.style.display = "block";
	backgroundLayer.style.width = "100%";
	backgroundLayer.style.height = "100%";
	backgroundLayer.style.left = "0px";
	backgroundLayer.style.top = "0px";
	backgroundLayer.style.zIndex = 2;	
}
/**
 * show background
 */
function showBackground(){
	var backgroundLayer = document.getElementById("backgroundLayer");
	backgroundLayer.style.display = "none";
}

function visibleImageDiv (id,img,height,width){
  if (document.getElementById) {
    var thisdiv = document.getElementById(id);
	var height = height;
	var width = width;
    thisdiv.style.display = 'block';
	thisdiv.style.backgroundImage ="url("+ img +")";
	thisdiv.style.height = height + (document.documentElement? "px" : "");
	thisdiv.style.width = width + (document.documentElement? "px" : "");

	if(document.all)
	  var IE = true;
	if(document.layers)
	  var NS4 = true;
	if(window.opera)
	  var OP = true;

	var scrollPos;

	if(typeof window.pageYOffset == "number") {
	  if (NS4) {
		thisdiv.top = window.pageYOffset + 2 +  (document.documentElement? "px" : "");
      } else {
		thisdiv.style.top = window.pageYOffset + 2 + (document.documentElement? "px" : "");
      }
	} else {	  
	  if (typeof window.pageYOffset != 'undefined') {
   		scrollPos = window.pageYOffset;
	  } else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
	  	scrollPos = document.documentElement.scrollTop;
	  } else if (typeof document.body != 'undefined') {
		scrollPos = document.body.scrollTop;
	  }
      thisdiv.style.top = scrollPos + 2 + (document.documentElement? "px" : "");
	}
	//if (OP)
    	  //thisdiv.style.pixelTop = 10 + (document.documentElement? "px" : "");
  }
}

function invisibleImageDiv (id){
  if (document.getElementById) {
    var mydiv = document.getElementById(id);
    mydiv.style.display = 'none';	
  }
}


/************************************/
/*	ADMIN-MENU		JS HELPER	*/
/************************************/
/**
 * show MainMenuDeleteForm
 */
function showMainMenuDeleteForm(id, orderId, href, subtable, area) {
	var js_Id = document.getElementById("delete_menu_id");
	js_Id.value = '';
	js_Id.value = id;
	var js_orderId = document.getElementById("delete_menu_orderId");
	js_orderId.value = '';
	js_orderId.value = orderId;
	var js_area = document.getElementById("delete_menu_area");
	js_area.value = '';
	js_area.value = area;
	var js_href = document.getElementById("delete_menu_href");
	js_href.setAttribute("readonly", "readonly");
	js_href.setAttribute("style", "background-color: #f9f9f9; border-color: #cccccc; color: #888888;");
	js_href.value = href;
	var js_subtable_field = document.getElementById("delete_menu_subtable_field");
	js_subtable_field.style.display = 'none';	
	if(subtable != '#') {
		var js_subtable = document.getElementById("delete_menu_subtable");
		js_subtable.value = '';
		js_subtable.value = subtable;		
		var js_subtable_txt = document.getElementById("delete_menu_subtable_txt");
		js_subtable_txt.innerHTML = '';
		js_subtable_txt.innerHTML = subtable;
		js_subtable_field.style.display = 'block';
	}

	var editForm = document.getElementById("deleteMainMenuEntry");
	editForm.style.position = "absolute";
	editForm.style.margin = "0px auto 0px auto";
	editForm.style.width = "600px";
	editForm.style.left = "auto";
	editForm.style.right = "auto";
	editForm.style.top = "150px";
	editForm.style.backgroundColor = "#f9f9f9";
	editForm.style.display = 'block';
	editForm.style.zIndex = 5;
	hideBackground();
}
/**
 * show MainSubDeleteForm
 */
function showSubMenuDeleteForm(id, orderId, href, area) {
	var js_Id = document.getElementById("delete_menu_id");
	js_Id.value = '';
	js_Id.value = id;
	var js_orderId = document.getElementById("delete_menu_orderId");
	js_orderId.value = '';
	js_orderId.value = orderId;
	var js_area = document.getElementById("delete_menu_area");
	js_area.value = '';
	js_area.value = area;
	var js_href = document.getElementById("delete_menu_href");
	js_href.setAttribute("readonly", "readonly");
	js_href.setAttribute("style", "background-color: #f9f9f9; border-color: #cccccc; color: #888888;");
	js_href.value = href;

	var editForm = document.getElementById("deleteSubMenuEntry");
	editForm.style.position = "absolute";
	editForm.style.margin = "0px auto 0px auto";
	editForm.style.width = "600px";
	editForm.style.left = "auto";
	editForm.style.right = "auto";
	editForm.style.top = "150px";
	editForm.style.backgroundColor = "#f9f9f9";
	editForm.style.display = 'block';
	editForm.style.zIndex = 5;
	hideBackground();
}
/**
 * show MainMenuEditForm
 */
function showMainMenuEditForm(id, href, modul, subtable, status) {
	var js_Id = document.getElementById("menu_id");
	js_Id.value = '';
	js_Id.value = id;
	var js_href = document.getElementById("menu_href");
	js_href.removeAttribute("readonly");
	js_href.setAttribute("style", "background-color: #fff; border-color: #93B13D; color: #000;");
	js_href.value = '';	
	js_href.value = href;
	var js_mod = document.getElementById("menu_mod");
	js_mod.value = '';
	js_mod.value = modul;
	var js_subtable = document.getElementById("menu_subtable");
	js_subtable.value = '';
	js_subtable.value = subtable;
	var js_subtable_txt = document.getElementById("menu_subtable_txt");
	js_subtable_txt.innerHTML = '';
	js_subtable_txt.innerHTML = subtable;
	var js_subtable_field = document.getElementById("menu_subtable_field");
	js_subtable_field.style.display = 'none';
	var js_subtable_old = document.getElementById("menu_subtable_old");
	js_subtable_old.value = '';
	js_subtable_old.value = subtable;	
	
	if(parseInt(status) == 2) {
		js_href.setAttribute("readonly", "readonly");
		js_href.setAttribute("style", "background-color: #f9f9f9; border-color: #cccccc; color: #888888;");
	}

	var editForm = document.getElementById("changeMainMenuEntry");
	editForm.style.position = "absolute";
	editForm.style.margin = "0px auto 0px auto";
	editForm.style.width = "600px";
	editForm.style.left = "auto";
	editForm.style.right = "auto";
	editForm.style.top = "150px";
	editForm.style.backgroundColor = "#f9f9f9";
	editForm.style.display = 'block';
	editForm.style.zIndex = 5;
	hideBackground();
}
/**
 * show SubMenuEditForm
 */
function showSubMenuEditForm(id, href, modul) {
	var js_Id = document.getElementById("menu_id");
	js_Id.value = '';
	js_Id.value = id;
	var js_href = document.getElementById("menu_href");
	js_href.value = '';
	js_href.value = href;
	var js_mod = document.getElementById("menu_mod");
	js_mod.value = '';
	js_mod.value = modul;

	var editForm = document.getElementById("changeSubMenuEntry");
	editForm.style.position = "absolute";
	editForm.style.margin = "0px auto 0px auto";
	editForm.style.width = "600px";
	editForm.style.left = "auto";
	editForm.style.right = "auto";
	editForm.style.top = "150px";
	editForm.style.backgroundColor = "#f9f9f9";
	editForm.style.display = 'block';
	editForm.style.zIndex = 5;
	hideBackground();
}
/**
 * hide MenuEditForm with id-input
 */
function hideMenuEditForm(id) {
	var editForm = document.getElementById(id);
	editForm.style.display = 'none';
}

function setMenuArea(area) {
	var editFormElement = document.getElementById("menu_area");
	editFormElement.value = '';
	editFormElement.value = area;
	alert(""+area+"");
}

/**
 * show alert with str-input
 */
function showAlert(str) {
	alert(unescape(""+str+""));
}
/************************************/
/*	ADMIN-XXXX		JS HELPER	*/
/************************************/
