
<!--hide this script from non-javascript-enabled browsers

function MM_findObj(n, d) { //v3.0
  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); return x;
}
/* Functions that swaps down images. */
function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}

/* Functions that handle preload. */
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];}}
}


today=new Date();
today.setTime(today.getTime() + (86400000));
today=today.toGMTString();
currentdate=new Date();
currentdate=currentdate.toLocaleString();
index = document.cookie.indexOf('PTTShopName');
if (index > -1) {
   countbegin=(document.cookie.indexOf('=',index)+1);
   countend=document.cookie.indexOf(';',index);
   if(countend==-1) {
      fulllist='';
   } else {
      fulllist=document.cookie.substring(countbegin,countend);
   }
} else {
   fulllist='';
}
if(fulllist.length < 1) {
   document.cookie='PTTShopCode=.; expires='+today;
   document.cookie='PTTShopName=.; expires='+today;
   document.cookie='PTTShopWeight=.; expires='+today;
   document.cookie='PTTShopTaxable=.; expires='+today;
   document.cookie='PTTShopPrice=.; expires='+today;
   document.cookie='PTTShopExtraFields=.; expires='+today;
   document.cookie='PTTShopAdvanced=.; expires='+today;
   document.cookie='PTTShopQuantity=.; expires='+today;
   document.cookie='TheCurrency=1; expires=Friday, 31-Dec-2010 08:00:00 GMT';
   document.cookie='JShopReferrer=.; expires='+today;
}

thisday=new Date();
thisday.setHours(thisday.getHours()+10);
thisday=thisday.toGMTString();
index = document.cookie.indexOf('JShopReferrer');
countbegin=(document.cookie.indexOf('=',index)+1);
countend=document.cookie.indexOf(';',index);
if(countend==-1) { countend=document.cookie.length; }
fulllist=document.cookie.substring(countbegin,countend);
if(fulllist.length < 2) {
   document.cookie='JShopReferrer='+document.referrer+'; expires='+thisday;
}

currencyCode = new Array(1); currencyName = new Array(1); currencyDecimals = new Array(1); currencyPre = new Array(1); currencyMiddle = new Array(1); currencyPost = new Array(1);
currencyCode[1]='GBP'; currencyName[1]='GBP'; currencyDecimals[1]='0'; currencyPre[1]='£'; currencyMiddle[1]=''; currencyPost[1]='';
    function goBuy() {
        ilist='';
        ilist=ilist+retrieveCookie('PTTShopCode',0,0)+'^';
        ilist=ilist+retrieveCookie('PTTShopName',0,0)+'^';
        ilist=ilist+retrieveCookie('PTTShopWeight',0,0)+'^';
        ilist=ilist+retrieveCookie('PTTShopTaxable',0,0)+'^';
        ilist=ilist+retrieveCookie('PTTShopPrice',0,0)+'^';
        ilist=ilist+retrieveCookie('PTTShopExtraFields',0,0)+'^';
        ilist=ilist+retrieveCookie('PTTShopAdvanced',0,0)+'^';
        ilist=ilist+retrieveCookie('PTTShopQuantity',0,0)+'^';
        ilist=ilist+retrieveCookie('TheCurrency',0,0)+'^';
        ilist=ilist+retrieveCookie('JShopReferrer',0,0)+'^';
        ilist=changeUnwanted(ilist);
        ilist=escape(ilist);
        ilist=changePercent(ilist);
        if (top.name != '') {
             window.open('https@www.doublepadlock.com/process/buy.php@dp100808',ilist);
        } else {
             top.name=ilist;
             top.location='https@www.doublepadlock.com/process/buy.php@dp100808';
        }
    }

function changeUnwanted(tstring) {
    nstring='';
    for (var i=0; i <= tstring.length; i++) {
        nchar=tstring.charAt(i);
        if (nchar=='*') { nchar='!&1'; }
        if (nchar=='+') { nchar='!&2'; }
        if (nchar=='@') { nchar='!&3'; }
        if (nchar=='.') { nchar='!&4'; }
        if (nchar=='default.htm') { nchar='!&5'; }
        if (nchar=='-') { nchar='!&6'; }
        nstring=nstring+nchar;
    }
    return nstring;
}
function changePercent(tstring) {
    nstring='';
    for (var i=0; i <= tstring.length; i++) {
        nchar=tstring.charAt(i);
        if (nchar=='%') { nchar='_'; }
        nstring=nstring+nchar;
    }
    return nstring;
}

