function load_div(id,arr,pre_fix)
{
  for(var i = 0;i<arr.length;i++)
  {
    obj = document.getElementById(pre_fix+'_'+arr[i]);

    if(arr[i] == id)
    {
      obj.style.display = '';
    }
    else
    {
      obj.style.display = 'none';
    }
  }
}

/**
 *
 * @access public
 * @return void
 **/
function load_flash(location,pre_fix){
  //load text
  arr = new Array(6);
  arr[0] = 'retail';
  arr[1] = 'relax';
  arr[2] = 'colour';
  arr[3] = 'cleanse';
  arr[4] = 'hair';
  arr[5] = 'spa';
  load_div(location,arr,pre_fix);

  //td style
  for(var i=0;i<arr.length;i++)
  {
    obj = document.getElementById('td_'+arr[i]);
    if(arr[i] == location)
    {
      obj.setAttribute("class", 'zones_purple'); //For Most Browsers
	    obj.setAttribute("className", 'zones_purple'); //For IE; harmless to other browsers.
    }
    else
    {
      obj.setAttribute("class", 'zones_grey'); //For Most Browsers
	    obj.setAttribute("className", 'zones_grey'); //For IE; harmless to other browsers.
    }
  }

  //new flash movie
  obj = window.document['flash_zone'];

  obj.movie = '/flash/'+location+'_zone_purple.swf';
  obj.src = '/flash/'+location+'_zone_purple.swf';

  //str = 'window.document[\'flash_zone\']';
  //play_movie(str);

}

function play_movie(stringToEval)
{
  var movie=eval(stringToEval);
  if (movie)
  {
    if (movie.PercentLoaded())
    {
      if (movie.PercentLoaded()==100)
      {
        movie.Play();
      }
      else
      {
        alert("movie is still loading, try again soon");
      }
    }
    else
    {
      alert("movie object found-but unable to send command");
    }
  }
  else
  {
    alert("movie object not found");
  }
}

function NewWindow(mypage, myname, w, h, scroll)
{
  var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function validateValue()
{
	// only allow numbers to be entered
	var checkOK = "0123456789";
	var checkStr = document.getElementById("amount").value;
	var allValid = true;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if ((ch == checkOK.charAt(j))||((ch == ".")&&(checkStr.indexOf(".") == checkStr.lastIndexOf(".")&&(checkStr.indexOf(".") >= (checkStr.length - 3)))))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
			allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only numbers (with or without pence) into the amount field.");
		return false;
	}
	if (checkStr.length == 0)
	{
		alert("Please supply a value in the \"enter amount\" box.");
		return false;
	}

	if (checkStr.indexOf(".") == -1)
	{
		document.getElementById("amount").value = checkStr + ".00";
	}
	else if (checkStr.indexOf(".") == (checkStr.length - 2))
	{
		document.getElementById("amount").value = checkStr + "0";
	}

	return true;
}