// All contents are Copyright The True Solution Co. Ltd. 2005
// email enquiries@absolutepages.com

var theImages = new Array;

function preloadImages()
{
  for(i=0; i<preloadImages.arguments.length; i++)
  {
    theImages[i] = new Image();
    theImages[i].src = preloadImages.arguments[i];
  }
}

preloadImages("images/waitingsign.gif", "sliderback.jpg");

var mywin = null;
var closewin = '"javascript:window.close()"';
var closeMsg = '"Click to close"';

function open_window(url,w,h)
{
  close_window();
  mywin=window.open
  ("","win","TOOLBAR=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=0,top=0,width="+w+",height="+h);
  mywin.document.write("<HTML><HEAD><TITLE>LIZ TYLER JEWELLERY</TITLE><STYLE TYPE='text/css'>body {color: #FFFFFF; background-color: #0000FF; background-image: url('images/waitingsign.gif'); text-align: center; background-repeat: no-repeat; background-position: center; font-family: sans-serif;} IMG {border-color: #0000FF; width: 443px; height: 443px;}</STYLE></HEAD><BODY><CENTER><B>CLICK ON IMAGE TO CLOSE</B></CENTER><BR><A HREF="+closewin+"><IMG SRC='"+url+"' ALT="+closeMsg+"></A></BODY></HTML>");
  mywin.focus();
}

function close_window()
{
  if (!(mywin==null))
  {
    if (!(mywin.closed)) mywin.close();
    mywin = null;
  }
}

//
// This holds the data for the review list.
//
var reviewList = new Array(200);
for (i = 0; i < 200; i++)
  {
    reviewList[i] = new Array(2);
    reviewList[i][0] = "";
    reviewList[i][1] = -1;
  }    

var currentData = "";

function getCurrentData()
{
  return currentData;
}

function showData (dataType)
{
  var elName;

  if (dataType == "CVDATA")
  {
    cvElement = document.getElementById("CVFDATA");
    cvElement.src = "lizcv.htm";
  }

  if (dataType == "INFODATA")
  {
    cvElement = document.getElementById("CVFDATA");
    cvElement.src = "info.htm";
  }

  if (dataType == "INFODATA") elName = "CVDATA"; else elName = dataType;

  if ((currentData != "") && (currentData != elName)) closeData(currentData);

  theElement = document.getElementById(elName);
  theElement.scrollTop = 0;
  theElement.style.visibility = "visible";

  currentData = dataType;
}

function closeData (dataType)
{
  var elName;

  if (dataType == "CVDATA")
  {
    cvElement = document.getElementById("CVFDATA");
    cvElement.src = "";
  }

  if (dataType == "INFODATA")
  {
    cvElement = document.getElementById("CVFDATA");
    cvElement.src = "";
  }

  if (dataType != "")
  {
    if (dataType == "INFODATA") elName = "CVDATA"; else elName = dataType;
    theElement = document.getElementById(elName);
    theElement.scrollTop = 0;
    theElement.style.visibility = "hidden";
  }
  currentData = "";
}

function setCookie (cookieName, cookieValue, cookiePath, cookieExpires)
{
  cookieValue = escape(cookieValue);
  
//  if (cookieExpires == "")
//  {
//    var nowDate = new Date();
//    nowDate.setMonth(nowDate.getMonth() + 6);
//    cookieExpires = nowDate.toGMTString();
//  }
//  
//  if (cookiePath != "")
//    cookiePath = ";Path=" + cookiePath;
//  else
//    cookiePath = "/";
  
  document.cookie = cookieName + "=" + cookieValue + ";expires=Wed, 21 Oct 2037 12:00:00 UTC; path=/";
}

