var cDescs=new Array("Half man, half beast, this hairy member of the Crisp Clan has much more to offer than just an impressive set of dentures to scare bite-size enemies. A master of disguise, Beast Feast then sneaks up close to enemies and appears to explode - emitting tiny, lethal shards that tear through anything. A superhero with a truely dynamite personality.","Don\'t mess with this lady! being one of the good \'guys\' she may have a soft centre but, as any foe soon discovers, she has a rock hard outer shell. What\'s more, Candy is certainly no sweetie when it comes to casting spells - that silver sickle is the key to her power.","Meet the superhero with the memorable handshake. Those lethal blades can slice through the toughest of bad guys, while that full faced helmet holds the strangest of secrets. And yet, despite appearances, Razor Fist has a great sense of humour - as long as you laugh at his jokes!","Nobody knows if Jaw Breaker is naturally the strong silent type or whether it\'s just the effect of those gobstoppers. Whatever the answer, this hi-tech hitman from the Sweet Clan has the ability to vanquish his enemies with heat seaking spheres. The effect is literally \'shocking\'! He has only one soft spot - he\'s \'sweet\' on Cool Candy.","With a tendancy to shoot first and ask questions later, Mega Blaster is the fastest of the Fast Food Clan. Always first to attack with his guns blazing, this red-blooded super guy is skilled at making a feast of his opponents.","Being a member of the Preserve Clan this streetfighter with the serious haircut and no nonsense muscles is second to none at getting out of sticky situations. A master of the laser sword and a crack shot, he also excels at the martial arts. He\'s a mean, lean, fist-and-foot fighting machine.");
var eNames=new Array("Gung-Ho","Spike","Computron","Armalite","Spearhead","Footpad","Hoodlum","Tinpot","Razor","The Dark Impaler","Cheaptrick","Kickback","Jahad","Sidewinder","Deth","Purepain","Angelface","Advisor","The Creeper","Patriot","The Icicle","Thug","Jawz","Corporal Hook","Rivet","Dum-Dum","The Surgeon","Anga","Cortex","Black Spot",
"Rocketeer","Lampstand","Isedno","The Changelings","Smiler","Arresta","Okido","Loner","Thirstykirst","The Fist","Ha-Ha","Nightstick","Doctor Grim","Prophet","Big Al","Weed","Dedgood","The Preacher","Skull","Hari-K","Banzai","Dragon Slayer","The Noodle","Chip-Chop","Sai-Yorprers","Wally Warhead","Lice Vice","Baldy","Revenga","Sir",
"Rammer","Metro-Gnome","Sissperio","Vandal","The Beast","Meangenie","Sacllywag","Reptokil","Mask","Bug","Prince Green","Cracker","The Tongue","Hairbrain","Black Fang","Fester","Oaf","Hawkbill","Two-Toe","Domino","Shadow","Aunt Coagula","Vorlord","Scrunge","Mane Man","Headsman","Gunk","Icky","Claw","Munch",
"Squab","Pendragon","Bulldog","Growel","The Shrimp","Chimera","Eraser","Har-So","Cudgel","The Fox","Wise Bear","Bowman","Bloodhound","Arachnida","Video San","Judge Moon","Gungadin","Monkey","The Calculator","Discman","Blackbottle","Fatso","Pegarus","Hammerhead","Doctor Pepper","Cybersan","Coolblade","Slurp","Faisake","Boss Tank");
var eDifs=new Array(2,4,3,4,5,2,2,2,5,5,2,3,2,5,5,3,3,3,4,5,3,3,4,5,6,4,4,5,5,7,2,4,5,5,6,3,4,5,6,7,3,3,5,5,6,2,3,4,4,5,4,5,4,4,6,5,6,7,7,8,4,5,4,6,6,2,3,5,7,9,3,4,4,5,6,3,4,5,5,6,4,5,6,7,8,5,5,7,8,9,4,5,6,6,8,4,6,7,7,8,4,4,6,6,8,4,5,6,7,7,5,5,7,8,9,7,7,8,9,10);
var ePos=new Array(0,1,2,3,4,1,2,3,4,5,2,3,4,5,6,3,4,5,6,7,4,5,6,7,8,5,6,7,8,9,7,8,9,10,11,8,9,10,11,12, 9,10,11,12,13,10,11,12,13,14,11,12,13,14,15,12,13,14,15,16,14,15,16,17,18,15,16,17,18,19,16,17,18,19,20,17,18,19,20,21,18,19,20,21,22,19,20,21,22,23,21,22,23,24,25,22,23,24,25,26,23,24,25,26,27,24,25,26,27,28,25,26,27,28,29,26,27,28,29,30);
var eEnergy=new Array(21,27,33,40,48,56,64,72,81,91,101,111,121,132,144,156,168,180,193,207,221,235,249,264,280,296,312,328,345,363,381);
var eAttack=new Array(7,8,9,11,12,15,16,18,21,23,26,28,30,33,35,39,41,44,48,51,55,58,61,65,68,73,76,80,85,89,94);
var eDefence=new Array(9,10,12,14,15,18,20,21,24,27,30,31,34,37,39,43,46,48,51,55,59,61,65,69,72,76,80,83,87,91,96);
var eType=new Array(1,0,1,0,0);
var eRewards=new Array(1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,4,4);
var spells=new Array("Steal Magic Points from enemy","Launch a powerful attack","Launch a very powerful attack","Recover own Energy","Recover more Energy","Decrease enemy Defence power","Increase own Defence power","Decrease enemy Attack power","Increase own Attack power","Prevent enemy from using Survival Points - Only needs to be used once per battle");
var mpr=new Array(0,2,5,2,4,3,5,4,6,3);
var aNames=new Array("Darman","Air Dragon","Zanbee","Pandoral","Barbirian","Gilger","Rezadon","Dolcoon","Baguza","Droome");
var aDescs=new Array("Everyone looks up to Darman \'The Wizard Eater\' - that\'s because he\'s thirty metres tall and so strong that he prefers to use bare hands rather than weapons in battle. Of course, you should always remember that: \"The bigger they are the harder they...\"","This horned and winged beast comes better armed than first appears, being capable of \'explosive\' attacks, night vision and hyper-flight. It\'s life force may not be great but its powers of recovery are most impressive.","Hugely powerful and yet with some surprising weak spots, Zanbee\'s remarkable good looks hide a black heart. He is a cheat and a scoundrel. Any honourable opponent would be unwise to turn their back on him.","What\'s in the box? Precious metals that turn into poison when placed in his opponents hands and perfumes that become acid when they touch the skin - to mention but a few of the tricks this demon of deciet has to offer.","Beware. The three-eyed Barbirian saps your will to fight - making the strongest of warriors and wizards doubt themselves and their quest. Those serpent\'s eyes will mesmerise, so try not to look directly at him.","A lobster-like mutant with virtually impenetrable armour is just as capable under water as on the land. Arrogant and incredibly aggressive, this cruel crustacean would love to have you for dinner.","Meet a lizard with a grudge. Created by the evil Droome and filled with hatred, Rezadon seeks revenge on Jam Bam who destroyed its twin clone in a previous battle. The only thing sharper than those teeth is that fearsome sword.","Master of flame, Dolcoon destroys with heat and plays tricks with the light - making it nearly impossible for his enemies to tell the difference between truth and illusion. The Unihorn on Dolcoon\'s head is the centre of his power.","Wielding an axe that few could lift, Baguza's giant body is only hindered by his small mind - a mind that knows no wit and knows no fear. Beware his \'death stampede\'... Those horns are even deadlier than they look.","This green fingered fiend is the Emperor Boss\'s right hand maniac. As clever as he is ugly, Droome is a power-mad wizard who secretly nurtures an ambition to be the ruler of the universe.");
var iNames=new Array("Life Crystals","Rocket Gun","Power Sword","Ninja Star","Infra-Red Glass","XF-Armour","Magic Spirit","Mandrake","Yodin","Infotracker");
var iDescs=new Array("Because of their amazing ability to boost your Life Force, these rare crystals are worth more than the most precious of metals. They are found only on one Light World - which Light World we cannot tell for fear that greedy treasure hunters will destroy the source.","A \'one shot\' weapon that could win (or lose) you a battle. Pull the trigger and watch your enemy\'s Life Force take a tumble. Miss and you\'ll find there are no second chances. Only a weapon for battlers with nerve!","An ancient sword of legendary power. Cast in Fulmium, the hardest known metal in the Barcode Nebula, the sword\'s blows can only be resisted by armour made of the same metal - which is a problem for your enemies, as all known deposits of Fulmium are now exhausted.","A lethal weapon which demands skill, patients and, most important, perfect timing. Send it spinning at the enemy when the Battler spirit is with you and the effect can be devestating. Time it wrong and the star may harmlessly bounce off their defences.","Wear this strategic sighting device to make defence considerably easier. The headset analyses enemy movements, suggests their probable modes of attack and even allows for perfect night vision. There\'s only one problem: it\'s a rather fragile device.","A synthetic suit of armour designed to resist both blade and spear, even when wielded by the mightiest of opponents over prolonged periods. Only a sword made of Fulmium could do the suit great damage. Fortunately that particular metal is very rare.","This is the very essence of all magic spells. Magic Spirit gives Wizards the choice of the 10 F-aldraki spells as written in the book of Merle. Read and learn, for which such knowledge comes wisdom and great power.","When traditionally prepared this mystical root posesses Life enhancing properties. It can be stored until needed, often in \'do or die\' situations when mandrake is your only means of survival.","If information is power then Yodin must, despite his small stature, demand your full respect. He will give you vital information but what he has to say will only be said once - so listen well.","This is a database with a mind of its own and a lot of helpful information to give. However, do not take advantage of this facility too often. Ask one time too many and you will, quite literally, pay for it! You have been warned.");
var parity=new Array("nnnnn","nfnff","nffnf","nfffn","fnnff","ffnnf","fffnn","fnfnf","fnffn","ffnfn");
var effect=new Array("ST-30%","ST-50%","DF-30%","DF-50%","DF-80%","HP-30%","HP-50%");
var langu="";
var rewards=new Array("HP+1000","HP+3000","HP+4000","HP+5000","HP+10000","ST+200","ST+400","ST+600","ST+800","ST+1000","DF+200","DF+400","DF+600","DF+800","DF+1000","Code 05","Code 10","Code 15","Code 20","Code 25","Code 35","Code 36","Code 37","Code 38","Code 39","Code 40","Code 41","Code 42","Code 43","Code 44","Code 45","Code 46","Code 47","Code 48","Code 49");

