var instats_domain="jenniferknoll.com";
var DC = new DateCalculators();

// -----------------------------------------------
// -----------------------------------------------
// ----- NAVIGATION / IMAGE SWAPPING
// -----
function HighlightNav(area) {
	var navRoot = document.getElementById("nav");
	if(document.all && navRoot) {
		var navItems, i, node;
		navItems = navRoot.getElementsByTagName("LI");
		for(i=0; i<navItems.length; i++) {
			node = navItems[i];
			node.onmouseover=function() { this.className += " over"; }
			node.onmouseout=function() { this.className = this.className.replace(" over", ""); }
		}
	}
} // HighlightNav


// -----------------------------------------------
// -----------------------------------------------
// ----- DATE CALCULATORS
// -----
function DateCalculators() {

	// Basic Date Setters
	var today = new Date();
	this.day = today.getDate();
	this.month = today.getMonth();
	this.year = today.getYear();
	this.year = (this.year < 1000) ? (this.year + 1900) : this.year;
	this.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	this.date = this.monthNames[this.month] + " " + this.day + ", " + this.year;

	this.GetDate = function() {
		return(this.date);
	} // this.GetDate

}


// -----------------------------------------------
// -----------------------------------------------
// ----- FORM CHECKING
// -----
function CheckForm(thisForm) {
	var msg = "";
	if(!CheckEmail(thisForm.email.value))
		msg += "You must enter a valid E-mail Address!\n";
	/*
	if(!CheckField(thisForm.first_name.value))
		msg += "You must enter a valid First Name!\n";
	if(!CheckField(thisForm.last_name.value))
		msg += "You must enter a valid Last Name!\n";
	*/
	if(msg) {
		alert(msg);
		return false;
	}
	return true;
} // CheckForm

function CheckEmail(val) {
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return(filter.test(val));
} // CheckEmail

function CheckField(val) {
	var re = new RegExp("[a-z0-9]", "ig");
	return(re.test(val));
} // CheckField

function openWin(strURL, name, winprops) {
	var winname = (name=="") ? "newwin" : name;
	if(winprops==null)
		winprops = "";
	winchild = window.open(strURL, winname, winprops);
	if(winprops!="") {
		winheight = winprops.match(/height=[0-9]+/i).toString().replace(/height=/i, "");
		winwidth = winprops.match(/width=[0-9]+/i).toString().replace(/width=/i,"");
		winchild.resizeTo(winwidth, winheight);
	}
	winchild.focus();
	return false;
} // openWin


// -----------------------------------------------
// -----------------------------------------------
// ----- STUPID SHIT
// -----
function ExtinctLink() {
	alert("404 - Page Not Found!\n\nPlease contact Jennifer@jenniferknoll.com for more information on this listing.");
	return false;
} // ExtinctLink
