//Create a boolean variable to check for a valid IE instance.
var xmlhttp = false;


//Check if we are using IE.
try {
	//If the javascript version is greater than 5.
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	//If not, then use the older active x object.
	try {
	//If we are using IE.
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
	//Else we must be using a non-IE browser.
	xmlhttp = false;
}
}


//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	xmlhttp = new XMLHttpRequest();
}


///// VISUALIZAÇÃO DO CALENDÁRIO

function updatecalendario()
{
	//document.getElementById("errordiv").innerHTML = "";
	document.getElementById('calendar').innerHTML = "<br><br><span style='font-size=12px; font-face:arial; font-color:#CCCCCC;'> <img src='puzzle/ajax-loader.gif'> <br> Carregando ...  </span>";
}
function showHideCalendar(month, year, cidade){
    //Abre a conexão
    xmlhttp.open("GET","calendar.php?month="+month+"&year="+year+"&cidade="+cidade);
    xmlhttp.onreadystatechange=mostracalendario
	updatecalendario();
    //Executa
    xmlhttp.send(null)
}

function mostracalendario() {
if (xmlhttp.readyState==4){
   //Mostra o HTML recebido
   document.getElementById('calendar').innerHTML=xmlhttp.responseText
   }
}


// function to create a form
function createform (e,date){
	theObject = document.getElementById("createtask");
	theObject.style.visibility = "visible";
	theObject.style.height = "200px";
	theObject.style.width = "200px";
	var posx = 0;
	var posy = 0;
	posx = e.clientX + document.body.scrollLeft;
	posy = e.clientY + document.body.scrollTop;
	theObject.style.left = posx + "px";
	theObject.style.top = posy + "px";

	//The location we are loading the page into.
	var objID = "createtask";
	var serverPage = "theform.php?date="+date;
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		obj.innerHTML = xmlhttp.responseText;
	}
	} // close function
xmlhttp.send(null);
}



// function to close task
function closetask (){
	theObject = document.getElementById("createtask");
	theObject.style.visibility = "hidden";
	theObject.style.height = "0px";
	theObject.style.width = "0px";
	acObject = document.getElementById("autocompletediv");
	acObject.style.visibility = "hidden";
	acObject.style.height = "0px";
	acObject.style.width = "0px";
}


// function to find the object - value X
function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	} else if (obj.x){
		curleft += obj.x;
	}
return curleft;
}


// function to find the object - value Y
function findPosY(obj){
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if (obj.y){
		curtop += obj.y;
	}
return curtop;
}


// function to autocomplete form
function autocomplete (thevalue, e){
	// definindo posição do DIV onde aparecerá o autocomplete
	theObject = document.getElementById("autocompletediv");
	theObject.style.visibility = "visible";
	theObject.style.width = "100px";
	var posx = 0;
	var posy = 0;
	posx = (findPosX (document.getElementById("yourname")) + 1);
	posy = (findPosY (document.getElementById("yourname")) + 23);
	theObject.style.left = posx + "px";
	theObject.style.top = posy + "px";
	var theextrachar = e.which;
	if (theextrachar == undefined){
		theextrachar = e.keyCode;
	}
	//The location we are loading the page into.
	var objID = "autocompletediv";

	//Take into account the backspace.
	if (theextrachar == 8){
		if (thevalue.length == 1){
		var serverPage = "autocomp.php";
		} else {
		var serverPage = "autocomp.php" + "?sstring=" + thevalue.substr (0, (thevalue.length -1));
		}
	} else {
		var serverPage = "autocomp.php" + "?sstring=" + thevalue + String.fromCharCode (theextrachar);
	}

// mostra conteúdo na DIV 


var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
	obj.innerHTML = xmlhttp.responseText;
	}
}
xmlhttp.send(null);
}
function setvalue (thevalue){
acObject = document.getElementById("autocompletediv");
acObject.style.visibility = "hidden";
acObject.style.height = "0px";
acObject.style.width = "0px";
document.getElementById("yourname").value = thevalue;
}
	
	
	
