// Javascript utilities

  // ****************************
  // General Navigation Utilities
  // ****************************
  function goToFrameCtl(target) {
    window.document.location = target;
  }
  
  function openResizableWin(fileName, title) {
     myFloater = window.open('',title);
     myFloater.location.href = fileName;
  }
  
  function openWin(fileName, title) {
    myFloater = window.open('', title, 'width = 700, height= 500');
    myFloater.location.href = fileName;
  }

  function closeMe() {
     window.close();
  }
  
  function redirectBack(timeOut) {
      setTimeout(goBack(), timeOut);
  }
  
  function goBack() {
      window.history.back();
  }

  function redirectHome(timeOut) {
      setTimeout(go(), timeOut);
  }
  
  function go() {
      top.document.location='http://www.awonderfulchoice.com/anchiskhati/main.html';
  }

  function redisplayList() {
    if (parent.entries != null) {
      parent.entries.location.reload();
    }
  }

    
  function writeStandardElements() {
    	document.write('<div class="choirName">');
	document.write('<img class="choirName" src="images/choirName.gif">');
	document.write('</div>');
    	document.write('<div class="awcLink">');
    	document.write('<p class="awcLink">Designed and built by ');
	document.write('<a href="http://www.awonderfulchoice.com" target="_self">');
	document.write('A Wonderful Choice');
	document.write('</a>');
	document.write('</p>');	
	document.write('</div>');
	document.write('<div class="lhs">');
	document.write('<table>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="main.html" target="_top">home</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="about.html" target="_top">about the choir</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="bios.html" target="_top">biographies</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="history.html" target="_top">history</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="disco.html" target="_top">CDs &amp; recordings</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="audio.html" target="_top">audio clips</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="prog.html" target="_top">programmes, instruments &amp; workshops</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="bookings.html" target="_top">bookings</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="framctl.html" target="_top">guest book</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="menuCell">');
	document.write('<a href="mailto:info&#64;anchiskhati.org?subject=Anchiskhati" target="_top">contact us</a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</div>');
  }
  
  function goToIndex2() {
    window.document.location = 'index2.html';
  }
  
  
  // ***************
  // Date utilities
  // ***************
  function displayDate() {
    today = new Date();
    document.write(today.toGMTString().substring(0, 16));
  }
  

  // ***************
  // Number utilites
  // ***************
  function checkFormat(input) {
    output = parseInt(input);
    if (output == "NaN") {
      output = 1;
    }
    return output;
  }

  function getRandom(num) {
    return Math.floor(Math.random() * num) + 1;
  }
  

  // *****************
  // Browser utilities
  // *****************
  function getAppVersion() {
    return navigator.appVersion;
  }

  function getAppName() {
    return navigator.appName;
  }

  function getCodeName() {
    return navigator.appCodeName;
  }

  function getLanguage() {
    return navigator.appLanguage;
  }

  function getPlatform() {
    return navigator.platform;
  }
  
  function getScreenWidth() {
    return screen.width;
  }

  function getScreenHeight() {
    return screen.height;
  }
  
  function is800x600() {
    if ((getScreenWidth() == 800)&&(getScreenHeight()== 600)) {
      return true;
    }
    else {
      return false;
    }
  }
    
  function getUserAgent() {
    return navigator.userAgent;
  }
  
  function getBrowser() {
    if (getUserAgent().indexOf("Opera") > -1) {
      return "Opera";
    }
    else if (getAppVersion().indexOf("IE") > -1) {
      return "IE";
    } 
    else {
      return getAppVersion();
    }
  }
  
  function showBrowser() {
    alert("Browser is " + getBrowser());
    return true;
  }


