/* --------------- STUDIO CONNECTIONS EXTERNAL JAVASCRIPT FILE -------------- */
/*                                                                            */
/*    Description: Customised greeting to visitor for Home Page               */
/*         Client: Cloud Studios - info@cloudstudios.com                      */
/*        Website: www.cloudstudios.com                                       */
/*         Author: Colin Abrahams - colin@studioconnections.net.au            */
/*      Copyright: 2008 Colin Abrahams, Studio Connections                    */
/*       Location: Wyong, NSW, Australia                                      */
/*        Version: SC-5.8                                                     */
/*   Last Updated: 2008-11-25                                                 */


// Last major site update
MajorUpdt = "Tue, 25 November 2008 13:30:00 GMT+1100";

// Message for new visitors or visitors without cookies enabled
MsgNew = "<h2>Welcome to the Cloud Studios website</h2>"

// Message for returned visitors
MsgRet = "<h2>Welcome back to the Cloud Studios website</h2>"

// Message to notify site updates for returned visitors
MsgUpdt = "<p><b>This site has been updated since your last visit.<br />"
        + "We've just added a shopping cart, new pages and made some changes "
        + "under the hood!</b></p>"

// Process major update
if (!isNaN(Date.parse(MajorUpdt))) {
  top.VisitUpdt = new top.Date();
  top.VisitUpdt.setTime(Date.parse(MajorUpdt));
}
else {
  top.VisitUpdt = "Error in MajorUpdt string";
}

// Visitor status logic
top.VisitStat = "New";
if (top.VisitLast && typeof top.VisitLast == "object"
  && top.VisitUpdt && typeof top.VisitUpdt == "object") {
  if (top.VisitLast.getTime() < top.VisitUpdt.getTime()) {
    top.VisitStat = "Updated";
  }
  else {
    top.VisitStat = "Returned";
  }
}

// Render message on page
if (top.VisitStat && top.VisitStat == "Updated") {
  document.writeln(MsgRet);
  document.writeln(MsgUpdt);
}
else if (top.VisitStat && top.VisitStat == "Returned") {
  document.writeln(MsgRet);
}
else {
  document.writeln(MsgNew);
}