function validateform (thevalue){
	serverPage = "validator.php?sstring=" + thevalue;
	objID = "messagebox";
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		obj.innerHTML = xmlhttp.responseText;
		}
	}
xmlhttp.send(null);
}


function updatetaskcalendario()
{
	//document.getElementById("errordiv").innerHTML = "";
	document.getElementById('taskbox').innerHTML = "<br><br><span style='font-size=12px; font-face:arial; font-color:#CCCCCC;'> <img src='puzzle/ajax-loader.gif'> <br> Carregando ...  </span>";
}

	

function checkfortasks (thedate, e){
	theObject = document.getElementById("taskbox");
	theObject.style.visibility = "visible";
	var posx = 0;
	var posy = 0;
	posx = e.clientX + document.body.scrollLeft - 100;
	posy = e.clientY + document.body.scrollTop;
	theObject.style.left = posx + "px";
	theObject.style.top = posy + "px";
	serverPage = "taskchecker.php?thedate="+thedate;
	objID = "taskbox";
	var obj = document.getElementById(objID);

	updatetaskcalendario()

	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		obj.innerHTML = xmlhttp.responseText;
		}
	}
xmlhttp.send(null);
}

function hidetask (){
	tObject = document.getElementById("taskbox");
	tObject.style.visibility = "hidden";
	tObject.style.height = "0px";
	tObject.style.width = "0px";
}

	


/// CH4


//Function to run a word grabber script.
function grabword (theelement){
//If there is nothing in the box, run Ajax to populate it.

	if (document.getElementById(theelement).innerHTML.length == 0){
		//Change the background color.
		document.getElementById(theelement).style.background = "#CCCCCC";
		serverPage = "wordgrabber.php";
		var obj = document.getElementById(theelement);
		xmlhttp.open("POST", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			}
			}
			xmlhttp.send(null);
	} else {
	//Change the background color.
	document.getElementById(theelement).style.background = "#FFFFFF";
	//If the box is already populated, clear it.
	document.getElementById(theelement).innerHTML = "";
	}
}	
	
	
	
	
//////////////////////// SUBMIT FORM /////////////////////////////////////////////















function processajax (serverPage, obj, getOrPost, str){
	//Get an XMLHttpRequest object for use.
	xmlhttp = getxmlhttp ();
	if (getOrPost == "get"){
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			}
		}
	xmlhttp.send(null);
	} else {
	xmlhttp.open("POST", serverPage, true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
			}
		}
	xmlhttp.send(str);
	}
}


function getxmlhttp(){

	//Create a boolean variable to check for a valid Microsoft active x instance.
	var xmlhttp = false;

	//Check if we are using internet explorer.
	try {
		//If the javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		//If not, then use the older active x object.
		try {
			//If we are using internet explorer.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			//Else we must be using a non-internet explorer browser.
			xmlhttp = false;
		}
	}
	// If not using IE, create a
	// JavaScript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
		}
	return xmlhttp;
	}
	



try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
       try{
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       }catch(E){
          xmlhttp = false;
       }
    }
}





// validate form
function validateform (thevalue){
	serverPage = "validator.php?sstring=" + thevalue;
	//objID = "messagebox";
	objID = "messagebox";
	var obj = document.getElementById(objID);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		obj.innerHTML = xmlhttp.responseText;
		}
	}
xmlhttp.send(null);
}





//Function to validate the addtask form.
function validatetask1 (thevalue, thename){
	var nowcont = true;
	if (thename == "yourname"){
		if (trim (thevalue) == ""){
		document.getElementById("themessage").innerHTML = "<span class=aviso>Informe seu nome</span>";
		nowcont = false;
		}
	}
	if (thename == "yourtask"){
		if (trim (thevalue) == ""){
		document.getElementById("themessage").innerHTML = "<span class=aviso>Informe seu compromisso</span>";
		nowcont = false;
		}
	}

	if (nowcont == true){
	}
return nowcont;
var aok;
}


