
this.Versions = new Array("L02","L05","L10","L20","L30","L40")

this.Versions["L02"] = new Array("L05","L10","L20","L30","L40");
this.Versions["L05"] = new Array("L10","L20","L30","L40");
this.Versions["L10"] = new Array("L20","L30","L40");
this.Versions["L20"] = new Array("L30","L40");
this.Versions["L30"] = new Array("L40");
this.Versions["L40"] = new Array();

this.Items = new Array()

this.Items["L02"] = new Array()

this.Items["L02"]["1"] = 3900

this.Items["L05"] = new Array()

this.Items["L05"]["1"] = 7900

this.Items["L10"] = new Array()

this.Items["L10"]["1"] = 14900

this.Items["L20"] = new Array()

this.Items["L20"]["1"] = 19900

this.Items["L30"] = new Array()

this.Items["L30"]["1"] = 24900

this.Items["L40"] = new Array()

this.Items["L40"]["1"] = 27900



function resetSelect(MySelect){

    tmp = MySelect.length

    for (i=0;i<tmp;i++){
    
        MySelect.options[i] = null
    
    }

}

function generateUpgradeTo(From){

    MyForm = document.PaypalForm

    resetSelect(MyForm.UpgradeTo);

    for (i=0;i<this.Versions[From].length;i++){

        tmp = this.Versions[From][i]

        MyForm.UpgradeTo.options[i] = new Option(tmp,tmp)
        MyForm.UpgradeTo.options[i+1] = null
    }

}

function initialiseProductList(){

    FromList = document.PaypalForm.UpgradeFrom

    for (i=0;i<this.Versions.length;i++){
    
        tmp = this.Versions[i]
        if(this.Versions[tmp].length>0){FromList.options[i] = new Option(tmp,tmp)}
        
    }
}

function countPrice(){

    MyForm = document.PaypalForm

    if(MyForm.UpgradeFrom.value!='' && MyForm.UpgradeTo.value!=''){
    
        Price1 = this.Items[MyForm.UpgradeFrom.value][1]
        Price2 = this.Items[MyForm.UpgradeTo.value][1]

        if(Price1!='' && Price2!=''){
            Price = Price2 - Price1
            Price = Price/100

            MyForm.UpgradePrice.value = Price
        }else{
            alert('Incorect parameters...')
        }

    } else { 
        alert("Please select your upgrade version!")
    }

}

function buyUpgrade(){

    MyForm = document.PaypalForm
    MyPaypalForm = document.PaypalForm2

    if(MyForm.UpgradePrice.value!=''){

        MyPaypalForm.item_name.value = 'Clickcat Upgrade '+ MyForm.UpgradeFrom.value + ' to ' + MyForm.UpgradeTo.value
        MyPaypalForm.amount.value = MyForm.UpgradePrice.value 
        MyPaypalForm.submit()        
        return false
    } else {
        alert('You must calculate the price first!')
        return false
    }

}