function Glow(whichImage) {
	if (document.images) {
		document[whichImage].src = allMyImages[whichImage]["over"].src;
		gWhichGlowing = whichImage;
	}
}

function DeGlow(){
	if (document.images) {
		document[gWhichGlowing].src = allMyImages[gWhichGlowing]["out"].src;
		gWhichGlowing = "";
	}
}

function windowPop(url, name, width, height, scrollboolean) {
	var params;
	if (scrollboolean != "") {
		params = "scrollbars="+scrollboolean;
	} else {
		params = "scrollbars=0";
	}
	params= params + ",location=0,menubar=0,status=0,toolbar=0,resizable=1,top=40,left=40,";
	params = params + "width=" + width + ",height=" + height; 
	window.open(url, name, params).focus();
}

function recipePopUp(id) {
	var name = "recipezoom";
	var width = 300;
	var height = 327;
	var url = "recipezoom.asp?recipeID=" + id;
	var params="scrollbars=0,location=0,menubar=0,status=0,toolbar=0,resizable=1,top=40,left=40,";
	var params = params + "width=" + width + ",height=" + height; 
	window.open(url, name, params).focus();
}

function toggleDiv(itemid) {
	var changeMe = document.getElementById(itemid);
	if ((changeMe.style.display == "none") || (changeMe.style.display == "")) {
		changeMe.style.display="block";
	} else {
		changeMe.style.display="none";
	}
}
function hideLink() {
	var myObj;
	myObj = document.getElementById("RecipeDetail_LargerImageLink");
	myObj.style.display="none";
}
function showLink() {
	var myObj;
	myObj = document.getElementById("RecipeDetail_LargerImageLink");
	myObj.style.display="block";
}

function openUPC() {
	var wt=325;
	var ht=195;
	var str="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,screenx=30,screeny=20,width="+wt+",height="+ht+",top=50,left=50";
	HomePop=window.open("upc.aspx","upcPop",str);
	HomePop.focus();
}

function openManu() {
	var wt=450;
	var ht=300;
	var str="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,screenx=30,screeny=20,width="+wt+",height="+ht+",top=50,left=50";
	HomePop=window.open("manufacturingcode.aspx","manuPop",str);
	HomePop.focus();
}

function tagExternal(link){
	clickTag(2,link);
}

function tagAction(name){
	clickTag(x4,name);
}

function tagDownload(path){
	clickTag(1,path);
}

// This replaces sage_ev
function clickTag(n, v)
{
	sage_ev(n, v);
}

var iObj,fObj,mObj;
function showDDL(t,strObj,f) {
	var sObj = document.getElementById(strObj);
	iObj = t;
	fObj = f || "rc";
	mObj = strObj;
	
	sObj.style.top = ((t.offsetTop + t.offsetHeight) + 1) + "px";
	sObj.style.left = t.offsetLeft + "px";
	sObj.style.width = t.offsetWidth + "px";

	if((sObj.style.display == "none") || (sObj.style.display == "")) {
		sObj.style.display = "block";
	} else {
		sObj.style.display = "none";
	}
	
	sObj.onmousedown = setNav;
	document.onmousedown = hideNav;
	
}
function setNav(evt) {
	e = (evt)?evt.target:event.srcElement;
	
	val = (e.innerText) ? e.innerText : e.text;
	id = e.getAttribute("CollectionId")
	
	iObj.value = val;
	document.getElementById(fObj).value = id;
	//alert(document.getElementById(fObj).id + ": " + document.getElementById(fObj).value + " :: " + id);
	e.style.color = "#666666";
	e.style.background = "#FFFFFF";
	e.parentNode.style.display = "none";
}
function hideNav(evt) {
	e = (evt)?evt.target:event.srcElement;
	
	if(document.getElementById(mObj).style.display == "block" && e!=iObj) {
		document.getElementById(mObj).style.display = "none";
	}
}
function setDefaultNav(f){
	fObj = f || "rc";
	
}

function goBrowse(){
	window.location.href =  'SpecialtyCollection.aspx?rc=' + document.getElementById(fObj).value;
	//window.location.href = 'mealideas.aspx?rc=' + document.getElementById(fObj).value;
}

