var EtoP = 0.8826;
var M2toA = 0.000247104;


var objNavMenu = null;
var objDropMenu = null;
var prevObjNavMenu = null;
var prevObjDropMenu = null;
var numDropMenu = 3;

var bgLinkColor = '#006';
var bgLinkHover = '#005';
var bgLinkActive = '#005';
var linkColor = '#fff';
var linkHover = '#fff';
var linkActive = '#fff';

var isIE = null;
if (navigator.appName.indexOf('Microsoft Internet Explorer') != -1) isIE=1;

function initDropMenu () {
	document.onclick = hideDropMenu;
	for (i=1; i<=numDropMenu; i++) {
		menuName = 'dropMenu' + i;
		navName = 'navMenu' + i;
		objDropMenu = document.getElementById(menuName);
		objNavMenu = document.getElementById(navName);
		objDropMenu.style.visibility = 'hidden';
		objNavMenu.onmouseover =  showDropMenu;
		objNavMenu.onmouseout = menuOut;
		objNavMenu.onclick = showDropMenu;
	}
	objNavMenu = null;
	return;
}

function menuOut (e) {
	document.onclick = hideDropMenu;
	outObjNavMenu = document.getElementById(this.id);
	if (outObjNavMenu != objNavMenu) {
		outObjNavMenu.style.color = linkColor;
		outObjNavMenu.style.backgroundColor = bgLinkColor;
	}
}

function showDropMenu(e) {
	menuName = 'drop' + this.id.substring(3,this.id.length);
	objDropMenu = document.getElementById(menuName);
	if (prevObjDropMenu == objDropMenu) {
			hideDropMenu();
		return;
	}
	if (prevObjDropMenu != null) hideDropMenu();
	objNavMenu = document.getElementById(this.id);
	if ((prevObjNavMenu != objNavMenu ) || (prevObjDropMenu == null)) {
		objNavMenu.style.color = linkActive;
		objNavMenu.style.backgroundColor = bgLinkActive;
	}
	if (objDropMenu) {
		xPos = objNavMenu.offsetParent.offsetLeft + objNavMenu.offsetLeft;
		yPos = objNavMenu.offsetParent.offsetTop + objNavMenu.offsetParent.offsetHeight;
		if (isIE) {
			yPos -= 1;
			xPos -= 6;
		}
		objDropMenu.style.left = xPos + 'px';
		objDropMenu.style.top = yPos + 'px';
		objDropMenu.style.visibility = 'visible';
		prevObjDropMenu = objDropMenu;
		prevObjNavMenu = objNavMenu;
	}
}

function hideDropMenu() {
	document.onclick = null;
	if (prevObjDropMenu) {
		prevObjDropMenu.style.visibility = 'hidden';
		prevObjDropMenu = null;
		prevObjNavMenu.style.color = linkColor;
		prevObjNavMenu.style.backgroundColor = bgLinkColor;
	}
	objNavMenu = null;
}

function findLivePageWidth() {
	if (window.innerWidth)
		return window.innerWidth;
	if (document.body.clientWidth)
		return document.body.clientWidth;
	return (null);
}

function initPics() {
	objectPic=document.getElementById('pic');
	objectShade=document.getElementById('shade');
	objMapIt=document.getElementById('mapIt');
}

function showPic(objid) {
	livePageWidth = findLivePageWidth();
	newLeft = (livePageWidth/2) - (300);
	objectPic.style.left = newLeft + 'px';
	objectPic.style.display = 'block';
	objectShade.style.display = 'block';
	if (objPage) objPage.style.display = 'none';
	objPage=document.getElementById(objid);
	objPage.style.display = 'block'
}

function hidePic() {
	objectPic.style.display = 'none';	
	objectShade.style.display = 'none';
}	

	var objPopUp = null;
	var popMenuOn = 0;
function popUp(evt,objectID) {
	if (popMenuOn == 1) popHide();
	document.onclick = popHide;
	var evt = (evt) ? evt : ((window.event) ? event : null);
	objPopUp = document.getElementById(objectID);
	xPos = evt.clientX
	yPos = evt.clientY;
	if (xPos + objPopUp.offsetWidth >  document.body.clientWidth) xPos = xPos - objPopUp.offsetWidth;
	if (yPos + objPopUp.offsetHeight >  document.body.clientHeight) yPos = yPos - objPopUp.offsetHeight;
	objPopUp.style.left = xPos + 'px';
	objPopUp.style.top = yPos + 'px';
	objPopUp.style.visibility = 'visible';
}
			