function popupImage(imagename,imagewidth,imageheight) {
   apopup=window.open(imagename,'jsppopupimage','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,copyhistory=no,width='+(imagewidth+20)+',height='+(imageheight+30));
}
function showPrice(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    thisitem=0;
    itemstart=0;
    theprice=0;
    for (var i=0; i<pricestring.length; i++) {
       if (pricestring.substring(i,i+1)=='~') {
          thisitem++;
          if (thisitem==eval(theCurrency)) {
             theprice=pricestring.substring(itemstart,i);
          }
          itemstart=i+1;
       }
    }
    return presentValue(theprice,currencyDecimals[theCurrency],currencyPre[theCurrency],currencyMiddle[theCurrency],currencyPost[theCurrency]);
}
function showPriceSingle(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    return presentValue(pricestring,currencyDecimals[theCurrency],currencyPre[theCurrency],currencyMiddle[theCurrency],currencyPost[theCurrency]);
}
function showPricePlain(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    return presentValue(pricestring,currencyDecimals[theCurrency],'',currencyMiddle[theCurrency],'');
}
function getPrice(pricestring) {
    index = document.cookie.indexOf('TheCurrency');
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    theCurrency=document.cookie.substring(countbegin,countend);
    thisitem=0;
    itemstart=0;
    theprice=0;
    for (var i=0; i<pricestring.length; i++) {
       if (pricestring.substring(i,i+1)=='~') {
          thisitem++;
          if (thisitem==eval(theCurrency)) {
             theprice=pricestring.substring(itemstart,i);
          }
          itemstart=i+1;
       }
    }
    return theprice;
}
    function presentValue(value,dp,pt,mt,at) {
        if(value<=0.9999) {
            newPounds='0';
        } else {
            newPounds=parseInt(value);
        }
        dec='1';
        for (var i=1; i<=dp;i++) {
            dec=dec+'0';
        }
        if (value>0) {
            newPence=Math.round((eval(value)+.000008 - newPounds)*(eval(dec)));
        } else {
            newPence=0;
        }
        compstring='9';
        for (var i=1; i <=dp-1;i++) {
            if (eval(newPence) <= eval(compstring)) newPence='0'+newPence;
            compstring=compstring+'9';
        }
        if (dp>0) {
            if (newPence==eval(dec)) { newPounds++; newPence=0; }
            newString=pt+newPounds+mt+newPence+at;
        } else {
            newString=pt+newPounds+at;
        }
        return (newString);
    }

