//Onmouseover Avatar
function onImg(ele, attributeID)
{
	if(obj.elements['pOption'+attributeID].value != ele.src) ele.className = 'optbdr_o';
}
//Onmouseout Avatar
function offImg(ele, attributeID)
{
	if(obj.elements['pOption'+attributeID].value != ele.src) ele.className = 'optbdr';
}

//Selects avatar
function selImg(ele, optionID, extraPrice, attributeID)
{
	if(obj.elements['currOption'+attributeID].value != "" && (imgOld = document.getElementById(obj.elements['currOption'+attributeID].value)))
	{
		imgOld.className = 'optbdr';
	}
	obj.elements['currOption'+attributeID].value = ele.id;
	obj.elements['pOption'+attributeID].value = ele.src;
	obj.elements['product_attribute_'+attributeID].value = optionID+'||'+extraPrice;
	ele.className = 'optbdr_s';
	//totalPrice = parseFloat(obj.total_price.value) + extraPrice;
	changePrice();
	//$('#product_price').html('$'+totalPrice);
}
function changePrice()
{
	attrIDs = obj.str_attributes.value.split('<||>');
	totalPrice = parseFloat(obj.base_price.value);
	for(var i = 0; i < attrIDs.length; i++)
	{
		arrTemp = obj.elements['product_attribute_'+attrIDs[i]].value.split('||');
		totalPrice+= parseFloat(arrTemp[1]);
	}
	obj.total_price.value = totalPrice;
	$('#product_price').html('$'+totalPrice.toFixed(2));
}


function addToCart(productID)
{
	strAttributes = '';
	if(obj.str_attributes)
	{
		arrAttrIDs = obj.str_attributes.value.split("<||>");
		for(var j = 0 ; j < arrAttrIDs.length; j++)
		{
			strAttributes+= (strAttributes == '')? arrAttrIDs[j]+'||'+obj.elements['product_attribute_'+arrAttrIDs[j]].value: '<==>'+arrAttrIDs[j]+'||'+obj.elements['product_attribute_'+arrAttrIDs[j]].value;
		}
	}
	self.location = webServer+"/cart_process.php?opt=add&new_price="+obj.total_price.value+"&attributes="+strAttributes+"&id="+productID+'&hash='+parseInt(Math.random() * 10000000000);

}
































