function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function visibility(name,items,saveCookie,visibleNumber) {
	// document.write("El número es " + x + "<br>");
	for (x = 1; x <= items; x++){
		if(visibleNumber > 0){
			// only one visible
			var id = name + "_" + x;
			var e = document.getElementById(id);
			if(visibleNumber == x){
				e.style.display = 'block';
				if (saveCookie == 'save'){
					document.cookie = id + "=" + 'block';
				}
			}
			else {
				e.style.display = 'none';
				if (saveCookie == 'save'){
					document.cookie = id + "=" + 'none';
				}
			}
		}
		else{
			// togle all ids
			var id = name + "_" + x;
			var e = document.getElementById(id);
			if(e.style.display == 'none'){
				e.style.display = 'block';
				if (saveCookie == 'save'){
					document.cookie = id + "=" + 'block';
				}
			}
			else {
				e.style.display = 'none';
				if (saveCookie == 'save'){
					document.cookie = id + "=" + 'none';
				}
			}
		}
	}
}
function getCookie(name){
  var cname = name + "=";               
  var dc = document.cookie;             
  if (dc.length > 0) {
    begin = dc.indexOf(cname);       
    if (begin != -1) {           
      begin += cname.length;       
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    } 
  }
  return null;
}
function checkVisibility(name,items){
	for (x = 1; x <= items; x++){
		var id = name + "_" + x;
		var cval = getCookie(id);
		if (cval > ''){
			var e = document.getElementById(id);
			e.style.display = cval;
		}
	}
}
function mouseFx(elem,color) {
		elem.style.backgroundColor=color;
}
function position(elem, l, r){
	var elem = document.getElementById(elem);
	elem.style.left = l + "px";
	elem.style.top = r + "px";
}
/* edit_layer Scroll*/
var slideTime = 700, topMargin;
xAddEventListener(window, 'load',
  function () {
    topMargin = xPageY(); //+150

    winOnResize(); // set initial position
    xAddEventListener(window, 'resize', winOnResize, false);
    xAddEventListener(window, 'scroll', winOnScroll, false);
  }, false
);
function winOnResize() {
  xMoveTo('edit_layer', 0, topMargin);
  xGetElementById('edit_layer').style.visibility = 'visible';
  winOnScroll(); // initial slide
}
function winOnScroll() {
  xSlideTo('edit_layer', xLeft('edit_layer'), xScrollTop() + topMargin, slideTime);
}
function showNavSection($id_sections, $id_sessions) {
	/*if (already[$id_sections] == 1){
		
	}
	esle{
	}
	var already[$id_sections] = 1;*/
		xajax_showNavSection($id_sections, $id_sessions);
}
function exe_xajax(mode, id){
	xajax_edit_layer(mode, id);
}
function DelAnswerWithAjax(mode, id, msg){
	if (! msg > '') var msg = 'Por favor confirme que desea elimar el objeto seleccionado';
	var answer;
	answer=confirm(msg);
	if(answer==true){
		//window.location="edit_in.php?modo=del_ima&id_paragraphs_images=<?php echo $_REQUEST[id_paragraphs_images] ?>"
		xajax_edit_layer(mode, id);
	}
}
function confirmUrl(msg, url){
	var answer;
	answer=confirm(msg);
	if(answer==true){
		window.location = url;
	}
}
// tool tip
var OP = (navigator.userAgent.indexOf('Opera') != -1) ? true : false;
var IE = (navigator.userAgent.indexOf('MSIE') != -1 && !OP) ? true : false;
var GK = (navigator.userAgent.indexOf('Gecko') != -1) ? true : false;
var NN4 = document.layers;
var DOM = document.getElementById;

function TOOLTIP() {

//this.width = 200;
//this.bgColor = '#FFFF99';
//this.textColor = '#000000';
//this.borderColor = '#000000';
this.opacity = 85;
this.cursorDistance = 10;

this.text = '';
this.height = 0;
this.obj = 0;
this.sobj = 0;
this.active = false;

this.create = function() {
  if(!this.sobj) this.init();
  var t = '<div class = "tooltip">' + this.text + '</div>';
  if(NN4) {
	t = '<table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor=' + this.borderColor + '>' + t + '</td></tr></table>';
	this.sobj.document.write(t);
	this.sobj.document.close();
  }
  else {
	this.sobj.border = '1px solid ' + this.borderColor;
	this.setOpacity();
	if(document.getElementById) document.getElementById('ToolTip').innerHTML = t;
	else document.all.ToolTip.innerHTML = t;
  }
  if(DOM) this.height = this.obj.offsetHeight;
  else if(IE) this.height = this.sobj.pixelHeight;
  else if(NN4) this.height = this.obj.clip.bottom;

  this.show();
}
this.init = function() {
  if(DOM) {
	this.obj = document.getElementById('ToolTip');
	this.sobj = this.obj.style;
  }
  else if(IE) {
	this.obj = document.all.ToolTip;
	this.sobj = this.obj.style;
  }
  else if(NN4) {
	this.obj = document.ToolTip;
	this.sobj = this.obj;
  }
}
this.show = function() {
  var ext = (document.layers ? '' : 'px');
  var left = mouseX;
  var top = mouseY;
  if(left + this.width + this.cursorDistance > winX) left -= this.width + this.cursorDistance;
  else left += this.cursorDistance;
  if(top + this.height + this.cursorDistance > winY) top -= this.height;
  else top += this.cursorDistance;
  this.sobj.left = left + ext;
  this.sobj.top = top + ext;
  if(!this.active) {
	this.sobj.visibility = 'visible';
	this.active = true;
  }
}
this.hide = function() {
  if(this.sobj) this.sobj.visibility = 'hidden';
  this.active = false;
}
this.setOpacity = function() {
  this.sobj.filter = 'alpha(opacity=' + this.opacity + ')';
  this.sobj.mozOpacity = '.1';
  if(this.obj.filters) this.obj.filters.alpha.opacity = this.opacity;
  if(!document.all && this.sobj.setProperty) this.sobj.setProperty('-moz-opacity', this.opacity / 100, '');
}
}//end TOOLTIP func
var tooltip = mouseX = mouseY = winX = winY = 0;
/*if(document.layers) {
document.write('<layer id="ToolTip"></layer>');
document.captureEvents(Event.MOUSEMOVE);
}
else document.write('<div id="ToolTip" style="position:absolute; z-index:99"></div>');*/
document.onmousemove = getMouseXY;
function getMouseXY(e) {
if(IE) {
  mouseX = event.clientX + document.body.scrollLeft;
  mouseY = event.clientY + document.body.scrollTop;
}
else {
  mouseX = e.pageX;
  mouseY = e.pageY;
}
if(mouseX < 0) mouseX = 0;
if(mouseY < 0) mouseY = 0;

else if(GK || NN4) {
  winX = window.innerWidth - 25;
  winY = window.innerHeight;
}
else if(DOM) {
  winX = document.body.offsetWidth - 25;
  winY = document.body.offsetHeight;
}
else {
  winX = screen.width - 25;
  winY = screen.height;
}
if(tooltip && tooltip.active) tooltip.show();
}
function toolTip(text, width, opacity) {
if(text) {
  tooltip = new TOOLTIP();
  tooltip.text = text;
  if(width) tooltip.width = width;
  if(opacity) tooltip.opacity = opacity;
  tooltip.create();
}
else if(tooltip) tooltip.hide();
}