var level = new String;
Number.prototype.ordinal = function () {
	return this + (
		(this % 10 == 1 && this % 100 != 11) ? 'st' :
		(this % 10 == 2 && this % 100 != 12) ? 'nd' :
		(this % 10 == 3 && this % 100 != 13) ? 'rd' : 'th'
	);
}
String.prototype.trim=function(){
    return this.replace(/^\s*|\s*$/g,'');
}
function validateEmail(email) {
	var emailEx = /^[a-zA-Z0-9\.\_\-]*\@[a-zA-Z0-9]*\.[a-zA-Z]{2,6}\.{0,1}[a-zA-Z]{0,6}$/;
	return emailEx.test(email)
}
function validatePhone(phone) {
	var phoneEx = /^1?[\.\-\s]?\d{3}[\.\-\s]?\d{3}[\.\-\s]?\d{4}[\.\-\s]?[EeXxTt]{0,3}?[\.\-\s]?[\s]?\d{0,5}?$/;
	return phoneEx.test(phone)
}
function roll(direction, id) {
	if (direction == "over") {
		document.getElementById(id).src = level+"images/nav/"+id+"_alt.jpg";
	} else if (direction == "out") {
		document.getElementById(id).src = level+"images/nav/"+id+".jpg";
	} else {
		window.alert("Rollover direction not specified for "+id);	
	}
}
function preload(){
	var overStates = new Array;
	var otherImages = new Array
	for (i=0;i<preload.arguments.length;i++) {
		if ((preload.arguments[i].split(".")[0] != "undefined") && (preload.arguments[i].split("/")[0] != "undefined")) {
			otherImages[i] = new Image;
			otherImages[i].src = preload.arguments[i];
		} else {
			overStates[i] = new Image;
			overStates[i].src = level+"images/nav/"+preload.arguments[i]+"_alt.jpg";
		}
	}
}
window.addEvent('domready', function(){
	level = $("pageLevel").href;
	preload("NewsEvents","SpecialsClearance","About","VirtualTour","HoursDirection","Locations","Pharmacy","HomeDecorGallery","GiftShop","HallmarkGoldCrown","OnlineStore");
});