 //Variables
var Country
var State
var SubmitButton
var VATNumber
var ButtonInvoice
var ButtonCC
var ExistingLicenseKey
var TextBoxLicenseKey
var NumOfLicensesSPE

function ValidateTypeofIndustry (source, arguments)
{
    if (arguments.Value == "0")	
        arguments.IsValid = false;	
    else
        arguments.IsValid = true;
}

function ValidateCountry (source, arguments)
{
    if (arguments.Value == "0")	
        arguments.IsValid = false;	
    else
        arguments.IsValid = true;
}

function ValidateNumberOfEmployees (source, arguments)
{
    if (arguments.Value == "0")	
        arguments.IsValid = false;	
    else
        arguments.IsValid = true;
}

function CheckCountry() {
    if (State == null) return;
    
    if (Country.value == 'UNITED STATES' || Country.value == 'United States' || Country.value == 'USA' || Country.value == 'Canada' || Country.value == 'CANADA')
    {
        State.disabled = false;
    }
    else
    {
        State.disabled = true;
    }
}

function CheckCountry1() {

    if (State != null) {
        if (Country.value == 'UNITED STATES' || Country.value == 'United States' || Country.value == 'USA' || Country.value == 'Canada' || Country.value == 'CANADA') {
            State.disabled = false;
        }
        else {
            State.disabled = true;
        }
    }

    /*

    if (Country.value == 'JAPAN' || Country.value == 'Japan') {
        
        radioButtonDollar.checked = true;
        radioButtonEuro.checked = false;
        radioButtonPound.checked = false;
        radioButtonEuro.disabled = true;
        radioButtonPound.disabled = true;
    }
    else {
        radioButtonEuro.disabled = false;
        radioButtonPound.disabled = false;
    }
    */
       
}


function ValidateState(source,arguments)
{
    if (Country.value == 'UNITED STATES' || Country.value == 'United States' || Country.value == 'USA' || Country.value == 'Canada' || Country.value == 'CANADA')
    {
        if(arguments.Value == '0') 
	        arguments.IsValid = false;
        else 
	        arguments.IsValid = true;
    }
}

function ValidateVAT(source,arguments)
{
    if (Country.value == 'AUSTRIA' || Country.value == 'BELGIUM' || Country.value == 'BULGARIA' || Country.value == 'CYPRUS' || Country.value == 'CZECH REPUBLIC' || Country.value == 'DENMARK' || Country.value == 'ESTONIA' || Country.value == 'FINLAND' || Country.value == 'FRANCE' || Country.value == 'GERMANY' || Country.value == 'GREEECE' || Country.value == 'HUNGARY' || Country.value == 'IRELAND' || Country.value == 'ITALY' || Country.value == 'LATVIA' || Country.value == 'LITHUANIA' || Country.value == 'LUXEMBOURG' || Country.value == 'MALTA' || Country.value == 'NETHERLANDS' || Country.value == 'POLAND' || Country.value == 'PORTUGAL' || Country.value == 'ROMANIA' || Country.value == 'SLOVAKIA' || Country.value == 'SLOVENIA' || Country.value == 'SPAIN' || Country.value == 'SWEDEN' || Country.value == 'UNITED KINGDOM')
    {
        if(arguments.Value == '') 
	        arguments.IsValid = false;
        else 
	        arguments.IsValid = true;
    }
}

function CheckCondition(obj)
{
    if (obj.checked)
    {
	    SubmitButton.disabled = false;
	    SubmitButton.style.cursor = "pointer";
	    SubmitButton.setAttribute("class", "submit-btn"); //For Most Browsers 
	    SubmitButton.setAttribute("className", "submit-btn");//For IE only
	}
    else
    {
        SubmitButton.disabled = true;
	    SubmitButton.style.cursor = "default";
	    SubmitButton.setAttribute("class", "submit-btn-off"); //For Most Browsers
	    SubmitButton.setAttribute("className", "submit-btn-off");//For IE only
	}
}


function CheckConditionAcademic(obj)
{
    if (obj.checked)
    {
	    SubmitButton.disabled = false;
	    SubmitButton.style.cursor = "pointer";
	    SubmitButton.setAttribute("class", "order-btn"); //For Most Browsers
	    SubmitButton.setAttribute("className", "order-btn");//For IE only
	}
    else
    {
        SubmitButton.disabled = true;
	    SubmitButton.style.cursor = "default";
	    SubmitButton.setAttribute("class", "order-btn-off"); //For Most Browsers
	    SubmitButton.setAttribute("className", "order-btn-off");//For IE only
	}
}



function CheckConditionOrder(obj) {
    ButtonInvoice = document.getElementById(getButtonInvoiceId());
    ButtonCC = document.getElementById(getButtonCCId());
    if (obj.checked)
    {
	    ButtonInvoice.disabled = false;
	    ButtonInvoice.style.cursor = "pointer";
	    ButtonInvoice.setAttribute("class", "order-invoice-btn"); //For Most Browsers
	    ButtonInvoice.setAttribute("className", "order-invoice-btn");//For IE only
	    ButtonCC.disabled = false;
	    ButtonCC.style.cursor = "pointer";
	    ButtonCC.setAttribute("class", "order-cart-btn"); //For Most Browsers
	    ButtonCC.setAttribute("className", "order-cart-btn");//For IE only
	}
	else
	{
	    ButtonInvoice.disabled = true;
	    ButtonInvoice.style.cursor = "default";
	    ButtonInvoice.setAttribute("class", "order-invoice-btn-off"); //For Most Browsers
	    ButtonInvoice.setAttribute("className", "order-invoice-btn-off");//For IE only
	    ButtonCC.disabled = true;
	    ButtonCC.style.cursor = "default";
	    ButtonCC.setAttribute("class", "order-cart-btn-off"); //For Most Browsers
	    ButtonCC.setAttribute("className", "order-cart-btn-off");//For IE only
	}
	 
}

