// main javascript functions for Frances Taylor web site

/* ***********************************************************
Example 4-5 (DHTMLapi.js)
"Dynamic HTML:The Definitive Reference"
by Danny Goodman
Published by O'Reilly & Associates  ISBN 1-56592-494-0
http://www.oreilly.com
Copyright 1998 Danny Goodman.  All Rights Reserved.
************************************************************ */
// DHTMLapi.js custom API for cross-platform
// object positioning by Danny Goodman (http://www.dannyg.com)

// Global variables
var isNav, isIE
var coll = ""
var styleObj = ""
if (parseInt(navigator.appVersion) >= 4) {
  if (navigator.appName == "Netscape") {
    isNav = true
  } else {
    isIE = true
    coll = "all."
    styleObj = ".style"
  }
}

// Convert object name string or object reference
// into a valid object reference
function getObject(obj) {
  var theObj
  if (typeof obj == "string") {
    theObj = eval("document." + coll + obj + styleObj)
  } else {
    theObj = obj
  }
  return theObj
}

// Positioning an object at a specific pixel coordinate
function shiftTo(obj, x, y) {
  var theObj = getObject(obj)
  if (isNav) {
    theObj.moveTo(x,y)
  } else {
    theObj.pixelLeft = x
    theObj.pixelTop = y
  }
}

// Moving an object by x and/or y pixels
function shiftBy(obj, deltaX, deltaY) {
  var theObj = getObject(obj)
  if (isNav) {
    theObj.moveBy(deltaX, deltaY)
  } else {
    theObj.pixelLeft += deltaX
    theObj.pixelTop += deltaY
  }
}

// Setting the z-order of an object
function setZIndex(obj, zOrder) {
  var theObj = getObject(obj)
  theObj.zIndex = zOrder
}

// Setting the background color of an object
function setBGColor(obj, color) {
  var theObj = getObject(obj)
  if (isNav) {
    theObj.bgColor = color
  } else {
    theObj.backgroundColor = color
  }
}

// Setting the visibility of an object to visible
function show(obj) {
  var theObj = getObject(obj)
  theObj.visibility = "visible"
}

// Setting the visibility of an object to hidden
function hide(obj) {
  var theObj = getObject(obj)
  theObj.visibility = "hidden"
}

// Retrieving the x coordinate of a positionable object
function getObjectLeft(obj)  {
  var theObj = getObject(obj)
  if (isNav) {
    return theObj.left
  } else {
    return theObj.pixelLeft
  }
}

// Retrieving the y coordinate of a positionable object
function getObjectTop(obj)  {
  var theObj = getObject(obj)
  if (isNav) {
    return theObj.top
  } else {
    return theObj.pixelTop
  }
}

// Utility function returns the available content width space in browser window
function getInsideWindowWidth(){
  if (isNav) {
    return window.innerWidth
  } else {
    return document.body.clientWidth
  }
}

// Utility function returns the available content height space in browser window
function getInsideWindowHeight() {
  if (isNav) {
    return window.innerHeight
  } else {
    var retval=0;
    if(document.body.clientHeight){
      if(document.body.clientHeight>retval)retval=document.body.clientHeight;
    }
    if(document.documentElement.clientHeight){
      if(document.documentElement.clientHeight>retval)retval=document.documentElement.clientHeight;
    }
    return retval;
  }
}


// ***********************************************************
// from http://developer.apple.com/internet/webcontent/styles.html


// Copyright © 2001 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.

