
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["L02"]["2"] = 2730
this.Items["L02"]["3"] = 1560

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

this.Items["L05"]["1"] = 9900
this.Items["L05"]["2"] = 6930
this.Items["L05"]["3"] = 3960

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

this.Items["L10"]["1"] = 14900
this.Items["L10"]["2"] = 10430
this.Items["L10"]["3"] = 5960

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

this.Items["L20"]["1"] = 27900
this.Items["L20"]["2"] = 19530
this.Items["L20"]["3"] = 11160

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

this.Items["L30"]["1"] = 54900
this.Items["L30"]["2"] = 38430
this.Items["L30"]["3"] = 21960

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

this.Items["L40"]["1"] = 64900
this.Items["L40"]["2"] = 45430
this.Items["L40"]["3"] = 25960



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!='' && MyForm.UserCountry.value!=''){
    
        Price1 = this.Items[MyForm.UpgradeFrom.value][MyForm.UserCountry.value]
        Price2 = this.Items[MyForm.UpgradeTo.value][MyForm.UserCountry.value]

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

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

    } else { 
        alert("Please select your country\nand the 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
    }

}