<!--
var addthis_pub = 'cranachan';

function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
  if ((typeof window.sidebar == "object") && 
      (typeof window.sidebar.addPanel == "function")) 
  {window.sidebar.addPanel(title,url,"");}
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}

function SizeMe(){
//var div = document.getElementById('page-body');
//var toph = document.getElementById('toppanel').offsetHeight;
//var btmh = document.getElementById('bottomnav').offsetHeight; 
//var height = div.offsetHeight;
//var myWidth = 0, myHeight = 0;
//  if( typeof( window.innerWidth ) == 'number' ) {
  //  //Non-IE
    //myWidth = window.innerWidth;
//    myHeight = window.innerHeight;
//  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//    //IE 6+ in 'standards compliant mode'
//    myWidth = document.documentElement.clientWidth;
//    myHeight = document.documentElement.clientHeight;
//  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
//    myWidth = document.body.clientWidth;
//    myHeight = document.body.clientHeight;
//  }
//if (height < myHeight) {
//div.height = myHeight - toph - btmh - 16;
//}else{
//div.height = height
//}
}



function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,"")); 
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}

function clearForm(formIdent) 
{ 
  var form, elements, i, elm; 
  form = document.getElementById 
    ? document.getElementById(formIdent) 
    : document.forms[formIdent]; 

	if (document.getElementsByTagName)
	{
		elements = form.getElementsByTagName('input');
		for( i=0, elm; elm=elements.item(i++); )
		{
			if (elm.getAttribute('type') == "text")
			{
				elm.value = '';
			}
		}
	}

	// Actually looking through more elements here
	// but the result is the same.
	else
	{
		elements = form.elements;
		for( i=0, elm; elm=elements[i++]; )
		{
			if (elm.type == "text")
			{
				elm.value ='';
			}
		}
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function clearForm(formIdent) 
{ 
  var form, elements, i, elm; 
  form = document.getElementById 
    ? document.getElementById(formIdent) 
    : document.forms[formIdent]; 

	if (document.getElementsByTagName)
	{
		elements = form.getElementsByTagName('input');
		for( i=0, elm; elm=elements.item(i++); )
		{
			if (elm.getAttribute('type') == "text")
			{
				elm.value = '';
			}
		}
	}

	// Actually looking through more elements here
	// but the result is the same.
	else
	{
		elements = form.elements;
		for( i=0, elm; elm=elements[i++]; )
		{
			if (elm.type == "text")
			{
				elm.value ='';
			}
		}
	}
}

function move_box(an, box) {
  var cleft = 0;
  var ctop = 0;
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    ctop += parseInt(
      document.body.currentStyle['marginTop']);
  }
  box.style.top = ctop + 'px';
}

function show_hide_box(an, width, height, borderStyle, id) {
  
var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      alert("Your browser does not support AJAX!");      return false;      }    }  }
	  xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
  {
	  var boxdiv = document.getElementById(id);
  
  if (boxdiv != null) {
    if (boxdiv.style.display=='none') {
      move_box(an, boxdiv);
      boxdiv.style.display='block';
	} else
      boxdiv.style.display='none';
	 return false;
  	}

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', id);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = '1px solid #990000';
  boxdiv.style.backgroundColor = '#fff';
  boxdiv.innerHTML = "<div align = 'right'><a href='javascript: return false;' onclick = (document.getElementById('" + id + "').style.display='none'); >(Close)</a></div>";

  var contents = document.createElement('div');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.style.border = 'none';
  contents.innerHTML = xmlHttp.responseText;

  boxdiv.appendChild(contents);
  document.body.appendChild(boxdiv);
  move_box(an, boxdiv);

  return false;
  }
}

xmlHttp.open("GET","/help.asp?context=" + id + "&id=" + RequestID(),true);
xmlHttp.send(null);
  
}

function hide_box(id) {
  var boxdiv = document.getElementById(id);
	boxdiv.style.display = 'none';

  return false;
}

function select_delivery(val){
var progress = document.getElementById('checkout_progress').innerHTML;
document.getElementById('delivery-process').innerHTML = progress;
document.getElementById('delivery-process').style.display = 'block';
var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      window.location = '/checkout/noscript/delivery-info.asp';      return false;      }    }  }
	  xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
  {
  var panel1 = document.getElementById('delivery-options');
  panel1.style.display = 'none';
  var panel2 = document.getElementById('delivery-selection');
  panel2.style.display = 'block';
  var panel2 = document.getElementById('add-shipping');
  panel2.style.display = 'none';
  var result = document.getElementById('thisoption');
  result.innerHTML = xmlHttp.responseText;
document.getElementById('delivery-process').innerHTML = '';
document.getElementById('delivery-process').style.display = 'none';
  }
}
var qstr = 'zone=' + val + "&id=" + RequestID();
xmlHttp.open("POST","checkout-process.asp",true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(qstr); 

}