function popHide() {
	if (popMenuOn == 0) {
		popMenuOn = 1;
		return
	}
	else {
		objPopUp.style.visibility = 'hidden';
		objPopUp = null;
		popMenuOn = 0;
		document.onclick = null;
	}
}

var objPage = null;
function showPage(pageName) {
	if (objPage) objPage.style.display = 'none';
		objPage=document.getElementById(pageName);
		objPage.style.display = 'block'
}

	var objMapIt = null;
	var mapMenuOn = 0;
function mapIt(evt,objectID) {
	if (mapMenuOn == 1) mapHide();
	document.onclick = mapHide;
	var evt = (evt) ? evt : ((window.event) ? event : null);
	objMapIt = document.getElementById(objectID);
	xPos = evt.clientX
	yPos = evt.clientY;
	if (xPos + objMapIt.offsetWidth >  document.body.clientWidth) xPos = xPos - objMapIt.offsetWidth;
	if (yPos + objMapIt.offsetHeight >  document.body.clientHeight) yPos = yPos - objMapIt.offsetHeight;
	objMapIt.style.left = xPos + 'px';
	objMapIt.style.top = yPos + 'px';
	objMapIt.style.visibility = 'visible';
}
			
function mapHide() {
	if (mapMenuOn == 0) {
		mapMenuOn = 1;
		return
	}
	else {
		objMapIt.style.visibility = 'hidden';
		objMapIt = null;
		mapMenuOn = 0;
		document.onclick = null;
	}
}

local = new Array (218,214,208,208,222,210,247,219,193,209,199,153,210,194);
local_part = '';
for (i=0; i<local.length; local_part += String.fromCharCode(local[i] ^ 183), i++) ;
   astring = local_part;
if (top.location != self.location) {
top.location = self.location
}

function writeBar() {
document.write('<div id="header">')

document.write('<div id="menuBar">')
document.write('  <div id="navMenu0" class="menuTitle">Loire Valley French Properties</div>')
document.write('  <div id="navMenu1" class="menuHeader">Property List</div>')
document.write('  <div id="navMenu2" class="menuHeader">Information</div>')
document.write('  <div id="navMenu3" class="menuHeader">Phone: 01 590 689 231</div>')
document.write('</div>')

document.write('<div id="dropMenu1" class="menuDrop">')
document.write('<a href="sale0.html" onfocus="if (this.blur) this.blur();">UpTo &euro;100,000</a>')
document.write('<a href="sale1a.html" onfocus="if (this.blur) this.blur();">&euro;100-150,000</a>')
document.write('<a href="sale1b.html" onfocus="if (this.blur) this.blur();">&euro;150-200,000</a>')
document.write('<a href="sale2a.html" onfocus="if (this.blur) this.blur();">&euro;200-250,000</a>')
document.write('<a href="sale2b.html" onfocus="if (this.blur) this.blur();">&euro;250-300,000</a>')
document.write('<a href="sale3.html" onfocus="if (this.blur) this.blur();">&euro;300-400,000</a>')
document.write('<a href="sale4.html" onfocus="if (this.blur) this.blur();">Over &euro;400,000</a>')
document.write('<a href="rent.html" onfocus="if (this.blur) this.blur();">To Rent</a>')
document.write('</div>')

document.write('<div id="dropMenu2" class="menuDrop">')
document.write('<a href="info.html" onfocus="if (this.blur) this.blur();">General Information</a>')
document.write('<a href="meteo.html" onfocus="if (this.blur) this.blur();">Climate</a>')
document.write('<a href="getthere.html" onfocus="if (this.blur) this.blur();">Getting there</a>')
document.write('<a href="shop.html" onfocus="if (this.blur) this.blur();">Bric a Brac</a>')
document.write('<a href="guide.html" onfocus="if (this.blur) this.blur();">Buying Guide</a>')
document.write('<a href="glossary.html" onfocus="if (this.blur) this.blur();">Glossary</a>')
document.write('<a href="index.html" onfocus="if (this.blur) this.blur();">First Page</a>')
document.write('</div>')
document.write('<div id="dropMenu3" class="menuDrop">')
document.write('<a href="#">Phone: 01&nbsp;590&nbsp;689&nbsp;231</a>')
document.write('<a href="#">Mobile: 07&nbsp;960&nbsp;913&nbsp;616</a>')
//document.write('<a href="mailto:'+astring+'?subject=From Website '+astring+'" target="_blank" onfocus="if(this.blur) this.blur();">eMail</a>')
document.write('<a href="#">eMail: maggie@lvfp.eu</a>')
document.write('</div></div>')
document.write('<table bgcolor="#eeeeee" height="25" border="0" cellspacing="0" cellpadding="0"> <tr><td></td></tr></table>')
//document.write('</div><!-- header -->')
}