function hSetup(){
spellView();
enemyView();
}

function setup(){
setEAN();
}

function vrs(lng,op){
langu=lng;
switch(op){
case "h":
heroView();
break;
case "i":
itemView();
break;
case "a":
antiView();
break;
case "e":
enemyView();
break;
}
}

function spellView(){
var a=document.forms["spl"].elements[0].selectedIndex;
document.forms["spl"].elements[1].value=mpr[a];
document.forms["spl"].elements[2].value=spells[a];
}

function enemyView(){
var enemy;
var wizard=document.forms["c1"].elements[0].value;
var warrior=document.forms["c1"].elements[1].value;
var era=document.forms["c1"].elements[3].selectedIndex;
var lw=document.forms["c1"].elements[4].selectedIndex;
var eNum=document.forms["c1"].elements[5].selectedIndex;
var wO=((5-(Math.floor(((parseInt(wizard.charAt(2),10)+parseInt(warrior.charAt(2),10)+era)%10)*0.5)))+lw)%5;
if(lw==5){wO=5;}
if(eType[eNum]==1){
document.forms["c1"].elements[10].value="Wizard";
}else{
document.forms["c1"].elements[10].value="Warrior";
}
enemy=eNum+lw*5+era*30;
document.forms["c1"].elements[6].value=eNames[enemy];
var offset=eNum;
if(lw==5){
offset+=5;
}else{
offset+=wO;
}
offset+=era*7;
document.forms["c1"].elements[7].value=eEnergy[offset]+"00";
document.forms["c1"].elements[8].value=eAttack[offset]+"00";
document.forms["c1"].elements[9].value=eDefence[offset]+"00";
if(eNum<4){
document.forms["c1"].elements[11].value=0;
document.forms["c1"].elements[12].value=(1-eType[eNum])*eRewards[wO+era*6]+"00";
document.forms["c1"].elements[13].value=eType[eNum]*eRewards[wO+era*6]+"00";
document.forms["c1"].elements[14].value=eType[eNum]*5;
document.forms["c1"].elements[15].value=(1-eType[eNum])*5;
}else{
if(lw<5){
document.forms["c1"].elements[11].value=((era+1)*7-2+wO)*300;
document.forms["c1"].elements[12].value=eRewards[wO+era*6]+"00";
document.forms["c1"].elements[13].value=eRewards[wO+era*6]+"00";
document.forms["c1"].elements[14].value=0;
document.forms["c1"].elements[15].value=0;
}else{
document.forms["c1"].elements[11].value=0;
document.forms["c1"].elements[12].value=0;
document.forms["c1"].elements[13].value=0;
document.forms["c1"].elements[14].value=0;
document.forms["c1"].elements[15].value=0;
}
}
document.images["enemy"].src="bcbi/"+langu+(document.forms["c1"].elements[3].selectedIndex+1)+(document.forms["c1"].elements[4].selectedIndex+1)+(document.forms["c1"].elements[5].selectedIndex+1)+".jpg";
var pCode;
switch(era){
case 0:
pCode=((1+parseInt(warrior.charAt(0),10)+parseInt(wizard.charAt(0),10))%10)+"1 "+((parseInt(warrior.charAt(1),10)+parseInt(wizard.charAt(1),10))%10)+"0"+((parseInt(warrior.charAt(2),10)+parseInt(wizard.charAt(2),10))%10);
break;
case 1:
pCode=((1+parseInt(warrior.charAt(0),10)+parseInt(wizard.charAt(0),10))%10)+"1 "+((7+parseInt(warrior.charAt(1),10)+parseInt(wizard.charAt(1),10))%10)+"7"+((4+parseInt(warrior.charAt(2),10)+parseInt(wizard.charAt(2),10))%10);
break;
case 2:
pCode=((2+parseInt(warrior.charAt(0),10)+parseInt(wizard.charAt(0),10))%10)+"2 "+((4+parseInt(warrior.charAt(1),10)+parseInt(wizard.charAt(1),10))%10)+"4"+((3+parseInt(warrior.charAt(2),10)+parseInt(wizard.charAt(2),10))%10);
break;
case 3:
pCode=((3+parseInt(warrior.charAt(0),10)+parseInt(wizard.charAt(0),10))%10)+"3 "+((1+parseInt(warrior.charAt(1),10)+parseInt(wizard.charAt(1),10))%10)+"1"+((2+parseInt(warrior.charAt(2),10)+parseInt(wizard.charAt(2),10))%10);
break;
}
document.forms["c1"].elements[2].value=pCode;
}

