// Copyright 1999,2000,2001,2002 - The website owner asserts copyright on this program and all of its components

function report_error(msg, url, line)
{  record('WEBPAGEERROR>>> msg='+msg+', url='+url+', line='+line);
//    alert('Sorry, but an error has been detected.\n'+
//           'The fault has been logged & we will fix it soon.\n\n' +
//           'In the meantime, this page may not work correctly for you.\n\n' +
//           'If you are not using Internet Explorer - then using it will probably avoid this error.\n' +
//           'Alternatively, you are welcome to email or phone on 01234 306993 during UK office hours.\n\n'+
//           'Once again, we apologise for any inconvenience this may have caused you.');
   return true;
};
window.onerror = report_error;

var UTILversion = 18;
var error_count = 0;
var doICQ       = false;

function get_items_total()
{var LinePrice, PriceTotal = 0, items, mycookie = GetCookie("order");
 if   (mycookie == "")
      {return 0;
	  }
 else {items = mycookie.split('|');
       count = items.length;
	   for (var i=0; i<count; i++)
           {parts = items[i].split("^");
            LinePrice = parts[10];
	        PriceTotal += LinePrice/1;
           }; 
     return PriceTotal;
	 };
};

function dummy(msg, url, line)
{return true;
};

function bookmark(url){
  if (document.all)
  window.external.AddFavorite(url,"Rebecca's Online Sex Shop");
  record('Bookmarking ' + url);
} 

function go()
{
 document.myform.url.value = myurl;
 record('Emailing page: ' + document.myform.url.value     +
        ' to '            + document.myform.email.value   +
        ' with name '     + document.myform.name.value    +
        ' and message '   + document.myform.message.value
       );
};

function mailto()
{document.write("<a href='#' " +
                "TITLE='Click to email this page to a friend' " +
                "onClick = \"window.open('mailto.htm?" +
                 location.href + "','','width=450,height=400'); return false\">" +
                "<IMG SRC='sendpage.gif' WIDTH='120' HEIGHT='44' BORDER='0'></a>");
};

function MoneyFormat(amount) {
	var val = parseFloat(amount);
	if (isNaN(val)) { return "0.00"; }
	else { val = Math.round(val*100)/100; }
	val = (val == Math.floor(val)) ? val + '.00' : ((val*10 == Math.floor(val*10)) ? val + '0' : val);
	return val;
	};

function GetCookie(name)
{  var allcookies = unescape(document.cookie);
   var pos = allcookies.indexOf(name+"=", start);
   if (pos != -1)
      {var start = pos + name.length + 1
       var end   = allcookies.indexOf(";", start)
       if (end == -1) end = allcookies.length;
       return unescape(allcookies.substring(start, end))
      }
   else return "";
};

function doNaviBar()
{document.writeln(
"<div align='center'>",
" <center>",
// "   <table width='100%' border='0' cellpadding='1'>",
// "    <tr>",
// "        <td width='100%' align='center'>",
// "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'",
// "             codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'",
// "             WIDTH='234' HEIGHT='60' id='ukl1' ALIGN=''>",
// "<PARAM NAME=movie VALUE='ukl1.swf'>",
// "<PARAM NAME=quality VALUE=high>",
// "<PARAM NAME=bgcolor VALUE=#FFFFFF>",
// "<EMBED src='ukl1.swf' quality=high bgcolor=#FFFFFF  WIDTH='234' HEIGHT='60' NAME='ukl1' ALIGN=''",
// " TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'>",
// "</EMBED>",
// "</OBJECT>",
// "         </td>",
// "     </tr>",
// "</table>",
 "   <table width='800' border='0' cellpadding='1'>",
 "     <tr>",
 "       <td bgcolor='Red' width='150'><div align='center'>",
 "		   <a class='white' href='help1.htm' target='_top'>HELP!</a>",
 "        </div></td>",
 "	",
 "      <td class='navibar' width='150'><div align='center'>",
 "          <a class=white target='_top' href='talk.htm'",
 "		      title = 'Various options for communicating with us'>",
 "			  Contact Us <img src='contact.gif' align='absmiddle' height='15' width='15' border='0'></a>",
 "	    </div></td>",
 "",
 "       <td class='navibar' width='150'><div align='center'>",
 "	  <a class=white target='_top' href='index.htm'",
 "		     Title = 'Show a list of shop departments you can visit'>",
 "			 Departments <img src='depts.gif' align='absmiddle' height='15' width='15' border='0'></a>",
 "		</div></td>",
 "",
 "       <td class='navibar' width='32%'><div align='center'>",
 "		  <a class=white target='_top' href= 'basket.htm'",
 "		     title = 'Show/Change your shopping basket contents or proceed to checkout'>",
 "			 Your Basket <img src='basket.gif' align='absmiddle' height='15' width='15' border='0'>",
 "            Total is: £",
 "           <script language='JavaScript1.2'>document.write(MoneyFormat(get_items_total()))</script>",
 "			 </a>",
 "			 </div></td>",
 "       </tr>",
 "   </table>",
 " </center>",
"</div>"
);
};