function getCookieValue(cookieName)
{
  var cookieValue = document.cookie;
  var cookieStartsAt = cookieValue.indexOf(" " + cookieName + "=");
  
  if (cookieStartsAt == -1)
  {
    cookieStartsAt = cookieValue.indexOf(cookieName + "=");
  }
  
  if (cookieStartsAt == -1)
  {
    cookieValue = "";
  }
  else
  {
    cookieStartsAt = cookieValue.indexOf("=", cookieStartsAt) + 1;
    var cookieEndsAt = cookieValue.indexOf(";", cookieStartsAt);
    if (cookieEndsAt == -1)
    {
      cookieEndsAt = cookieValue.length;
    }
    cookieValue = unescape(cookieValue.substring(cookieStartsAt, cookieEndsAt));    
  }
  return cookieValue;
}

function store (itemType, thisNum)
{
  var found = 0;
  //
  // If the item isn't in the list then put it in else remove it.
  //
  for (i = 0; i < reviewList.length; i++)
  {
    if ((reviewList[i][0] == itemType) && (reviewList[i][1] == thisNum))
    {
      reviewList[i][0] = "";
      reviewList[i][1] = -1;
      found = 1;
      document.images[thisNum+3].src = "pinned.gif";
      break;
    }
  }

  //
  // If not found then stick it in the list.
  //
  if (found == 0)
  {
    for (i = 0; i < reviewList.length; i++)
    {
      if (reviewList[i][0] == "")
      {
        reviewList[i][0] = itemType;
        reviewList[i][1] = thisNum;
        document.images[thisNum+3].src = "pinnedon.gif";
        break;
      }
    }
  }
}

function setRevButts(dataType)
{
  for (i = 0; i < reviewList.length; i++)
  {
    if (reviewList[i][0] == dataType)
    {
      document.images[(reviewList[i][1]) + 3].src = "pinnedon.gif";
    }
  }
}  

function retrieveRev (dataType)
{

  //
  // Open the cookie, split the data and place it in the array.
  //
  var cookieStr = getCookieValue("liztylerreview");
  cookieStr = cookieStr.split(";");
  if (cookieStr != "")
  {
    for (i = 0; i < (cookieStr.length - 1); i+=2)
    {
      reviewList[(i/2)][0] = cookieStr[i];
      reviewList[(i/2)][1] = parseInt(cookieStr[i+1]);
    }
  }

  //
  // Call setRevButts to highlight selected items.
  //
  if (dataType != "gall") setRevButts(dataType);
}

function writeRev ()
{
  //
  // Overwrite the cookie - take the data from the array and combine it.
  //
  var savedData = "";

  for (i = 0; i < reviewList.length; i++)
  {
    if (!(reviewList[i][0] == ""))
    {
      for (j = 0; j < 2; j++)
      {
        savedData = savedData + reviewList[i][j] + ";";
      }
    }
  }
  
 setCookie("liztylerreview", savedData, "", "");
 
}

//*****************************************
// CHANGE THIS IN LIZREV.JS AS WELL!!!!!!
//*****************************************
function loadExhib()
{
  exhibNode = document.getElementById("EXHIBDATA");

  //
  // Put the exhib info into the exhibition div
  //
  liText = document.createTextNode("EXHIBITIONS :");
  exhibNode.appendChild(liText);
  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  liText = document.createTextNode("5th - 7th March 2010 DESIRE at Queen Charlotte Hall, Richmond upon Thames. Please visit ");
  exhibNode.appendChild(liText);

  li1Text = document.createTextNode("www.desirefair.com");
  a1Node = document.createElement("A");
  a1Node.href = "http://www.desirefair.com/";
  a1Node.appendChild(li1Text);
  exhibNode.appendChild(a1Node);

  liText = document.createTextNode(" for details.");
  exhibNode.appendChild(liText);

//-------------------------------------------------

  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  liText = document.createTextNode("29th May - 13th June 2010 Dorset Art Weeks, together with furniture designer Simon Pirie at Courtyard Workshop, Rogers Hill Farm, Briantspuddle near Bere Regis, DT2 7HJ. Please visit ");
  exhibNode.appendChild(liText);

  li2Text = document.createTextNode("www.dorsetartweeks.co.uk");
  a2Node = document.createElement("A");
  a2Node.href = "http://www.dorsetartweeks.co.uk/";
  a2Node.appendChild(li2Text);
  exhibNode.appendChild(a2Node);

  liText = document.createTextNode(" for details.");
  exhibNode.appendChild(liText);

//--------------------------------------------------

  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  liText = document.createTextNode("27th Sept - 10th October 2010 The Goldsmiths' fair Goldsmiths' Hall. Please visit ");
  exhibNode.appendChild(liText);

  li3Text = document.createTextNode("www.thegoldsmiths.co.uk");
  a3Node = document.createElement("A");
  a3Node.href = "http://www.thegoldsmiths.co.uk/";
  a3Node.appendChild(li3Text);
  exhibNode.appendChild(a3Node);

  liText = document.createTextNode(" for details.");
  exhibNode.appendChild(liText);

//--------------------------------------------------

  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  liText = document.createTextNode("CLOSE");
  aNode = document.createElement("A");
  aNode.href = "javascript:closeData('EXHIBDATA')";
  aNode.appendChild(liText);
  brNode = document.createElement("BR");
  exhibNode.appendChild(brNode);
  exhibNode.appendChild(aNode);
}

