<!--
var shabbychic = "url(img/frames/bpwhiteframe.jpg)";
var blackframe = "url(img/frames/bpblackframe.jpg)";
var goldframe = "url(img/frames/bpgoldframe.jpg)";
var cherryframe = "url(img/frames/bpcherryframe.jpg)";
var oakframe = "url(img/frames/bpoakframe.jpg)";

var shabbychicsample = "img/frames/shabby-chic-frame.jpg";
var blackframesample = "img/frames/black-frame.jpg";
var goldframesample = "img/frames/gold-frame.jpg";
var cherryframesample = "img/frames/cherry-frame.jpg";
var oakframesample = "img/frames/bpoakframe.jpg";


var framesample = "img/frames/cherry-frame.jpg";

var is_matted = -1;
var is_framed = -1;

var imgtop = 0;
var imgleft = 0;
var imgheight = 0;
var imgwidth = 0;

var smimgtop = 0;
var smimgleft = 0;
var smimgwidth = 0;
var smimgheight = 0;


function initl(){
document.product.mat.options[0].selected = true;
document.product.frame.options[0].selected = true;
document.product.ID1.options[0].selected = true;
blackframe = "url(img/frames/blblackframe.jpg)";
goldframe = "url(img/frames/blgoldframe.jpg)";
cherryframe = "url(img/frames/blcherryframe.jpg)";
oakframe = "url(img/frames/bloakframe.jpg)";
shabbychic = "url(img/frames/blwhiteframe.jpg)";
imgtop = findTop('img');
imgleft = findLeft('img');	
imgheight = findHeight('img') - 1;
imgwidth = findWidth('img') - 1;

fcuropt();

}
function initp(){

document.product.mat.options[0].selected = true;
document.product.frame.options[0].selected = true;
document.product.ID1.options[0].selected = true;
blackframe = "url(img/frames/bpblackframe.jpg)";
goldframe = "url(img/frames/bpgoldframe.jpg)";
cherryframe = "url(img/frames/bpcherryframe.jpg)";
oakframe = "url(img/frames/bpoakframe.jpg)";
shabbychic = "url(img/frames/bpwhiteframe.jpg)";
var shabbychicsample = "img/frames/shabby-chic-frame.jpg";
var blackframesample = "img/frames/black-frame.jpg";
var goldframesample = "img/frames/gold-frame.jpg";
var cherryframesample = "img/frames/cherry-frame.jpg";
var oakframesample = "img/frames/bpoakframe.jpg";

imgtop = findTop('img');
imgleft = findLeft('img');	
imgheight = findHeight('img') - 1;
imgwidth = findWidth('img') - 1;

fcuropt();

}

function matframeck(area){

var matvalue=document.product.mat.options[document.product.mat.selectedIndex].value;
var framevalue=document.product.frame.options[document.product.frame.selectedIndex].value;
var opt = document.product.ID1.options[document.product.ID1.selectedIndex].value; 

var printsize = "";
var optloc = 0;

if (opt.indexOf("11x14 Print") != -1){printsize = "11x14 Print";}
else if (opt.indexOf("12x16 Print") != -1){printsize = "12x16 Print";}
else if (opt.indexOf("9x12 Print") != -1){printsize = "9x12 Print";}
else if (opt.indexOf("6x9 Print") != -1){printsize = "6x9 Print";}
else if (opt.indexOf("8x10 Print") != -1){printsize = "8x10 Print";}
else if (opt.indexOf("5x7 Print") != -1){printsize = "5x7 Print";}
else {return;}

if (area == "fish"){
if (matvalue == "No Mat" && framevalue == "No Frame"){optloc = 0; document.getElementById('sampleimage').style.visibility = 'hidden';}
else if (matvalue != "No Mat" && framevalue == "No Frame"){optloc = 1;}
else if (matvalue != "No Mat" && framevalue != "No Frame"){optloc = 2;}
else {optloc =0;}
}
else if (area == "Calendar Print")
{
if (framevalue == "No Frame")
	{optloc = 1;} else {optloc = 2;} document.getElementById('sampleimage').style.visibility = 'hidden';}
else {
if (matvalue == "No Mat" && framevalue == "No Frame"){optloc = 0; document.getElementById('sampleimage').style.visibility = 'hidden';}
else if (matvalue != "No Mat" && framevalue == "No Frame"){optloc = 1;}
else if (matvalue != "No Mat" && framevalue != "No Frame"){optloc = 2;}
else {optloc =3;}

}

for (i = 0; i < document.product.ID1.options.length; i++){
	xopt = document.product.ID1.options[i].value; 
		if (xopt.match(printsize)){
		switch (optloc){
		case 0: // NO MAT NO FRAME
			if (xopt.match("Mat") != "Mat" && xopt.match("Frame") != "Frame"){
			document.product.ID1.options.selectedIndex = i; prodopts();}
			break;
		case 1: // MAT NO FRAME
			if (xopt.match("Mat") == "Mat" && xopt.match("Frame") != "Frame"){
			document.product.ID1.options.selectedIndex = i; prodopts();}
			break;
		case 2: // MAT AND FRAME
			if (xopt.match("Mat") == "Mat" && xopt.match("Frame") == "Frame"){
			document.product.ID1.options.selectedIndex = i; prodopts();}
			break;
		default: // NO MAT FRAME
			if (xopt.match("Mat ") != "Mat" && xopt.match("Frame") == "Frame"){
			document.product.ID1.options.selectedIndex = i; prodopts();}
			break;
		}	
	}
}
}

