
/*
**
** Global Functions for Animal Tracks
** $VER: animal.js 1.0 (22.07.2009)
**
**
** This file is part of the ImpleoCMS project.
**
** (C) 2008-2009 Daniel J. Allsopp
** All rights reserved
**
** See the documentation for conditions.
**
*/

/*
**
**	Slideshow Functions
**  Created 23.04.2009
**
*/

function StartShow(id, first, last, delay, random, start)
   {
      if(random != false) start = Math.ceil(Math.random() * last);

      setTimeout(PlayShow(id, start, first, last, delay), 0);
   }
                                                
function PlayShow(name, frame, first, last, delay)
	{
		return (function()
			{
				Effect.Fade(name + '_' + frame);
				if (frame == last) { frame = first; } else { frame = frame + 1; }
				setTimeout("Effect.Appear('" + name + "_" + frame + "');", 250);
				setTimeout(PlayShow(name, frame, first, last, delay), delay + 250);
			})
	}

/*
**
**	Helper Functions
**  Created 05.02.2009
**
*/

function Pointer(id)
   {
      id.style.cursor = 'Pointer';
   }

function MouseOver(id, colour)
    {
		id.style.color = colour;
		id.style.cursor = 'Pointer';
    }

function MouseOut(id, colour)
    {
        id.style.color = colour;
        id.style.cursor = 'Default';
    }

function GotoLocation(loc)
   {
      /* internet explorer really is crap! */
      if(navigator.appName == 'Microsoft Internet Explorer')
         {
            var b = document.getElementsByTagName('base');
            
            if(b && b[0] && b[0].href)
               {
                  if(loc != b[0].href)
                     {
                        if (b[0].href.substr(b[0].href.length-1) == '/' && loc.charAt(0) == '/') loc = loc.substr(1);
                        loc = b[0].href + loc;
                     }
               }
         }

      document.location.href = loc;
   }
   
function GotoURL(loc)
    {
        document.location.href = loc;
    }
   
function SubmitForm(name)
   {
      document.getElementById(name).submit();
   }

function ResetForm(name)
   {
      document.getElementById(name).reset();
   }
