// JavaScript Document

function initPage() {
	MM_preloadImages(
		'/images/leftnav/products_over.gif',
		'/images/leftnav/whatsnew_over.gif',
		'/images/leftnav/recipes_over.gif',
		'/images/leftnav/faqs_over.gif',
		'/images/leftnav/funzone_over.gif',
		'/images/leftnav/haveyoubeenstarkist_over.gif'
	);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function modalWinGirlFriend()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("charlie/ThinkTuna.html","name","dialogWidth:650px;dialogHeight:500px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open('charlie/ThinkTuna.html','name','height=500,width=650,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
} 
// sorry charlie
function modalWinSorry()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("charlie/Sorry_Charlie.html","name","dialogWidth:650px;dialogHeight:500px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open("charlie/Sorry_Charlie.html",'name','height=500,width=650,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
} 
//poetry
function modalWinPoetry()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("charlie/library.html","name","dialogWidth:650px;dialogHeight:500px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open("charlie/library.html","name",'height=500,width=650,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
} 
//tennis
function modalWinTennis()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("charlie/tennis.html","name","dialogWidth:650px;dialogHeight:500px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open("charlie/tennis.html",'name','height=500,width=650,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
} 
//wharf
function modalWinWharf()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("charlie/wharf.html","name","dialogWidth:650px;dialogHeight:500px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open("charlie/wharf.html",'name','height=500,width=650,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
} 
//priceless
function modalWinPriceless()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("charlie/priceless.html","name","dialogWidth:650px;dialogHeight:500px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open("charlie/priceless.html",'name','height=500,width=650,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
} 
// Martha Stewart
function modalWinMarthaStewart()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("/TedAllen.html","name","dialogWidth:639px;dialogHeight:520px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open("/TedAllen.html",'name','height=520,width=639,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
} 
// Ted Allen 
function modalWinTedAllen()
{
    if (window.showModalDialog) 
    {
        window.showModalDialog("/TedAllen.html","name","dialogWidth:325px;dialogHeight:250px;resizable:no;status:no;scroll:no;unadorned:yes");
    } 
    else 
    {
        window.open("/TedAllen.html",'name','height=250,width=325,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,modal=yes');
    }
}
// Signup click
function signupcilck()
{
    
     var emailvalue=document.getElementById('Registration1_txtEmail').value
     var URL="/UDM/NewsletterSignUp.aspx?email="
     var redirecturl=URL+emailvalue
     self.location.href=redirecturl;
}
// Add Tracking Code To Print Buttons
$(document).ready(function(){
	
	// Only Recipie Pages
	
	var qs = window.location.search.substring(1);
	
	if(qs.toLowerCase().indexOf('recipes') != -1){
		
		$('#printRecipe').find('a').click(function(){
			
			trackRecipePrint();
			
		});
		
	}
	
});

function trackRecipePrint(){
	var click1 = new Image();
	var axel = Math.random() + "";
	var a = axel * 1000000000000000000;
	click1.src ='http://fls.doubleclick.net/activityi;src=2617224;type=stark476;cat=unq-s517;ord=1;num=' + a + '?';
}