// ugly workaround for missing support for selectorText in Netscape6/Mozilla
// call onLoad() or before you need to do anything you would have otherwise used
// selectorText for.
var ugly_selectorText_workaround_flag = false;
var allStyleRules;
// code developed using the following workaround (CVS v1.15) as an example.
// http://lxr.mozilla.org/seamonkey/source/extensions/xmlterm/ui/content/XMLTermCommands.js
function ugly_selectorText_workaround() {
  if((navigator.userAgent.indexOf("Gecko") == -1) ||
     (ugly_selectorText_workaround_flag)) {
    return; // we've already been here or shouldn't be here
  }
  var styleElements = document.getElementsByTagName("style");

  for(var i = 0; i < styleElements.length; i++) {
    var styleText = styleElements[i].firstChild.data;
    // this should be using match(/\b[\w-.]+(?=\s*\{)/g but ?= causes an
    // error in IE5, so we include the open brace and then strip it
    allStyleRules = styleText.match(/\b[\w-.]+(\s*\{)/g);
  }

  for(var i = 0; i < allStyleRules.length; i++) {
    // probably insufficient for people who like random gobs of
    // whitespace in their styles
    allStyleRules[i] = allStyleRules[i].substr(0, (allStyleRules[i].length - 2));
  }
  ugly_selectorText_workaround_flag = true;
}


// setStyleById: given an element id, style property and
// value, apply the style.
// args:
//  i - element id
//  p - property
//  v - value
//
function setStyleById(i, p, v) {
  var n = document.getElementById(i);
  n.style[p] = v;
}

// getStyleById: given an element ID and style property
// return the current setting for that property, or null.
// args:
//  i - element id
//  p - property
function getStyleById(i, p) {
  var n = document.getElementById(i);
  var s = eval("n.style." + p);

  // try inline
  if((s != "") && (s != null)) {
    return s;
  }

  // try currentStyle
  if(n.currentStyle) {
    var s = eval("n.currentStyle." + p);
    if((s != "") && (s != null)) {
      return s;
    }
  }

  // try styleSheets
  var sheets = document.styleSheets;
  if(sheets.length > 0) {
    // loop over each sheet
    for(var x = 0; x < sheets.length; x++) {
      // grab stylesheet rules
      var rules = sheets[x].cssRules;
      if(rules.length > 0) {
        // check each rule
        for(var y = 0; y < rules.length; y++) {
          var z = rules[y].style;
          // selectorText broken in NS 6/Mozilla: see
          // http://bugzilla.mozilla.org/show_bug.cgi?id=51944
          ugly_selectorText_workaround();
          if(allStyleRules) {
            if(allStyleRules[y] == i) {
              return z[p];
            }
          } else {
            // use the native selectorText and style stuff
            if(((z[p] != "") && (z[p] != null)) ||
               (rules[y].selectorText == i)) {
              return z[p];
            }
          }
        }
      }
    }
  }
  return null;
}

// setStyleByClass: given an element type and a class selector,
// style property and value, apply the style.
// args:
//  t - type of tag to check for (e.g., SPAN)
//  c - class name
//  p - CSS property
//  v - value
var ie = (document.all) ? true : false;

function setStyleByClass(t,c,p,v){
  var elements;
  if(t == '*') {
    // '*' not supported by IE/Win 5.5 and below
    elements = (ie) ? document.all : document.getElementsByTagName('*');
  } else {
    elements = document.getElementsByTagName(t);
  }
  for(var i = 0; i < elements.length; i++){
    var node = elements.item(i);
    for(var j = 0; j < node.attributes.length; j++) {
      if(node.attributes.item(j).nodeName == 'class') {
        if(node.attributes.item(j).nodeValue == c) {
          eval('node.style.' + p + " = '" +v + "'");
        }
      }
    }
  }
}

// getStyleByClass: given an element type, a class selector and a property,
// return the value of the property for that element type.
// args:
//  t - element type
//  c - class identifier
//  p - CSS property
function getStyleByClass(t, c, p) {
  // first loop over elements, because if they've been modified they
  // will contain style data more recent than that in the stylesheet
  var elements;
  if(t == '*') {
    // '*' not supported by IE/Win 5.5 and below
    elements = (ie) ? document.all : document.getElementsByTagName('*');
  } else {
    elements = document.getElementsByTagName(t);
  }
  for(var i = 0; i < elements.length; i++){
    var node = elements.item(i);
    for(var j = 0; j < node.attributes.length; j++) {
      if(node.attributes.item(j).nodeName == 'class') {
        if(node.attributes.item(j).nodeValue == c) {
          var theStyle = eval('node.style.' + p);
          if((theStyle != "") && (theStyle != null)) {
            return theStyle;
          }
        }
      }
    }
  }
  // if we got here it's because we didn't find anything
  // try styleSheets
  var sheets = document.styleSheets;
  if(sheets.length > 0) {
    // loop over each sheet
    for(var x = 0; x < sheets.length; x++) {
      // grab stylesheet rules
      var rules = sheets[x].cssRules;
      if(rules.length > 0) {
        // check each rule
        for(var y = 0; y < rules.length; y++) {
          var z = rules[y].style;
          // selectorText broken in NS 6/Mozilla: see
          // http://bugzilla.mozilla.org/show_bug.cgi?id=51944
          ugly_selectorText_workaround();
          if(allStyleRules) {
            if((allStyleRules[y] == c) ||
               (allStyleRules[y] == (t + "." + c))) {
              return z[p];
            }
          } else {
            // use the native selectorText and style stuff
            if(((z[p] != "") && (z[p] != null)) &&
               ((rules[y].selectorText == c) ||
                (rules[y].selectorText == (t + "." + c)))) {
              return z[p];
            }
          }
        }
      }
    }
  }

  return null;
}

// setStyleByTag: given an element type, style property and
// value, and whether the property should override inline styles or
// just global stylesheet preferences, apply the style.
// args:
//  e - element type or id
//  p - property
//  v - value
//  g - boolean 0: modify global only; 1: modify all elements in document
function setStyleByTag(e, p, v, g) {
  if(g) {
    var elements = document.getElementsByTagName(e);
    for(var i = 0; i < elements.length; i++) {
      elements.item(i).style[p] = v;
    }
  } else {
    var sheets = document.styleSheets;
    if(sheets.length > 0) {
      for(var i = 0; i < sheets.length; i++) {
        var rules = sheets[i].cssRules;
        if(rules.length > 0) {
          for(var j = 0; j < rules.length; j++) {
            var s = rules[j].style;
            // selectorText broken in NS 6/Mozilla: see
            // http://bugzilla.mozilla.org/show_bug.cgi?id=51944
            ugly_selectorText_workaround();
            if(allStyleRules) {
              if(allStyleRules[j] == e) {
                s[p] = v;
              }
            } else {
              // use the native selectorText and style stuff
              if(((s[p] != "") && (s[p] != null)) &&
                 (rules[j].selectorText == e)) {
                s[p] = v;
              }
            }

          }
        }
      }
    }
  }
}

// getStyleByTag: given an element type and style property, return
// the property's value
// args:
//  e - element type
//  p - property
function getStyleByTag(e, p) {
  var sheets = document.styleSheets;
  if(sheets.length > 0) {
    for(var i = 0; i < sheets.length; i++) {
      var rules = sheets[i].cssRules;
      if(rules.length > 0) {
        for(var j = 0; j < rules.length; j++) {
          var s = rules[j].style;
          // selectorText broken in NS 6/Mozilla: see
          // http://bugzilla.mozilla.org/show_bug.cgi?id=51944
          ugly_selectorText_workaround();
          if(allStyleRules) {
            if(allStyleRules[j] == e) {
              return s[p];
            }
          } else {
            // use the native selectorText and style stuff
            if(((s[p] != "") && (s[p] != null)) &&
               (rules[j].selectorText == e)) {
              return s[p];
            }
          }

        }
      }
    }
  }

  // if we don't find any style sheets, return the value for the first
  // element of this type we encounter without a CLASS or STYLE attribute
  var elements = document.getElementsByTagName(e);
  var sawClassOrStyleAttribute = false;
  for(var i = 0; i < elements.length; i++) {
    var node = elements.item(i);
    for(var j = 0; j < node.attributes.length; j++) {
      if((node.attributes.item(j).nodeName == 'class') ||
         (node.attributes.item(j).nodeName == 'style')){
         sawClassOrStyleAttribute = true;
      }
    }
    if(! sawClassOrStyleAttribute) {
      return elements.item(i).style[p];
    }
  }
}






/* *********************************************************** */

// mta stuff


// function to get the height of an element by using its ID
// (e.g.   <div class=menu2 id=menuitem2> becomes getHeightOfID("menuitem2")

function getHeightOfId(ID){
  if(arguments.length!=1)alert("Wrong number of arguments to getHeightOfID()");
  var ns6=document.getElementById&&!document.all
  var ie=document.all

  if((!ie)&&(!ns6)){
    var AlertStr="Alert you appear to be running an outdated browser. ";
    AlertStr=AlertStr+"Please upgrade to a more recent browser. ";
    AlertStr=AlertStr+"Some things on this site will not work properly with your current browser.";
    alert(AlertStr);
  }

  if(ns6){
    return(document.getElementById(ID).offsetHeight);
  }

  if(ie){
    return(eval("document.all." + ID + ".clientHeight"));
  }

  return(50);
}

// almost identical, but using offsetheight for the IE return as clientheight sometimes returns 0

function getHeightOfId_OH(ID){
  if(arguments.length!=1)alert("Wrong number of arguments to getHeightOfID_OH()");
  var ns6=document.getElementById&&!document.all
  var ie=document.all

  if((!ie)&&(!ns6)){
    var AlertStr="Alert you appear to be running an outdated browser. ";
    AlertStr=AlertStr+"Please upgrade to a more recent browser. ";
    AlertStr=AlertStr+"Some things on this site will not work properly with your current browser.";
    alert(AlertStr);
  }

  if(ns6){
    return(document.getElementById(ID).offsetHeight);
  }

  if(ie){
    return(eval("document.all." + ID + ".offsetHeight"));
  }

  return(50);
}



// procs fo allow pages wrongly called outside of frames to reposition themselves

function BreakOutOfFrames(){
  if (window != top) top.location.href = location.href;
}



// function to force very soft reloading of pages when browser resizes

function onResizeProc(){history.go(0);}


// proc to set innerhtml of an element

function setInnerHTML(ID,str){
  var ns6=document.getElementById&&!document.all
  var ie=document.all
  var objfound;

  if((!ie)&&(!ns6)){
    var AlertStr="Alert you appear to be running an outdated browser. ";
    AlertStr=AlertStr+"Please upgrade to a more recent browser. ";
    AlertStr=AlertStr+"Some things on this site will not work properly with your current browser.";
    alert(AlertStr);
  }

  if(ns6){
    objfound=document.getElementById(ID);
  }

  if(ie){
    objfound=eval("document.all." + ID);
  }
  objfound.innerHTML=str;
}


function setOuterHTML(ID,str){
  var ns6=document.getElementById&&!document.all
  var ie=document.all
  var objfound;

  if((!ie)&&(!ns6)){
    var AlertStr="Alert you appear to be running an outdated browser. ";
    AlertStr=AlertStr+"Please upgrade to a more recent browser. ";
    AlertStr=AlertStr+"Some things on this site will not work properly with your current browser.";
    alert(AlertStr);
  }

  if(ns6){
    objfound=document.getElementById(ID);
  }

  if(ie){
    objfound=eval("document.all." + ID);
  }
  objfound.outerHTML=str;
}


// proc to get innerHTML of an element
function getInnerHTML(ID){
  if(arguments.length!=1)alert("getInnerHTML needs 1 argument");

  var ns6=document.getElementById&&!document.all
  var ie=document.all

  if(ie){
    return(eval("document.all." + ID + ".innerHTML"));
    }
  else{
    if(ns6){
      return(document.getElementById(ID).innerHTML);
    }
  }
}


// function to turn visibility on and off for a given element
// syntax: setvisibility([element id] [visibility status (hidden|visible)]))

function setvisibility(element,status){
//alert("setvisibility: element " + element + ", status: " + status);
  if(arguments.length!=2)alert("two arguments needed: [element id] [visibility status (hidden|visible)]");
  var ns6=document.getElementById&&!document.all
  var ie=document.all
  var ele;

  if(ie){
    ele=(eval("document.all." + element));
    }
  else{
    if(ns6){
      ele=(document.getElementById(element));
    }
  }
  ele=ele.style;
  ele.visibility=status;
}





// function to set position for a given element
// syntax: setposition ([element id] [position]

function setposition(element,position){
//alert("setposition: element " + element + ", position: " + position);
  if(arguments.length!=2)alert("two arguments needed: [element id] [position]");
  var ns6=document.getElementById&&!document.all
  var ie=document.all
  var ele;

  if(ie){
    ele=(eval("document.all." + element));
    }
  else{
    if(ns6){
      ele=(document.getElementById(element));
    }
  }
  ele=ele.style;
  ele.position=position;
}





// function to see if a page is being reloaded, and set its name if not
// if there is no argument, the name is set to the pathname value from
// window.location

// the return value is 1 (if the page was reloaded) and 0 if not

function ReloadTestAndSetName(){

  var NameToSet;
  if(arguments.length==0){
    NameToSet=window.location.pathname;
    }
  else{
    NameToSet=(arguments[0]);
  }


  if(window.name.indexOf(NameToSet)==0){ // reloaded
    return(1);
    }
  else{                                  // not reloaded
    window.name=NameToSet;
    return(0);
  }
}



// writing cookies


function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}



