
function calc(theForm , t_Flag )
{

t_cds=theForm.form.vol.value;
t_post=theForm.form.postal.value;
t_msg = 'We do not currently have a postage rate available for this order\n';
t_msg = t_msg + 'please click on Contact Me and email the number of CDs';
t_msg = t_msg + ' and the destination\n We will then respond with the cost of your order.';
//
// t_button >0 means send it to Paypal
// ==0 means postage rate not defined
//
t_button="0";
t_postage=0;
t_cost=t_cds*8.50;
p_test="9830155";
p_test_an="9992909";
p_uk1="10189914";
p_uk2="0";
p_uk3="0";
p_uk4="0";
p_uk5="0";
p_uk6="0";
p_rio1="0";
p_rio2="0";
p_rio3="0";
p_rio4="0";
p_rio5="0";
p_rio6="0";

if ( t_Flag > 0 ){
t_button=p_test_an;

}

switch (t_post) {
   case '1': 
switch (t_cds) {
   case '1': t_button=p_uk1; break;
   case '2': t_button=p_uk2; break;
   case '3': t_button=p_uk3; break;
   case '4': t_button=p_uk4; break;
   case '5': t_button=p_uk5; break;
   case '6': t_button=p_uk6; break;
   default: ;
}
break;
   case '2': 
switch (t_cds) {
   case '1': t_button=p_roi1; break;
   case '2': t_button=p_roi2; break;
   case '3': t_button=p_roi3; break;
   case '4': t_button=p_roi4; break;
   case '5': t_button=p_roi5; break;
   case '6': t_button=p_roi6; break;
   default: ;
}
 break;
   default: ;
}
if (t_button == "0"){
alert(t_msg);
return false;
}

theForm.form.hosted_button_id.value=t_button;
return true;}



var hD="0123456789ABCDEF";

function d2h(d) {
var h = hD.substr(d&15,1);
while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;}
if (h.length < 2){return "0" + h;}
return h;
}


function h2d(h) {
var h1;

h1=parseInt(h,16);
if (h < 10){return "0" +h1;}
return h1;}

function crypt(name1) 

{
var j, Y = "00",t
offset = Math.floor(Math.random()*256)
Y +=d2h(offset)

if ( name1.length < 1 ) {return ""}

for (j=0 ; j < name1.length ; j++){
//document.write(name1.charCodeAt(j) + " ")
I=name1.charCodeAt(j) *1 + offset+j
while (I>255) {I=I-256;}
Y += d2h(I)
//Y += String.fromCharCode(j+offset+name1.charCodeAt(j))
}
//document.write("<br>" + Y +"<br>" + name1 + "<br>" )
return Y
}

function uncrypt(name1) 

{
var j, Y = "y",t

if ( name1.length < 1 ) {return ""}

for (j=0 ; j < name1.length ; j++){
I=name1.substring(j,j+1) 
if (!((I>='0' && I<='9' ) || (I>='A' && I<='F' ))){
document.write(name1 )
return}}

code_version=h2d(name1.substring(0,2))
offset=h2d(name1.substring(2,4))

//document.write("<br>decrypt" + name1 + "=plain=")
for (j=4 ; j < name1.length ; j=j+2){
//document.write(name1.charCodeAt(j) + " ")
//I=name1.charCodeAt(j) *1
t_str =name1.substring(j,j+2)
chrcode=h2d(t_str)-offset-(j-4)/2
while (chrcode<0) {chrcode=chrcode+256;}
document.write(String.fromCharCode(chrcode))
Y = Y + String.fromCharCode(h2d(t_str))
// while (I>255) {I=I-256;}
//Y += d2h(I)
//Y += String.fromCharCode(j+offset+name1.charCodeAt(j))
}

return Y
}


function suncrypt(name1) 

{
var j, Y = "",t

if ( name1.length < 1 ) {return ""}
for (j=0 ; j < name1.length ; j++){
I=name1.substring(j,j+1) 
if (!((I>='0' && I<='9' ) || (I>='A' && I<='F' ))){
return name1}}

code_version=h2d(name1.substring(0,2))
offset=h2d(name1.substring(2,4))

//document.write("<br>decrypt" + name1 + "=plain=")
for (j=4 ; j < name1.length ; j=j+2){
//document.write(name1.charCodeAt(j) + " ")
//I=name1.charCodeAt(j) *1
t_str =name1.substring(j,j+2)
chrcode=h2d(t_str)-offset-(j-4)/2
while (chrcode<0) {chrcode=chrcode+256;}
Y +=String.fromCharCode(chrcode)
// while (I>255) {I=I-256;}
//Y += d2h(I)
//Y += String.fromCharCode(j+offset+name1.charCodeAt(j))
}

return Y
}


function dcrypt(namestr)
{
t_str=crypt(namestr)
uncrypt(t_str)
}

function check_events(theForm)
{
var str = ""

if (theForm.dated.value == "")
  {
	alert("Please fill in a date for the event (DD/MM/YYYY).");
	theForm.dated.focus();
	return false;
  } 
if (theForm.event.value == "")
  {
	alert("Please fill in a brief event description.");
	theForm.event.focus();
	return false;
  } 
 
    return true;
}