function debug(msg)
{
 if (GetCookie('DEBUG')=="ON")
    {
     alert(msg)
    };
};


function NewSearch(num, keyword)
{
 record('Search ' + num + ': '+ keyword);
 var newloc = "search.php?&simple=true&type=%&key=" + keyword;
 window.location.href = newloc;
};

function DoSearch()
{
 var keyword = document.search.keyword.value;
 record('Index Search: '+ keyword);
 var newloc = "search.php?&simple=true&type=%&key=" + keyword;
 window.location.href = newloc;
};

function gothere()
{
 var value = document.myform.selector[document.myform.selector.selectedIndex].value;
 debug(value);
 window.location.href = value + '.htm?sel';
};

function record(info)
{
 if (document.URL.search(/file/i) != 0)
   {
    var LogVersion = '1';
    var BID = GetCookie('BID');
    if (BID == '')
       {
        var now = new Date();
        BID = Date.parse(now.toUTCString())/1000;
        document.cookie = "BID=" + BID + '; expires=Tue, 31-Dec-2012 00:00:00 GMT';
        BID = GetCookie('BID');
       };

    var undefined;
    var NQ        = document.URL.split('?'); if (NQ[1] == undefined) NQ[1]='';
    var pagename  = NQ[0].split(/\\|\//);
        pagename   = pagename[pagename.length-1];

    pagename = pagename + '+' + UTILversion;

    if (info != '') pagename = pagename + '+' + info;
    if (NQ[1] !='') pagename = pagename + '?' + NQ[1];
    pagename = escape(pagename);

    if (pagename.length > 255)
       { pagename = pagename.slice(0,254)
       };

    NQ = document.referrer.split('?');
    if      ((NQ[0] == undefined) || (NQ[0] == ''))
           {myreferrer = ''
           }
    else  {var  temp1       = NQ[0].split('/');
                   myreferrer  = temp1[temp1.length-1];
                   refdomain  = temp1[2]; if (refdomain == undefined) refdomain = '';

           if (refdomain != '' && refdomain != document.domain) myreferrer = document.referrer;
           if (myreferrer.length > 255)
              {myreferrer = myreferrer.slice(0,254)
              };
          };
	   
    var x = new Image();
    var logstring = '/cgi-bin/log.pl?' +
                     LogVersion        + '^'
                      + pagename       + '^'
                      + BID            + '^'
                      + "ONLINE"       + '^'
                      + escape(myreferrer);
    x.src = logstring;
  };
};

function sponsor(URL)
{record("sponsor visit to: " + URL);
 window.open(URL);
};

function amazon(ISBN)
{  record('Amazon click on: ' + ISBN);
   var myhref = "http://www.amazon.co.uk/exec/obidos/ASIN/" + ISBN + "/rebeccsadultshop";
   window.open(myhref);
};