<!-- Hide from old browsers
// Unless otherwise noted, all JavaScript is copyright 
// (c) SilverDisc Ltd 1996-2002: all rights reserved. 

// Language constants:
var English = 1;
var NumLanguages = 1;

// Variables:
var timerID = null;
var timerRunning = false;

var months;
var days;

// Controls:
var language = English;
var twentyfourhour = false;

function MakeEmptyArray(n)
{
    var i;
    this.length = n;
    for(i = 1; i <= n; i++)
    {
        this[i] = null;
    }
    return this;
}

function MakeFilledArray()
{
    // Make an array of strings
    var i;

    this.length = MakeFilledArray.arguments.length;
    for(i = 1; i <= this.length; i++)
    {
        this[i] = MakeFilledArray.arguments[i - 1];
    }
    return this;
}


function showDate ()
{
    var now = new Date();
    var dow;
    var month;
    var date;
    var year;
    var timeValue;
    var suffix;
    var suffidx;

    // Initialise the arrays
    months = new MakeEmptyArray(NumLanguages);
    months[English] = new MakeFilledArray("enero", "febrero", "marzo", "abril", 
                                        "mayo", "junio", "julio", "agosto",
                                        "septiembre", "octubre", "noviembre", "diciembre");

    days = new MakeEmptyArray(NumLanguages);
    days[English] = new MakeFilledArray("domingo", "lunes", "martes", "mi&eacute;rcoles",
                                     "jueves", "viernes", "sábado");
    dow = days[language][now.getDay() + 1];
    month = months[language][now.getMonth() + 1];

    date = now.getDate();
    // if(date < 10)
    // {
    //     date = "0" + date;
    // }

    year = now.getYear();
    // The following line required for 2 digit years in some browsers
    if (year.toString().length != 4 ) { year = year +1900 };

    timeValue = " " + dow;

    suffidx=(date % 10)
    if (suffidx == 0) suffix="";
    if (suffidx == 1) suffix="ro";
    if (suffidx == 2) suffix="";
    if (suffidx == 3) suffix="";
    if (suffidx > 3) suffix="";
    timeValue += " " + date + suffix + " de " + month + " de " + year;
    document.write(timeValue);
    // Sneak in referrer tracking here for now.
    {
	    var referrerStr=document.referrer;
	    var urlStr=window.location.href;
	    if (referrerStr=="")
	    { referrerStr="none" };
            if ((referrerStr.indexOf("www.silverdisc") == -1)
            && (referrerStr.indexOf(".programming") == -1)
            && (referrerStr.indexOf("www.hits2business") == -1)
            && (referrerStr.indexOf("www.websitehealthcheck") == -1)
            && (referrerStr.indexOf("www.betterinterfaces") == -1)
            && (referrerStr.indexOf("search.atomz.com") == -1))
            {
	      document.write('<IMG SRC="/images/clear.gif?page='+escape(urlStr)+'&referrer='+escape(referrerStr)+'" WIDTH="1" HEIGHT="1" BORDER="0">');
	      //alert('<IMG SRC="/gifs/clear.gif?page='+escape(urlStr)+'&referrer='+escape(referrerStr)+'" WIDTH="1" HEIGHT="1" BORDER="0">');
            }
    }
}

function goPage(fname)
{
    dest=eval("document."+fname+"Navigator.root.value")+eval("document."+fname+"Navigator.doc.options[document."+fname+"Navigator.doc.selectedIndex].value");
    //alert("go page:"+dest);
    self.location.href = dest;
    //document.TOCNavigator.doc.selectedIndex = "0";
    return false;
}

function newWindow(name,url,width,height,controls) 
{
  var param="width="+width+",height="+height;
  var winref;
  param=param+",resizable";
  if (controls =="SCROLL")
  {
    param=param+",scrollbars";
  }
  if (controls =="ALL")
  {
    param=param+",menubar,toolbar,location,status,scrollbars";
  }
  if (controls =="PRINT")
  {
    param=param+",menubar,scrollbars";
  }
  winref=window.open(url,name,param);
}