function loadAbout()
{
  aboutNode = document.getElementById("ABOUTDATA");

  //
  // Put the About Liz info into the about div
  //
  liText = document.createTextNode("ABOUT LIZ :");
  aboutNode.appendChild(liText);
  brNode = document.createElement("BR");
  aboutNode.appendChild(brNode);
  brNode = document.createElement("BR");
  aboutNode.appendChild(brNode);
  liText = document.createTextNode("I aim to produce essentially feminine, graceful jewellery and silverware with a strong sense of movement in the design. A recurring feature in whatever scale I am working is that the fittings and decoration frequently form an integral part of the item, so there is no interruption in the flow of the design.");
  brNode = document.createElement("BR");
  brNode2 = document.createElement("BR");
  aboutNode.appendChild(liText);
  aboutNode.appendChild(brNode);
  aboutNode.appendChild(brNode2);
  liText = document.createTextNode("I work primarily to commission and, having trained as a diamond sorter and stone buyer, delight in selecting beautiful diamonds and fabulous coloured gemstones - usually from Germany, for their exquisite and unusual gem cutting skills. I specialise in using the hammering technique, anti-clastic raising, whereby I produce two curves in opposite directions, saddle-like, which allows me to create curvaceous pieces - large and light, flexible yet strong. These I complement or combine with carved and cast pieces with sympathetic fluid lines.");
  brNode = document.createElement("BR");
  brNode2 = document.createElement("BR");
  aboutNode.appendChild(liText);
  aboutNode.appendChild(brNode);
  aboutNode.appendChild(brNode2);
  liText = document.createTextNode("I have won several awards, most significantly Best Design in Diamonds at the UK Jewellery Awards 1998, and most recently, second prize in the Kayman Awards 2002. My designs regularly feature in The Platinum Collection and the World Gold Council trend setting collections. My most important pieces are now signed by laser and the larger diamonds I use are certificated to confirm their unique quality.");
  brNode = document.createElement("BR");
  aboutNode.appendChild(liText);
  aboutNode.appendChild(brNode);
  liText = document.createTextNode("CLOSE");
  aNode = document.createElement("A");
  aNode.href = "javascript:closeData('ABOUTDATA')";
  aNode.appendChild(liText);
  liText2 = document.createTextNode("CV");
  aNode2 = document.createElement("A");
  aNode2.href = "javascript:showData('CVDATA')";
  aNode2.appendChild(liText2);
  brNode = document.createElement("BR");
  aboutNode.appendChild(brNode);
  aboutNode.appendChild(aNode);
  liText = document.createTextNode(" | ");
  aboutNode.appendChild(liText);
  aboutNode.appendChild(aNode2);
  brNode = document.createElement("BR");
  aboutNode.appendChild(brNode);
  brNode = document.createElement("BR");
  aboutNode.appendChild(brNode);
}
