//
// 01/07/2006 Added self.location.search to framing routines.
// 25/06/2006 Added DeSpace and ReSpace to support commonisation of titles.htm.
//
var OldWhere;

var domain = "EssexTheatreTicketing.co.uk";
window.defaultStatus="http://www." + domain;
//  {window.onerror=myOnError;}
var owner = "Essex Theatre Ticketing";
var lastmoddate = document.lastModified;

if (lastmoddate == 0) {
   var PageData = "<center>Last modified: Unknown. &copy; 2003 Copyright " + owner;
} else {
   var ModDate = new Date (lastmoddate)
   var PageData = "<center>Last modified: " + lastmoddate + ". &copy; 2004-"
		 + ModDate.getYear() + " " + owner;
}

function DeSpace(string) {
   string = string.replace (/ /g, "_");		// replace spaces with underlines
   return string;
}

function ReSpace(string) {
   string = string.replace (/_/g, " ");		// replace underlines with spaces
   return string;
}



function myOnError(){
    if (OldWhere != 'Data') {
       self.location.href = "frame.htm";
    } else {
         if (self.location.search.length == 0) {
            self.location.href = "frame.htm?" + self.location.pathname;
         } else {
            self.location.href = "frame.htm?" + self.location.pathname + "?" + self.location.search;
         }
    }
    return true;
}




function PutInFrame (where) {

   function FrameMe (where) {
     if ((where == "Data") || (where == "data")) {
        self.location.href = "frame.htm?" + self.location.pathname;  	// load the specified file
     } else {
        self.location.href = "frame.htm";				// load the default frameset
     }

   }

   try {
      if (parent.frames[3].name != "data") {
// We're in a frame but not the right one
         FrameMe (where);
     }
   } catch (error) {
//    Page is not currently in desired frame
      FrameMe (where);
   }
}




function PrintNum (number){
   strings = new Array ("no", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten");
   if (number <= strings.length) {
     document.write (strings [number]);
   } else {
     document.write (number);
   }
}

function NoSpam (email, site, display) {
   if (site == undefined) {
      site = domain
   }

   if (site == "") {
      site = domain
   }

   if (display == undefined) {
      display = email + "@" + site
   }

   if (display == "") {
      display = email + "@" + site
   }
   document.write("<A href=mailto:" + email + "@" + site + ">" + display + "</A>")
}

function MenuItem (RelativePath, text, target) {
     page = RelativePath.substring (RelativePath.lastIndexOf ("/") + 1);
     document.write ("<LI><a target=\"" + target + "\" onMouseOver=\"window.status=\'http://www." + domain + "/" + page + "\';return true;\" href=\""+ RelativePath + "\">" + text + "</a>");
}