﻿

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

/*
**
**	Global Variables
**  Created 04.09.2008
**
*/

var readonlycolour = '#ffe0e0';
var activecolour = '#c9eefc';
var inactivecolour = '#ffffff';
var activeborder = '#00aeef';
var inactiveborder = '#a0a0a0';
var readonlyborder = '#ffa0a0';

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

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

        /* true start position */
        if(start == 1)
            start = last;
        else
            start = start - 1;

        /* start playback */
        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 23.04.2009
**
*/

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

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

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

function ActiveField(id)
	{
		id.style.backgroundColor = activecolour;
		id.style.borderColor = activeborder;
	}

function ReadOnlyField(id)
	{
		id.style.backgroundColor = readonlycolour;
		id.style.borderColor = readonlyborder;
	}
	
function InactiveField(id)
	{
		id.style.backgroundColor = inactivecolour;
		id.style.borderColor = inactiveborder;
	}
	
function SubmitForm(name)
   {
      document.getElementById(name).submit();
   }

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