function add_shipping(){
  var panel1 = document.getElementById('delivery-options');
  panel1.style.display = 'none';
  var panel2 = document.getElementById('delivery-selection');
  panel2.style.display = 'none';
  var panel2 = document.getElementById('add-shipping');
  panel2.style.display = 'block';
}

function set_shipping(){
	var error = '';
if (document.getElementById("shipname1").value == '') { error = error + 'Please provide a first name or intial<br />'};
if (document.getElementById("shipname2").value == '') { error = error + 'Please provide a last name<br />'};
if (document.getElementById("shipaddress1").value == '') { error = error + 'Please provide an address<br />'};
if (document.getElementById("shiptown").value == '') { error = error + 'Please state post town or city<br />'};
if (document.getElementById("shipcounty").value == '') { error = error + 'Please state county or state<br />'};
if (document.getElementById("shippostcode").value == '') { error = error + 'Please provide a post code<br />'};

if (error != '') {
	var output = document.getElementById('error');
  output.innerHTML = '<div class="alert">' + error + '</div>';
exit;
}else{
	var output = document.getElementById('error');
  output.innerHTML = '';
}

show_progress();
var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      window.location = '/checkout/noscript/delivery-info.asp';      return false;      }    }  }
	  xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
  {
	
  var panel1 = document.getElementById('delivery-options');
  panel1.style.display = 'none';
  var panel2 = document.getElementById('delivery-selection');
  panel2.style.display = 'block';
  var panel3 = document.getElementById('add-shipping');
  panel3.style.display = 'none';
  var button = document.getElementById('add-shipping-button');
  button.style.display = 'none';
  var button2 = document.getElementById('change-shipping-button');
  button2.style.display = 'block';
hide_progress();
  if (xmlHttp.responseText != '') {
  var result = document.getElementById('shipping_address');
  result.innerHTML = xmlHttp.responseText;
  }
  }
}
var qstr = '';
qstr = qstr + 'action=addshipping';
qstr = qstr + '&shiptitle=' + escape(document.getElementById("shiptitle").value);
qstr = qstr + '&shipother=' + escape(document.getElementById("shipother").value);
qstr = qstr + '&shipname1=' + escape(document.getElementById("shipname1").value);
qstr = qstr + '&shipname2=' + escape(document.getElementById("shipname2").value);
qstr = qstr + '&shipcompany=' + escape(document.getElementById("shipcompany").value);
qstr = qstr + '&shipaddress1=' + escape(document.getElementById("shipaddress1").value);
qstr = qstr + '&shipaddress2=' + escape(document.getElementById("shipaddress2").value);
qstr = qstr + '&shiptown=' + escape(document.getElementById("shiptown").value);
qstr = qstr + '&shipcounty=' + escape(document.getElementById("shipcounty").value);
qstr = qstr + '&shippostcode=' + escape(document.getElementById("shippostcode").value) + "&id=" + RequestID();

xmlHttp.open("POST","checkout-process.asp",true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(qstr); 

}


function change_shipping(){
show_progress();
  var panel1 = document.getElementById('delivery-options');
  panel1.style.display = 'none';
  var panel2 = document.getElementById('delivery-selection');
  panel2.style.display = 'none';
  var panel3 = document.getElementById('add-shipping');
  panel3.style.display = 'block';
  var button = document.getElementById('add-shipping-button');
  button.style.display = 'block';
  var button2 = document.getElementById('change-shipping-button');
  button2.style.display = 'none';
hide_progress();
 
}

function clear_shipping(){
show_progress();
	var output = document.getElementById('error');
  output.innerHTML = '';
var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      window.location = '/checkout/noscript/delivery-info.asp';      return false;      }    }  }
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
  {
	
  var panel1 = document.getElementById('delivery-options');
  panel1.style.display = 'none';
  var panel2 = document.getElementById('delivery-selection');
  panel2.style.display = 'block';
  var panel3 = document.getElementById('add-shipping');
  panel3.style.display = 'none';
  var button = document.getElementById('add-shipping-button');
  button.style.display = 'block';
  var button2 = document.getElementById('change-shipping-button');
  button2.style.display = 'none';
hide_progress();
  var result = document.getElementById('shipping_address');
  result.innerHTML = xmlHttp.responseText;
  }
}
var qstr = '';
qstr = qstr + 'action=clearshipping' + '&id=' + RequestID();