// Handle screen redraw problems in Navigator
if (navigator.appName=="Netscape")
{
  window.captureEvents(Event.RESIZE);
  window.onresize=function (evt){location.reload(); };
}// Data validation functions:

// Check whether string is empty or all white-space
function IsEmptyString(s)
{
    var i;

    // Quick checks for complete emptiness
    if(s == null) return true;
    if(s.length == 0) return true;
    
    // Look for non-whitespace in the string
    for(i = 0; i < s.length; i++)
    {
        // Check next character isn't empty
        var c = s.charAt(i);
        if(c != " " || c != "\t" || c != "\n" || c != "\r")
        {
            // Non-white space found - it's non-empty
            return false;
        }
    }
    // No non-space characters found - string is empty
    return true;
}

// Check for valid email address. Expect to see something like
// [A-Za-z0-9.]@[A-Za-z0-9].[A-Za-z0-9.] (i.e. xxx@yyy.zzz will do
// fine). To check this quickly, walk through looking for an '@'.
// Once found, start looking for a '.'.
function IsValidEmail(s)
{
    var i;
    
    // Quick check - is it empty?
    if(IsEmptyString(s))
    {
        return false;
    }

    // Look for @ 
    for(i = 0; i < s.length; i++)
    {
        if(s.charAt(i) == "@") break;
    }
    // Then look for .
    for( ; i < s.length; i++)
    {
        if(s.charAt(i) == ".") return true;

    }
    // Off the end? Missed either @ or .
    return false;
}

// Check for valid phone number. First character can be "+" (for
// international dialling). After that we only allow [0-9()[]- ]
function IsValidPhone(s)
{
    var i;

    // Quick check...
    if(IsEmptyString(s)) return false;  // Can't be empty

    // Check first character...
    i = 0;
    if(s.charAt(i) == "+")
    {
        i = 1;      // That's OK, don't check it again
    }

    // Check the rest...
    var validChars = "0123456789 -()[]";
    for( ; i < s.length; i++)
    {
        var c = s.charAt(i);
        if(validChars.indexOf(c) == -1)
        {
            return false;       // Invalid character
        }       
    }

    return true;    // If we get here the number is OK
}

// Validate the "Response" form. User must supply certain bits
// of info.
function ValidateForm(frm)
{
    // Check that some sensible data has been entered
    // in key fields. Use must enter the following:
    // - contact name
    // - one or more of email, fax or telephone #
    // NB Silverdisc form does not include postal address
    if(IsEmptyString(frm.contact.value))
    {
        alert("Please specify a contact name.");
        frm.contact.focus();
        frm.contact.select();
        return false;
    }

    if(IsEmptyString(frm.email.value) &&
            IsEmptyString(frm.phone.value))
    {
        alert("Please give either your email address or telephone number " +
                "so that we can contact you.");
        frm.email.focus();
        frm.email.select();
        return false;
    }

    // If we have email or phone number check that they are valid
    if(!IsEmptyString(frm.email.value) &&
            !IsValidEmail(frm.email.value))
    {
        var msg;
        msg = "You have not entered a valid email address.\n";

        // If we have a phone number or postal address then they
        // have the option of not sending an email address
        if(IsValidPhone(frm.phone.value) ||
                IsValidPhone(frm.fax.value))
        {
            // Email isn't essential
            msg += "Press OK if you do not want to submit an email address " +
                "or Cancel to enter a valid email address before sending " +
                "your request.";
            if(!confirm(msg))
            {
                frm.email.focus();
                frm.email.select();
                return false;
            }
        }
        else
        {
            alert(msg);
            frm.email.focus();
            frm.email.select();
            return false;
        }
    }

    if(!IsEmptyString(frm.phone.value) &&
            !IsValidPhone(frm.phone.value))
    {
        var msg;
        msg = "You have not entered a valid phone number.\n";

        // If we have a valid email or fax number then they
        // have the option of not sending a phone number
        if(IsValidEmail(frm.email.value) ||
                IsValidPhone(frm.fax.value))
        {
            // Phone no isn't essential
            msg += "Press OK if you do not want to submit a telephone " +
                "number or Cancel to enter a valid number before sending " +
                "your request.";
            if(!confirm(msg))
            {
                frm.phone.focus();
                frm.phone.select();
                return false;
            }
        }
        else
        {
            alert(msg);
            frm.phone.focus();
            frm.phone.select();
            return false;
        }
    }

    // Check the selected country. If can't be option 0, which is the
    // 'Pick a country' prompt. If it's the last option (N-1), then
    // prompt to specify an "other" country if necessary
    if(frm.country.selectedIndex == 0)
    {
        alert("Please specify a country.\n" +
		"This is useful for us in processing your request.");
        return false;
    }
    else if(frm.country.selectedIndex == frm.country.length - 1)
    {
        if(frm.otherCountry == null ||
			frm.otherCountry == "" ||
			IsEmptyString(frm.otherCountry.value))
        {
            alert("You have selected Other for your country.\n" +
			"Please enter your country name to help us process " +
			"your request.")
            frm.otherCountry.focus();
            frm.otherCountry.select();
            return false;
        }
    }
    
    // Check that at least *one* interest option is checked
    if(!frm.cdrom.checked &&
        !frm.www.checked &&
        !frm.consult.checked &&
        !frm.other.checked)
    {
        alert("Please check at least one interest so that we know " +
                "how we can help you.");
        return false;
    }

    // OK! Let the form submit itself
    return true;
}