function generateBarcode(){
if(document.forms[0].elements[1].selectedIndex==0){
var chkDig=0;
var frst,cod,weight,prty,wd;
cod=document.forms["bcg"].elements[4].value;
if(document.forms["bcg"].elements[2].checked){
cod=cod.substr(0,11)+document.forms["bcg"].elements[3].value;
}
for(i=0;i<12;i++){
if(cod.charAt(i)>="0" && cod.charAt(i)<="9"){
weight=1;
if(i%2==0){weight=3;}
chkDig+=parseInt(cod.charAt(i))*weight;
}
}
frst=(10-(chkDig%10))%10;
if(document.forms["bcg"].elements[2].checked){
document.forms["bcg"].elements[3].value=cod.substr(11,1);
cod=cod.substr(0,11)+frst;
frst=document.forms["bcg"].elements[3].value;
document.forms["bcg"].elements[4].value=cod;
}
prty="n"+parity[frst]+"iiiiii";
document.forms["bcg"].elements[3].value=frst;
var bcd=new Array(13);
for(i=1;i<13;i++){
bcd[i]=parseInt(cod.charAt(i-1),10);
}
bcd[0]=chkDig;
document.images["b13"].src="uniBarc.php?cod=13_"+cod;
m0(frst,cod);
wd=204;
}else{
var chkDig=0;
var frst,cod,weight,prty;
cod=document.forms["bcg"].elements[4].value;
for(i=0;i<7;i++){
if(cod.charAt(i)>="0" && cod.charAt(i)<="9"){
weight=1;
if(i%2==0){weight=3;}
chkDig+=parseInt(cod.charAt(i),10)*weight;
}
}
frst=(10-(chkDig%10))%10;
cod=cod.substr(0,7)+frst;
document.forms["bcg"].elements[4].value=cod;
var bcd=new Array(9);
for(i=1;i<8;i++){
bcd[i]=parseInt(cod.charAt(i-1),10);
}
document.images["b13"].src="uniBarc.php?cod=8_"+cod;
m2(cod);
wd=134;
}
document.images["b13"].width=wd*0.5;
document.images["b13"].height=35;
if(document.forms["bcg"].elements[0].selectedIndex==0){
document.images["b13"].width=wd;
document.images["b13"].height=70;
}
}