function showmat()
{

var bcolor = ""; 
var mcolor = "";
var newmat=document.product.mat.options[document.product.mat.selectedIndex].value;

var object = document.getElementById('mat');

if (is_matted == -1){ 
	bcolor = "thin solid ButtonFace";
	mcolor = "rgb(255,255,255)";
	document.product.mat.options[0].selected = true;}
else {
switch (newmat)
{
case "No Mat":
	bcolor = "0px solid ButtonFace";
	mcolor = "rgb(255,255,255)";
	
	break;
case "Cr/Green Mat":
	bcolor = "5px solid rgb(51,102,51)";
	mcolor = "rgb(251,244,221)";
	break;
case "Cr/Gold Mat":
	bcolor = "5px solid rgb(160,127,83)";
	mcolor = "rgb(251,244,221)";
	break;
case "Cr/Cr Mat":
	bcolor = "8px double rgb(255,242,211)";
	bcolor = "8px double rgb(246,238,214)";
	mcolor = "rgb(251,244,221)";
	break;
case "Dark Olive Mat":
	bcolor = "thin solid ButtonFace";
	mcolor = "rgb(53,21,3)";
	
	break;	
case "Cream Mat":
	bcolor = "thin solid ButtonFace";
	mcolor = "rgb(255,242,216)";
	mcolor = "rgb(251,244,221)";
	break;	
case "Green Mat":
	bcolor = "thin solid ButtonFace";
	mcolor = "rgb(52,69,41)";
	break;			
default:
	break;
}
}

var object = document.getElementById('img');
object.style.border = bcolor;

object = document.getElementById('matlayer');
object.style.backgroundColor = mcolor;

}	 

function fcuropt() {
	var opt=document.product.ID1.options[document.product.ID1.selectedIndex].value;
	var price = opt.substr(opt.lastIndexOf(",") + 1);
	var popts = opt.substr(0,opt.indexOf(","));
	
	document.product.fdesc.value =  popts +"@ $"+price;
	return;
} 

function prodopts()
{
var opt=document.product.ID1.options[document.product.ID1.selectedIndex].value;
var absent = -1;
fcuropt();

is_matted=opt.indexOf('Mat');
is_framed=opt.indexOf('Frame');

var imgobj = document.getElementById('img');
var matobj = document.getElementById('matlayer');
if (opt.indexOf('No Mat')!= -1) {is_matted = -1};
if (is_matted == absent){

	document.product.mat.options[0].selected = true;
	imgobj.style.border = "thin solid ButtonFace";
	document.getElementById('matlayer').style.visibility = 'hidden';

	setLayer('img', imgtop, imgleft , imgwidth , imgheight);
} else {
	setLayer('img', smimgtop, smimgleft, smimgwidth, smimgheight);
	document.getElementById('matlayer').style.visibility = 'visible';
	if (document.product.mat.options[0].selected == true)
	{document.product.mat.options[1].selected = true; showmat();}
}

if (is_framed == absent){ 
	document.product.frame.options[0].selected = true;
	document.getElementById('framelayer').style.visibility = 'hidden';
	document.getElementById('sampleimage').style.visibility = 'hidden';
} else {
	document.getElementById('framelayer').style.visibility = 'visible';
	if (document.product.frame.options[0].selected == true)
	{document.product.frame.options[1].selected = true; showframe();}
	if (is_matted == absent){imgobj.style.border = '0px solid ButtonFace'}
}
}

