// Auto Scrolling Functions--------------------------------------------------------------------------------------------------------------------------
function scrollIt(){
	window.scrollTo(document.forms[0].pageX.value, document.forms[0].pageY.value);
}

function setCoords(){
	var myPageX;
	var myPageY;
	if (document.all){
		myPageX = document.body.scrollLeft;
		myPageY = document.body.scrollTop;
	} else {
		myPageX = window.pageXOffset;
		myPageY = window.pageYOffset;
	}
	document.forms[0].pageX.value = myPageX;
	document.forms[0].pageY.value = myPageY;
}
// End Auto Scrolling Functions----------------------------------------------------------------------------------------------------------------------


function noEnterKey(){
	if (window.event.keyCode == 13){
		 event.returnValue=false;
		 event.cancel = true;
	}
}

function is_integer(num){
	if (isNaN(num)){return false;}
	if (num.indexOf(".") != -1){return false;}
	return true;
}


function is_currency(num){
	var temp_num;
	temp_num = "";
	re = /[^0-9,\$\.]/;
	if (re.test(num)){return false;}
	temp_num = num;
	temp_num = temp_num.replace(/[\$,]/g, "");
	if (temp_num.length == 0){return false;}
	if (isNaN(temp_num)){return false;}	
	return true;
}


function is_date (num){	
	if (num.length != 10){return false;}	
	temp_arr = num.split("/");
	if (temp_arr.length != 3){return false;}	
	the_month = temp_arr[0];
	the_month = parseInt(the_month, 10);
	the_day = temp_arr[1];
	the_day = parseInt(the_day, 10);
	the_year = temp_arr[2];
	the_year = parseInt(the_year, 10);
	if (isNaN(the_month) || isNaN(the_day) || isNaN(the_year)){return false;}
	if (the_month > 12 || the_month < 1){return false;}
	if (the_day < 1) {return false;}
	if (the_month == 1 || the_month == 3 || the_month == 5 || the_month == 7 || the_month == 8 || the_month == 10 || the_month == 12){
		if (the_day > 31) {return false;}
	}
	if (the_month == 2){
		if (the_day > 28){return false;}
	}
	if (the_month == 4 || the_month == 6 || the_month == 9 || the_month == 11){
		if (the_day > 30) {return false;}
	}
	return true;
}


function date_compare (num1, num2){
	// if date1 before date2, return -1
	// if date1 same as date2, return 0
	// if date1 after date2, return +1
	
	var date1 = new Date(num1);
	var date2 = new Date(num2);
	
	if (date1 < date2){return -1;}
	if (date1 > date2){return 1;}
	return 0;
}


function is_week(num1, num2){
	var date1 = new Date(num1);
	var date2 = new Date(num2);
	time_span = date2 - date1
	seven_days = 86400000*7
	if (time_span > seven_days){
		return false;
	}
	return true;
}
