<!--

function $(id) { return document.getElementById(id); }


/* Browser detect */
function Is() {
agent = navigator.userAgent.toLowerCase();
this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);
this.ns = ((agent.indexOf('mozilla') != -1) &&
(agent.indexOf('spoofer') == -1) &&
(agent.indexOf('compatible') == -1) &&
(agent.indexOf('opera') == -1) &&
(agent.indexOf('webtv') == -1) &&
(agent.indexOf('hotjava') == -1));
this.ns2 = (this.ns && (this.major == 2));
this.ns3 = (this.ns && (this.major == 3));
this.ns4 = (this.ns && (this.major == 4));
this.ns6 = (this.ns && (this.major >= 5));
this.ie = ((agent.indexOf("msie") != -1) &&
(agent.indexOf("opera") == -1));
this.ie3 = (this.ie && (this.major < 4));
this.ie4 = (this.ie && (this.major == 4) &&
(agent.indexOf("msie 4") != -1));
this.ie5 = (this.ie && (this.major == 4) &&
(agent.indexOf("msie 5.") != -1) &&
(agent.indexOf("msie 5.5") == -1) &&
(agent.indexOf("mac") == -1));
this.iem5 = (this.ie && (this.major == 4) &&
(agent.indexOf("msie 5.") != -1) &&
(agent.indexOf("mac") != -1));
this.ie55 = (this.ie && (this.major == 4) &&
(agent.indexOf("msie 5.5") != -1));
this.ie6 = (this.ie && (this.major == 4) &&
(agent.indexOf("msie 6.") != -1));
this.ie7 = (this.ie && (this.major == 4) &&
(agent.indexOf("msie 7.0") != -1));
this.nsdom = (this.ns4 || this.ns6);
this.ie5dom = (this.ie5 || this.iem5 || this.ie55);
this.iedom = (this.ie4 || this.ie5dom || this.ie6);
this.w3dom = (this.ns6 || this.ie6 ||this.ie7);
}

var is = new Is();



/* Function to get scroll height of page (for adjusting vertical bar height) */
function getPageHeight() {
	if (window.innerHeight && window.scrollMaxY ) { // Firefox
		pageHeight = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight) { // all but explorer (MAC)
		pageHeight = document.body.scrollHeight;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		pageHeight = document.body.offsetHeight + document.body.offsetTop;
	}
	return pageHeight;
}

/* Function to get standard inner window width */
function getPageWidth() {
	if (window.innerHeight && window.scrollMaxY ) { // Firefox
		pageWidth = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight) { // all but explorer (MAC)
		pageWidth = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		pageWidth = document.body.offsetWidth + document.body.offsetLeft;
	}
	return pageWidth;
}

/* Get viewport height */
function getWindowHeight() {
  var winHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    winHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    winHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientHeight ) ) {
    //IE 4 compatible
    winHeight = document.body.clientHeight;
  }
  return winHeight;
}




function enlargeImage(new_src) {

	if (is.ie && !is.ie7) { 
		
		window.open('/enlargeImage.php?src='+new_src,'enlargeImg','height=480,width=700,resizable=1,scrollbars=0,toolbar=0');
		
	} else {
	
		$('white_wash').style.display='block';
		$('image_enlarge_container').style.display='block';
		$('loading').style.display='block';
		
		$('image_enlarge_img').onload = revealImage;
		$('image_enlarge_img').src=new_src;
	
	}

}

function revealImage() {
	$('white_wash').style.height = Math.max(getPageHeight(),getWindowHeight()) + 'px';
	$('image_enlarge').style.width=$('image_enlarge_img').offsetWidth+'px';
	$('loading').style.display='none';
	
	//Fade in
	imgFadeIn = new Animator({
		duration: 400
	})
	 .addSubject(new NumericalStyleSubject($('image_enlarge'), 'opacity',0,1));
	imgFadeIn.play();
}

function closeImage() {
	$('white_wash').style.display='none';

	imgFadeOut = new Animator({
		duration: 0,
		onComplete: function() {
				$('image_enlarge_container').style.display='none';
		}
	})
	 .addSubject(new NumericalStyleSubject($('image_enlarge'), 'opacity',1,0));
	imgFadeOut.play();
}



function addToFavs() { 
	if (is.ie) {
		window.external.AddFavorite('http://www.mazzardfarm.com','Mazzard Farm - Holiday Cottages in East Devon');
	} else {
		alert('Press Ctrl/Cmd + D to save this site to your bookmarks!');
	}
 }


//-->