function CheckConditionOrderBB(obj)
{
    ButtonInvoice = document.getElementById(getButtonInvoiceId());
    ButtonCC = document.getElementById(getButtonInvoiceId());
    if (obj.checked)
    {
	    ButtonInvoice.disabled = false;
	    ButtonInvoice.style.cursor = "pointer";
	    ButtonInvoice.setAttribute("class", "btn-order-invice"); //For Most Browsers
	    ButtonInvoice.setAttribute("className", "btn-order-invice");//For IE only
	    ButtonCC.disabled = false;
	    ButtonCC.style.cursor = "pointer";
	    ButtonCC.setAttribute("class", "btn-order-cc"); //For Most Browsers
	    ButtonCC.setAttribute("className", "btn-order-cc");//For IE only
	}
	else
	{
	    ButtonInvoice.disabled = true;
	    ButtonInvoice.style.cursor = "default";
	    ButtonInvoice.setAttribute("class", "btn-order-invice"); //For Most Browsers
	    ButtonInvoice.setAttribute("className", "btn-order-invice");//For IE only
	    ButtonCC.disabled = true;
	    ButtonCC.style.cursor = "default";
	    ButtonCC.setAttribute("class", "btn-order-cc"); //For Most Browsers
	    ButtonCC.setAttribute("className", "btn-order-cc");//For IE only
	}
	 
}

function CheckCondition(obj)
{
    if (obj.checked)
    {
	    SubmitButton.disabled = false;
	    SubmitButton.style.cursor = "pointer";
	    SubmitButton.setAttribute("class", "submit-btn"); //For Most Browsers 
	    SubmitButton.setAttribute("className", "submit-btn");//For IE only
	}
    else
    {
        SubmitButton.disabled = true;
	    SubmitButton.style.cursor = "default";
	    SubmitButton.setAttribute("class", "submit-btn-off"); //For Most Browsers
	    SubmitButton.setAttribute("className", "submit-btn-off");//For IE only
	}
}



//price calculate on order pages
function CalculatePriceOrder()
	{		

	var strPricesUser = StringPricesUser;
    var pricesUser = strPricesUser.split('#');	
    var tempString; 
	var tempStart; 
	var tempEnd; 
	var tempPricePerUnit; 
	var tempPurcent = 20;
    var tempCurrency;
    //Prices for Task Update
    var pricePerUnitTUDollar = 9.90;
    var pricePerUnitTUEuro = 7.90;
    var pricePerUnitTUGBP = 6.90;
    var pricePerUnitTUJPY = 1200;
    
    
    if(radioButtonDollar.checked)
    tempCurrency = 2;
    else if (radioButtonEuro.checked)
    tempCurrency = 1;
    else if(radioButtonPound.checked)
    tempCurrency = 3;
    else if(radioButtonYen.checked)
    tempCurrency = 4;
    if(tempCurrency == 'undefined') 
	tempCurrency = 2;





var curText = Country.options[Country.selectedIndex].text;
/*
if (curText == "Japan") {
    strPricesUser = '1__1__100000__55.67$0#2__1__100000__55.67$0#3__1__100000__55.67$0#4__1__100000__55.67$0#';
    pricesUser = strPricesUser.split('#');
    pricePerUnitTUDollar = 12.9;
    pricePerUnitTUEuro = 12.9;
    pricePerUnitTUGBP = 12.9;
    pricePerUnitTUJPY = 12.9;
}*/
				for(var i=0; i<pricesUser.length-1; i++)
				{
					if(parseInt(pricesUser[i].substring(0,pricesUser[i].indexOf('__'))) == tempCurrency)
					{
						tempString = pricesUser[i].substring(pricesUser[i].indexOf('__')+2,pricesUser[i].length);
						tempStart = tempString.substring(0,tempString.indexOf('__'));
						tempEnd = tempString.substring(tempString.indexOf('__')+2,tempString.lastIndexOf('__'));
						
						tempPricePerUnit = tempString.substring(tempString.lastIndexOf('__')+2,tempString.indexOf('$'));
						tempPricePerUnit += '.' + tempString.substring(tempString.indexOf('$')+1,tempString.length)
						
						if(parseInt(tempStart)<=NumOfLicenses.value && NumOfLicenses.value<=parseInt(tempEnd))
						{
							if(ddlSelectLicenseType.checked)
							{
								if(tempCurrency == 4)//Only for Yen Currency (This upgrade should be 1000 yeni)
								{
									tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(1000);
								}
								else
								{
									tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(tempPricePerUnit) * parseFloat(tempPurcent)/100;
								}
							}
				
							tempTotal = NumOfLicenses.value * parseFloat(tempPricePerUnit);
							
							tempPricePerUnit = parseFloat(tempPricePerUnit).toFixed(2);
							//tempTotal = parseFloat(tempTotal).toFixed(2);
							
							if(cbTaskUpdate.checked)
				                {
				                    if(radioButtonDollar.checked)
					                {
					                    tempTotalTU =  NumOfLicenses.value * parseFloat(pricePerUnitTUDollar);
					                    LabelPricePerUnit.innerHTML = '$'+tempPricePerUnit;
					                    LabelPricePerUnitTU.innerHTML = '$'+pricePerUnitTUDollar;
					                    tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
					                    tempTotal = parseFloat(tempTotal).toFixed(2);
					                    LabelTotal.innerHTML = '$'+tempTotal;
					                }
                					
					                else if(radioButtonEuro.checked)
					                {
					                    tempTotalTU =  NumOfLicenses.value * parseFloat(pricePerUnitTUEuro);
					                    LabelPricePerUnit.innerHTML = '&euro;'+tempPricePerUnit; 
					                    LabelPricePerUnitTU.innerHTML = '&euro;'+pricePerUnitTUEuro;
					                    tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
					                    tempTotal = parseFloat(tempTotal).toFixed(2);
					                    LabelTotal.innerHTML = '&euro;'+tempTotal; 
					                }
					                else if(radioButtonPound.checked)
					                {
					                    tempTotalTU =  NumOfLicenses.value * parseFloat(pricePerUnitTUGBP);
					                    LabelPricePerUnit.innerHTML = '&pound;'+tempPricePerUnit; 
					                    LabelPricePerUnitTU.innerHTML = '&pound;'+pricePerUnitTUGBP;
					                    tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
					                    tempTotal = parseFloat(tempTotal).toFixed(2);
						                LabelTotal.innerHTML = '&pound;'+tempTotal; 
					                }
						                else if(radioButtonYen.checked)
					                {
					                    tempTotalTU =  NumOfLicenses.value * parseFloat(pricePerUnitTUJPY);
					                    LabelPricePerUnit.innerHTML = '&yen;'+tempPricePerUnit; 
					                    LabelPricePerUnitTU.innerHTML = '&yen;'+pricePerUnitTUJPY;
					                    tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
					                    tempTotal = parseFloat(tempTotal).toFixed(2);
						                LabelTotal.innerHTML = '&yen;'+tempTotal; 
					                }
					                LabelQTYTU.innerHTML = NumOfLicenses.value;
					                //LabelQTYGApps.innerHTML = NumOfLicenses.value;
				                }
				                else
				                {
							        if(radioButtonDollar.checked)
							        {
							            tempTotal = parseFloat(tempTotal).toFixed(2);
							            LabelPricePerUnit.innerHTML = '$'+tempPricePerUnit;
							            LabelTotal.innerHTML = '$'+tempTotal;
							        }
        							
							        else if(radioButtonEuro.checked)
							        {
							            tempTotal = parseFloat(tempTotal).toFixed(2);
							            LabelPricePerUnit.innerHTML = '&euro;'+tempPricePerUnit; 
							            LabelTotal.innerHTML = '&euro;'+tempTotal; 
							        }
							        else if(radioButtonPound.checked)
							        {
							            tempTotal = parseFloat(tempTotal).toFixed(2);
							            LabelPricePerUnit.innerHTML = '&pound;'+tempPricePerUnit; 
								        LabelTotal.innerHTML = '&pound;'+tempTotal; 
							        }
								        else if(radioButtonYen.checked)
							        {
							            tempTotal = parseFloat(tempTotal).toFixed(2);
							            LabelPricePerUnit.innerHTML = '&yen;'+tempPricePerUnit; 
								        LabelTotal.innerHTML = '&yen;'+tempTotal; 
							        }
							        //tempTotal = parseFloat(tempTotal).toFixed(2);
							        LabelQTYTU.innerHTML = '/';
							        LabelPricePerUnitTU.innerHTML='/';
							    }
							
					        if(cbGApps.checked)
					        {
					            LabelQTYGApps.innerHTML = NumOfLicenses.value;
					        }
					        else
					        {
					            LabelQTYGApps.innerHTML = '/';
					        }
					        
							if(ddlSelectLicenseType.checked)
								LabelLicenseOption.innerHTML = "Yes";
							else
							LabelLicenseOption.innerHTML = "No";
							
							
							LabelQTY.innerHTML = NumOfLicenses.value;
							//LabelQTYGApps.innerHTML = NumOfLicenses.value;
						}
					}
				}
				
			}
			