function doMailto()
{
var str="%0d%0d";
if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1)
{
 //alert("Version:"+navigator.appVersion+" , "+navigator.appName);
 
 if (navigator.appVersion.indexOf("5.5") == -1) str="%250d%250d";
}
document.write('<A HREF="mailto:?subject=Riverside HiFi&body=Hi, '+str+'I think you will find this hifi web site of interest: '+str+'http://www.riversidehifi.co.uk/ '+str+'The page I was looking at was called: '+str+'\''+document.title+'\' '+str+'and is at: '+str+escape(window.location.href)+' '+str+'Regards">');

}

function add2Favorites(rootURL)
{
    if ((navigator.appName.indexOf("Microsoft Internet Explorer") != -1) && 
        (parseInt(navigator.appVersion) > 3)) 
    {
        document.write('<A HREF="#" onclick="window.external.AddFavorite(window.location.href,document.title);return false;"><IMG SRC="'+rootURL+'gifs/add2fav.gif" BORDER="0" ALT="Click here to add this page to your favorites"></A>');
    }
}

// Slideshow
var myTransitions = new Array(38);
myTransitions[0] = "progid:DXImageTransform.Microsoft.RandomDissolve()";
myTransitions[1] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='star', motion='out')";
myTransitions[2] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='diamond', motion='in')";
myTransitions[3] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='cross', motion='out')";
myTransitions[4] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='circle', motion='in')";
myTransitions[5] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='square', motion='out')";
myTransitions[6] = "progid:DXImageTransform.Microsoft.Iris(irisStyle='plus', motion='in')";
myTransitions[7] = "progid:DXImageTransform.Microsoft.Barn(orientation='vertical' motion='in')";
myTransitions[8] = "progid:DXImageTransform.Microsoft.Barn(orientation='vertical' motion='out')";
myTransitions[9] = "progid:DXImageTransform.Microsoft.Barn(orientation='horizontal' motion='in')";
myTransitions[10] = "progid:DXImageTransform.Microsoft.Barn(orientation='horizontal' motion='out')";
myTransitions[11] = "progid:DXImageTransform.Microsoft.Pixelate()";
myTransitions[12] = "progid:DXImageTransform.Microsoft.Inset()";
myTransitions[13] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='left')";
myTransitions[14] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='right')";
myTransitions[15] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='down')";
myTransitions[16] = "progid:DXImageTransform.Microsoft.Checkerboard(Direction='up')";
myTransitions[17] = "progid:DXImageTransform.Microsoft.RandomBars(motion='horizontal')";
myTransitions[18] = "progid:DXImageTransform.Microsoft.RandomBars(motion='vertical')";
myTransitions[19] = "progid:DXImageTransform.Microsoft.Slide(bands=5, slideStyle='push')";
myTransitions[20] = "progid:DXImageTransform.Microsoft.Slide(bands=5, slidestyle='swap')";
myTransitions[21] = "progid:DXImageTransform.Microsoft.Slide(bands=5, slidestyle='hide')";
myTransitions[22] = "progid:DXImageTransform.Microsoft.Spiral()";
myTransitions[23] = "progid:DXImageTransform.Microsoft.Stretch(stretchStyle='push')";
myTransitions[24] = "progid:DXImageTransform.Microsoft.Stretch(stretchstyle='spin')";
myTransitions[25] = "progid:DXImageTransform.Microsoft.Stretch(stretchstyle='hide')";
myTransitions[26] = "progid:DXImageTransform.Microsoft.Wipe(GradientSize=.50, wipeStyle=0, motion='forward')";
myTransitions[27] = "progid:DXImageTransform.Microsoft.RadialWipe(wipeStyle='clock')";
myTransitions[28] = "progid:DXImageTransform.Microsoft.RadialWipe(wipeStyle='radial')";
myTransitions[29] = "progid:DXImageTransform.Microsoft.RadialWipe(wipeStyle='wedge')";
myTransitions[30] = "progid:DXImageTransform.Microsoft.Zigzag(motion='leftup')";
myTransitions[31] = "progid:DXImageTransform.Microsoft.Strips(motion='leftup')";
myTransitions[32] = "progid:DXImageTransform.Microsoft.Strips(motion='rightup')";
myTransitions[33] = "progid:DXImageTransform.Microsoft.Strips(motion='leftdown')";
myTransitions[34] = "progid:DXImageTransform.Microsoft.Strips(motion='rightdown')";
myTransitions[35] = "progid:DXImageTransform.Microsoft.Wheel(spokes=8)";
myTransitions[36] = "progid:DXImageTransform.Microsoft.Inset()";
myTransitions[37] = "progid:DXImageTransform.Microsoft.Fade(overlap=1)";