function retrieveCookie(thecookie,thenumber,theadditional) {
    index = document.cookie.indexOf(thecookie);
    countbegin=(document.cookie.indexOf('=',index)+1);
    countend=document.cookie.indexOf(';',index);
    if(countend==-1) { countend=document.cookie.length; }
    fulllist=document.cookie.substring(countbegin,countend);
    if (thenumber==0) { return fulllist; }
    thisitem=0;
    newcookie='';
    itemstart=0;
    for(var i=0; i<fulllist.length;i++) {
        if (fulllist.substring(i,i+1)=='|') {
            thisitem++;
           itemvalue=fulllist.substring(itemstart,i);
           if (thisitem==thenumber) {
                if (theadditional==0) {
                    return itemvalue;
                } else {
                    itemstarttwo=0;
                    thisitemtwo=0;
                    for (var j=0; j<itemvalue.length; j++) {
                        if (itemvalue.substring(j,j+1)=='~') {
                            thisitemtwo++;
                            itemvaluetwo=itemvalue.substring(itemstarttwo,j);
                            if (thisitemtwo==theadditional) {
                                return itemvaluetwo;
                            }
                            itemstarttwo=j+1;
                        }
                    }
                }
            }
            itemstart=i+1;
        }
    }
    return '';
}
function addToCookie(thecookie,thevalue) {
    fulllist=retrieveCookie(thecookie,0,0);
    if (fulllist=='.') { fulllist=''; }
    fulllist=fulllist+thevalue+'|';
    document.cookie=thecookie+'='+fulllist+'; expires='+today;
}
function removeFromCookie(thecookie,thenumber) {
    fulllist=retrieveCookie(thecookie,0,0);
    thisitem=0;
    newcookie='';
    itemstart=0;
    for(var i=0; i<fulllist.length;i++) {
        if (fulllist.substring(i,i+1)=='|') {
            thisitem++;
            itemvalue=fulllist.substring(itemstart,i);
            if (thisitem!=thenumber) {
                newcookie=newcookie+itemvalue+'|';
            }
            itemstart=i+1;
        }
    }
    if (newcookie=='') { newcookie='.'; }
    document.cookie=thecookie+'='+newcookie+'; expires='+today;
}
function changeCookieValue(thecookie,thenumber,thevalue) {
    fulllist=retrieveCookie(thecookie,0,0);
    thisitem=0;
    newcookie='';
    itemstart=0;
    for(var i=0; i<fulllist.length;i++) {
        if (fulllist.substring(i,i+1)=='|') {
            thisitem++;
            itemvalue=fulllist.substring(itemstart,i);
            if (thisitem==thenumber) {
                itemvalue=thevalue;
            }
            newcookie=newcookie+itemvalue+'|';
            itemstart=i+1;
        }
    }
    document.cookie=thecookie+'='+newcookie+'; expires='+today;
}
function retrieveCookieCount(thecookie) {
   fulllist=retrieveCookie(thecookie,0,0);
   thisitem=0; newcookie=''; itemstart=0;
   for(var i=0; i<fulllist.length;i++) {
    if (fulllist.substring(i,i+1)=='|') {
        thisitem++;
        itemstart=i+1;
    }
   }
   return thisitem;
}
function showCurrency() {   index = document.cookie.indexOf('TheCurrency');   countbegin=(document.cookie.indexOf('=',index)+1);   countend=document.cookie.indexOf(';',index);   if(countend==-1) { countend=document.cookie.length; }   theCurrency=document.cookie.substring(countbegin,countend);   document.basketform.selectcurrency.selectedIndex=theCurrency-1;}function checkAdvanced(adv,advField0,advField1) {
     newAdv='';advlist=0;
    for (var j=0;j<=adv.length;j++) {
            if (adv.substring(j,j+1) == '{') {
            thisadv=1;
            advstart=j+1;
        } else if (adv.substring(j,j+1) == '}') {
            advend=j;
            advPrice=adv.substring(advstart,advend);
            advlist++; applicable=true;
            if (field0!='none' && advField0 != field0) applicable=false;
            if (field1!='none' && advField1 != field1) applicable=false;
            if (applicable==true) {
                newAdv = newAdv+ '{'+field0+'!'+field1+'!'+advFrom+'!'+advTo+'!'+advPrice+'}'
            }
        } else if (adv.substring(j,j+1)=='!') {
            if (thisadv==1) field0 = adv.substring(advstart, j);
            if (thisadv==2) field1 = adv.substring(advstart, j);
            if (thisadv== 3) advFrom=adv.substring(advstart,j);
            if (thisadv== 4) advTo=adv.substring(advstart,j);
            thisadv++;advstart=j+1;
        }
    }
    if (newAdv=='') newAdv='none';
    return newAdv;
}
    function buyNGItem(newCode,newItem,newPrice,newTaxable,newWeight,newField0,newField1,newAP,newQuantity) {
        if(newQuantity<=0) {
            rc = alert('The quantity entered is incorrect');
        } else {
            if (confirm('Put '+newItem+' into basket? ')) {
                 if (newAP!='none') {
                     newAP=checkAdvanced(newAP,newField0,newField1);
                 }
                 amended = false;
                 newItemList=''; itemlist=0;
                 for (var i=1;i<=retrieveCookieCount('PTTShopCode');i++) {
                      theCode=retrieveCookie('PTTShopCode',i,0);
                      theItem=retrieveCookie('PTTShopName',i,0);
                      theQuantity=retrieveCookie('PTTShopQuantity',i,0);
                              theField0 = retrieveCookie('PTTShopExtraFields',i,1);
                              theField1 = retrieveCookie('PTTShopExtraFields',i,2);
                      if (theCode==newCode && theItem==newItem  && theField0 == newField0 && theField1 == newField1) {
                           amended=true;
                           tempquantity=eval(theQuantity)+eval(newQuantity);
                           changeCookieValue('PTTShopQuantity',i,tempquantity);
                      }
                 }
                 if (amended==false) {
                    addToCookie('PTTShopCode',newCode);
                    addToCookie('PTTShopName',newItem);
                    addToCookie('PTTShopPrice',newPrice);
                    addToCookie('PTTShopWeight',newWeight);
                    addToCookie('PTTShopTaxable',newTaxable);
                    addToCookie('PTTShopExtraFields',newField0+'~'+newField1+'~');
                    addToCookie('PTTShopAdvanced',newAP);
                    addToCookie('PTTShopQuantity',newQuantity);
                 }
             }
         }
     }
	
	function buyItem(newCode,newItem,newPrice,newTaxable,newWeight,newField0,newField1,newAP,newQuantity) {
        if(newQuantity<=0) {
            rc = alert('The quantity entered is incorrect');
        } else {
            if (confirm('Put '+newItem+' ('+newField1+' and '+newField0+') into basket? ')) {
                 if (newAP!='none') {
                     newAP=checkAdvanced(newAP,newField0,newField1);
                 }
                 amended = false;
                 newItemList=''; itemlist=0;
                 for (var i=1;i<=retrieveCookieCount('PTTShopCode');i++) {
                      theCode=retrieveCookie('PTTShopCode',i,0);
                      theItem=retrieveCookie('PTTShopName',i,0);
                      theQuantity=retrieveCookie('PTTShopQuantity',i,0);
                              theField0 = retrieveCookie('PTTShopExtraFields',i,1);
                              theField1 = retrieveCookie('PTTShopExtraFields',i,2);
                      if (theCode==newCode && theItem==newItem  && theField0 == newField0 && theField1 == newField1) {
                           amended=true;
                           tempquantity=eval(theQuantity)+eval(newQuantity);
                           changeCookieValue('PTTShopQuantity',i,tempquantity);
                      }
                 }
                 if (amended==false) {
                    addToCookie('PTTShopCode',newCode);
                    addToCookie('PTTShopName',newItem);
                    addToCookie('PTTShopPrice',newPrice);
                    addToCookie('PTTShopWeight',newWeight);
                    addToCookie('PTTShopTaxable',newTaxable);
                    addToCookie('PTTShopExtraFields',newField0+'~'+newField1+'~');
                    addToCookie('PTTShopAdvanced',newAP);
                    addToCookie('PTTShopQuantity',newQuantity);
                 }
             }
         }
     }
	 
	 function buyGlos(newCode,newItem,newPrice,newTaxable,newWeight,newField0,newField1,newAP,newQuantity) {
        if(newQuantity<=0) {
            rc = alert('The quantity entered is incorrect');
        } else {
            if (confirm('Put '+newItem+' into basket? ')) 
			{
                 if (newAP!='none') 
				 {
                     newAP=checkAdvanced(newAP,newField0,newField1);
                 }
                 amended = false;
                 newItemList=''; itemlist=0;
                 for (var i=1;i<=retrieveCookieCount('PTTShopCode');i++) 
				 {
                      theCode=retrieveCookie('PTTShopCode',i,0);
                      theItem=retrieveCookie('PTTShopName',i,0);
                      theQuantity=retrieveCookie('PTTShopQuantity',i,0);
                              theField0 = retrieveCookie('PTTShopExtraFields',i,1);
                              theField1 = retrieveCookie('PTTShopExtraFields',i,2);
                      if (theCode==newCode && theItem==newItem  && theField0 == newField0 && theField1 == newField1) {
                           amended=true;
                           tempquantity=eval(theQuantity)+eval(newQuantity);
                           changeCookieValue('PTTShopQuantity',i,tempquantity);
                      }
                 }
                 if (amended==false) {
                    addToCookie('PTTShopCode',newCode);
                    addToCookie('PTTShopName',newItem);
                    addToCookie('PTTShopPrice',newPrice);
                    addToCookie('PTTShopWeight',newWeight);
                    addToCookie('PTTShopTaxable',newTaxable);
                    addToCookie('PTTShopExtraFields',newField0+'~'+newField1+'~');
                    addToCookie('PTTShopAdvanced',newAP);
                    addToCookie('PTTShopQuantity',newQuantity);
                 }
             //document.itemsform.submit();
			 }
         }
     }

