﻿ 
		var IE = document.all?true:false;
		if (!IE) document.captureEvents(Event.MOUSEMOVE)
		//document.onmousemove = getMouseXY;
		var tempX = 0;
		var tempY = 0;
		
		var mouseleft = true;
		
		function getMouseXY(e) {
				
			if (IE) { // grab the x-y pos.s if browser is IE
							
			tempX = event.clientX + document.body.scrollLeft;
			tempY = event.clientY + document.body.scrollTop;

			}
			else {  // grab the x-y pos.s if browser is NS
			tempX = e.pageX;
			tempY = e.pageY;
		
			}  
			if (tempX < 0){tempX = 0;}
			if (tempY < 0){tempY = 0;}  
			return true;			
		}

	  var inShimmer = false;
	  var inButton = false;

	  function buttonIn()
	  {
	  	inButton = true;
	  	//mouseIn();
	  	open();
	  }
	  
	  function buttonOut()
	  {
	  	inButton=false;
		mouseOut();

	  }
	  
	  function shimmerIn()
	  {
	  	// If we were in the Shimmer and now we are out, we may still be in
	  	if (inShimmer)
	  	{
	  		// Check the mouse locations to determine if we are still in
	  		getMouseXY(event);
	  		var leftx = tempX - 27 + 'px';
   			var topy = tempY - 375 + 'px';
   			var rightx = tempX - 27 + 360 + 'px';
   			var bottomy = tempY  + 10 + 'px';
   			
   			
   			if ((tempX > leftx && tempX < rightx) && (tempY > topy && tempY < bottomY))
   			{
   				// We are still in the Shimmer
   				return;
   				
   			}
   			else
   			{
   				// We are not so, we can close it
   				shimmerOut();
   			}      
	  		
	  	}
	  	inShimmer = true;
	  	//alert("in");
	  }
	  
	  function shimmerOut()
	  {
	  
	 	 // Check the mouse locations to determine if we are still in
	  		getMouseXY(event);
	  		
	  		var leftx = shimmerLeftX;
   			var topy = shimmerTopY;
   			var rightx = shimmerLeftX + shimmerWidth;
   			var bottomy = shimmerTopY + shimmerHeight + 10;
   			
   		//	alert(leftx + "=leftx," + tempX + "=mousex," + rightx + "=rightx," + topy + "=topy," +  tempY + "=mousey" + bottomy + "=bottomy" );
   			if ((tempX > leftx && tempX < rightx) && (tempY > topy && tempY < bottomy))
   			{
   				// We are still in the Shimmer
   				return;
   				
   			}

	  	inShimmer =false;
		mouseOut();
		//alert("out");
		
	  }
	  

	  var shimmerTopY = 0;
	  var shimmerLeftX = 0;
	  var shimmerWidth = 340;
	  var shimmerHeight = 360;
	  
	  function mouseIn() {
       
        setTimeout ( "open()", 500 );
       	    
      }
       
      function open() 
      {
   
      	// Check if the Shimmer is already created
      	var oldShimmer = document.getElementById('shimmer');
       	// If it exists, we close it
       	if (oldShimmer != null)
      	{
      
      	    close(); 
      	}
      	  
        // create an iframe at the exact same position and 
        // size as the sub div
        // Google "iframe shime" for more information
        getMouseXY(event);
        var shimmer = document.createElement('iframe');
        shimmer.id='shimmer';
        shimmer.style.position='absolute';
  
        // normally you would get the dimensions and 
        // positions of the sub div dynamically. For demo 
        // purposes this is hardcoded
        
        shimmer.style.width=shimmerWidth + 'px';
        shimmer.style.height= shimmerHeight + 'px';
   		var topx = tempX - 7;
   		var topy = tempY - 375;
        shimmer.style.top=topy  + 'px';              
        shimmer.style.left=topx  + 'px';
        shimmerTopY = topy;
        shimmerLeftX = topx;

        shimmer.style.zIndex='999';
        shimmer.setAttribute('frameborder','0');
        shimmer.setAttribute('src','javascript:false;');
        shimmer.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
		  document.body.appendChild(shimmer);
        // make sub div visible
        var sd = document.getElementById('subdiv');
          sd.style.top=topy;
          sd.style.left=topx;
          sd.style.width=shimmerWidth + 'px';
          sd.style.height= shimmerHeight + 'px';
   	      sd.style.visibility='visible';
        //  sd.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";

   	  }
   	  
      function mouseOut() {
     
     	setTimeout ( "close()", 500 );

      }
      
      function close() {
    

	    // check if we are in the Shimmer, if we are, we won't close it
	   // if (inShimmer || inButton)
	    //{
	   // 	return;
	    //}
	    
      	var sd = document.getElementById('subdiv');
        sd.style.visibility='hidden';
        var shimmer = document.getElementById('shimmer');
        if (shimmer != null)
        {
	        document.body.removeChild(shimmer);
	    }
        
      }