function m0(prty,cod){
switch(cod){
case "905040352507":
m1("0","521501106508");
break;
case "905040352521":
m1("0","521501187507");
break;
case "120401154185":
m1("0","120401154505");
break;
case "120201044181":
m1("0","120201044501");
break;
case "120102308184":
m1("0","120102308504");
break;
default:
m1(prty,cod);
}
}

function m1(prty,cod){
var duration="";
var reward="";
var scrc1,hdr,ftr,vl,rwd;
var bcd=new Array(12);
var mthd=2;
for(i=0;i<12;i++){
bcd[i]=parseInt(cod.substr(i,1),10);
}
if(prty<2 || (bcd[1]==9 && bcd[8]==5)){
if(bcd[6]<5){
rwd=bcd[9]*10+bcd[10];
if(rwd>64){
reward=rewards[rwd-65];
}
mthd=1;
if(prty==0 && bcd[0]<6 && bcd[2]<2 && bcd[4]<2 && bcd[9]==5 && bcd[10]==0){
scrc1="2"
if(bcd[7]>6){
scrc1+="11";
}else{
scrc1+="22";
}
scrc1+="0111";
for(i=0;i<3;i++){
vl=bcd[i*2]*10+bcd[i*2+1];
scrc1+=addTs(vl)+"1"+addTs(vl)+"1";
}
}else{
scrc1="20";
if(bcd[7]>6){
scrc1+="1";
}else{
scrc1+="2";
}
scrc1+="0111";
vl=prty*100+bcd[0]*10+bcd[1];
scrc1+="ttt0"+addTs(vl)+"1";
vl=bcd[2]*10+bcd[3];
if(prty>1 && ((bcd[6]==0 || bcd[6]==2) || (bcd[4]==3 && bcd[5]==0))){vl+=100;}
scrc1+="ttt0"+addTs(vl)+"1";
vl=bcd[4]*10+bcd[5];
if(prty>1 && bcd[6]>0 && bcd[6]<3){vl+=100;}
scrc1+="ttt0"+addTs(vl)+"1";
}
}
if(bcd[6]>4 && ((bcd[2]<2 && bcd[4]<2) || prty>1)){
if(bcd[6]<7){
scrc1="2001010ttt0ttt0"+addTs(bcd[2]*10+bcd[3])+"1"+addTs(bcd[2]*10+bcd[3])+"1ttt0ttt0";
mthd=1;
if(bcd[6]==5){
duration="1 Turn";
}else{
duration="1 Battle";
}
}
if(bcd[6]>6 && bcd[6]<9){
scrc1="2001001ttt0ttt0ttt0ttt0"+addTs(bcd[4]*10+bcd[5])+"1"+addTs(bcd[4]*10+bcd[5])+"1";
mthd=1;
if(bcd[6]==7){
duration="1 Turn";
}else{
duration="1 Battle";
}
}
if(bcd[6]==9){
if(bcd[7]<5){
scrc1="2001100"+addTs(bcd[0]*10+bcd[1])+"1"+addTs(bcd[0]*10+bcd[1])+"1ttt0ttt0ttt0ttt0";
mthd=1;
}else{
if(bcd[7]<7){
scrc1="0002000ttt0ttt0ttt0ttt0ttt0ttt0";
mthd=1;
}else{
if(bcd[7]<8){
scrc1="2001002ttt0ttt0ttt0ttt0"+addTs(bcd[2]*10+bcd[3])+"0"+addTs(bcd[2]*10+bcd[3])+"0";
mthd=1;
}else{
scrc1="2001020ttt0ttt0"+addTs(bcd[4]*10+bcd[5])+"0"+addTs(bcd[4]*10+bcd[5])+"0ttt0ttt0";
mthd=1;
}
}
}
}
}
}
if(mthd==2){
m2(cod.substr(4,8));
}else{
var reduction="None";
if(bcd[9]==2 && bcd[10]>2 && (bcd[6]<9 || bcd[7]<5 || bcd[7]>6)){
reduction=effect[bcd[10]-3];
}
if(scrc1.indexOf("NaN")>-1){
scrc1="0000000ttt0ttt0ttt0ttt0ttt0ttt0";
}
document.images["c1"].src="scr.php?cod="+scrc1;
document.forms["bcg"].elements[8].value=duration;
document.forms["bcg"].elements[9].value=reduction;
document.forms["bcg"].elements[10].value=reward;
}
}

