function changeOptionPrice(sizeselect)
{	
	setAdditionalInfo(sizeselect);
	
	if (typeof document.le_form.ComplexFeatures_holder != 'undefined')
	{
		document.le_form.ComplexFeatures_holder[sizeselect].checked=true;
	}	
	if (document.le_form.CurrencyCode)
	{
		for(k=0;k<document.le_form.CurrencyCode.length;k++)
		{
			if ( document.le_form.CurrencyCode[k].checked)
			{
				for(j=0;j<document.le_form.ComplexFeatures.length;j++)
				{
					if ( document.le_form.ComplexFeatures[j].checked)
					{
						var compFeatValue = document.le_form.ComplexFeatures[j].value;
						var compFeatArrayValue = compFeatValue.split("|");
						compFeatArrayValue[3] = pricearray[k][sizeselect];
						CompFeatToStr = compFeatArrayValue.join("|");
						document.le_form.ComplexFeatures[j].value=CompFeatToStr;
					}	
				}
				var currsym="";
				if (typeof tmpcurrencyArray != 'undefined')
				{
					for(l=0;l<tmpcurrencyArray.length;l++)
					{
						if (tmpcurrencyArray[l] == document.le_form.CurrencyCode[k].value)
						{
							if (symbolArray)
							{
								var currsym=symbolArray[l];
							}	
						}	
					}					
				}
				if(document.getElementById)
				{
					if (typeof document.le_form.ComplexFeatures_holder != 'undefined')
					{
						var tmp_radioval = document.le_form.ComplexFeatures_holder[sizeselect].value;
						var tmp_radioArrayValue = tmp_radioval.split("|");
						tmp_radioArrayValue[3] = pricearray[k][sizeselect];
						tmp_radioStr = tmp_radioArrayValue.join("|");
						document.le_form.ComplexFeatures.value=tmp_radioStr;						
						GetDiv("comp_addinfo_Msg").innerHTML = popimagearray[sizeselect][5];
					}	
					GetDiv("comp_Price_Msg").innerHTML = currsym+pricearray[k][sizeselect];	
					GetDiv("comp_productid_Msg").innerHTML = optionidarray[sizeselect];
				}	
			}
		}	
	}
}

function changeCurrency(currsel)
{
	// If the complex option is an array then do this bit
	if (document.le_form.ComplexFeatures[0])
	{
		for(i=0;i<document.le_form.ComplexFeatures.length;i++)
		{
			if ( document.le_form.ComplexFeatures[i].checked)
			{
				var compFeatValue = document.le_form.ComplexFeatures[i].value;
				var compFeatArrayValue = compFeatValue.split("|");
				compFeatArrayValue[3] = pricearray[currsel][i];
				CompFeatToStr = compFeatArrayValue.join("|");
				document.le_form.ComplexFeatures[i].value=CompFeatToStr;	
				if(document.getElementById)
				  GetDiv("comp_Price_Msg").innerHTML = pricearray[currsel][i];	
			}
		}
	}
	// otherwise treat it as a one radio option
	else
	{
		var compFeatValue = document.le_form.ComplexFeatures.value;
		var compFeatArrayValue = compFeatValue.split("|");
		compFeatArrayValue[3] = pricearray[currsel][0];
		CompFeatToStr = compFeatArrayValue.join("|");
		document.le_form.ComplexFeatures.value=CompFeatToStr;	
		if(document.getElementById)
		  GetDiv("comp_Price_Msg").innerHTML = pricearray[currsel][0];	
	}
}

function currCookieUpdater(cookiename, selectedCurr, loopy)
{	
	var cookieExpiry = new Date((new Date()).getTime() + 750*36000000);
	SetCurrCookie (cookiename, selectedCurr, cookieExpiry, loopy);

	var currsym="";
	if (document.le_form)
	{
		if (document.le_form.CurrencyCode)
		{
			for(o=0;o<document.le_form.CurrencyCode.length;o++)
			{
				if (document.le_form.CurrencyCode[o].checked)
				{
					if (typeof tmpcurrencyArray != 'undefined')
					{
						for(p=0;p<tmpcurrencyArray.length;p++)
						{
							if (tmpcurrencyArray[p] == document.le_form.CurrencyCode[o].value)
							{
								if (symbolArray)
								{
									var currsym=symbolArray[p];
									if(optionidarray)
										var optionpicker=optionidarray.length-1;
									else
										var optionpicker=0;
										
									if(document.getElementById)
									{
										if(document.getElementById('comp_Price_Msg'))									
											GetDiv("comp_Price_Msg").innerHTML = currsym+pricearray[loopy][optionpicker];
										if(document.getElementById('comp_Price_Msg_main'))									
											GetDiv("comp_Price_Msg_main").innerHTML = currsym+pricearray[loopy][optionpicker];
									}	
									document.le_form.ComplexFeatures_holder[optionpicker].checked=true;
									var tmp_radioval = document.le_form.ComplexFeatures_holder[optionpicker].value;
									var tmp_radioArrayValue = tmp_radioval.split("|");
									tmp_radioArrayValue[3] = pricearray[loopy][optionpicker];
									tmp_radioStr = tmp_radioArrayValue.join("|");
									document.le_form.ComplexFeatures.value=tmp_radioStr;	
									changeOptionPrice(optionpicker);
									changeImage(optionpicker);
									change3dimages(optionpicker);
								}	
							}
						}					
					}
				}					
			}
		}
	}	
}
function SetCurrCookie (name,value,expires,loopy)
{
//    alert(name.toUpperCase() + "=" + escape (value) + "; expires=" + expires.toGMTString());
	document.cookie = name.toUpperCase() + "=" + escape (value) + "; path=/; expires=" + expires.toGMTString();
	if (document.le_form)
	{
		if (document.le_form.ComplexFeatures)
		{
			changeCurrency(loopy);
		}	
	}	
}

function setAdditionalInfo(i){
	var strText = popimagearray[i][5];
	GetDiv("comp_addinfo_Msg").innerHTML = strText;
}