function CalculatePriceOrderBB()
	{		

	var strPricesUser = StringPricesUser;
    var pricesUser = strPricesUser.split('#');	
    var tempString; 
	var tempStart; 
	var tempEnd; 
	var tempPricePerUnit; 
	var tempPurcent = 20;
    var tempCurrency;
    //Prices for Task Update
//    var pricePerUnitTUDollar = 9.90;
//    var pricePerUnitTUEuro = 7.90;
//    var pricePerUnitTUGBP = 6.90;
//    var pricePerUnitTUJPY = 1200;
    
    
    if(radioButtonDollar.checked)
    tempCurrency = 2;
    else if (radioButtonEuro.checked)
    tempCurrency = 1;
    else if(radioButtonPound.checked)
    tempCurrency = 3;
//    else if(radioButtonYen.checked)
//    tempCurrency = 4;
    if(tempCurrency == 'undefined') 
	tempCurrency = 2;
				
				
				for(var i=0; i<pricesUser.length-1; i++)
				{
					if(parseInt(pricesUser[i].substring(0,pricesUser[i].indexOf('__'))) == tempCurrency)
					{
						tempString = pricesUser[i].substring(pricesUser[i].indexOf('__')+2,pricesUser[i].length);
						tempStart = tempString.substring(0,tempString.indexOf('__'));
						tempEnd = tempString.substring(tempString.indexOf('__')+2,tempString.lastIndexOf('__'));
						
						tempPricePerUnit = tempString.substring(tempString.lastIndexOf('__')+2,tempString.indexOf('$'));
						tempPricePerUnit += '.' + tempString.substring(tempString.indexOf('$')+1,tempString.length)
						
						if(parseInt(tempStart)<=NumOfLicenses.value && NumOfLicenses.value<=parseInt(tempEnd))
						{
					
						tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(tempPricePerUnit)* parseFloat(tempPurcent)/100;;
								
						}
				
							tempTotal = NumOfLicenses.value * parseFloat(tempPricePerUnit);
							
							tempPricePerUnit = parseFloat(tempPricePerUnit).toFixed(2);
							//tempTotal = parseFloat(tempTotal).toFixed(2);
							
//						
							        if(radioButtonDollar.checked)
							        {
							            tempTotal = parseFloat(tempTotal).toFixed(2);
							            LabelPricePerUnit.innerHTML = '$'+tempPricePerUnit;
							            LabelTotal.innerHTML = '$'+tempTotal;
							        }
        							
							        else if(radioButtonEuro.checked)
							        {
							            tempTotal = parseFloat(tempTotal).toFixed(2);
							            LabelPricePerUnit.innerHTML = '&euro;'+tempPricePerUnit; 
							            LabelTotal.innerHTML = '&euro;'+tempTotal; 
							        }
							        else if(radioButtonPound.checked)
							        {
							            tempTotal = parseFloat(tempTotal).toFixed(2);
							            LabelPricePerUnit.innerHTML = '&pound;'+tempPricePerUnit; 
								        LabelTotal.innerHTML = '&pound;'+tempTotal; 
							        }
//								        else if(radioButtonYen.checked)
//							        {
//							            tempTotal = parseFloat(tempTotal).toFixed(2);
//							            LabelPricePerUnit.innerHTML = '&yen;'+tempPricePerUnit; 
//								        LabelTotal.innerHTML = '&yen;'+tempTotal; 
//							        }
							        tempTotal = parseFloat(tempTotal).toFixed(2);
							        LabelQTY.innerHTML = '/';
//							        LabelPricePerUnit.innerHTML='/';
							 
							
							
							LabelQTY.innerHTML = NumOfLicenses.value;
							//LabelQTYGApps.innerHTML = NumOfLicenses.value;
						}
					}
					}
			
		
			
			
 //price calculate on CalculatorPage

			function CalculatePrice() {

			    var strPricesUser = StringPricesUser;
			    var pricesUser = strPricesUser.split('#');
			    var tempString;
			    var tempStart;
			    var tempEnd;
			    var tempPricePerUnit;
			    var tempPricePerUnitMSP;
			    var tempPurcent = 20;
			    var tempCurrency;
			    var tempSave;
			    //Prices for Task Update
			    var pricePerUnitTUDollar = 9.90;
			    var pricePerUnitTUEuro = 7.90;
			    var pricePerUnitTUGBP = 6.90;
			    var pricePerUnitTUJPY = 1200;
			    //Prices for MS Project
			    var pricePerUnitMSPDollar = 999.95;
			    var pricePerUnitMSPEuro = 1299.00;
			    var pricePerUnitMSPGBP = 899.99;
			    var pricePerUnitMSPJPY = 132090.00;



			    if (radioButtonDollar.checked)
			        tempCurrency = 2;
			    else if (radioButtonEuro.checked)
			        tempCurrency = 1;
			    else if (radioButtonPound.checked)
			        tempCurrency = 3;
			    else if (radioButtonYen.checked)
			        tempCurrency = 4;
			    if (tempCurrency == 'undefined')
			        tempCurrency = 2;
			    if (NumOfLicenses.value > 0)
			        LabelTotalMSP.style.color = "Red";
			    if (NumOfLicenses.value > 0) {
			        for (var i = 0; i < pricesUser.length - 1; i++) {
			            if (parseInt(pricesUser[i].substring(0, pricesUser[i].indexOf('__'))) == tempCurrency) {
			                tempString = pricesUser[i].substring(pricesUser[i].indexOf('__') + 2, pricesUser[i].length);
			                tempStart = tempString.substring(0, tempString.indexOf('__'));
			                tempEnd = tempString.substring(tempString.indexOf('__') + 2, tempString.lastIndexOf('__'));

			                tempPricePerUnit = tempString.substring(tempString.lastIndexOf('__') + 2, tempString.indexOf('$'));
			                tempPricePerUnit += '.' + tempString.substring(tempString.indexOf('$') + 1, tempString.length)
			                tempPricePerUnitMSP = tempString.substring(tempString.lastIndexOf('__') + 2, tempString.indexOf('$'));
			                tempPricePerUnitMSP += '.' + tempString.substring(tempString.indexOf('$') + 1, tempString.length)


			                if (parseInt(tempStart) <= NumOfLicenses.value && NumOfLicenses.value <= parseInt(tempEnd)) {

			                    if (tempCurrency == 4)//Only for Yen Currency (This upgrade should be 1000 yeni)
			                    {
			                        tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(1000);
			                        tempPricePerUnit = parseFloat(tempPricePerUnitMSP);
			                        tempPricePerUnitMSP = parseFloat(tempPricePerUnit) + parseFloat(1000);
			                        tempPricePerUnitMSP = parseFloat(tempPricePerUnitMSP);
			                    }
			                    else {
			                    }
			                }


			                tempTotal = NumOfLicenses.value * parseFloat(tempPricePerUnit);
			                tempTotalMSP = NumOfLicenses.value * parseFloat(tempPricePerUnitMSP);
			                tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                tempSave = parseFloat(tempSave).toFixed(2);

			                tempPricePerUnit = parseFloat(tempPricePerUnit).toFixed(2);
			                tempPricePerUnitMSP = parseFloat(tempPricePerUnitMSP).toFixed(2);


			                if (cbTaskUpdate.checked) {
			                    if (radioButtonDollar.checked) {
			                        tempTotalTU = NumOfLicenses.value * parseFloat(pricePerUnitTUDollar);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPDollar);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);
			                        tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        LabelTotal.innerHTML = '$' + tempTotal;
			                        LabelTotalMSP.innerHTML = '$' + tempTotalMSP;
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelSave.innerHTML = '$' + tempSave;
			                    }

			                    else if (radioButtonEuro.checked) {
			                        tempTotalTU = NumOfLicenses.value * parseFloat(pricePerUnitTUEuro);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPEuro);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);
			                        tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelTotal.innerHTML = '&euro;' + tempTotal;
			                        LabelTotalMSP.innerHTML = '&euro;' + tempTotalMSP;
			                        LabelSave.innerHTML = '&euro;' + tempSave;
			                    }
			                    else if (radioButtonPound.checked) {
			                        tempTotalTU = NumOfLicenses.value * parseFloat(pricePerUnitTUGBP);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPGBP);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);

			                        tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        LabelTotal.innerHTML = '&pound;' + tempTotal;
			                        LabelTotalMSP.innerHTML = '&pound;' + tempTotalMSP;
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelSave.innerHTML = '&pound;' + tempSave;
			                    }
			                    else if (radioButtonYen.checked) {
			                        tempTotalTU = NumOfLicenses.value * parseFloat(pricePerUnitTUJPY);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPJPY);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);
			                        tempTotal = parseFloat(tempTotal) + parseFloat(tempTotalTU);
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        LabelTotal.innerHTML = '&yen;' + tempTotal;
			                        LabelTotalMSP.innerHTML = '&yen;' + tempTotalMSP;
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelSave.innerHTML = '&yen;' + tempSave;

			                    }
			                }
			                else {
			                    if (radioButtonDollar.checked) {
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPDollar);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);
			                        LabelTotal.innerHTML = '$' + tempTotal;
			                        LabelTotalMSP.innerHTML = '$' + tempTotalMSP;
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelSave.innerHTML = '$' + tempSave;
			                    }

			                    else if (radioButtonEuro.checked) {
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPEuro);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);
			                        LabelTotal.innerHTML = '&euro;' + tempTotal;
			                        LabelTotalMSP.innerHTML = '&euro;' + tempTotalMSP;
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelSave.innerHTML = '&euro;' + tempSave;
			                    }
			                    else if (radioButtonPound.checked) {
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPGBP);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);
			                        LabelTotal.innerHTML = '&pound;' + tempTotal;
			                        LabelTotalMSP.innerHTML = '&pound;' + tempTotalMSP;
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelSave.innerHTML = '&pound;' + tempSave;
			                    }
			                    else if (radioButtonYen.checked) {
			                        tempTotal = parseFloat(tempTotal).toFixed(2);
			                        tempTotalMSP = NumOfLicenses.value * parseFloat(pricePerUnitMSPJPY);
			                        tempTotalMSP = parseFloat(tempTotalMSP).toFixed(2);
			                        LabelTotal.innerHTML = '&yen;' + tempTotal;
			                        LabelTotalMSP.innerHTML = '&yen;' + tempTotalMSP;
			                        tempSave = parseFloat(tempTotalMSP) - parseFloat(tempTotal);
			                        tempSave = parseFloat(tempSave).toFixed(2);
			                        LabelSave.innerHTML = '&yen;' + tempSave;
			                    }




			                }

			            }
			        }
			    }
			    else {
			        LabelTotal.innerHTML = '';
			        LabelTotalMSP.innerHTML = '';
			        LabelSave.innerHTML = '';
			    }
			}   
				
				
				
			
			

