// JavaScript Document

var d_x = 0;
var d_y = 0 ;
var img_h ;
var img_w ;
// var hd = document.getElementById("hd");



function showThis( elementId ){
	//alert( elementId )  ;
	document.getElementById(elementId).style.visibility = "visible" ;
	
	
}

function hideThis( elementId )
{
	document.getElementById(elementId ).style.visibility = "hidden" ;		
}



function show_up_coords(event)
{
    u_x=event.x;
    u_y=event.y;
 /*   w=document.getElementById("hd").width;
    h=document.getElementById("hd").height;	
*/    
    //alert("X coords: " + x + ", Y coords: " + y)
    document.getElementById("coords").value= "X: " + u_x + ", Y: " + u_y ;
    
    img_w = u_x - d_x ;
    img_h = u_y - d_y ;  
}

function show_move_coords(event)
{
/*	m_x=event.clientX
	m_y=event.clientY */
	
	m_x=event.x    ;
	m_y=event.y    ;
	
	//alert("X coords: " + x + ", Y coords: " + y)
	document.getElementById("move_coords").value= "X: " + m_x + ", Y: " + m_y ;	
		
	
	img_w = m_x - d_x ;
	img_h = m_y - d_y ;
	
	
	document.getElementById("hd").style.width 	= img_w ;
	document.getElementById("hd").style.height	= img_h ;

}

function test(){
    alert("Inside Test");

}

function show_down_coords( e )
{
//     alert("Inside show-down");
    if (!e) var e = window.event;
	// e gives access to the event in all browsers
	
	d_x=e.clientX ;
	d_y=e.clientY ;
	
	
	alert(e.type);
	
 	alert("X coords: " + d_x + ", Y coords: " + d_y) ;
 	
 	
// 	
// 	//document.getElementById("down_coords").value= "X: " + d_x + ", Y: " + d_y ;	
// 	
	document.getElementById("hd").style.left	= d_x;
	document.getElementById("hd").style.top		= d_y;
	hd.style.left	= d_x;
	hd.style.top		= d_y;
}

function show_key_press( e ){
    if (!e) var e = window.event;

    if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	var character = String.fromCharCode(code);
	alert('Character was ' + character);

}

function move_piece()
{
    hd = document.getElementById("hd").style.left ;
 alert("In move_piece hd.style.left = " + hd);
    d_x = hd.style.left ;
 
    d_x = d_x + 1 ;
    hd.style.left = d_x ;
  
//     hd.style.left  = hd.style.left + 10 ;
//     x = x + 10 ;
//     hd.style.left = x ;

}

function whichButton(event)
{
	//alert(event.keyCode)
	document.getElementById("key_id").value= event.keyCode ;
}




//			SCRAP HEAP  ========================================================================
/*


	//document.getElementById("hd").style.position="absolute";
	
	//document.getElementById("hd").width = w * 1.5;
	//document.getElementById("hd").style.top=y-25;
	
	//document.getElementById("hd").style.left=x-(document.getElementById("hd").width / 2);
	//document.getElementById("hd").style.top=y- (document.getElementById("hd").width / 2);
	 
	'new_c' => 'New',
	'notcontactedyet_c' => 'Not Contacted',
	'contacted_c' => 'Contacted',
	'decision_maker_c' => 'Decision Maker ID',
	'qualified_c' => 'Qualified',
	'demoscheduled_c' => 'Demo Scheduled',
	'democomp_c' => 'Demo Complete',
	'propsent_c' => 'Proposal Sent',
	'contsent_c' => 'Contract Sent',
	'pendingapproval_c' => 'Pending Approval',
	'contractrecvd_c' => 'Contract Received',
	'tobetrained_c' => 'To Be Trained',
	'closedlost_c' => 'Closed Lost',
	'mgr_review_c' => 'MGR Review',
*/