function m2(cod){
var c1e,c1a,c1d,c0e,c0a,c0d,reduction,duration,scrc1,scrc2;
duration="";
var reward="";
bcd=new Array(8);
for(i=0;i<8;i++){
bcd[i]=parseInt(cod.charAt(i),10);
}
if(bcd[7]<5){
scrc1="2";
if(bcd[0]<7){
scrc1+="220111";
}else{
scrc1+="110111";
}
c1e=Math.floor(bcd[6]*0.5)*10+bcd[5];
c1a=(bcd[5]+8)%10;
if(c1a<3){c1a+=10;}
c1d=bcd[4];
if(c1d<3){c1d+=10;}
c0e=c1e*10+bcd[4];
c0a=(c1a-1)*10+((5+bcd[4])%10);
c0d=(c1d-3)*10+((bcd[3]+7)%10);
scrc1+=addTs(c1e)+"1"+addTs(c0e)+"1";
scrc1+=addTs(c1a)+"1"+addTs(c0a)+"1";
scrc1+=addTs(c1d)+"1"+addTs(c0d)+"1";
}else{
if(bcd[7]<7){
scrc1="2001010ttt0ttt0";
if(bcd[7]==5){
duration="1 Turn";
}else{
duration="1 Battle";
}
c1a=((bcd[4]+5)%10);
c0a=c1a+10;
if((bcd[5]+5)%10>3){c0a+=10;}
if((bcd[5]+5)%10>7){c0a+=10;}
scrc1+=addTs(c1a)+"1"+addTs(c0a)+"1ttt0ttt0";
}else{
if(bcd[7]<9){
scrc1="2001001ttt0ttt0ttt0ttt0";
if(bcd[7]==7){
duration="1 Turn";
}else{
duration="1 Battle";
}
c1d=((bcd[3]+7)%10);
c0d=c1d;
if((bcd[4]+7)%10>3){c0d+=10;}
if((bcd[4]+7)%10>7){c0d+=10;}
scrc1+=addTs(c1d)+"1"+addTs(c0d)+"1";
}else{
scrc1="2001100";
c1e=bcd[5];
if(bcd[6]>3){c1e+=10;}
if(bcd[6]>7){c1e+=10;}
c0e=bcd[4]+bcd[5]*10;
if(bcd[6]>7){c0e+=100;}
scrc1+=addTs(c1e)+"1"+addTs(c0e)+"1ttt0ttt0ttt0ttt0";
}
}
}
reduction="None";
if(bcd[3]>7 && bcd[5]>2){
reduction=effect[bcd[5]-3];
}
if(scrc1.indexOf("NaN")>-1){
scrc1="0000000ttt0ttt0ttt0ttt0ttt0ttt0";
}
document.images["c1"].src="scr.php?cod="+scrc1;
document.forms["bcg"].elements[8].value=duration;
document.forms["bcg"].elements[9].value=reduction;
document.forms["bcg"].elements[10].value=reward;
}