function flipImage(imgname,imgsrc) {
    document.images[imgname].src=imgsrc;
}

function validate()
{
	var f = "";
	
	var optionlist = "";
	
	var price1 = 0;
	
	if (document.itemsform.cdrom1.checked==1) //is a CDROM
	{
		
		document.itemsform.tangible.value = "yes";
		price1 = price("stal");
		optionlist = "CDROM, ";
		if (document.itemsform.tutor1.checked==1)
		{
			price1 = price1 + price("tutor");
			optionlist = optionlist + "with tutoring, ";
		}
		else
		{
			optionlist = optionlist + "no tutoring, ";
		}
		
		if (document.itemsform.cert1.checked==1)
		{
			price1 = price1 + price("cert");
			optionlist = optionlist + "with signed certificate";
		}
		else
		{
			optionlist = optionlist + "without signed certificate";
		}
		
	}
	else //is online
	{
		
		document.itemsform.tangible.value = "no";
		price1 = price("basic");
		optionlist = "online, ";
		if (document.itemsform.tutor1.checked==1)
		{
			price1 = price1 + price("tutor");
			optionlist = optionlist + "with tutoring, ";
		}
		else
		{
			optionlist = optionlist + "no tutoring, ";
		}
		
		if (document.itemsform.cert1.checked==1)
		{
			price1 = price1 + price("cert");
			optionlist = optionlist + "with signed certificate";
		}
		else
		{
			optionlist = optionlist + "without signed certificate";
		}
	}
	
	
	document.itemsform.itemname2.value = optionlist;
	document.itemsform.price.value = price1;
	
	document.forms.itemsform.submit();
}