function CalculatePriceOrderEvolution()
	{		

	var strPricesUser = StringPricesUser;
    var pricesUser = strPricesUser.split('#');	
    var tempString; 
	var tempStart; 
	var tempEnd; 
	var tempPricePerUnit; 
	var tempPurcent = 20;
    var tempCurrency;
    var tempPerUnitTotalSPV;
    var tempPerUnitTotalSPE;


   
    if(radioButtonDollar.checked)
    tempCurrency = 2;
    else if (radioButtonEuro.checked)
    tempCurrency = 1;
    else if(radioButtonPound.checked)
    tempCurrency = 3;
   
    if(tempCurrency == 'undefined') 
	tempCurrency = 2;
			
				for(var i=0; i<pricesUser.length-1; i++)
				{
					if(parseInt(pricesUser[i].substring(0,pricesUser[i].indexOf('__'))) == tempCurrency)
					{
						tempString = pricesUser[i].substring(pricesUser[i].indexOf('__')+2,pricesUser[i].length);
						tempStart = tempString.substring(0,tempString.indexOf('__'));
						tempEnd = tempString.substring(tempString.indexOf('__')+2,tempString.lastIndexOf('__'));
						
						tempPricePerUnit = tempString.substring(tempString.lastIndexOf('__')+2,tempString.indexOf('$'));
						tempPricePerUnit += '.' + tempString.substring(tempString.indexOf('$')+1,tempString.length)
						
						if((parseInt(tempStart)-1)<=NumOfLicenses.value && NumOfLicenses.value<=parseInt(tempEnd))
						{
							if(ddlSelectLicenseType.checked)
							{
								if(tempCurrency == 4)//Only for Yen Currency (This upgrade should be 1000 yeni)
								{
									tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(1000);
								}
								else
								{
									tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(tempPricePerUnit) * parseFloat(tempPurcent)/100;
								}
							}
			            
			                if(radioButtonInhouse.checked)
			                {
			                    if(radioButtonDollar.checked)
			                    {
				                    if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
							        {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*19.90;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = parseFloat(NumOfLicensesSPE.value)*19.90;
							        }
							        if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							        {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*39.00 + parseFloat(NumOfLicenses.value)*19.90;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*39.90 + parseFloat(NumOfLicenses.value)*19.90;
    						        }   							
							    }
							    if(radioButtonEuro.checked)
			                    {
				                    if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                    {
							            tempTotal = NumOfLicenses.value * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*14.90;
							            tempPerUnitTotalSPV = NumOfLicenses.value * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE =parseFloat(NumOfLicensesSPE.value)*14.90;
							        }
							        if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							        {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*29.90 + parseFloat(NumOfLicenses.value)*14.90;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*29.90 + parseFloat(NumOfLicenses.value)*14.90;
							        }
    						    						
							    }
    							
							    if(radioButtonPound.checked)
			                    {
				                    if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                    {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*12.90;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE =parseFloat(NumOfLicensesSPE.value)*12.90;
							        }
							        if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							        {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*25.90 + parseFloat(NumOfLicenses.value)*12.90;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE =(parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*25.90 + parseFloat(NumOfLicenses.value)*12.90;
							        }
    						    						
							    }
    							
    							
							    tempPricePerUnit = parseFloat(tempPricePerUnit).toFixed(2);
							    tempTotal = parseFloat(tempTotal).toFixed(2);
    							
    							
							    if(radioButtonDollar.checked)
							    {
							        LabelPricePerUnit.innerHTML = '$'+tempPricePerUnit;
							        LabelTotal.innerHTML = '$'+tempTotal;
							        LabelPricePerUnitSPE.innerHTML = '$'+'19.90'+'/'+'39.90'+'<sup>*</sup>';
							        LabelPricePerUnitSPETotal.innerHTML ='$'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='$'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							
    							   
    							    
							    }
    							
							    else if(radioButtonEuro.checked)
							    {
							        LabelPricePerUnit.innerHTML = '&euro;'+tempPricePerUnit; 
							        LabelTotal.innerHTML = '&euro;'+tempTotal; 
							        LabelPricePerUnitSPE.innerHTML = '&euro;'+'14.90'+'/'+'29.90'+'<sup>*</sup>';
							        LabelPricePerUnitSPETotal.innerHTML ='&euro;'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='&euro;'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							       
							    }
    							
							    else if(radioButtonPound.checked)
							    {
							        LabelPricePerUnit.innerHTML = '&pound;'+tempPricePerUnit; 
								    LabelTotal.innerHTML = '&pound;'+tempTotal; 
								    LabelPricePerUnitSPE.innerHTML = '&pound;'+'12.90'+'/'+'25.90'+'<sup>*</sup>';
								    LabelPricePerUnitSPETotal.innerHTML ='&pound;'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='&pound;'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							
								    
							        
							    }
							}
							
							if(radioButtonHosted.checked)
			                {
			          
			                    if(radioButtonDollar.checked)
			                    {
				                    if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                    {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*9.90;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = parseFloat(NumOfLicensesSPE.value)*9.90;
							        }
							        if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							        {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*19.90 + parseFloat(NumOfLicenses.value)*9.90;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*19.90 + parseFloat(NumOfLicenses.value)*9.90;
							        }
    						    
    							
							    }
							    if(radioButtonEuro.checked)
			                    {
				                    if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                    {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*7.50;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = parseFloat(NumOfLicensesSPE.value)*7.50;
    							
							        }
							        if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							        {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*14.90 + parseFloat(NumOfLicenses.value)*7.50;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE =  (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*14.90 + parseFloat(NumOfLicenses.value)*7.50;
							        }
        						    						
							    }
    							
							    if(radioButtonPound.checked)
			                    {
				                    if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                    {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*6.50;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = parseFloat(NumOfLicensesSPE.value)*6.50;
    							 
							        }
							        if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							        {
							            tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*12.90 + parseFloat(NumOfLicenses.value)*6.50;
							            tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							            tempPerUnitTotalSPE = (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*12.90 + parseFloat(NumOfLicenses.value)*6.50;
							        }
        						    						
							    }
        							
    							
							    tempPricePerUnit = parseFloat(tempPricePerUnit).toFixed(2);
							    tempTotal = parseFloat(tempTotal).toFixed(2);
    							
    							
							    if(radioButtonDollar.checked)
							    {
							        LabelPricePerUnit.innerHTML = '$'+tempPricePerUnit;
							        LabelTotal.innerHTML = '$'+tempTotal;
							        LabelPricePerUnitSPE.innerHTML = '$'+'9.90'+'/'+'19.90'+'<sup>*</sup>';
							         LabelPricePerUnitSPETotal.innerHTML ='$'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='$'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							  
    							   
    							    
							    }
    							
							    else if(radioButtonEuro.checked)
							    {
							        LabelPricePerUnit.innerHTML = '&euro;'+tempPricePerUnit; 
							        LabelTotal.innerHTML = '&euro;'+tempTotal; 
							        LabelPricePerUnitSPE.innerHTML = '&euro;'+'7.50'+'/'+'14.90'+'<sup>*</sup>';
							         LabelPricePerUnitSPETotal.innerHTML ='&euro;'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='&euro;'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							    
							    }
    							
							    else if(radioButtonPound.checked)
							    {
							        LabelPricePerUnit.innerHTML = '&pound;'+tempPricePerUnit; 
								    LabelTotal.innerHTML = '&pound;'+tempTotal; 
								    LabelPricePerUnitSPE.innerHTML = '&pound;'+'6.50'+'/'+'12.90'+'<sup>*</sup>';
								     LabelPricePerUnitSPETotal.innerHTML ='&pound;'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='&pound;'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							          
							    }
							}
							
							else
							
							{						        
							    if(radioButtonDollar.checked)
			                    {
				                if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                {
							    tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*19.90;
							    tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							    tempPerUnitTotalSPE = parseFloat(NumOfLicensesSPE.value)*19.90;
							    }
							    if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							    {
							    tempTotal = NumOfLicenses.value * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*39.90 + parseFloat(NumOfLicenses.value)*19.90;
							     tempPerUnitTotalSPV = NumOfLicenses.value * parseFloat(tempPricePerUnit);
							    tempPerUnitTotalSPE = (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*39.90 + parseFloat(NumOfLicenses.value)*19.90;
							    }
    						    
    							
							    }
							    if(radioButtonEuro.checked)
			                    {
				                if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                {
							    tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*14.90;
							    tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							    tempPerUnitTotalSPE = parseFloat(NumOfLicensesSPE.value)*14.90;
							
							    }
							    if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							    {
							    tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*29.90 + parseFloat(NumOfLicenses.value)*14.90;
							      tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							    tempPerUnitTotalSPE = (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*29.90 + parseFloat(NumOfLicenses.value)*14.90;
							    }
    						    						
							    }
    							
							    if(radioButtonPound.checked)
			                    {
				                if(parseInt(NumOfLicenses.value) > parseInt(NumOfLicensesSPE.value))
				                {
							    tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + parseFloat(NumOfLicensesSPE.value)*12.090;
							    tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							    tempPerUnitTotalSPE = parseFloat(NumOfLicensesSPE.value)*12.90;
						
							    }
							    if(parseInt(NumOfLicenses.value) <= parseInt(NumOfLicensesSPE.value))
							    {
							    tempTotal = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit) + (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*25.90 + parseFloat(NumOfLicenses.value)*12.90;
							        tempPerUnitTotalSPV = parseFloat(NumOfLicenses.value) * parseFloat(tempPricePerUnit);
							    tempPerUnitTotalSPE = (parseFloat(NumOfLicensesSPE.value)- parseFloat(NumOfLicenses.value))*25.90 + parseFloat(NumOfLicenses.value)*12.90;
							    }
    						    						
							    }
    							
    							
							    tempPricePerUnit = parseFloat(tempPricePerUnit).toFixed(2);
							    tempTotal = parseFloat(tempTotal).toFixed(2);
    							
    							
							    if(radioButtonDollar.checked)
							    {
							        LabelPricePerUnit.innerHTML = '$'+tempPricePerUnit;
							        LabelTotal.innerHTML = '$'+tempTotal;
							        LabelPricePerUnitSPE.innerHTML = '$'+'19.90'+'/'+'39.90'+'<sup>*</sup>';
							        LabelPricePerUnitSPETotal.innerHTML ='$'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='$'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							     
    							   
    							    
							    }
    							
							    else if(radioButtonEuro.checked)
							    {
							        LabelPricePerUnit.innerHTML = '&euro;'+tempPricePerUnit; 
							        LabelTotal.innerHTML = '&euro;'+tempTotal; 
							        LabelPricePerUnitSPE.innerHTML = '&euro;'+'14.90'+'/'+'29.90'+'<sup>*</sup>';
							        LabelPricePerUnitSPETotal.innerHTML ='&euro;'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='&euro;'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							      
								    
							    
							    }
    							
							    else if(radioButtonPound.checked)
							    {
							        LabelPricePerUnit.innerHTML = '&pound;'+tempPricePerUnit; 
								    LabelTotal.innerHTML = '&pound;'+tempTotal; 
								    LabelPricePerUnitSPE.innerHTML = '&pound;'+'12.90'+'/'+'25.90'+'<sup>*</sup>';
								    LabelPricePerUnitSPETotal.innerHTML ='&pound;'+parseFloat(tempPerUnitTotalSPE).toFixed(2);
							        LabelPricePerUnitSPVTotal.innerHTML ='&pound;'+parseFloat(tempPerUnitTotalSPV).toFixed(2);
							     
								    
							    
							    }
							
							
							}
							
											
							if(ddlSelectLicenseType.checked)
								LabelLicenseOption.innerHTML = "Yes";
							else
							LabelLicenseOption.innerHTML = "No";
							
							LabelQTY.innerHTML = NumOfLicenses.value;
							LabelQTYSPE.innerHTML = NumOfLicensesSPE.value;
						}
					}
				}
}
			
			

function CheckCompany(obj)
{
    
    if(obj.value == 'rbCompany')
    {
        ValidatorEnable(document.getElementById(getRfvCompany()), true);
    }
    else 
    {
        ValidatorEnable(document.getElementById(getRfvCompany()), false);
    }
}

function CheckCompany1(obj) {

   
    if (obj.value == 'rbCompany') {
        ValidatorEnable(document.getElementById(getRfvCompany()), true);

            ValidatorEnable(cvVat, true);
            ValidatorEnable(rfvVat, true);
        

    }
    else {
        ValidatorEnable(document.getElementById(getRfvCompany()), false);
        ValidatorEnable(cvVat, false);
        ValidatorEnable(rfvVat, false);
    }

}


function ValidateLicenseSupport()
{
    TextBoxLicenseKey = document.getElementById(gettbLicenseKey());
    if (ExistingLicenseKey != null) {
        if (ExistingLicenseKey.value == '1') {
            TextBoxLicenseKey.disabled = false;
            TextBoxLicenseKey.setAttribute('class', 'input'); //For Most Browsers
            TextBoxLicenseKey.setAttribute('className', 'input'); //For IE only
        }
        else if (ExistingLicenseKey.value == '2') {
            TextBoxLicenseKey.disabled = 'true';
            TextBoxLicenseKey.setAttribute('class', 'input-off'); //For Most Browsers
            TextBoxLicenseKey.setAttribute('className', 'input-off'); //For IE only
        }
    }
    
}

function CalculatePriceOrderAcademic()
	{

	var strPricesUser = StringPricesUser;
    var pricesUser = strPricesUser.split('#');	
    var tempString; 
	var tempStart; 
	var tempEnd; 
	var tempPricePerUnit; 
	var tempPurcent = 20;
    var tempCurrency;
    
    if(radioButtonDollar.checked)
    tempCurrency = 2;
    else if (radioButtonEuro.checked)
    tempCurrency = 1;
    else if(radioButtonPound.checked)
    tempCurrency = 3;
    else if(radioButtonYen.checked)
    tempCurrency = 4;
    if(tempCurrency == 'undefined') 
	tempCurrency = 2;
				
				for(var i=0; i<pricesUser.length-1; i++)
				{
					if(parseInt(pricesUser[i].substring(0,pricesUser[i].indexOf('__'))) == tempCurrency)
					{
						tempString = pricesUser[i].substring(pricesUser[i].indexOf('__')+2,pricesUser[i].length);
						tempStart = tempString.substring(0,tempString.indexOf('__'));
						tempEnd = tempString.substring(tempString.indexOf('__')+2,tempString.lastIndexOf('__'));
						
						tempPricePerUnit = tempString.substring(tempString.lastIndexOf('__')+2,tempString.indexOf('$'));
						tempPricePerUnit += '.' + tempString.substring(tempString.indexOf('$')+1,tempString.length)
						
						if(parseInt(tempStart)<=NumOfLicenses.value && NumOfLicenses.value<=parseInt(tempEnd))
						{
							if(ddlSelectLicenseType.checked)
							{
								if(tempCurrency == 4)//Only for Yen Currency (This upgrade should be 1000 yeni)
								{
									tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(1000);
								}
								else
								{
									tempPricePerUnit = parseFloat(tempPricePerUnit) + parseFloat(tempPricePerUnit) * parseFloat(tempPurcent)/100;
								}
							}
				
							tempTotal = NumOfLicenses.value * parseFloat(tempPricePerUnit)/2;
							tempPricePerUnit = parseFloat(tempPricePerUnit).toFixed(2)/2;
							tempTotal = parseFloat(tempTotal).toFixed(2);
							
							
							if(radioButtonDollar.checked)
							{
							    LabelPricePerUnit.innerHTML = '$'+tempPricePerUnit.toFixed(2);
							    LabelTotal.innerHTML = '$'+tempTotal;
							}
							
							else if(radioButtonEuro.checked)
							{
							    LabelPricePerUnit.innerHTML = '&euro;'+tempPricePerUnit.toFixed(2); 
							    LabelTotal.innerHTML = '&euro;'+tempTotal; 
							}
							else if(radioButtonPound.checked)
							{
							    LabelPricePerUnit.innerHTML = '&pound;'+tempPricePerUnit.toFixed(2); 
								LabelTotal.innerHTML = '&pound;'+tempTotal; 
							}
								else if(radioButtonYen.checked)
							{
							    LabelPricePerUnit.innerHTML = '&yen;'+tempPricePerUnit.toFixed(2); 
								LabelTotal.innerHTML = '&yen;'+tempTotal; 
							}
							
							
							
					
							if(ddlSelectLicenseType.checked)
								LabelLicenseOption.innerHTML = "Yes";
							else
							LabelLicenseOption.innerHTML = "No";
							
							LabelQTY.innerHTML = NumOfLicenses.value;
						}
					}
				}
			}
			


		
function changeVisibility(obj)
{
    document.getElementById('showLicensesNumber').style.display = 'block';
    if(obj.value == "rbHosted")
    {
           document.getElementById('infoNumOfLicenses').style.display = 'none';
           document.getElementById('dlLicenseID').style.display = 'block';
           NumOfLicensesSPE.value = '1';
           LabelQTYSPE.innerHTML = '1';
           LabelErrorLicenseID.innerHTML = '';
           }
     else
     if(obj.value == "rbInhouse")
     {
           document.getElementById('dlLicenseID').style.display = 'none';
           NumOfLicensesSPE.value = '50';
           LabelQTYSPE.innerHTML =  '50';
           LabelErrorLicenseID.innerHTML = '';
           }
            CalculatePriceOrderEvolution();
           
}

function changeVisibilityExistingCustomers(obj)
{
    document.getElementById('showLicensesNumber').style.display = 'block';
    if(obj.value == "rbHosted")
    {
           document.getElementById('infoNumOfLicenses').style.display = 'none';
           document.getElementById('dlLicenseID').style.display = 'block';
           NumOfLicensesSPE.value = '1';
      
   
           }
     else
     if(obj.value == "rbInhouse")
     {
           document.getElementById('dlLicenseID').style.display = 'none';
           NumOfLicensesSPE.value = '50';
        
         
           }
          
           
}


function ChangeVisibilityCreditCards(obj)
{
    if(obj.value == "rbCreditCard")
        document.getElementById('dlCreditCard').style.display = 'block';
     if(obj.value == "rbInvoice")
        document.getElementById('dlCreditCard').style.display = 'none';

}

function CheckNumberOfLicensesSPE()
{
    if(radioButtonInhouse.checked)
    {
        if(parseInt(NumOfLicensesSPE.value) < 50)
        {
            document.getElementById('infoNumOfLicenses').style.display = 'block';
            NumOfLicensesSPE.value = '50';
            LabelQTYSPE.innerHTML = '50';
        }
        else
        if(parseInt(NumOfLicensesSPE.value) >=50)
        {
            LabelQTYSPE.innerHTML = NumOfLicensesSPE.value;
        }
        else
            document.getElementById('infoNumOfLicenses').style.display = 'none';
       
        CalculatePriceOrderEvolution();
    }   
    else
    {
         LabelQTYSPE.innerHTML = NumOfLicensesSPE.value;
         CalculatePriceOrderEvolution();
         document.getElementById('infoNumOfLicenses').style.display = 'none';
    
    }
    
    
   
}

function CheckNumberOfLicensesSPEExistingCustomers()
{
    if(radioButtonInhouse.checked)
    {
        if(parseInt(NumOfLicensesSPE.value) < 50)
        {
            document.getElementById('infoNumOfLicenses').style.display = 'block';
            NumOfLicensesSPE.value = '50';
         
        }
        else
        if(parseInt(NumOfLicensesSPE.value) >=50)
            document.getElementById('infoNumOfLicenses').style.display = 'none';
       
        
    }   
    if(radioButtonHosted.checked)
    {
        
        
         document.getElementById('infoNumOfLicenses').style.display = 'none';
    
    }
    
    
   
}

function SPECompanyNameEnable()
{
    if(LicenseID.disabled == 'true')
    {
        ValidatorEnable(document.getElementById(getRfvCompany()), true);
    }
    
}


