function printPage(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}
function jm_MapQuest(country, address, city, state, zip) {
  window.open("http://local.google.com/local?f=q&hl=en&q="+ escape(address) + ",+" + escape(city) + ",+" + escape(state) + "+" + escape(zip),"jm_mapquestwin","width=720,height=400,toolbar=1,menubar=1,status=1,resizable=1,location=0,directories=0,scrollbars=1");
}

function sendToFriend(){
	theURL = this.location.href;
	generateModalWindow(400, 260);
}
function closeModal(){
	if($('modalWindow')){
		Element.remove('modalWindow');
	}
}
function generateModalWindow(w,h){
	var objBody = document.getElementsByTagName("body").item(0);
	var overlayDiv = document.createElement('div');
	overlayDiv.setAttribute("id","modalWindow");
	overlayDiv.style.position = "absolute";
	overlayDiv.style.top = "0";
	overlayDiv.style.left = "0";
	overlayDiv.style.height = (getBrowserHeight()) + "px";
	overlayDiv.style.width = "100%";
	overlayDiv.style.textAlign = "left";
	if(ltIE7){
		overlayDiv.style.backgroundImage = "url(/global_images/dark-bg.gif)";
	}else{
		overlayDiv.style.backgroundImage = "url(/global_images/modal-dark-bg.png)";
	}
	var innerModal = document.createElement('div');
	innerModal.style.position = "relative";
	innerModal.style.zIndex = "200";
	innerModal.style.width = w + "px";
	innerModal.style.height = h + "px";
	innerModal.style.backgroundColor = "#ffffff";
	innerModal.innerHTML = "<div id='sendToFriendForm'>"+
	"<form action='' id='myForm' name='myForm' method='get' onsubmit='submitForm(this)' >"+
	"<div id='ttCloseButton' ><a href='#' onclick='closeModal()'><img src='/global_images/close.gif' alt='close' border='0' /></a></div>"+
	"<div id='sendToFriendFormlable' ><h3>Send to a friend.</h3></div>"+
	"<label for='yourName'>your name: </label>"+
	"<input type='text' id='yourName' />"+
	"<br /><br />"+
	"<label for='yourEmailAddress'>your email address:</label>"+
	"<input type='text' id='yourEmailAddress' />"+
	"<br /><br />"+
	"<hr />"+
	"<br />"+
	"<label for='friendsName'>friends name: </label>"+
	"<input type='text' id='friendsName' />"+
	"<br /><br />"+
	"<label for='friendsEmail'>friends email address: </label>"+
	"<input type='text' id='friendsEmail' />"+
	"<br /><br />"+
	"<div id='inputButton'><input onclick='AjaxSendUrl(this)'value='send' type='button' id='submitButton' /></div>"+
	"</form>"+
	"</div>";
	var topMargin = (getBrowserHeight() / 2) - (h/2);
	innerModal.style.marginTop = topMargin + "px";
	innerModal.style.marginLeft = "auto";
	innerModal.style.marginRight = "auto";
	overlayDiv.appendChild(innerModal);
	objBody.insertBefore(overlayDiv, objBody.firstChild);

}

function getBrowserHeight() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return(myHeight);
};
// JavaScript Document Ajax form
function AjaxSendUrl(){
	var email = $F('friendsEmail');
	var name = $F('friendsName');
	var youremail = $F('yourEmailAddress');
	var yourname = $F('yourName');
	var theURL = this.location.href;
	var validated = false;
	if(email != "" && email != null){
		if(name != "" && name != null){
			if(echeck(email)){
				validated = true;
			}else{
			//****not actual email****
			theerr('please enter a correct email address');
			}
		}else{
			//****name is empty****
			theerr('please enter your name');
		}
	}else{
		//****email is empty****
		theerr('please enter your email address');
	}
	
	if(validated){
	
	var handlerFunc = function(t) {
		//put results in tooltip
		$('sendToFriendForm').innerHTML = t.responseText
	}
	var errFunc = function(t) {
		//put error in tooltip
		$('sendToFriendForm').innerHTML = '<h3>Error ' + t.status + ' -- ' + t.statusText + '</h3>';
	}
	new Ajax.Request('/sendme.aspx?yourEmailAddress='+youremail+"&yourName="+yourname+"&friendsEmailAddress="+email+"&friendsName="+name+"&theURL="+theURL, {onSuccess:handlerFunc, onFailure:errFunc});
	$('sendToFriendForm').innerHTML = "<img src='/global_images/lightbox/loading.gif' alt='loading contents' width='32' height='32' align='absmiddle' />";
	//wwcToolTip.style.display = "block";
	}
}

function echeck(str) {//CHECKS FOR A VALID EMAIL ADDRESS
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
		return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
	if (str.indexOf(" ")!=-1){
		return false
	}
return true					
}
var theerr = function(t) {
		//put error in tooltip
		$('sendToFriendFormlable').innerHTML = '<h3 style="color:#ff0000;">Error: ' + t + '</h3>';
	}
	
function setFlashHeight() {
		var flashVid = document.getElementById("viddiv");
		
		// get current height and width
		var hCur = Element.getHeight(flashVid);
		var newHeight = 350;

		// scalars based on change from old to new
		var yScale = (newHeight / hCur) * 100;
		new Effect.Scale(flashVid, yScale, {scaleX: false, duration: 0.5, scaleContent: false});
		
		//objBody.className = "viddivstylenh"
}
function restoreFlashHeight() {
		var flashVid = document.getElementById("viddiv");
		
		// get current height and width
		var hCur = Element.getHeight(flashVid);
		var newHeight = 42;

		// scalars based on change from old to new
		var yScale = (newHeight / hCur) * 100;
		new Effect.Scale(flashVid, yScale, {scaleX: false, duration: 0.5, scaleContent: false});
		//objBody.className = "viddivstyle"	
}