//standard pop-up
function Popup(FullURL,Style){
	var RandomNumber = Math.round(Math.random()*100)
	var Scrollbar = 'yes'

	//set popup style
	if(Style == 'SmallWide'){
		var Width = 350;
		var Height = 250;
		Scrollbar = 'no'
		}
	if(Style == 'Mini'){
		var Width = 230;
		var Height = 250;
		Scrollbar = 'no'
		}
	if(Style == 'Note'){
		var Width = 400;
		var Height = 300;
		}
	if(Style == 'Tip'){
		var Width = 500;
		var Height = 400;
		}
	if(Style == 'Page'){
		var Width = 750;
		var Height = 550;
		}
	if(Style == 'PageWithAddress'){
		var Width = 750;
		var Height = 550;
		}
		
	//open window
	if(Style == 'PageWithAddress'){
		window.open(FullURL,'PopupWindow' + RandomNumber,'toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, resizable=yes, scrollbars=' + Scrollbar + ', screeny=0, screenx=0, top=0, left=0, width=' + Width + ', height=' + Height);
		}
	else{
		window.open(FullURL,'PopupWindow' + RandomNumber,'toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes, scrollbars=' + Scrollbar + ', screeny=0, screenx=0, top=0, left=0, width=' + Width + ', height=' + Height);
		}
	}

//standard pop-up
function FormPopup(FullURL,Style,PopupName){
	var Scrollbar = 'yes'

	//set popup style
	if(Style == 'SmallWide'){
		var Width = 350;
		var Height = 250;
		Scrollbar = 'no'
		}
	if(Style == 'Mini'){
		var Width = 230;
		var Height = 250;
		Scrollbar = 'no'
		}
	if(Style == 'Note'){
		var Width = 400;
		var Height = 300;
		}
	if(Style == 'Tip'){
		var Width = 500;
		var Height = 400;
		}
	if(Style == 'Page'){
		var Width = 750;
		var Height = 550;
		}
	if(Style == 'PageWithAddress'){
		var Width = 750;
		var Height = 550;
		}
		
	//open window
	if(Style == 'PageWithAddress'){
		window.open(FullURL,PopupName,'toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, resizable=yes, scrollbars=' + Scrollbar + ', screeny=0, screenx=0, top=0, left=0, width=' + Width + ', height=' + Height);
		}
	else{
		window.open(FullURL,PopupName,'toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes, scrollbars=' + Scrollbar + ', screeny=0, screenx=0, top=0, left=0, width=' + Width + ', height=' + Height);
		}
	}

function IsDate(FieldValue){
	if(isNaN(new Date(FieldValue))){
		return false;}

	var NewDate = new Date(FieldValue);
	var FormattedDate = ''
 
	if(NewDate.getMonth() + 1 < 10){
		FormattedDate = FormattedDate + '0'}

	FormattedDate = FormattedDate + (NewDate.getMonth() + 1) + '/'

	if(NewDate.getDate() < 10){
		FormattedDate = FormattedDate + '0'}

	FormattedDate = FormattedDate + NewDate.getDate()

	if(NewDate.getYear() > 1900){
		FormattedDate = FormattedDate + '/' + NewDate.getYear()}
	else{
		FormattedDate = FormattedDate + '/' + (NewDate.getYear() + 1900)}

	if(FormattedDate == FieldValue){
		return true;}
	else{
		return false;}
	}

function IsAlpha(FieldValue){
	return true
	}

function IsNumeric(FieldValue){
	var RegExpression = /^[0-9]{0,999}$/g;
	if(RegExpression.test(FieldValue) > 0){return true}
	//2nd test because mozilla tests twice with different results
	else if(RegExpression.test(FieldValue) > 0){return true}
	else{return false}
	}

function IsCurrency(FieldValue){
	var RegExpression = /^[0-9]{1,4}[.]{0,1}[0-9]{0,2}$/g;
	if(RegExpression.test(FieldValue) > 0 || FieldValue == ''){return true}
	else if(RegExpression.test(FieldValue) > 0 || FieldValue == ''){return true}
	else{return false}
	}

function IsAlphaNumeric(FieldValue){
	var Result = true
	var RegExpression = /[0-9]/;
	if(RegExpression.test(FieldValue) == false){Result = false}

	var RegExpression = /[A-Za-z]/;
	if(RegExpression.test(FieldValue) == false){Result = false}
	
	return Result
	}
	
	
//--------------------------------------------------------------------------------------------------
//TRACK MOUSE EVENTS

	// Set Netscape up to run the "captureMousePosition" function whenever the mouse is moved.
	// For Internet Explorer and Netscape 6, you can capture the movement a little easier.
	if(document.layers) { // Netscape
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = captureMousePosition;}
	else if(document.all) { // Internet Explorer
		document.onmousemove = captureMousePosition;}
	else if(document.getElementById) { // Netcsape 6
		document.onmousemove = captureMousePosition;}

	// Global variables
	xMousePos = 0; // Horizontal position of the mouse on the screen
	yMousePos = 0; // Vertical position of the mouse on the screen
	xMousePosMax = 0; // Width of the page
	yMousePosMax = 0; // Height of the page

	function captureMousePosition(e) {

		if (document.layers){
			// When the page scrolls in Netscape, the event's mouse position reflects the absolute position on the screen. innerHight/Width
			// is the position from the top/left of the screen that the user is looking at. pageX/YOffset is the amount that the user has
			// scrolled into the page. So the values will be in relation to each other as the total offsets into the page, no matter if
			// the user has scrolled or not.
			xMousePos = e.pageX;
			yMousePos = e.pageY;
			xMousePosMax = window.innerWidth+window.pageXOffset;
			yMousePosMax = window.innerHeight+window.pageYOffset;}
		else if(document.all){
			// When the page scrolls in IE, the event's mouse position  reflects the position from the top/left of the screen the
			// user is looking at. scrollLeft/Top is the amount the user has scrolled into the page. clientWidth/Height is the height/
			// width of the current page the user is looking at. So, to be consistent with Netscape (above), add the scroll offsets to
			// both so we end up with an absolute value on the page, no  matter if the user has scrolled or not.
			xMousePos = window.event.x+document.body.scrollLeft;
			yMousePos = window.event.y+document.body.scrollTop;
			xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
			yMousePosMax = document.body.clientHeight+document.body.scrollTop;}
			
		else if(document.getElementById){
			// Netscape 6 behaves the same as Netscape 4 in this regard
			xMousePos = e.pageX;
			yMousePos = e.pageY;
			xMousePosMax = window.innerWidth+window.pageXOffset;
			yMousePosMax = window.innerHeight+window.pageYOffset;}

		//add position of iframe
		//xMousePos = xMousePos + ThisFrame.offsetLeft
		//yMousePos = yMousePos + ThisFrame.offsetTop

		//display position in status bar
		//window.status = "xMousePos=" + xMousePos + ", yMousePos=" + yMousePos + ", xMousePosMax=" + xMousePosMax + ", yMousePosMax=" + yMousePosMax;
		}