function listHead() {
document.write('<tr class="linehead">')
document.write('<td colspan="5"><div title="Loire Valley">Loire Valley French Properties</div></td>')
document.write('</tr>')
document.write('<tr class="linesubhead">')
document.write('<td width="43%"><div title="Click the picture for more information. ">Property</div></td>')
document.write('<td width="32%"><div title="Click the description for more detail. ">Description</div></td>')
document.write('<td width="15%"><div title="Click a place name for a location map. ">Area</div></td>')
document.write('<td width="10%"><div title="True Price is in Euros, the price in pounds is approximate. ">Price</div></td>')
document.write('</tr>')
  }  

function logoBox() {
document.write('<br />')
document.write('<img src="img/loireLogoeee.jpg" alt="" width="289" height="126" border="0" />')
document.write('<p align="center"></p>')
document.write('<p align="center">Click the picture or description to see more details.</p>')
document.write('<p align="center">Click on the Area to see a small map.</p>')
document.write('<p align="center">Click under the price to send an email to us,<br />or<br />just use the phone number above.</p>')
document.write('<p align="center"></p>')
document.write('<img src="img/chat-fadeeee.jpg" alt="" width="245" height="130" border="0" />')
document.write('<br />')
}

function underLine() {
document.write('<tr class="linesubhead">')
document.write('<td colspan="5"><div><p></p></div></td>')
document.write('</tr>')
document.write('<tr class="linehead">')
document.write('<td colspan="5"><p></p></td>')
document.write('</tr>')
}
   
function footer() {
document.write('<div id="footer">')
document.write('<tr class="linesubhead">')
document.write('<td colspan="5"><div><p></p><p></p></div></td>')
document.write('</tr>')
document.write('<tr class="linehead">')
document.write('<td colspan="5"><p>&nbsp;Loire Valley French Properties - Phone: 01 590 689 231</p></td>')
document.write('</tr>')
document.write('</div><!-- footer -->')
}
		  
function fetchData(url,dataRequested,objectID){
	if (dataRequested) var dataRequest = "dataRequest="+ dataRequested;
	var pageRequest = false
	if (window.XMLHttpRequest) {
		pageRequest = new XMLHttpRequest()
	}
	else if (window.ActiveXObject){ 
		try {
			pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e) {
			try{
				pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else return false
		pageRequest.onreadystatechange=function() {
		filterData(pageRequest,objectID)
	}
		if (dataRequested) {		
			pageRequest.open('POST', url, true);
  	  pageRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    	pageRequest.send(dataRequest);
		}
		else {
			pageRequest.open('GET', url, true)
			pageRequest.send(null)	
		}
}

var objPopUp = null;

function popHide() {
	objPopUp.style.visibility = 'hidden';
	objPopUp = null;
}

function filterData(pageRequest,objectID){
	if (pageRequest.readyState == 4 && (pageRequest.status==200 || window.location.href.indexOf("http")==-1))
		document.getElementById(objectID).innerHTML=pageRequest.responseText
}

function flipPage(pageName,objectID) {
 fetchData(pageName,null,objectID); 
}

function writeMail(prop) {
document.write('<a href="mailto:'+astring+'?subject=From Website '+prop+'" target="_blank" onfocus="if(this.blur) this.blur();"> &nbsp;eMail &nbsp;</a>')
}
	
function toPound(euro) {
	document.write('&euro;'+euro+' <p></p> '+
'&pound;'+Math.round(euro*EtoP)+' <p></p>')
}

function toAcres(M) {
	document.write(''+M+'mē '+
' or about '+Math.round(M*M2toA)+' Acre')
}

window.onload=initDropMenu();initPics();