// cope with preserving state across refreshes.
//



var MenuState="none";  // variable to hold the state of the menu
                       // NB the default value can't be "" as tests for ths in IE fail(!)


// function to invoke as the onunload proc of body

function SaveMenuState(){
  createCookie("StateCookie",MenuState);
}


// function to invoke at the start of body, to retrieve MenuState from cookie

function RetrieveMenuState(){
  MenuState=readCookie("StateCookie");
  if(MenuState==null)MenuState="none";
  if(MenuState.indexOf("null")==0)MenuState="none";
  if(MenuState=="")MenuState="none";
}

// function to use to set the menu state

function SetMenuState(){
  var i;
  if(arguments.length==0)alert("SetMenuState needs one argument, the menu state");

  MenuState=arguments[0];

  // empty other content, and set the chosen one
  if(MenuState.indexOf("italy")==0){
    setvisibility("italy","visible");
    setposition("italy","relative");
    }
  else{
    setvisibility("italy","hidden");
    setposition("italy","absolute");
  }


  if(MenuState.indexOf("perf")==0){
    setvisibility("perf","visible");
    setposition("perf","relative");
    }
  else{
    setvisibility("perf","hidden");
    setposition("perf","absolute");
  }

  if(MenuState.indexOf("art")==0){
    setvisibility("art","visible");
    setposition("art","relative");
    }
  else{
    setvisibility("art","hidden");
    setposition("art","absolute");
  }

  SaveMenuState();
}