function clearText(thefield){
	if (thefield.value.toLowerCase()=="title or ingredient"){
		thefield.value = ""
	}
}
var holdOrigID;
function setTrapID(t,id) {
	if(typeof trapID == "string") {
		trapID = id;
	}
	t.onblur = function() {
		if(t.value=="") {
			trapID = holdOrigID;
		}
	}
}

function addBookmark() {
	var url = window.location;
	var title = "Campbell's Kitchen - Tasty Tuesday"
	
	if(/msie/i.test(navigator.userAgent)) {
		window.external.addFavorite(url, title)
	}
}		

var liveWorldURL = "http://kitchentable-campbells.forums.liveworld.com/entry.jsp";
function alterFormAction() {
	//alert(document.body.innerHTML);
	document.forms[0].submit();
}
function checkExist(path) {
	var print = false;
	var css = document.styleSheets;
	for(i=0;i<css.length;i++) {
		if(css[i].href.indexOf("printrecipe")!=-1) {
			print = true;
		}
	}
	var zoom = new Image();
	zoom.src = path;
	if(!print) zoom.onload = showLink;
}

function printMe() {
	if (window.print()) {
		window.print();
	}
}

function writeWindowsMedia(strFileName, strAutoStart, intWidth, intHeight){
	document.write("<object ID=RVOCX CLASSID=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" WIDTH=" + intWidth + " HEIGHT=" + intHeight + ">");
	document.write("<param NAME=\"SRC\" VALUE=\"" + strFileName + "\">");
	document.write("<param NAME=\"CONTROLS\" VALUE=\"ImageWindow\">");
	document.write("<param NAME=\"CONSOLE\" VALUE=\"one\">");
	document.write("<param NAME=\"CENTER\" VALUE=\"TRUE\">");
	document.write("<param NAME=\"MAINASPECT\" VALUE=\"false\">");
	document.write("<param NAME=\"AUTOSTART\" VALUE=\"" + strAutoStart + "\">");
	document.write("<embed type=\"audio/x-pn-realaudio-plugin\" SRC=\"" + strFileName + "\" WIDTH=" + intWidth + " HEIGHT=" + intHeight + " NOJAVA=true CONTROLS=ImageWindow CONSOLE=one AUTOSTART=" + strAutoStart + "></embed>");
	document.write("</object>");
	document.write("<br>");
	document.write("<object ID=RVOCX CLASSID=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" WIDTH=" + intWidth + " HEIGHT=36>");
	document.write("<param NAME=\"CONTROLS\" VALUE=\"ControlPanel\">");
	document.write("<param NAME=\"CONSOLE\" VALUE=\"one\">");
	document.write("<embed type=\"audio/x-pn-realaudio-plugin\" SRC=\"" + strFileName + "\" WIDTH=" + intWidth + " HEIGHT=36 NOJAVA=true CONTROLS=ControlPanel CONSOLE=one></embed>");
	document.write("</object>");
	document.write("<br>");
	document.write("<object ID=RVOCX CLASSID=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" WIDTH=" + intWidth + " HEIGHT=30>");
	document.write("<param NAME=\"CONTROLS\" VALUE=\"StatusBar\">");
	document.write("<param NAME=\"CONSOLE\" VALUE=\"one\">");
	document.write("<embed type=\"audio/x-pn-realaudio-plugin\" SRC=\"" + strFileName + "\" WIDTH=" + intWidth + " HEIGHT=36 NOJAVA=true CONTROLS=StatusBar CONSOLE=one></embed>");
	document.write("</object>");
}

function writeWindowsMedia(strFileName, strAutoStart, intWidth, intHeight){
	document.write("<object ID=\"MediaPlayer\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" standby=\"Loading Media Player\" width=" + intWidth + " height=" + intHeight + " type=\"application/x-oleobject\">");
	document.write("<param NAME=\"FileName\" VALUE=\"" + strFileName + "\">");
	document.write("<param NAME=\"AutoStart\" Value=\"" + strAutoStart + "\">");
	document.write("<param NAME=\"ShowControls\" VALUE=\"True\">");
	document.write("<param NAME=\"ShowStatusBar\" VALUE=\"True\">");
	document.write("<param NAME=\"ShowDisplay\" VALUE=\"False\">");
	document.write("<param NAME=\"AllowChangeDisplaySize\" VALUE=\"TRUE\">");
	document.write("<param NAME=\"DisplaySize\" VALUE=\"0\">");
	document.write("<param NAME=\"AutoSize\" VALUE=\"true\">");
	document.write("<embed type=\"application/x-mplayer2\" ");
	document.write("pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" ");
	document.write("SRC=\"" + strFileName + "\" ");
	document.write("width=" + intWidth + " ");
	document.write("height=" + intHeight + " ");
	document.write("name=\"MediaPlayer\" ");
	document.write("autostart=\"" + strAutoStart + "\" ");
	document.write("ShowStatusBar=1 ");
	document.write("ShowDisplay=0 ");
	document.write("ShowControls=1 ");
	document.write("AllowChangeDisplaySize=\"TRUE\" ");
	document.write("DisplaySize=\"0\" ");
	document.write("AutoSize=\"false\">");
	document.write("</embed>");
	document.write("</object>");
}

function openProduct(link) {
	if (link) {
		var win = window.open(link.href,'product_popup','width=600,height=475,menubar=no,resizable=no,status=no,toolbar=no');
		win.focus();
	}
		
	return false;
}

//SwansonBrothKitchen Homepage CollectionNav
var cnLastSelected = "";
var cnLastBelow = "";
var cnSelected = "";
var cnBelow = "";
var lastCnKey = "last";

function collectionnavSelected(navItemSelected,navItemBelow) {
	bottomImg = document.getElementById('cnBottomImg');
	// set the first item as selected, if no item explicitly set to selected
	if (cnSelected == "") {
		document.getElementById('cnOpen_first').style.display = "none";
		document.getElementById('navItem_first').src = "images/specialty/swansonbroth/cn_first_off.gif";
		document.getElementById('navItem_second').src = "images/specialty/swansonbroth/cn_second_off.gif";
		document.getElementById('navItem_third').src = "images/specialty/swansonbroth/cn_third_off.gif";
	} else {
		cnLastSelected = cnSelected;
		cnLastBelow = cnBelow;
	}
	
	
	cnSelected = navItemSelected;
	cnBelow = navItemBelow;

	if (cnSelected != cnLastSelected) {

		cnSelectedImg = document.getElementById('navItem_' + cnSelected);
		cnLastSelectedImg = document.getElementById('navItem_' + cnLastSelected);
		if (cnSelected != lastCnKey) {
			cnBelowImg = document.getElementById('navItem_' + cnBelow);
		}
		if (cnSelected != lastCnKey) {cnLastBelowImg = document.getElementById('navItem_' + cnLastBelow);}
		
		if (cnSelected != lastCnKey && cnLastSelected != "" && cnLastSelected != lastCnKey) {cnLastBelowImg.src = "images/specialty/swansonbroth/cn_" + cnLastBelow + "_off.gif";}
		cnSelectedImg.src = "images/specialty/swansonbroth/cn_" + cnSelected + "_on.gif";
		if (cnLastSelected != "") {cnLastSelectedImg.src = "images/specialty/swansonbroth/cn_" + cnLastSelected + "_off.gif";}
		if (cnSelected != lastCnKey) {
			cnBelowImg.src = "images/specialty/swansonbroth/cn_" + cnBelow + "_onabove.gif";
		}
		
		cnItemInfo = document.getElementById('cnOpen_' + cnSelected);
		cnItemInfo.style.display = "inline";
		
		if (cnLastSelected != "") {
			cnLastItemInfo = document.getElementById('cnOpen_' + cnLastSelected);
			cnLastItemInfo.style.display = "none";
		}

		if (cnSelected == lastCnKey) { bottomImg.src = "images/specialty/swansonbroth/cn_on_bottom.gif"; } else { bottomImg.src = "images/specialty/swansonbroth/cn_off_bottom.gif"; }
	}
}

function openHolidayVideo() {
	var videoPopup = window.open('http://www.cscassets.com/holidayvideo/videoPlayer.html','holidayvideo','width=360,height=290,scrollbars=no,menubar=no,resizable=no,toolbar=no,location=no,status=no');
}

// IE6 bg flicker
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}