/**
 * @author randy
 */
function vpWidth()
	{
	return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	}
	
function vpHeight()
	{
	return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	}
	
// x/y positioning functions
function xCenter(inner)

	{ 
	return	Math.floor(vpWidth() / 2) - Math.floor(inner.width() / 2) - 30;
	}
			
function yCenter(inner) 
	{ 
	return   Math.floor(vpHeight() / 3) - Math.floor(inner.height() / 2);
	}
	
	

function HSAWaitStart(message)
	{
	return setTimeout('HSATimerSpinner("' + message + '")' ,500);
	}
	
function HSATimerSpinner(message)
	{
	$('body').prepend('<div id="HSAWaitGB"></div>');
	$('#HSAWaitGB').css({'opacity' 				: 0.3,
								'display' 				: 'block',
								'width' 					: '100%',
								'height' 				: '100%', // $(document).height(),
								'position' 				: 'absolute',
								'left' 					: '0px',
								'right' 					: '0px',
								'z-index' 				: '20002',
								'border' 				: 'none',
								'margin' 				: '0px',
								'padding' 				: '0px',
								'background-color'	: '#000000',
								'cursor' 				: 'wait'
							  });
							  
	$('body').append('<span id="HSAWaitSpinner">' +
	 							'<img src="images/waiting.gif" height="30" width="30"/>' +
								' Please wait... ' + message + '...' +
						  '</span>');
						  
	var s = $('#HSAWaitSpinner');
						  
	s.css('font-size','30px');
	
	s.css({'display' 				: 'block',
			  'position'			: 'absolute', 
			  'z-index'				: '20001',
			  'background-color'	:'#bcec74',
			  'vertical-align'	: 'middle',
			  'padding-right'		: '20px',
			  'padding-left'		: '20px',
			  'padding-top'		: '20px',
			  'padding-bottom'	: '20px',
			  'width'				: s.width()  + 'px',
			  'height'				: s.height() + 'px',
			  'left'					: xCenter(s) + 'px',
			  'top'					: yCenter(s) + 'px'
			 });

	}

function HSAWaitStop(timer)
	{
	clearTimeout(timer);
	$('#HSAWaitSpinner').remove();
	$('#HSAWaitGB').remove();
	}
