function sendMail(user,domain,tld,subject,message) {
	if (!user) user = "sales";
	if (!domain) domain = "lakeforesthomesinc";
	if (!tld) tld = "com";
	locationstring = "mailto:" + user + "@" + domain + "." + tld;
	if (subject) locationstring += "?subject=" + encodeURIComponent(subject);
	if (message) locationstring += "&body=" + encodeURIComponent(message);
	window.location = locationstring;
}

function openWindow(url,features) {
	var newWin = window.open(url,'popup',features);
	newWin.focus();
}

function closeWindow() {
	if (window.opener) {
		self.close();	
	}
}

function externalLinks() { 
	if (!document.getElementsByTagName) return;
	var pattern = /external/;
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && pattern.test(anchor.getAttribute("rel"))) 
		anchor.target = "_blank"; 
	} 
}

function filesToBlank() { 
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && /\.pdf$/i.test(anchor.href)) {
		anchor.target = "_blank";
		anchor.innerHTML += " [PDF]";
		}
		if (anchor.getAttribute("href") && /\.doc$/i.test(anchor.href)) {
		anchor.target = "_blank";
		anchor.innerHTML += " [DOC]";
		}
		if (anchor.getAttribute("href") && /\.pps$/i.test(anchor.href)) {
		anchor.target = "_blank";
		anchor.innerHTML += " [PPS]";
		}
		if (anchor.getAttribute("href") && /\.ppt$/i.test(anchor.href)) {
		anchor.target = "_blank";
		anchor.innerHTML += " [PPT]";
		}
	} 
}

function nullLinks() {
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var re = /\bnull\b/;
		var anchor = anchors[i]; 
		if (re.test(anchor.className)) {
			anchor.onclick = function() { return false; }
		}
	}
}

function printPage() {
	if(window.print != null) {
		window.print();
	}
	else {
		alert("To print this page, please select Print from your browser's File menu.");
	}
}

function preload() {
	var path = "/images/";
	var images = new Array("");
	var preload = new Array();
	var j = images.length;
	for (var i=0; i<images.length; i++) {
		preload[j] = new Image;
		preload[j++].src = path + images[i];
	}
}

function makeRollovers() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a");
	var mouseovers = new Array;
	var j = 0;
	for (var i=0; i<anchors.length; i++) {
   	var e = anchors[i]; 
   	if (/\brollover\b/.test(e.className)) {
			mouseovers[j] = new Image;
			mouseovers[j].src = e.childNodes[0].src.replace('_up','_ov');
			j++;
			e.onmouseover = function() { 
				this.childNodes[0].src = this.childNodes[0].src.replace('_up','_ov');
			}
			e.onmouseout = function() {
				this.childNodes[0].src = this.childNodes[0].src.replace('_ov','_up');
			}		
		}
	} 
}


var NS = (navigator.appName=="Netscape")?true:false; 

function fitToPic() { 
	iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
	iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
	iWidth = document.images[0].width - iWidth; 
	iHeight = document.images[0].height - iHeight; 
	window.resizeBy(iWidth, iHeight); 
	self.focus(); 
}

function popUnder() {
	var w = window.open('http://lakeforesthomesinc.com/special_offer.php','popunder','width=300,height=300,resizable=1');
	w.blur();
}

function disable(element,trigger) {
	var e = document.getElementById(element);
	var t = document.getElementById(trigger);
	e.disabled = false;
	if (t.selectedIndex != 0) {
		e.selectedIndex = 0; 
		e.disabled = true;
	}
}

function init() {
	externalLinks();
	filesToBlank();
	nullLinks();
	makeRollovers();
}