function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
/*
function toggledd(div_id) {
	var dd = document.getElementById(div_id);
	if ( dd.style.visibility == 'visible' ) {	dd.style.visibility = 'hidden';}
	else {dd.style.visibility = 'visible';}
}
*/
function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
		viewportwidth = window.innerWidth;
	} else {
		viewportheight = document.documentElement.clientHeight;
		viewportwidth = document.documentElement.clientWidth;
	}
	
	if (typeof window.pageYOffset != 'undefined') {
		scrOfY = window.pageYOffset;
	} else {
		scrOfY = document.documentElement.scrollTop;
	}
	

	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		blanket_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			blanket_width = document.body.parentNode.clientWidth;
		} else {
			blanket_width = document.body.parentNode.scrollWidth;
		}
	}
	
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	blanket.style.width = blanket_width + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	//popUpDiv_height=blanket_height/2-150;//150 is half popup's height
	popUpDiv_height=scrOfY+(viewportheight/2-220);//150 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-290;//150 is half popup's width
	popUpDiv.style.left = window_width + 'px';
}
function window_pos2(popUpDivVar,width) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-width/2;//half popup's width
	popUpDiv.style.left = window_width + 'px';
}
function popup2(windowname,width) {
	document.getElementById('imgname').style.width = width - 5 + "px";
	//document.getElementById('imgcake').style.width = width + "px";
	document.getElementById('popUpDiv').style.width = width + "px";
	//document.getElementById('catlist').style.visibility = "hidden";
	blanket_size(windowname);
	window_pos2(windowname,width);
	toggle('blanket');
	toggle(windowname);
	//toggledd('catlist');
}
function popup(windowname) {
	//document.getElementById('catlist').style.visibility = "visible";
	blanket_size(windowname);
	window_pos(windowname);
	toggle('blanket');
	toggle(windowname);
	//toggledd('catlist');
}

function imgdesc(img_dir,img_src,img_name) {
	//document.getElementById('imgcake').src = '/images/foodfav/bakery/cakes/lg/' + img_src;  //Did not work in IE6
	//document.getElementById('imgcake').innerHTML = "<img src='/images/foodfav/bakery/cakes/lg/" + img_src + "' border='0' />";
	document.getElementById('imgcake').innerHTML = "<img src='/images/foodfav/bakery/"+ img_dir + "/lg/" + img_src + "' />";
	//document.getElementById('imgcake').innerHTML = "<img src='http://www.reasors.com/images/foodfav/bakery/cakes/lg/" + img_src + "' />";
	//document.getElementById('imgcake').src = "/images/foodfav/bakery/cakes/lg/" + img_src;
	//document['imgcake'].src = '/images/foodfav/bakery/cakes/lg/' + img_src;
	document.getElementById('imgname').innerHTML = img_name;
}

function pieimgdesc(img_dir,img_src,img_name,img_desc) {
	document.getElementById('imgcake').innerHTML = "<img src='/images/foodfav/bakery/" + img_dir + "/" + img_src + "' />";
	document.getElementById('imgname').innerHTML = "<b>" + img_name + ":</b> " + img_desc;
}

function trayimgdesc(img_dir,img_src,img_name,img_desc) {
	document.getElementById('imgcake').innerHTML = "<img src='/images/foodfav/" + img_dir + "/" + img_src + "' />";
	document.getElementById('imgname').innerHTML = "<b>" + img_name + ":</b> " + img_desc;
}
