//***************************************************************************map zoom

mapnum = 4;
function flipMap(){
var MPP = document.getElementById("mapimg");
var ZMM = document.getElementById("zoomrey");
if(mapnum==4){
    MPP.style.backgroundImage="url(img/map30.gif)";
	ZMM.innerHTML="72%";
    }
else if(mapnum==3){
    MPP.style.backgroundImage="url(img/map20.gif)";
	ZMM.innerHTML="43%";
    }
else if(mapnum==2){
    MPP.style.backgroundImage="url(img/map10.gif)";
	ZMM.innerHTML="12%";
    }
else if(mapnum==1){
    MPP.style.backgroundImage="url(img/map40.jpg)";
	ZMM.innerHTML="93%";
	mapnum=5;
    }
	mapnum--
}
// JavaScript Document 
var IE = (navigator.appName == "Microsoft Internet Explorer")?true:false
  
  if (!IE) document.captureEvents(Event.MOUSEMOVE)
  document.onmousemove = getMouseXY;

  var tempX, tempY;   

  function getMouseXY(e) {
    if (IE) { 
      tempX = event.clientX + document.body.scrollLeft;
      tempY = event.clientY + document.body.scrollTop;
    } 
    else { 
      tempX = e.pageX; 
      tempY = e.pageY;
    }  
    return true;
  }


//******the difference between where the element is located and the position of the  mouse function.

 var theSpotX = 0;  var theSpotY = 0; 

  function getObjectXY(theElement){
    
    elemPosX = theElement.offsetLeft;
    elemPosY = theElement.offsetTop;
    theElement = theElement.offsetParent;
    while(theElement != null){
      elemPosX += theElement.offsetLeft; 
      elemPosY += theElement.offsetTop;
      theElement = theElement.offsetParent;
	  
    }
    theSpotX = elemPosX;  
    theSpotY = elemPosY;
    return true;
  }

  function StartDrag(elem,papa){
  papa1 = document.getElementById(papa);
    theID = elem.id;
    var fix = getObjectXY(elem);
	mamaX = papa1.offsetLeft;
	mamaY = papa1.offsetTop;
	
	difX = theSpotX - tempX;
    difY = theSpotY - tempY;
     if(theDrag)window.clearInterval(theDrag);
    theDrag = setInterval("DragIt("+theID+")",3);
  }

  function DragIt(elem){ 
 
	 elem.style.left = (tempX + difX)-mamaX-28+"px";
    elem.style.top = (tempY + difY)-mamaY-78+"px";
	stopMap();
    }
  
//****************************************************************************************cancel drag
  theDrag=false;
  function CancelDrag(){ 
  	area1 = document.getElementById("mapimg");
	 AT = area1.offsetTop;
	 AL = area1.offsetLeft;
if(AT>-40 | AL>-40){
	 re_pos();
}
if(AT<-608 | AL<-488){
	  re_pos();
	  }
  else  if(theDrag){
      window.clearInterval(theDrag);
    }
  }
 //************************************************************************* cancel drag paramiters.
function stopMap(){
	 AT = area1.offsetTop;
	 AL = area1.offsetLeft;
if(AT>-40 | AL>-40)
	 {window.clearInterval(theDrag);
	  }
if(AT<-608| AL<-488)
	 {window.clearInterval(theDrag);
	  }
}
//************************************************************************* map position func.
//function re_pos(){G = setTimeout("re_posInt()",2*1000);}
function re_pos(){
area1.style.top="20px";
area1.style.left="20px";
area1.style.top=area1.offsetTop-308;
area1.style.left=area1.offsetLeft-240;
  }
//************************************************************************* map position.
/*area1 = document.getElementById("mapimg");
function slide(){
mpp=setInterval("mflow()",5);
}
i=-41;
function mflow(){
area1.style.left=i*2.5;
area1.style.top=i*2.6;
i--
if(area1.offsetLeft<-320)
{window.clearInterval(mpp);}
}*/
//************************************************************************************tip
  function tipText(TTT){
	var tipp = document.getElementById(TTT);
	var direc = document.getElementById("directions");
	var direcL= direc.offsetLeft;
	var direcT = direc.offsetTop;
	tipp.style.display = "block";
	tipp.style.left = (tempX-direcL)+90;
    tipp.style.top = (tempY-direcT)+50;
  }
  function tipClose(TTT){
	var tipp = document.getElementById(TTT);
		tipp.style.display = "none";
  }