
function getInsideWindowWidth() {
	isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
	if (window.innerWidth) {
		return window.innerWidth;
	}
	else if (isIE6CSS) {
		// measure the html element's clientWidtht
		return document.documentElement.clientWidth;
	}
	else if (document.body && document.body.clientWidth) {
		return document.body.clientWidth;
	}
	return 1; // 0 could lead to dividing 0 by 2.
}



function getInsideWindowHeight() {
	isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
	if (window.innerHeight) {
		return window.innerHeight;
	}
	else if (isIE6CSS) {
		// measure the html element's clientHeight
		return document.documentElement.clientHeight;
	}
	else if (document.body && document.body.clientHeight) {
		return document.body.clientHeight;
	}
	return 1; // 0 could lead to dividing 0 by 2.
}



var agt = navigator.userAgent.toLowerCase(); 


var winWidth = 951;
var winHeight = 684;

function resetStyleSheetHome() {


	winWidth = getInsideWindowWidth();

	if (winWidth < 951) {
		winWidth = 951;
	}

	winHeight = getInsideWindowHeight();


	var extraWidAv = winWidth - 951;
	var extraDepAv = winHeight - 684;


	if (extraWidAv > 100 && extraDepAv > 2 ) { // don't bother for less
		if (agt.indexOf("opera")!=-1) { // opera
			// still to sort bug
		} 
		else if (document.styleSheets[0].rules) { // IE

			if ( getInsideWindowWidth() > 1024) { // don't bother for less
				document.styleSheets[0].rules[4].style.borderLeftWidth = "10px"; 
				document.styleSheets[0].rules[4].style.borderRightWidth = "10px"; 
			}

			if ( extraDepAv > 0) {
				document.styleSheets[0].rules[4].style.top = extraDepAv/2 + "px"; 
				document.styleSheets[0].rules[4].style.borderTopWidth = "10px"; 
				document.styleSheets[0].rules[4].style.borderBottomWidth = "10px";
			}
		}
		else { // MOZILLA

			if ( getInsideWindowWidth() > 1024) { // don't bother for less
				document.styleSheets[0].cssRules[4].style.borderLeftWidth = "10px"; 
				document.styleSheets[0].cssRules[4].style.borderRightWidth = "10px"; 
			}

			if ( extraDepAv > 0) {
				document.styleSheets[0].cssRules[4].style.top = extraDepAv/2 + "px"; 
				document.styleSheets[0].cssRules[4].style.borderTopWidth = "10px"; 
				document.styleSheets[0].cssRules[4].style.borderBottomWidth = "10px"; 
			}
		}
	}
	else {
	//	document.getElementById("spacerimage").innerHTML = "<br><br>";
	}
}





function openEnglish() {
	var newPG = "http://www.meadowviewcottage.co.uk/" + tE + ".html";
	top.location.href = newPG;
}



function openFrench() {
	var newPG = "http://www.meadowviewcottage.co.uk/" + tF + ".html";
	top.location.href = newPG;
}



function openGerman() {
	var newPG = "http://www.meadowviewcottage.co.uk/" + tG + ".html";
	top.location.href = newPG;
}




function switchVideoForIpadPhone() {
	if (navigator.userAgent && ( navigator.userAgent.indexOf("iPad") > -1 || navigator.userAgent.indexOf("iPhone") > -1 )) {
		var htmlToUse = '<img src="images/ipadiphone.jpg" alt="" />';
		document.getElementById("myVideo").innerHTML = htmlToUse;
	}
}

function fixScrollDivForIpadPhone() {
	if (navigator.userAgent && ( navigator.userAgent.indexOf("iPad") > -1 || navigator.userAgent.indexOf("iPhone") > -1 )) {
		document.getElementById("mainpanel").style.overflow =  "visible";
		document.getElementById("mainpanel").style.width =  "400px";
		document.getElementById("mainpanel").style.height =  "100%";
		document.getElementById("mainpanel").style.zIndex =  "99";
	}
}