// function to goto index.htm and reset menustate cookie

function gotoHome(){
  MenuState="none";
  SetMenuState(MenuState);
  SaveMenuState();
  location.replace("index.htm");
}


function setmenus_hover(){
  MenuState=arguments[0];
  SetMenuState(MenuState);
  SaveMenuState();
}




// function to get the width of an element by using its ID
// (e.g.   <div class=menu2 id=menuitem2> becomes getWidthOfID("menuitem2")

function getWidthOfID(ID){
  if(arguments.length!=1)alert("Wrong number of arguments to getWidthOfID()");
  var ns6=document.getElementById&&!document.all
  var ie=document.all

  if((!ie)&&(!ns6)){
    var AlertStr="Alert you appear to be running an outdated browser. ";
    AlertStr=AlertStr+"Please upgrade to a more recent browser. ";
    AlertStr=AlertStr+"Some things on this site will not work properly with your current browser.";
    alert(AlertStr);
  }

  if(ns6){
    return(document.getElementById(ID).offsetWidth);
  }

  if(ie){
    return(eval("document.all." + ID + ".clientWidth"));
  }

  return(50);
}





// function to put an orphan frame in proper frames context. Method
//
// 1 write the current path in a cookie
// 2 top.location.replace("index.htm");

// syntax: PutInFrame(<self>, [<path to index.htm>]
//
// the first argument is not actually used, but it's there in case it turns out to be needed
// the second argument means that, if we are t the top level, it is just:
//
//  PutInFrame(self);
//
// but in the /features directory this becomes

