//Global Variables
var requiredVersion = 7;
var useRedirect = false;
var flashPage   = "flash.htm"
var noFlashPage = "noflash.htm"
var upgradePage = "upgradeflash.htm"

// System Variables
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;
var flash8Installed = false;
var flash9Installed = false;
var maxVersion = 9;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}

function initsite() {
 var name=navigator.appName;
 var vers=navigator.appVersion;
 var agent=navigator.userAgent;
 vers=vers.substring(0,1);

 if(navigator.appName == "WebTV") {
  window.location = "nosupport.htm"
 }

 if (agent.search("Opera") >= 0)
  name="Opera";	//even Opera 7
 if (name=="Konqueror")
  name="Konqueror";
 if (name == "Netscape" && vers < 5)
  window.location = "nosupport.htm";
  
 if(navigator.appVersion.indexOf("MSIE")!= -1){
  wholeString = navigator.appVersion
  starts = wholeString.indexOf("MSIE")
  ends = wholeString.indexOf(";",starts)
  version = wholeString.substring(starts+4, ends)
  if (version < 5){
  window.location = "nosupport.htm";
  }
 }
  
 reloadPage(true); 
}

function getPageName() {
 var sPath = window.location.pathname;
 var sPage;
 if (sPath.indexOf('/C:') > 0 || sPath.indexOf('C:\\') > 0) {
  sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
 }
 else {
	 //online
  sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
 }
 //alert(sPage);
 return sPage;
}

function mkflashbanner(pluginOK) {
 if(pluginOK) {
  document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"527\" height=\"109\" id=\"banner\" align=\"middle\">');
  document.write('<param name=\"allowScriptAccess\" value=\"sameDomain\" />');
  document.write('<param name=\"movie\" value=\"images/banner.swf\" />');
  document.write('<param name=\"FlashVars\" value=\"varPageID=' + getPageName() + '\" />');  
  document.write('<param name=\"loop\" value=\"false\" />');
  document.write('<param name=\"quality\" value=\"high\" />');
  document.write('<param name=\"bgcolor\" value=\"#6A7B95\" />');
  document.write('<embed src=\"images/banner.swf\" FlashVars=\"varPageID=' + getPageName() + '\" loop=\"false\" quality=\"high\" bgcolor=\"#6A7B95\" width=\"527\" height=\"109\" name=\"banner\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');
  document.write('</object>');
 } else {
  document.write('<img src=\"images/tb102.jpg\" width=69 height=109 alt=\"toronto\"></td>');
  document.write('<td rowspan=2> <img src=\"images/tb103.jpg\" width=123 height=109 alt=\"web design\"></td>');
  document.write('<td rowspan=2> <img src=\"images/tb104.jpg\" width=142 height=109 alt=\"website design\"></td>');
  document.write('<td rowspan=2> <img src=\"images/tb105.jpg\" width=124 height=109 alt=\"website design toronto\"></td>');
  document.write('<td rowspan=2> <img src=\"images/tb106.jpg\" width=69 height=109 alt=\"web page\">');
 }
}

function detectFlash () {
 var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
 var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows

 jsVersion = 1.1;

if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
 }	

 // Start Flash Detecting
 if (navigator.plugins) {
  if (navigator.plugins["Shockwave Flash 2.0"]
    || navigator.plugins["Shockwave Flash"]) {

    var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
    var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
    var flashVersion = parseInt(flashDescription.substring(16));

    flash2Installed = flashVersion == 2;    
    flash3Installed = flashVersion == 3;
    flash4Installed = flashVersion == 4;
    flash5Installed = flashVersion == 5;
    flash6Installed = flashVersion == 6;
    flash7Installed = flashVersion == 7;
    flash8Installed = flashVersion == 8;
    flash9Installed = flashVersion >= 9;
  }
 }

 for (var i = 2; i <= maxVersion; i++) {  
  if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  
 if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  
 if (actualVersion >= requiredVersion) {
  if (useRedirect) {
   if(jsVersion > 1.0) {
     window.location.replace(flashPage);  
   } else {
     window.location = flashPage;
   }
  }

  hasRightVersion = true;                
  } else {  
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}

function checkform(form) {
 if (form.name.value == "") {
  alert( "Please enter your name." );
  form.name.focus();
  return false ;
 }
 if (form.email.value == "") {
  alert( "Please enter your email address." );
  form.email.focus();
  return false ;
 }
 if (form.comments.value == "") {
  alert( "Please enter your message." );
  form.comments.focus();
  return false ;
 }
 
 return true ;
}

function cn5() {
 document.write('BRTe'+'ch Solutio'+'ns Des'+'ign');	
}

function mkemail(name) {
 document.write('<a class=\"cnt\" href=\"mai' + 'lto:' + name + '@brt' + 'ech-design.' + 'com\">' + name + '@brt' + 'ech-design.' + 'com</a>');
}
