global = true;

function switchg(){
  if(global) global = false
  else global = true
}

document.onmousedown = switchg;

function detectMouseCoordinates(e){
    var posx,posy;
	
    posx=0;
    posy=0;

    if(!e) var e = window.event;
	
    if(e.pageX||e.pageY) {
          posx=e.pageX - 77;
          posy=e.pageY;
		}
    else if(e.clientX||e.clientY) {
          posx = e.clientX + document.documentElement.scrollLeft - 77;
          posy = e.clientY + document.documentElement.scrollTop;
    	}
    if(global) movete('capagris',posx);
	}
document.onmousemove = detectMouseCoordinates;

function movete(id, posx) {
	destino = parseInt(posx)
	
	// ANCHO DE LA VENTANA
	var myWidth = 0, myHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
		}
	// ANCHO DE LA VENTANA
	
//	if(document.all) myWidth = myWidth - 154;
//	else myWidth = myWidth - 170;
	if(document.all) myWidth = 780 - 155;
	else myWidth = 780 - 154;
	
	if((destino > 0) && (destino < myWidth)) {
		obj = document.getElementById(id).style
		
		c = parseInt(obj.left);
		if(parseInt(obj.left) != destino) obj.left = destino+"px"
		}
	}

// Función que modifica el alto del div de la izquierda
function initHeight() {
	// Sumamos el alto de los tres div de la izquierda
	if(document.getElementById("contentAll").offsetHeight > document.getElementById("i3").offsetHeight) {
		if(document.all) document.getElementById("i3").style.height = (document.getElementById("contentAll").offsetHeight - 100)
		else document.getElementById("i3").style.minHeight = (document.getElementById("contentAll").offsetHeight - 105) + 'px'
		}
	}