//
//  PutInFrame(self,"./");
//


function PutInFrame(){
  var replacementpath="index.htm";

  if(arguments.length==2)replacementpath="../" + replacementpath;

  if(self.name!="homefr"){  // this file has not been named => we are out of frames context
    createCookie("HomefrCookie",location.pathname + location.hash);
    location.replace(replacementpath);
  }

}



// function to hide email addresses from robots

// create a lookup table





var cstr5="lin.com";
var cstr4="mando";
var cstr3="aylor-";
var cstr2="l@t";
var cstr1="mai";


function blat(){
  var blatstr;
  if(arguments.length==0){
    blatstr="<a href='mailto:" + cstr1 + cstr2 + cstr3 + cstr4 + cstr5 +"'>" + cstr1 + cstr2 + cstr3 + cstr4 + cstr5 +"</a>";
    }
  else{
    var i;
    blatstr="<a href='mailto:";
    for(i=0;i<arguments.length;i++)blatstr+=arguments[i];
    blatstr+="'>";
    for(i=0;i<arguments.length;i++)blatstr+=arguments[i];
    blatstr+="</a>";
  }
  document.write(blatstr);
}





function PageSetup(){
 var lmargin=190;

  // find  width of inner window
  innerwidth=getInsideWindowWidth();
  if(arguments.length==1){
    innerwidth=innerwidth-arguments[0];
    lmargin=arguments[0];
  }




  //now compute ideal column width => margins
  colwidth=540;
  marginval=0;

  if(innerwidth>colwidth){
    marginval=Math.round((innerwidth-colwidth)/2);
  }
  if(marginval<10){marginval=10;}

  var marginval20=marginval+20;

  var mainheight=getInsideWindowHeight();

  var sstr="";
  sstr+=".intext{text-align: justify; margin-left: " + marginval + "px; margin-right: " + marginval + "px;}";
  sstr+=".intextnojust{text-align: left; margin-left: " + marginval + "px; margin-right: " + marginval + "px;}";
  sstr+=".link{text-align: justify; text-indent: -20px; margin-left: " + marginval20 + "px; margin-right: " + marginval + "px;}";

  sstr+=".marginleft190{margin-left:" + lmargin + "px; height: " + mainheight + "px; overflow: auto;}";
  document.write("<style>" + sstr + "</style>");
}