function validatec()
{
	var f = "";
	
	var optionlist = "";
	
	var price1 = 0;
	
	if (document.itemsform.cdrom1.checked==1) //is a CDROM
	{
		
		document.itemsform.tangible.value = "yes";
		price1 = price("stalc");
		optionlist = "Small business CDROM, ";
		if (document.itemsform.tutor1.checked==1)
		{
			price1 = price1 + price("tutorc");
			optionlist = optionlist + "with tutoring, ";
		}
		else
		{
			optionlist = optionlist + "no tutoring, ";
		}
		
		if (document.itemsform.cert1.checked==1)
		{
			price1 = price1 + price("certc");
			optionlist = optionlist + "with signed certificate";
		}
		else
		{
			optionlist = optionlist + "without signed certificate";
		}
		
	}
	else //is online
	{
		
		document.itemsform.tangible.value = "no";
		price1 = price("basicc");
		optionlist = "Small business online, ";
		if (document.itemsform.tutor1.checked==1)
		{
			price1 = price1 + price("tutorc");
			optionlist = optionlist + "with tutoring, ";
		}
		else
		{
			optionlist = optionlist + "no tutoring, ";
		}
		
		if (document.itemsform.cert1.checked==1)
		{
			price1 = price1 + price("certc");
			optionlist = optionlist + "with signed certificate";
		}
		else
		{
			optionlist = optionlist + "without signed certificate";
		}
	}
	
	
	document.itemsform.itemname2.value = optionlist;
	document.itemsform.price.value = price1;
	
	document.forms.itemsform.submit();
}
// stop hiding -->