xmlHttp.open("POST","checkout-process.asp",true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(qstr); 
}

function checkout(val){
var message = document.getElementById('instructions_message');
message.innerHTML = '';
var instr = trim(document.getElementById('instructions').value);
if (instr=='' && val > 50){
	message.innerHTML = '<div class="alert">Please provide instructions where to leave the package if you are not in when it is delivered.</div>';
	progress.style.display = 'none';
	alert('Please provide delivery instructions');
	exit();
}
var progress = document.getElementById('checkout_progress').innerHTML;
document.getElementById('checkout').innerHTML = progress;
var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      window.location = '/checkout/noscript/delivery-info.asp';      return false;      }    }  }
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4 && xmlHttp.responseText != '')
  {
  window.location = xmlHttp.responseText;
  }
}
var qstr = '';
qstr = qstr + 'action=setinstructions' + "&id=" + RequestID();
qstr = qstr + '&instructions=' + escape(document.getElementById('instructions').value);
xmlHttp.open("POST","checkout-process.asp",true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(qstr); 
}

function clear_option(){
show_progress();
var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      window.location = '/checkout/noscript/delivery-info.asp';      return false;      }    }  }
	  xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
  {
  var panel2 = document.getElementById('delivery-selection');
  panel2.style.display = 'none';
  var panel3 = document.getElementById('add-shipping');
  panel3.style.display = 'none';
 	var panel4 = document.getElementById('delivery-options');
  panel4.style.display = 'block'; 
hide_progress();
  }
}
var qstr = 'action=clear&id=' + RequestID();
xmlHttp.open("POST","checkout-process.asp",true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(qstr); 

}

function select_pay_method(val){
var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest();  }
catch (e)
  {  // Internet Explorer  
  try
    {    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    }
  catch (e)
    {    try
      {      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      }
    catch (e)
      {      window.location = '/checkout/noscript/customer-info.asp?payment-method=' + val;}    }  }
//xmlHttp.onreadystatechange=function()
//{
//if(xmlHttp.readyState==4 && xmlHttp.responseText != '')
  //{
//window.location = xmlHttp.responseText;
  //}
//}
//var qstr = 'action=payment&payment-method=' + val + '&id=' + RequestID();
//xmlHttp.open("POST","checkout-process.asp",true);
//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//xmlHttp.send(qstr); 
window.location = '/checkout/customer-info.asp?payment-method=' + val;
}

function trim(sString) 
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}

function toProperCase(sString) 
{
    return sString.charAt(0).toUpperCase() + sString.substring(1,sString.length).toLowerCase();
}

function CloseMe(){
var elem = document.getElementById('enlarged');
var zoom = document.getElementById('zoom');
zoom.src='../graphics/spacer.gif';
elem.style.display = 'none';
elem.style.visibility = 'hidden';
}

function EnlargeImage(image,id){
var elem = document.getElementById('enlarged');
var zoom = document.getElementById('zoom');
var thumb = document.getElementById('thumb'+id);
var valueT = 0, valueL = 0;
      do {
        valueT += thumb.offsetTop  || 0;
        valueL += thumb.offsetLeft || 0;
        thumb = thumb.offsetParent;
      } while (thumb);
	  
    if (elem) 
    {
        elem.style.display = 'block';
        elem.style.visibility = 'visible';
		elem.style.left = valueL - 200;
		elem.style.top = valueT - 200;
		zoom.src=image;
}
}

function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
  if ((typeof window.sidebar == "object") && 
      (typeof window.sidebar.addPanel == "function")) 
  {window.sidebar.addPanel(title,url,"");}
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}

function RequestID() {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = 6;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}


function show_progress(){
	// Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  var w = document.body.clientWidth;
  var h = document.body.clientHeight;
  wleft = w / 2;
wtop = h / 2;

	var progress = document.getElementById('progress');
progress.style.display = 'block';
progress.style.top = wtop;
progress.style.left = wleft;

}

function hide_progress(){
	  var progress = document.getElementById('progress');
	progress.style.display = 'none';
}
function textCounter (field, countfield, maxlimit, remfield)
{
  	if (field.value.length > maxlimit)
  	field.value = field.value.substring(0, maxlimit);
  	else
  	countfield.value = maxlimit - field.value.length;
	remfield.value = field.value.length
}

//-->