function pCod(frm,a,b,c){
var war,wiz,cod;
war=document.forms[frm].elements[0].value;
wiz=document.forms[frm].elements[1].value;
cod="P"+((parseInt(war.substr(0,1),10)+parseInt(wiz.substr(0,1),10)+a)%10)+a+" "+((parseInt(war.substr(1,1),10)+parseInt(wiz.substr(1,1),10)+b)%10)+b+((parseInt(war.substr(2,1),10)+parseInt(wiz.substr(2,1),10)+c)%10);
document.forms[frm].elements[3].value=cod;
}

function fCod(frm,a,b,c){
var war,wiz,cod;
war=document.forms[frm].elements[0].value;
wiz=document.forms[frm].elements[1].value;
cod="F "+((parseInt(war.substr(0,1),10)+parseInt(wiz.substr(0,1),10)+a)%10)+((parseInt(war.substr(1,1),10)+parseInt(wiz.substr(1,1),10)+b)%10)+((parseInt(war.substr(2,1),10)+parseInt(wiz.substr(2,1),10)+c)%10);
document.forms[frm].elements[3].value=cod;
}

function rncod(){
if(document.forms[0].elements[1].selectedIndex==0){
var rncd="";
for(i=0;i<12;i++){
rncd+=Math.floor(Math.random()*10);
}
document.forms["bcg"].elements[4].value=rncd;
generateBarcode();
}else{
var rncd="";
for(i=0;i<8;i++){
rncd+=Math.floor(Math.random()*10);
}
document.forms["bcg"].elements[4].value=rncd;
generateBarcode();
}
}

function dnc(){
window.alert("We told you not to click!");
window.alert("Now you have to read my story.");
window.alert("It is a story of love...");
window.alert("...a story of hatred...");
window.alert("...it has action,...");
window.alert("...adventure,...");
window.alert("...romance,...");
window.alert("...and barcodes.");
window.alert("Click OK to continue...");
window.location.href="story.htm";
}

function addTs(ipt){
var opt=""+ipt;
for(j=opt.length;j<3;j++){opt="t"+opt;}
ipt=parseInt(ipt,10);
if(opt=="tt0"){opt="ttt";}
return opt;
}

function setEAN(){
var a=document.forms[0].elements[1].selectedIndex;
if(a==0){
document.forms[0].elements[2].disabled=false;
document.forms[0].elements[3].disabled=false;
document.forms[0].elements[4].maxLength=12;
}else{
document.forms[0].elements[2].disabled=true;
document.forms[0].elements[3].disabled=true;
document.forms[0].elements[4].maxLength=8;
document.forms[0].elements[4].value=document.forms[0].elements[4].value.substr(0,8);
}
generateBarcode();
}