
//function initEventCapture(){
//  try{
//	document.onmousedown = setXY;

//  }catch(err){alert('intiEventCapture '+err);} 
//}

//////////  and these to the index page
//<input type='hidden' id='action_clickx' name='action_clickx' value='0'/>
//<input type='hidden' id='action_clicky' name='action_clicky' value='0'/>

function getActionClickX(){
  var rc = 0;
  if(document.getElementById("action_clickx")){ 
	rc= getNumber(document.getElementById("action_clickx").value);
	
  }

  return rc;
}

function getActionClickY(){
  var rc = 0;
  if(document.getElementById("action_clicky")){ 
	rc=getNumber(document.getElementById("action_clicky").value);
  }
  return rc;
}


/////////////
// put setXY in the startup script for the body
function setXY(e){

    var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft	+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop	+ document.documentElement.scrollTop;
	}
    // see if object was an action button 
    var objectID = (e.target) ? e.target.id : ((e.srcElement) ? e.srcElement.id : null);
	//alert('objectID='+objectID);
	/*if(objectID.indexOf('action_deleteinitiate')==0){

	  document.getElementById("headermessage").innerHTML="Are you sure?";
	  document.getElementById("message").innerHTML="Delete";
      document.getElementById("DeleteWindow").style.left=posx;
	  document.getElementById("DeleteWindow").style.top=posy;
      document.getElementById("DeleteWindow").style.visibility="visible";
	}
	*/
    if(document.getElementById("action_clickx")){ 
		//alert("set action_clicky " +posx);
	   document.getElementById("action_clickx").value=posx;
	}
    if(document.getElementById("action_clicky")){ 
	   document.getElementById("action_clicky").value=posy;
	}
    if(document.getElementById("action_scrollleft")){ 
	   //document.getElementById("action_scrollleft").value=posx;
       document.getElementById("action_scrollleft").value=0;
	}
    if(document.getElementById("action_scrolltop")){ 
	   //document.getElementById("action_scrolltop").value=posy;
	   document.getElementById("action_scrolltop").value=document.body.scrollTop;	
	}

}

function scrollPage(){

  document.body.scrollLeft=document.getElementById("action_scrollleft").value;
  document.body.scrollTop=document.getElementById("action_scrolltop").value;

}

///////////////////////////
//  Put onClick='addScrollXYToUrl(this)' in each link.
////////////////
function addScrollXYToUrl(linkObj){
  if(document.getElementById('action_scrollleft')){
    /// add this to a link to force scrolling coordinates into the parameters 
    linkObj.href=linkObj.href+'&action_scrollleft='+document.getElementById('action_scrollleft').value+'&'+'action_scrolltop='+document.getElementById('action_scrolltop').value;
  
  }else{
    alert("addScrollXYToUrl "+"element action_scrollleft undefined" );
  }
} 







