
//***************************************************************************
//*
//*		(c) Copyright 2006 Alta Systems (NI) Ltd
//*		All reproduction and reuse prohibited without prior written
//*		permission of the copyright owner.
//*
//*
//***************************************************************************

function rollOver(p_obj) {
	p_obj.src = p_obj.src.replace(/_up/i, '_hover');
}

function rollOut (p_obj) {
	p_obj.src = p_obj.src.replace(/_hover/i, '_up');
}

// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
function logout( p_sessionid )   
{   
	if ( confirm("Are you sure you want to log out?") ) 
	{ 
		//document.location.href="Logout.asp?session=" + p_sessionid ;
		document.location.href="/ocr/Logout.asp?session=" + p_sessionid;
	}
}  


// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
function get_help( p_sessionid )
{   

	window.open('Help.asp?session=' + p_sessionid, 'help', 'height=400,width=700,status=no,toolbar=yes,menubar=yes,location=no,resizable=yes,scrollbars=yes'); 

}  

// ---------------------------------------------------------------------
//	Global Variables for the buttons
// ---------------------------------------------------------------------

var m_path = 'images\\buttons\\';
var m_ext = '.gif';

// ---------------------------------------------------------------------
//	Name		:	altaChgState
//	Purpose		:	To change the image of the button depending upon the 
//					current mouse event
// ---------------------------------------------------------------------

function altaChgState(p_ele, p_event) {

	switch (p_event.type)
	{
	case 'mouseover':
		p_ele.src = m_path + p_ele.id + '_hover' + m_ext;
		break;
	case 'mousedown':
		p_ele.src = m_path + p_ele.id + '_down' + m_ext;
		break;
	case 'mouseout':
		p_ele.src = m_path + p_ele.id + '_up' + m_ext;
		break;
	case 'mouseup':
		p_ele.src = m_path + p_ele.id + '_hover' + m_ext;
		break;
	}

}

// ---------------------------------------------------------------------
//	Name		:	altaImgPreload
//	Purpose		:	To preload the images for use in buttons
// ---------------------------------------------------------------------

function altaImgPreload() {

	var h_argscount;
	var h_args = arguments;

	if (!document.m_imgsArr) document.m_imgsArr = new Array();

	var h_count = document.m_imgsArr.length;

	for (h_argscount=1; h_argscount<h_args.length; h_argscount++)
	{
		if (h_args[h_argscount].indexOf("#") != 0)
		{
			document.m_imgsArr[h_count] = new Image;
			document.m_imgsArr[h_count].src = m_path + h_args[0] + h_args[h_argscount] + m_ext;
			h_count++;
		}
	}

}

// ---------------------------------------------------------------------
//	Name		:	altaListImgArray
//	Purpose		:	Debug function that lists the contents of the document 
//					image and preload image arrays
// ---------------------------------------------------------------------

function altaListImgArray() {

	var h_images = document.images;
	var h_length = h_images.length;
	var h_count;
	var h_output = "";

	for (h_count=0; h_count < h_length ; h_count++ )
	{
		h_output = h_output + h_images[h_count].src + '\n';
	}

	h_output = h_output + "\nAnd the contents of the Preload Array:\n";
	
	h_images = document.m_imgsArr;
	h_length = h_images.length;

	for (h_count=0; h_count < h_length ; h_count++ )
	{
		h_output = h_output + h_images[h_count].src + '\n';
	}
	
	alert('The contents of the images array:\n' + h_output);

}

// ---------------------------------------------------------------------
//	Global Variables for the text counter
// ---------------------------------------------------------------------

var moz = window.Event ? true : false;

// ---------------------------------------------------------------------
//	Name		:	textCounter
//	Purpose		:	Character counter/restrictor for text fields
// ---------------------------------------------------------------------

function textCounter (field, countfield, maxsize) 
{
 var maxlimit = maxsize;
 var divcount = document.getElementById(countfield);
 
 if ( field.value.length > maxsize )
 {
  field.value = field.value.substring( 0, maxsize );
 }
 else
 {
  if (moz) // Mozilla etc.
   divcount.innerHTML = '(' + (maxsize - field.value.length) + ' characters remaining)';
  else
   divcount.innerText = '(' + (maxsize - field.value.length) + ' characters remaining)';
 }
}

// ---------------------------------------------------------------------
// ---------------------------------------------------------------------