function onResizeProc(){history.go(0);}




function Define_fronttext(){
  var topheight=280;                           // banner plus text and photos
  var spare=getInsideWindowHeight()-topheight;
  var mtop=Math.round(spare*0.45);
  
  sstr=".fronttext{text-align: center;"
  sstr+="padding-top: " + mtop + "px;"
  sstr+="}";


  var cdheight=getInsideWindowHeight()-100;

  sstr+=".cdblurb{";
  sstr+="  width:200px;";
  sstr+="  border-left: 1px solid;";
  sstr+="  border-color: #096e6b;";
  sstr+="  font-size: 12px;";
  sstr+="  font-family:  Gill Sans MT, tahoma,  helvetica, sans-serif;";
  sstr+="  padding: 8px;";
  sstr+="  text-align: right;";
  sstr+="  height: " + cdheight + "px;"
  sstr+="  float: right;";
  sstr+="  padding-bottom:20px;";
  sstr+="}";

  document.write("<style>" + sstr + "</style>");
}


// function to open window for flowers

var lastwin=null;

function openwin(url,width,height){
  var openwidth=width+40;
  var openheight=height+50;
  var args="height=" + openheight + ",width=" + openwidth + ",screenX=0,screenY=0,location=no,left=0,top=0,resizable=yes,status=no,toolbar=no,scrollbars=yes";
  if(lastwin!=null)lastwin.close();
  lastwin=open("","",args);
  var lastwinstr="";
  lastwinstr+="<html>";
  lastwinstr+="<head>";
  lastwinstr+="<style type=text/css>@import url(main.css);</style>";
  lastwinstr+="<script src='main.js'></script>";
  lastwinstr+="</head>";
  lastwinstr+="<body class=margin10>";
  lastwinstr+="<center><img src='" + url + "'></centre>";
  lastwinstr+="<p class=photocaptioncenter><a href='javascript:self.close();'>close</a></div>";
  lastwinstr+="</body></html>";
  lastwin.document.write(lastwinstr);
}




// function to insert space up to total available less padding argument
function pad(usedsp){
  var w=getInsideWindowWidth()-usedsp;
  document.write("<img src='pics/5x5.gif' width= " + w + " height=1>");
}



// *****************************************



var clips=new Array("tr1","tr5","tr7","tr12","tr15","tr19");

var currclip;

function setclip(clip){
 var i;
 for (i in clips){
   setInnerHTML(clips[i], "");
 }                    
 currclip=clip;
 var clstr="";
 var IE=0;
 if(navigator.appName.indexOf("Microsoft")>-1)IE=1;

 if(IE==0){
   clstr+="<object>";
   clstr+="<param='src' value='sound/" + clip +".mp3'>";
   clstr+="<param='autoplay' value='true'>";
   clstr+="<param='controller' value='true'>";
   clstr+="<embed src='sound/" + clip + ".mp3' autostart='true' loop='false' width=180 height=30></embed>";
   clstr+="</object>";
   }
 else{
   clstr+="<embed src='sound/" + clip + ".mp3' autostart='true' loop='false' width=180 height=40></embed>";
 }

 clstr+="<div style='padding-bottom:1px;'>&nbsp;</div>";

 setInnerHTML(clip, clstr);
}

