var Framing_Product_Price = 0;
var Framing_Frame_Price = 0;
var Framing_Matte_Price = 0;
var PopToCartSupport = '';
var MatteOptName = '';
var FrameOptName = '';




function change_option(divtochange, name, image_file, optionid, price)
{
	//document.getElementById('theframe').style.backgroundImage = 'url('+image_file+')';
	if (document.getElementById(divtochange+'_price'))
	{
		Framing_Frame_Price = price;
		document.getElementById(divtochange+'_price').innerHTML = format_price(Framing_Frame_Price);
		document.getElementById('framing_total').innerHTML = format_price(Framing_Product_Price+Framing_Frame_Price);
	}
}



function change_frame(name, image_file, optionid, price)
{
	document.getElementById('theframe').style.backgroundImage = 'url('+image_file+')';
	Framing_Frame_Price = price;
	document.getElementById('frame_price').innerHTML = format_price(Framing_Frame_Price);
	document.getElementById('framing_total').innerHTML = format_price(Framing_Product_Price+Framing_Frame_Price+Framing_Matte_Price);

}

function change_matte(name, image_file, optionid, price)
{
	document.getElementById('thematte').style.backgroundImage = 'url('+image_file+')';
	Framing_Matte_Price = price;
	document.getElementById('matte_price').innerHTML = format_price(Framing_Matte_Price);
	document.getElementById('framing_total').innerHTML = format_price(Framing_Product_Price+Framing_Frame_Price+Framing_Matte_Price);

}


function format_price(num) {
num = eval(num);
num *= 100;
num = Math.round(num)/100;

	if (num - Math.floor(num) == 0) {
		num = num + ".00";
	} else {
		string = num.toString();
		parts = string.split(".");
		cents = parts[1];
			if (cents.length == 1) {
				num = num + "0";
				}
	}

//num = "$" + num;
return num;
}



function check_framing_exceptions()
{
	if (framing_options == "Photo")
	{
	
	if((document.getElementById('frame_none').checked && !document.getElementById('matte_none').checked) || (!document.getElementById('frame_none').checked && document.getElementById('matte_none').checked))
		{
				exception_msg ="Please Select a Frame and a Matte!";
				return false;
		}
		else
		return true;
	}else if (framing_options == "Frame_Jersey_Generic")
		if((document.getElementById('frame_none').checked && !document.getElementById('style_none').checked) || (!document.getElementById('frame_none').checked && document.getElementById('style_none').checked))
		{
				exception_msg ="Please Select a Style and a Frame!";
				return false;
		}
		else
		return true;
	
	else
	return true;
}
