  var currDivIDV;
  var currDivIDH;
// function switchDiv()
//  this function takes the id of a div
//  and calls the other functions required
//  to show that div
//
  function switchDiv(div_id, hide_div_id)
  {
    var style_sheet = getStyleObject(div_id);
    if (style_sheet)
    {
        changeObjectVisibility(hide_div_id,"hidden");
        changeObjectVisibility(div_id,"visible");
        currDivIDV=div_id;
        currDivIDH=hide_div_id;
    }
    else
    {
      alert("sorry, this only works in browsers that do Dynamic HTML");
    }
  }

// function getStyleObject(string) -> returns style object
//  given a string containing the id of an object
//  the function returns the stylesheet of that object
//  or false if it can't find a stylesheet.  Handles
//  cross-browser compatibility issues.
//
  function getStyleObject(objectId) {
    // checkW3C DOM, then MSIE 4, then NN 4.
    //
    if(document.getElementById && document.getElementById(objectId)) {
      return document.getElementById(objectId).style;
     }
     else if (document.all && document.all(objectId)) {
      return document.all(objectId).style;
     }
     else if (document.layers && document.layers[objectId]) {
      return document.layers[objectId];
     } else {
      return false;
     }
  }

  function changeObjectVisibility(objectId, newVisibility) {
      // first get a reference to the cross-browser style object
      // and make sure the object exists
      var styleObject = getStyleObject(objectId);
      if(styleObject) {
        styleObject.visibility = newVisibility;

        return true;
      } else {
      // we couldn't find the object, so we can't change its visibility
        return false;
      }
  }

  function changeObjectVisibilityAndValue(objectId, newVisibility, value) {
      // first get a reference to the cross-browser style object
      // and make sure the object exists
      var styleObject = getStyleObject(objectId);
      if(styleObject) {
        styleObject.visibility = newVisibility;

          document.getElementById(objectId).innerHTML=value;

        return true;
      } else {
      // we couldn't find the object, so we can't change its visibility
        return false;
      }
  }


function updateFunction(path,formName,key,input,itwo){
    var ajaxRequest;  // The variable that makes Ajax possible!
    var allComments="";

    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
    }

    if(key!="x"&&key!="xx"&&key!="rm"){
        var inputValue =document.getElementById(input).value;
        if(document.getElementById(input).value!=""){
            ajaxRequest.open("GET",path+"?input="+escape(inputValue)+"&itwo="+itwo+"&key="+key, true);
            ajaxRequest.send(null);
            changeObjectVisibility(currDivIDV,"hidden");
            changeObjectVisibilityAndValue(currDivIDH,"visible",inputValue );
        }
        else{
             alert("enter contet please")
        }
    }
    else{
        var msg = "ÀEst‡ usted seguro usted quiere SUPRIMIR este art’culo?";
        if(confirm(msg)){
            ajaxRequest.open("GET",path+"?input="+escape(inputValue)+"&itwo="+itwo+"&key="+key, true);
            ajaxRequest.send(null);
            location.reload(true);
        }

    }

}
function updateComment(path,formName,key,input,itwo, returnPath){
    var ajaxRequest;  // The variable that makes Ajax possible!
    var allComments="";

    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
    }

    if(document.getElementById(input).value!=""){
        var inputValue =document.getElementById(input).value;
        ajaxRequest.open("POST",path+"?input="+escape(inputValue)+"&itwo="+itwo+"&key="+key, true);
        ajaxRequest.send(null);
        location.href=returnPath;
    }
    else{
         alert("enter contet please")
    }
}


function ajaxFunction(path){
    var ajaxRequest;  // The variable that makes Ajax possible!
    var allComments="";

    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
            var ajaxResponse = ajaxRequest.responseText;
            allComments = document.getElementById("comments");
            var com = document.createElement('P');
            com.className='comments';
            com.innerHTML=ajaxResponse;
            allComments=allComments.appendChild(com);
            //document.comments.commentInput.value = ajaxRequest.responseText;
            document.comments.commentInput.value = "";
            document.comments.commentInput.focus();
        }
    }
    var commentValue =document.getElementById("commentInput").value;
    if(document.getElementById("commentInput").value!=""){
        ajaxRequest.open("GET", path+"?commentInput="+escape(commentValue), true);
        ajaxRequest.send(null);
    }
    else{
         alert("enter contet please")
    }
}
function goTo(destination){
    location.href=destination;
}

  /*
  * below for limiting input text
  * */
  //** Form field Limiter v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com
//** Feb 25th, 09'- Script creation date
//** This notice must stay intact for legal use

var fieldlimiter={

defaultoutput: "<b>[int]</b> letras quedan para llegar a su limite.", //default message that gets output to statusid element

uncheckedkeycodes: /(8)|(13)|(16)|(17)|(18)/, //keycodes that are not checked, even when limit has been reached. See http://www.javascriptkit.com/jsref/eventkeyboardmouse.shtml for avail keycodes

limitinput:function(e, config){
	var e=window.event || e
	var thefield=config.thefield
	var keyunicode=e.charCode || e.keyCode
	if (!this.uncheckedkeycodes.test(keyunicode)){
		if (thefield.value.length>=config.maxlength){
			if (e.preventDefault)
				e.preventDefault()
			return false
		}
	}
},

showlimit:function(config){
	var thefield=config.thefield
	var statusids=config.statusids
	var charsleft=config.maxlength-thefield.value.length
	if (charsleft<0) //if user has exceeded input limit (possible if cut and paste text into field)
		thefield.value=thefield.value.substring(0, config.maxlength) //trim input
	for (var i=0; i<statusids.length; i++){
		var statusdiv=document.getElementById(statusids[i])
		if (statusdiv) //if status DIV defined
			statusdiv.innerHTML=this.defaultoutput.replace("[int]", Math.max(0, charsleft))
	}
	config.onkeypress.call(thefield, config.maxlength, thefield.value.length)
},

cleanup:function(config){
	for (var prop in config){
		config[prop]=null
	}
},


addEvent:function(targetarr, functionref, tasktype){
	if (targetarr.length>0){
		var target=targetarr.shift()
		if (target.addEventListener)
			target.addEventListener(tasktype, functionref, false)
		else if (target.attachEvent)
			target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)})
		this.addEvent(targetarr, functionref, tasktype)
	}
},

setup:function(config){
	if (config.thefield){ //if form field exists
		config.onkeypress=config.onkeypress || function(){}
		config.thefield.value=config.thefield.value
		this.showlimit(config)
		this.addEvent([window], function(e){fieldlimiter.showlimit(config)}, "load")
		this.addEvent([window], function(e){fieldlimiter.cleanup(config)}, "unload")
		this.addEvent([config.thefield], function(e){return fieldlimiter.limitinput(e, config)}, "keypress")
		this.addEvent([config.thefield], function(){fieldlimiter.showlimit(config)}, "keyup")
	}
}

}