// *** settings - start ***
var panelItemShootSpeed=40; // lower=faster
// *** settings - end ***


var stop_clock=false;


function shootItems(numItem)
{
  var base_delay=150;
  var i;

  stopMovie();
  for(i=0; i<numItem; i++)
  {
    base_delay = shootOne("item"+(i+1),(i+1)*panelItemShootSpeed);
  }
  base_delay+=500;
  setTimeout("playMovie();",base_delay);
}


function shootOne(sub_name,base_delay)
{
  var i;
  var j=0;

  for(i=-200; i<=0; i+=10)
  {
    setTimeout("document.getElementById('" + sub_name + "').style.left=" + i,base_delay+j);
    j=j+10;
  }
  return base_delay+j;
}


function showItems(numItem)
{
  var i;

  for(i=0; i<numItem; i++)
    document.getElementById("item"+(i+1)).style.left=0;
}


function link_to(link_url)
{
  window.location=link_url;
}


var gDate="";

function show_clock()
{

   if(gDate=="") initClock();

   // Get all our date variables:
   var Digital = new Date();
   var hours = Digital.getHours();
   var minutes = Digital.getMinutes();
   var seconds = Digital.getSeconds();

   // Set up the hours for either 24 or 12 hour display:
   dn = "AM";
   if (hours > 12) { dn = "PM"; hours = hours - 12; }
   if (hours == 0) { hours = 12; }
   if (minutes <= 9) { minutes = "0"+minutes; }
   if (seconds <= 9) { seconds = "0"+seconds; }

   myclock = '';
   myclock += gDate + '&nbsp;&nbsp;';
   myclock += hours+':'+minutes;
   myclock += ':'+seconds;
   myclock += ' '+dn;

   document.getElementById("LiveClockIE").innerHTML = myclock;
   if(!stop_clock) setTimeout("show_clock()",1000);
}


function initClock()
{
   var dn = "";

   var MonthsOfYear = new Array(12);
   MonthsOfYear[0] = "Jan";
   MonthsOfYear[1] = "Feb";
   MonthsOfYear[2] = "Mar";
   MonthsOfYear[3] = "Apr";
   MonthsOfYear[4] = "May";
   MonthsOfYear[5] = "Jun";
   MonthsOfYear[6] = "Jul";
   MonthsOfYear[7] = "Aug";
   MonthsOfYear[8] = "Sep";
   MonthsOfYear[9] = "Oct";
   MonthsOfYear[10] = "Nov";
   MonthsOfYear[11] = "Dec";

   var DayOfWeek = new Array(7);
   DayOfWeek[1]="Monday";
   DayOfWeek[2]="Tuesday";
   DayOfWeek[3]="Wednesday";
   DayOfWeek[4]="Thursday";
   DayOfWeek[5]="Friday";
   DayOfWeek[6]="Saturday";
   DayOfWeek[7]="Sunday";

   var gDigital = new Date();
   var day = DayOfWeek[gDigital.getDay()];
   var mday = gDigital.getDate();
   var month = gDigital.getMonth();
   var year  = gDigital.getYear();
   var styear = ' ' + year;
   styear = styear.substring(styear.length-2,styear.length);
   gDate = day; // + ' ' + mday + ' ' + MonthsOfYear[month] + ' ' + styear;
}


function setCookie(cookieName, cookieValue)
{
  var expiryDate = new Date();
  expiryDate.setMonth(expiryDate.getMonth() + 6);
  cookieValue = escape(cookieValue);
  document.cookie = cookieName + "=" + cookieValue + ";expires=" + expiryDate.toGMTString() + ";path=/;" ;
}


function getCookie(cookieName)
{
   var cookieStr = document.cookie;
   var cookieValue;
   var cookieStart,cookieEnd;

   cookieStart = cookieStr.indexOf(" " + cookieName + "=");
   if(cookieStart == -1) cookieStart = cookieStr.indexOf(cookieName + "=");
   if(cookieStart == -1) cookieValue = "";
   else {
     cookieStart = cookieStr.indexOf("=", cookieStart) + 1;
     cookieEnd   = cookieStr.indexOf(";", cookieStart);
     if(cookieEnd == -1 ) {
       cookieEnd = cookieStr.length;
     }
     cookieValue = unescape(cookieStr.substring(cookieStart, cookieEnd));
   }
   return cookieValue;
}


function new_bare_window(url_str)
{
    window.open(url_str, '',
    'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,top=0,left=0,width='+
    (screen.availWidth-8) +  ',height=' + (screen.availHeight-45));
}


function playMovie()
{
  if(!no_flash) document.getElementById("movie").Play();
}


function stopMovie()
{
  if(!no_flash) document.getElementById("movie").StopPlay();
}


function launch_ecfsp_deve()
{
  var url_str='https://www.e-cfsp.co.uk/sdwdeve/fglccgi.exe/wa/r/aspdeve?Arg=ini=aspdeve';

  window.open(url_str, '',
  'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,top=0,left=0,width='+
  (screen.availWidth-12) +  ',height=' + (screen.availHeight-48));
}