// FUNÇÃO PARA POSTAR O FORMULÁRIO
function getformvalues(fobj, valfunc){
	var str = "";
	aok = true;
	var val;

	//Run through a list of all objects contained within the form.
	for(var i = 0; i < fobj.elements.length; i++){
		if(valfunc) {
			if (aok == true){
				val = 

validatetask1(fobj.elements[i].value,fobj.elements[i].name);
				if (val == false){
					aok = false;
				}
			}
		}
	str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
	}
//Then return the string values.
return str;
}


function submitform(theform, serverPage, objID, valfunc){
	var file = serverPage;
	var str = getformvalues(theform,valfunc);
	//If the validation is ok.
	if (aok == true){
		obj = document.getElementById(objID);
		processajax(serverPage, obj, "post", str);
	}
}


function trim (inputString) {
	// Removes leading and trailing spaces from the passed string. Also removes
	// consecutive spaces and replaces them with one space. If something besides
	// a string is passed in (null, custom object, etc.), then return the input.
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") { // Check for spaces at the beginning of the string
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { // Check for spaces at the end of the string
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
while (retValue.indexOf(" ") != -1) {
		// Note there are two spaces in the string
		// Therefore look for multiple spaces in the string
		retValue = retValue.substring(0, retValue.indexOf(" ")) + 

retValue.substring(retValue.indexOf(" ")+1, retValue.length); 
		// Again, there are two spaces in each of the strings
	}
return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function


///// LISTANDO EVENTOS PARA SEREM EXCLUÍDOS

function updatemostraeventos()
{
	//document.getElementById("errordiv").innerHTML = "";
	document.getElementById('createtask').innerHTML = "<br><span style='font-size=12px; font-face:arial; font-color:#CCCCCC;'> <img src='puzzle/ajax-loader.gif'> <br> Carregando ...  </span>";
}

function eventoslistar(date){
    //Abre a conexão
    xmlhttp.open("GET","tasklist.php?thedate="+date);
    xmlhttp.onreadystatechange=mostraeventos
	updatemostraeventos();
    //Executa
    xmlhttp.send(null)
}

function mostraeventos() {
if (xmlhttp.readyState==4){
   //Mostra o HTML recebido
   document.getElementById('createtask').innerHTML=xmlhttp.responseText
   }
}

////// MOSTRAR FOTO

function updateStatus()
{
	//document.getElementById("errordiv").innerHTML = "";
	document.getElementById('verfoto').innerHTML = "<span style='font-size=12px; font-face:arial; font-color:#CCCCCC;'> <img src='puzzle/ajax-loader.gif'>  Carregando ...  </span>";
}


// function to create a form
function createphoto(e, foto){
	theObject = document.getElementById("verfoto");
	theObject.style.visibility = "visible";
	theObject.style.height = "420px";
	theObject.style.width = "400px";
	var posx = 0;
	var posy = 0;
	posx = e.clientX + document.body.scrollLeft - 110;
	posy = e.clientY + document.body.scrollTop - 100;
	theObject.style.left = posx + "px";
	theObject.style.top = posy + "px";

//The location we are loading the page into.
	var objID = "verfoto";
//	var serverPage = "theform.php";
	var obj = document.getElementById(objID);
	
	updateStatus('verfoto'); 
	
//	xmlhttp.open("GET", serverPage);
    xmlhttp.open("GET","ver_foto.php?foto="+foto);

	
//    xmlhttp.onreadystatechange=mostrafoto

	
	xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		obj.innerHTML = xmlhttp.responseText;
	}
	} // close function
xmlhttp.send(null);
}


function foto(foto){
    //Abre a conexão
	updateStatus('verfoto'); 
	
    xmlhttp.open("GET","ver_foto.php?foto="+foto);
    xmlhttp.onreadystatechange=mostrafoto
    //Executa
    xmlhttp.send(null)
}