var CUBE=23;
var PIXEL=11;
var FADE=37;
var FADEWIPE=26;
var IRIS=4;
var STAR=1;

var NUMITEMS=3;
var timerID = null;
var timerRunning = false;
var timerInt = 3; // Timer interval in seconds
var pictureCount=1;
var preloadedImages = new Array();

var useFilters=false;
var use55Filters=false;
var aCount=0;

function preloadPictures()
{
  var img=0;
  for (img=0; img<(pictures.length/NUMITEMS); img++)
  {
     //alert("Preload:"+imgRefs[img]);
     preloadedImages[img]= new Image;
     preloadedImages[img].src=pictures[img*NUMITEMS];
  }
}

function initShow(transition)
{
  // This test needed as netscape gags on picture reference
  if (document.all)
  {
    // This test needed as opera gags on filters reference
    if (document.all.picture.filters)
    {
      // IF ie 5.5 or greater we can use 5.5 filters
      //alert(navigator.appName+" : "+navigator.appVersion);
      use55Filters=((navigator.appName.indexOf("Microsoft Internet Explorer") != -1)&&
      (parseFloat(navigator.appVersion.substr((navigator.appVersion.toLowerCase().indexOf('msie')+4))) >= 5.5));
    
      // IF ie 4 or greater we can use 4.0 filters
      useFilters=((navigator.appName.indexOf("Microsoft Internet Explorer") != -1)&&(parseInt(navigator.appVersion) >= 4));
    
      if (use55Filters)
      {
        // IE5.5 only!
        picture.style.filter=myTransitions[transition];
      }
      else
      {
        picture.style.filter="blendTrans(duration=2)";
      }
      // Stop image from being trashed by a previous Play!
      document.all.picture.filters(0).Stop();
      document.all.picture.filters(0).Apply();
    }
  }

  if (document.images)
  {
    preloadPictures();
    startShow();
  }
}

