// JavaScript Document
function setHeadline(elm, bg, pth, cl){
	var path = pth+"includes/js-bin/sIFR/garamond.swf";
	if (elm){elm = elm;} else {return false;};
	if (cl){cl = cl;} else {cl = "#000000";};
	if (bg){bg = bg;} else {bg = "#FFFFFF";};
	if (pth){pth = pth;} else {pth = "";};
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named(
		{
		sSelector:elm, 
		sFlashSrc:path, 
		sColor:cl, 
		sLinkColor:"#000000", 
		sBgColor:bg, 
		sHoverColor:"#000000", 
		nPaddingTop:0, 
		nPaddingBottom:0, 
		sFlashVars:"textalign=left&offsetTop=0"}));
	};
}

//
//onchange = function (){ jumpToMenu('parent',this); }
function jumpToMenu(t,obj){
  eval(t+".location='"+obj.options[obj.selectedIndex].value+"'");
  //alert(obj.options[obj.selectedIndex].value)
}

function openWhereToBuy()
{
    //window.open('http://scotts.findlocation.com/search.aspx?search_param=R50&postalcode=&productlist_orcontains=~022680~,~022683~,~022686~,~022983~,~022618~,~022690~,~022687~,~022187~,~022987~,~022685~,~022684~,~022184~,~022984~,~022694~,~022691~,~022791~,~022991~,~022816~,~022813~,~022810~,~022819~,~022828~,~022825~,~022831~,~022834~,~022822~','','scrollbars=no,menubar=no,height=650,width=700,resizable=yes,toolbar=no,location=no,status=no');
	window.open('http://www.scotts.com/smg/locateRetailers/locateRetailers.jsp?header=header','','scrollbars=yes,menubar=yes,height=650,width=940,resizable=yes,toolbar=yes,location=yes,status=yes');    
}

//Pop-up window on domain exit
var outlink=false;

window.onunload=function(){
	if(!outlink && getCookie('survey') != '1'){
		setCookie('survey','1',365)
		window.open('http://websurveyor.net/wsb.dll/15578/WildBirdFoodSurvey.htm','','scrollbars=no,menubar=no,height=650,width=700,resizable=yes,toolbar=no,location=no,status=no');
	}
}
	
function testLinks(){
	for(var i=0;i<document.links.length;i++){
		document.links[i].onmousedown=function(){
			var siteURL="scottswildbirdfood";
			var thisURL=this.href;
			if (thisURL.search(siteURL) > 0){outlink=true;}
			//alert(thisURL.search(siteURL))
			return true;
		};
	}
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}