function mostrafoto() {
if (xmlhttp.readyState==4){
   //Mostra o HTML recebido
   document.getElementById('verfoto').innerHTML=xmlhttp.responseText
   }
}


///// EXCLUIR EVENTOS




<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v4.01
  //Copyright 1998 Macromedia, Inc. All rights reserved.
  var i,j,aLayer,retVal,curDrag=null,curLeft,curTop,IE=document.all,NS4=document.layers;
  var NS6=(!IE&&document.getElementById), NS=(NS4||NS6); if (!IE && !NS) return false;
  retVal = true; if(IE && event) event.returnValue = true;
  if (MM_dragLayer.arguments.length > 1) {
    curDrag = MM_findObj(objName); if (!curDrag) return false;
    if (!document.allLayers) { document.allLayers = new Array();
      with (document) if (NS4) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
        for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
          with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
      } else {
        if (NS6) { var spns = getElementsByTagName("span"); var all = getElementsByTagName("div"); 
          for (i=0;i<spns.length;i++) if (spns[i].style&&spns[i].style.position) allLayers[allLayers.length]=spns[i];}
        for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i]; 
    } }
    curDrag.MM_dragOk=true; curDrag.MM_targL=targL; curDrag.MM_targT=targT;
    curDrag.MM_tol=Math.pow(tol,2); curDrag.MM_hLeft=hL; curDrag.MM_hTop=hT;
    curDrag.MM_hWidth=hW; curDrag.MM_hHeight=hH; curDrag.MM_toFront=toFront;
    curDrag.MM_dropBack=dropBack; curDrag.MM_dropJS=dropJS;
    curDrag.MM_everyTime=et; curDrag.MM_dragJS=dragJS;
    curDrag.MM_oldZ = (NS4)?curDrag.zIndex:curDrag.style.zIndex;
    curLeft= (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft; 
    if (String(curLeft)=="NaN") curLeft=0; curDrag.MM_startL = curLeft;
    curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop; 
    if (String(curTop)=="NaN") curTop=0; curDrag.MM_startT = curTop;
    curDrag.MM_bL=(cL<0)?null:curLeft-cL; curDrag.MM_bT=(cU<0)?null:curTop-cU;
    curDrag.MM_bR=(cR<0)?null:curLeft+cR; curDrag.MM_bB=(cD<0)?null:curTop+cD;
    curDrag.MM_LEFTRIGHT=0; curDrag.MM_UPDOWN=0; curDrag.MM_SNAPPED=false; //use in your JS!
    document.onmousedown = MM_dragLayer; document.onmouseup = MM_dragLayer;
    if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  } else {
    var theEvent = ((NS)?objName.type:event.type);
    if (theEvent == 'mousedown') {
      var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
      var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
      var maxDragZ=null; document.MM_maxZ = 0;
      for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
        var aLayerZ = (NS4)?aLayer.zIndex:parseInt(aLayer.style.zIndex);
        if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
        var isVisible = (((NS4)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
        if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
          var parentL=0; var parentT=0;
          if (NS6) { parentLayer = aLayer.parentNode;
            while (parentLayer != null && parentLayer.style.position) {             
              parentL += parseInt(parentLayer.offsetLeft); parentT += parseInt(parentLayer.offsetTop);
              parentLayer = parentLayer.parentNode;
          } } else if (IE) { parentLayer = aLayer.parentElement;       
            while (parentLayer != null && parentLayer.style.position) {
              parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
              parentLayer = parentLayer.parentElement; } }
          var tmpX=mouseX-(((NS4)?pageX:((NS6)?parseInt(style.left):style.pixelLeft)+parentL)+MM_hLeft);
          var tmpY=mouseY-(((NS4)?pageY:((NS6)?parseInt(style.top):style.pixelTop) +parentT)+MM_hTop);
          if (String(tmpX)=="NaN") tmpX=0; if (String(tmpY)=="NaN") tmpY=0;
          var tmpW = MM_hWidth;  if (tmpW <= 0) tmpW += ((NS4)?clip.width :offsetWidth);
          var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS4)?clip.height:offsetHeight);
          if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
              || maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
      if (curDrag) {
        document.onmousemove = MM_dragLayer; if (NS4) document.captureEvents(Event.MOUSEMOVE);
        curLeft = (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft;
        curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop;
        if (String(curLeft)=="NaN") curLeft=0; if (String(curTop)=="NaN") curTop=0;
        MM_oldX = mouseX - curLeft; MM_oldY = mouseY - curTop;
        document.MM_curDrag = curDrag;  curDrag.MM_SNAPPED=false;
        if(curDrag.MM_toFront) {
          eval('curDrag.'+((NS4)?'':'style.')+'zIndex=document.MM_maxZ+1');
          if (!curDrag.MM_dropBack) document.MM_maxZ++; }
        retVal = false; if(!NS4&&!NS6) event.returnValue = false;
    } } else if (theEvent == 'mousemove') {
      if (document.MM_curDrag) with (document.MM_curDrag) {
        var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
        var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
        newLeft = mouseX-MM_oldX; newTop  = mouseY-MM_oldY;
        if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
        if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
        if (MM_bT!=null) newTop  = Math.max(newTop ,MM_bT);
        if (MM_bB!=null) newTop  = Math.min(newTop ,MM_bB);
        MM_LEFTRIGHT = newLeft-MM_startL; MM_UPDOWN = newTop-MM_startT;
        if (NS4) {left = newLeft; top = newTop;}
        else if (NS6){style.left = newLeft; style.top = newTop;}
        else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
        if (MM_dragJS) eval(MM_dragJS);
        retVal = false; if(!NS) event.returnValue = false;
    } } else if (theEvent == 'mouseup') {
      document.onmousemove = null;
      if (NS) document.releaseEvents(Event.MOUSEMOVE);
      if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
      if (document.MM_curDrag) with (document.MM_curDrag) {
        if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
            (Math.pow(MM_targL-((NS4)?left:(NS6)?parseInt(style.left):style.pixelLeft),2)+
             Math.pow(MM_targT-((NS4)?top:(NS6)?parseInt(style.top):style.pixelTop),2))<=MM_tol) {
          if (NS4) {left = MM_targL; top = MM_targT;}
          else if (NS6) {style.left = MM_targL; style.top = MM_targT;}
          else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
          MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
        if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
        if(MM_dropBack) {if (NS4) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
        retVal = false; if(!NS) event.returnValue = false; }
      document.MM_curDrag = null;
    }
    if (NS) document.routeEvent(objName);
  } return retVal;
}


shortcut.add("SHIFT+A",function() 
{
	MM_showHideLayers('lracesso','','visible');
	window.location.href('#acessa');

});

shortcut.add("CTRL+1",function() 
{
	window.location.href('index.php');
});

shortcut.add("CTRL+2",function() 
{
	window.location.href('?acesso=1');
});

shortcut.add("CTRL+3",function() 
{
	window.location.href('?acesso=36');
});
shortcut.add("CTRL+4",function() 
{
	window.location.href('?acesso=5');
});
shortcut.add("CTRL+5",function() 
{
	window.location.href('?acesso=41');
});
shortcut.add("CTRL+6",function() 
{
	window.location.href('?acesso=17');
});
shortcut.add("CTRL+7",function() 
{
	window.location.href('?acesso=27');
});
shortcut.add("CTRL+8",function() 
{
	window.location.href('?acesso=28');
});
shortcut.add("CTRL+9",function() 
{
	window.location.href('?acesso=30');
});
shortcut.add("CTRL+0",function() 
{
	window.location.href('?acesso=38');
});
shortcut.add("esc",function() 
{
	MM_showHideLayers('lracesso','','hide');
});