function stopShow()
{
  timerRunning = false;
  clearInterval(timerID);
  timerID = null;
}

function startShow()
{
  // 
  // Could start an animation straight away
  // but assumes image is in and visibility flag write supported
  // and assumes HTML has visibility set to hidden first.
  //if (useFilters)
  //{
   //document.all.picture.filters(0).Apply();
   //document.all.picture.style.visibility="visible";
   //document.all.picture.filters(0).Play();
  //}

  timerRunning = true;
  timerID = setInterval("nextPicture()",timerInt*1000)
}

function nextPicture()
{
  if (useFilters)
  {
    aCount=aCount+1;
    if (aCount>37) {aCount=0;}
    document.all.picture.filters(0).Apply();
  }

  if (pictureCount>=(pictures.length/NUMITEMS))
  {
   // we have been around once so pause now at 1st image.
   pictureCount=0;
   document.images["picture"].src=preloadedImages[pictureCount].src;
   if (pictures[(pictureCount*NUMITEMS)+2] !="")
   {
     document.images["picture"].alt="Click here to pause and launch site";
   }
   else
   {
     document.images["picture"].alt="Click here to pause";
   }
   window.status=pictures[(pictureCount*NUMITEMS)+1]+" - click image to pause";
   //stopShow();
   //document.images["picture"].src=preloadedImages[pictureCount].src;
   //document.images["picture"].alt=pictures[(pictureCount*NUMITEMS)+1]+" - click to play again";
   //window.status=pictures[(pictureCount*NUMITEMS)+1]+" - click image to play again";
   pictureCount=1;
  }
  else
  {
    if ((preloadedImages[pictureCount].complete || preloadedImages[pictureCount].complete==null))
    {
      document.images["picture"].src=preloadedImages[pictureCount].src;
      if (pictures[(pictureCount*NUMITEMS)+2] !="")
      {
        document.images["picture"].alt="Click here to pause and launch site";
      }
      else
      {
        document.images["picture"].alt="Click here to pause";
      }
      window.status=pictures[(pictureCount*NUMITEMS)+1]+" - click image to pause";
      pictureCount++;
    }
  }
  if (useFilters)
  {
    document.all.picture.filters(0).Play();
  }

}
function showUrl()
{
  if ((pictureCount-1) >= 0)
  {
    if (pictures[(pictureCount-1*NUMITEMS)+2] !="")
    {
      window.status=pictures[((pictureCount-1)*NUMITEMS)+2];
    }
  }
  return true;
}

function toggleShow()
{
  if (timerRunning)
  {
   var currentPicture=pictureCount-1;
   stopShow();
   document.images["picture"].alt="Click here to continue";
   window.status=pictures[(currentPicture*NUMITEMS)+1]+" - click image to continue";
   if (pictures[(currentPicture*NUMITEMS)+2] !="")
   {
     newWindow("externalSite",pictures[(currentPicture*NUMITEMS)+2],"780","500","SCROLL") 
   }
  }
  else
  {
   nextPicture();
   startShow();
  }
}

function doEm(name, addytext, subject, bodyt, classt)
{
  var addy=name + '\@' + 'silverdisc' + '.co.uk';
  var subj="Consulta desde el sitio de SilverDisc";
  var bod="";

  if (subject !="")
  {
    subj=subject;
  }
  if (bodyt!="")
  {
    bod="&body="+bodyt;
  }
  if (classt!="")
  {
    document.write('<A class=\"'+classt+'\" HREF=\"mail' + 'to:' + addy + '?subject='+subj+bod+'\">' + addytext + '</a>');
  }
  else
  {
    document.write('<A HREF=\"mail' + 'to:' + addy + '?subject='+subj+bod+'\">' + addytext + '</a>');
  }
}


// End hiding -->
