function clearField(field,defaultMsg){
	if(field.value == defaultMsg){
		field.value = '';
	}
}
function defaultField(field,defaultMsg){
	if(field.value == ''){
		field.value = defaultMsg;
	}
}


/* CONDENSED SOUPS rollover code */
function imageChange(imageID,imageName) {
  document.images[imageID].src= eval(imageName + ".src");
}

healthy = new Image();
healthy.src = "images/condensed/navbar_healthy.png";
healthy_over = new Image();
healthy_over.src = "images/condensed/navbar_healthy-over.png";
classics = new Image();
classics.src = "images/condensed/navbar_classics.png";
classics_over = new Image();
classics_over.src = "images/condensed/navbar_classics-over.png";
favorites = new Image();
favorites.src = "images/condensed/navbar_favorites.png";
favorites_over = new Image();
favorites_over.src = "images/condensed/navbar_favorites-over.png";
cooking = new Image();
cooking.src = "images/condensed/navbar_cooking.png";
cooking_over = new Image();
cooking_over.src = "images/condensed/navbar_cooking-over.png";
fun_favorites = new Image();
fun_favorites.src = "images/condensed/navbar_fun_favorites.png";
fun_favorites_over = new Image();
fun_favorites_over.src = "images/condensed/navbar_fun_favorites-over.png";
/* end CONDENSED SOUPS rollover code */

if (document.images) {
	var imageNames = new Array("tn_home","tn_recipes","tn_recipebox","tn_collections");
	var imagePath = "images/";
	var imageExtension = ".gif";
	var allMyImages = new Array(imageNames.length);
	var curName = "";
	var gWhichGlowing = "";
	
	for (var i=0; i<imageNames.length; i++) {
		curName = imageNames[i];
		allMyImages[curName] = new Array("over","out");
		allMyImages[curName]["out"] = new Image();
		allMyImages[curName]["out"].src = imagePath+curName+imageExtension;
		allMyImages[curName]["over"] = new Image();
		allMyImages[curName]["over"].src = imagePath+curName+"-over"+imageExtension;
	}
}

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 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 openVideo() {
	var videoPopup = window.open('lowersodiumvideo.aspx','lowersodiumvideo','width=400,height=345,scrollbars=no,menubar=no,resizable=no,toolbar=no,location=no,status=no');
}

function tagExit(obj, type){
	var s_click = s_gi(s_account);
	s_click.tl(this, 'e', type);
}


function tagExternal(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;
function showDDL(t,strObj) {
	var sObj = document.getElementById(strObj);
	iObj = t;
	
	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.onclick = setNav;
	
}
function setNav(evt) {
	e = (evt)?evt.target:event.srcElement;
	
	val = (e.innerText) ? e.innerText : e.text;
	id = e.getAttribute("CollectionId")
	
	
	
	e.parentNode.style.display = "none";
	iObj.value = val;
	document.forms[0].rc.value = id;
}
/*==============================================================================
  Cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
==============================================================================*/
function addEvent(element, eventType, functionToCall, useCapture) {
 	if (element.addEventListener) { // DOM standard
		element.addEventListener(eventType, functionToCall, useCapture);
		return true;
	} else if (element.attachEvent) { // IE's model
		var r = element.attachEvent('on' + eventType, functionToCall);
		return r;
	} else { // for browsers which support neither method
		element['on' + eventType] = functionToCall;
	}
}

/*==============================================================================
  Get source of event
==============================================================================*/
function getSource(e) {
	if (typeof e == 'undefined') {
	 	var e = window.event;
	}
	
	var source;
	if (typeof e.target != 'undefined') {
		source = e.target;
	} else if (typeof e.srcElement != 'undefined') {
		source = e.srcElement;
	} else {
		return;
	}
	
	return source;
}
	
/*==============================================================================
  StockPots
==============================================================================*/
function changeSoup(soupName) {
	var soups = ["adobechx","tomato","broccoli","potato","crabcorn","minestrone","chowder","chili","veggie","chixrice","noodle","tortilla"];

	//hide all soups
	for (i=0;i<soups.length;i++) {
		//soupID = soups[i];
		document.getElementById('stockpot_content_' + soups[i]).style.display = "none";
	}	

	//show soup
	document.getElementById('stockpot_content_' + soupName).style.display = "inline";
}

// IE6 bg flicker
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


/*==============================================================================
  Select Harvest Phase 2
==============================================================================*/
function showNutrition(productid){
	var win = window.open(('select-nutrition-popup.aspx?brand=select&prd_product_id=' + productid),'product_popup','width=600,height=475,menubar=no,resizable=no,status=no,toolbar=no');
	win.focus();
}

function productView(productName)
{
	var s_click = s_gi(s_account);
	s_click.events='event2';
	s_click.eVar28 = productName;
	s_click.prop28 = productName;
	s_click.t();
}

var holdOrigID;
function setTrapID(t,id) {
	if(typeof trapID == "string") {
		trapID = id;
	}
	t.onblur = function() {
		if(t.value=="") {
			trapID = holdOrigID;
		}
	}
}
