var cookedstatus;
var copystatus;
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}
function changeImage(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
		else document.images[imgName].src = eval(imgObj+".src");
	}
}
//function initcooked() {
//		cooked = new CheckBox('cookedImg','cooked','single',false);
//	}

preload('checkbox0','/images/CookedOff.gif');
preload('checkbox1','/images/cookedOn.gif');

preload('copy0','/images/copyAdd_On.gif');
preload('copy1','/images/copyAdd_Off.gif');


function CheckBox(imgName,trueValue,falseValue,defaultToTrue) {
		this.imgName = imgName
		this.trueValue = trueValue
		this.falseValue = falseValue
		this.state = (defaultToTrue) ? 1 : 0
		this.value = (this.state) ? this.trueValue : this.falseValue
		this.change = CheckBoxChange
	}
function CheckBoxChange() {
		imgName = this.imgName
		this.state = (this.state) ? 0 : 1
		this.value = (this.state) ? this.trueValue : this.falseValue
		if (imgName.indexOf('cooked')>=0) {
			changeImage(this.layer,this.imgName,'checkbox'+this.state)
			cookedstatus = this.state;
		}
		else {
			changeImage(this.layer,this.imgName,'copy'+this.state)
			copystatus = this.state;
		}
	}
function changeCheckBox(pid) {
	//alert(document.getElementById('cooked'+pid).value);
	document.getElementById('cooked'+pid).value=(cookedstatus) ? 'Y' : 'N';
}
function changeGiftCheckBox(pid) {
	//alert(document.getElementById('cooked'+pid).value);
	document.getElementById('giftitem'+pid).value=(giftstatus) ? 'Y' : 'N';
}
function changeGiftBox(pid) {
	selectedValue = document.getElementById('cooked'+pid).value;
	if (selectedValue == 'Y')
		selectedValue = 'N';
	else
		selectedValue = 'Y';
	document.getElementById('giftitem'+pid).value=selectedValue;
}


//window.onload = initcooked;