function newcdOnLoad(){
  currclip=readCookie("saved_currclip");
  var currclipfound=0;
  if(currclip!=null){
    if(currclip.indexOf("null")!=0)currclipfound=1;
  }
  if(currclipfound>0){
    setclip(currclip);
  }


  var buynowstr="";
  buynowstr+="<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>";
  buynowstr+="<input type='hidden' name='cmd' value='_s-xclick'>";
  buynowstr+="<input type='image' src='pics/x-click-but23.gif' border='0' name='submit'>";
  buynowstr+="<img alt='' border='0' src='https://www.paypal.com/en_GB/i/scr/pixel.gif' width='1' height='1'>";
  buynowstr+="<input type='hidden' name='encrypted' value='-----BEGIN PKCS7-----MIIHbwYJKoZIhvcNAQcEoIIHYDCCB1wCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYB8mSqbE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XVqfUz87kumKdX4oDCsjtAI56cu8Ni76ygq+wRvW2tKw8Nvk1V/B2zMNVe8+t9Tq24fmWXU4RjaAHI+vh1c7UuAvYJZ8w4v7RdcWEnZSNAQemj9sg3bAIE+bxG8=-----END PKCS7-----";
  buynowstr+="'>";
  buynowstr+="</form>";

  setInnerHTML("buynow",buynowstr);

}

function newcdOnUnload(){
  createCookie("saved_currclip",currclip,1);
}

function genOnLoad(){
  createCookie("saved_currclip",null,-1);
}


function WriteSoundClips(){

  var sstrtr1="";
  var sstrtr5="";
  var sstrtr7="";
  var sstrtr12="";
  var sstrtr15="";
  var sstrtr19="";

  sstrtr1+="<span id='tr1'></span>";
  sstrtr1+="<div class=clip>";
  sstrtr1+="  <a class=itname href='javascript:setclip(\"tr1\");'>Allegro</a> Sonata in D major &#151; Giovanni&nbsp;Battista&nbsp;Gervasio";
  sstrtr1+="</div>";

  sstrtr5+="<span id='tr5'></span>";
  sstrtr5+="<div class=clip>";
  sstrtr5+="  <a class=itname href='javascript:setclip(\"tr5\");'>Grave</a> Sonata n.54 (K.89)  &#151; Domenico&nbsp;Scarlatti";
  sstrtr5+="</div>";

  sstrtr7+="<span id='tr7'></span>";
  sstrtr7+="<div class=clip>";
  sstrtr7+="  <a class=itname href='javascript:setclip(\"tr7\");'>Allegro</a> Sonata in G major &#151;  Addiego&nbsp;Guerra";
  sstrtr7+="</div>";

  sstrtr12+="<span id='tr12'></span>";
  sstrtr12+="<div class=clip>";
  sstrtr12+="  <a class=itname href='javascript:setclip(\"tr12\");'>Fugato</a> Sonata in D major &#151;  Emanuele&nbsp;Barbella";
  sstrtr12+="</div>";

  sstrtr15+="<span id='tr15'></span>";
  sstrtr15+="<div class=clip>";
  sstrtr15+="  <a class=itname href='javascript:setclip(\"tr15\");'>Allegro</a> Sonata in D major &#151;  Giuseppe&nbsp;Giuliano";
  sstrtr15+="</div>";

  sstrtr19+="<span id='tr19'></span>";
  sstrtr19+="<div class=clip>";
  sstrtr19+="  <a class=itname href='javascript:setclip(\"tr19\");'>Larghetto, andantino grazioso</a> Sonata in G major &#151;  G&nbsp;B&nbsp;Gervasio";
  sstrtr19+="</div>";

  setInnerHTML("tr1div",sstrtr1);
  setInnerHTML("tr5div",sstrtr5);
  setInnerHTML("tr7div",sstrtr7);
  setInnerHTML("tr12div",sstrtr12);
  setInnerHTML("tr15div",sstrtr15);
  setInnerHTML("tr19div",sstrtr19);
}