function initimage(img)
{		  
document.images.matimg.src=	img
}	

function showframe() {
var nframe=document.product.frame.options[document.product.frame.selectedIndex].value;
var opt=document.product.ID1.options[document.product.ID1.selectedIndex].value;
is_framed=opt.indexOf('Frame');
document.getElementById('framelayer').style.visibility = 'visible';
if (is_framed == -1)
{document.product.frame.options[0].selected = true; newImage = "url(img/noframe.jpg)"; document.getElementById('framelayer').style.visibility = 'hidden'; return}
else{
document.getElementById('sampleimage').style.visibility = 'visible';
switch (nframe)
{
case "Black Frame":
	newImage = blackframe;
	framesample = blackframesample;
	break;
case "Gold Frame":
	framesample = goldframesample;
	newImage = goldframe;
	break;
case "Cherry Frame":
	newImage = cherryframe;
	framesample = cherryframesample;
	break;
case "Honey Oak Frame":
	newImage = oakframe;
	break;
case "ShabbyChic Frame":
	framesample = shabbychicsample;
	newImage = shabbychic;
	break;	

default:     document.getElementById('sampleimage').style.visibility = 'hidden';
	newImage = "url(img/noframe.jpg)";
	break;
}
}
document.getElementById('framelayer').style.backgroundImage = newImage;
 document.getElementById("sampleimage").src=framesample; 

}   

function setcolor(objectID,ocolor) {
var object = document.getElementById(objectID);
	object.style.backgroundColor = ocolor;
} 
function setVisibility(objectID,state) {

var bcolor = "thin solid ButtonFace"; 
	var object = document.getElementById(objectID);
	if (object.style.visibility == 'visible') {object.style.visibility = 'hidden';}
	else {object.style.visibility = 'visible';}	
	
	object.style.border = bcolor;
}  
function setLayer(objectID, laytop, layleft, laywidth, layheight) {
		var object = document.getElementById(objectID);
		object.style.width = (laywidth -1) + 'px ';
		object.style.height = (layheight -1) + 'px ';
		object.style.left = (layleft -1) + 'px ';
		object.style.top = (laytop - 1) + 'px ';
		
		var object = document.getElementById('currentimage');
		object.style.width = (laywidth - 1) + 'px ';
		object.style.height = (layheight - 1) + 'px '; 
		
}
function setsmlayer(laytop, layleft, laywidth, layheight) {

	smimgleft = layleft;
	smimgtop = laytop;
	smimgwidth = laywidth;
	smimgheight = layheight;
}
function setClip(objectID, clipTop, clipRight, clipBottom, clipLeft) {
		var object = document.getElementById(objectID);
		object.style.clip = 'rect(' + clipTop + 'px ' + clipRight + 'px ' + clipBottom + 'px ' + clipLeft +'px)';
}
function setLayerid(objectID,layerNum) {
	var object = document.getElementById(objectID);
	object.style.zIndex = layerNum;
}	   
function findWidth(objectID) {
	var object = document.getElementById(objectID);
	if (object.offsetWidth) 
		return object.offsetWidth;
	return (null);
}
function findHeight(objectID) {
	var object = document.getElementById(objectID);
	if (object.offsetHeight) 
		return object.offsetHeight;
	return (null);
}
function showDim(objectID) {
	widthObj = findWidth(objectID);
	heightObj = findHeight(objectID);
	alert('Width: ' + widthObj + 'px; Height: ' + heightObj + 'px' );
	}	

function findLeft(objectID) {
	var object = document.getElementById(objectID);
	if (object.offsetLeft)
		return object.offsetLeft;
	return (null);
}
function findTop(objectID) {
	var object = document.getElementById(objectID);
	if (object.offsetTop)
		return object.offsetTop;
	return (null);
}
function findBottom(objectID) {
	var object = document.getElementById(objectID);
	if (object.offsetTop)
		return (object.offsetTop + object.offsetHeight);
	return (null);
}
function showPos(objectID) {
	if (objectID) {
		leftPos = findLeft(objectID);
		topPos = findTop(objectID);
		alert('Left: ' + leftPos + 'px; Top: ' + topPos + 'px' );
			}
}	
function findWidth(objectID) {
	var object = document.getElementById(objectID);
	if (object.offsetWidth) 
		return object.offsetWidth;
	return (null);
}

//-->
	
