<!-- Browser detection ------------------------------------------------- -->

intIEversion = -1; 
if (navigator.appName == 'Microsoft Internet Explorer')
{
   var ua = navigator.userAgent;
   var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
   if (re.exec(ua) != null)
      intIEversion = parseFloat( RegExp.$1 );
}
IE = (intIEversion > -1);

<!-- Adjusting to various screen sizes, iPad and iPhone ---------------- --> 

if ((IE) && (intIEversion < 9) && (screen.width < 1000))
{
   document.write('<link rel="stylesheet" type="text/css" ');
   document.write('href="Stylefiles/stylefile_centre_off.css">') 
}    
if (screen.width < 481)
{
   document.write('<meta name="viewport" ');
   document.write('content="width=device-width">');
}
if ((screen.width > 480) && (screen.width < 769))
{
} 

<!-- Page name and location -------------------------------------------- -->

strWinPath = window.location.pathname;
slash = "/";
if (window.location.protocol == 'file:')
   if (strWinPath.lastIndexOf(slash) < strWinPath.lastIndexOf("\\"))
      slash = "\\";
strPageName = CleanString(strWinPath.slice(strWinPath.lastIndexOf(slash) + 1, strWinPath.length - 5));
if (strPageName.length == 0)
   strPageName = "index"; 		 	

<!-- Help functions ---------------------------------------------------- -->   
   
function CleanString(str)
{
   str = str.replace(/%20/g,' ');
   if (IE)
      str = str.replace(/\//g,'\\');
   return str;		 
}

function EMail(text)
{
   document.write('<a class="textlink"');
   document.write('href="mailto:stadecottage@btinternet.com" ');
   document.write('title="stadecottage@btinternet.com - click to mail">');
   document.write('stadecottage@btinternet.com</a>');
}  

