﻿/* png fix*/
/*-------------------------------------------------------------------------------*/
var init_pngFix = function()
{
    $('body').supersleight();
}
/* input labelify
/*-------------------------------------------------------------------------------*/
var init_labelify = function()
{
    $(":text").labelify();
}
/* cufon
/*-------------------------------------------------------------------------------*/
var init_cufon = function()
{
    Cufon.replace('h1, h2 , h4,h2 a,div#product_content .Nutro_viewall a, .test_viewall a,div#product_content .purepurpose_colcontent a,div#product_content .abt_learnmore a,.NRShare' , { fontFamily: 'Trade Gothic LT Std-BdCn20', hover: true });    
    Cufon.replace('.product_redsubhead, .product_blacksubhead, .product_blackhead , .product_redhead,.product_details_subred, .news_content,.product_blackheadproducts,.spanHomePromoTitle,.divHomePromoContent,.divHomePromoButonText,div#tabModule div h3' , { fontFamily: 'Trade Gothic LT Std-BdCn20'});   
    Cufon.replace('#tabModule a' , { fontFamily: 'Trade Gothic LT Std-BdCn20', hover: true });
    Cufon.replace('.Banner_right h5, .Banner_right h6 a' , { fontFamily: 'Trade Gothic LT Std-BdCn20', hover: true });
    Cufon.replace('div#product_content h2 a,.formsubHeading,.bottomContentRight h5,.leftLowerContent h5,.bottomContentEnd h5,.Banner_right_smallbreed h6 a,.Banner_right_smallbreed h5,.sharebreed', { fontFamily: 'Trade Gothic LT Std-BdCn20', hover: true });
            
}
/* tabs
/*-------------------------------------------------------------------------------*/
var init_tabs = function()
{
    
    
    if ($("#tabModule").length > 0)
    {
  
       $("#tabModule").tabs({ event: 'mouseover'});
     }
     if ($("#heroSlides").length > 0)
    {
     if(document.getElementById("heroSlides").style.display != 'none')
      {
        $("#heroSlides").tabs({ event: 'click' }).tabs('rotate', 5300);
        $("#heroSlides").tabs({ fx: [{opacity:'toggle', duration:'fast'},{opacity:'toggle', duration:'slow'}] }).tabs();
        
        
      }
    }
    if ($("#heroSlides2").length > 0)
    {
      if(document.getElementById("heroSlides2").style.display != 'none')
       {
        $("#heroSlides2").tabs({ event: 'click' }).tabs('rotate', 5300);
        $("#heroSlides2").tabs({ fx: [{opacity:'toggle', duration:'fast'},{opacity:'toggle', duration:'slow'}] }).tabs();
        
        
       }
    }
}/* new window
/*-------------------------------------------------------------------------------*/
var init_newWindow = function()
{
    $("a[rel=external]").attr('target', '_blank');
}
/* dropnav
/*-------------------------------------------------------------------------------*/
var sfHover = function()
{
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) 
    {
        sfEls[i].onmouseover=function() 
        {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() 
        {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
var debug = function(what){
    if(window.console && window.console.firebug){
        //console.log(what);
    }       
    else{
        //alert(what);
    }
}
$(document).ready(function() {
    debug('dom ready');
    emailLink();
    facebookLink();
    twitterLink();
    
});
//SHARE LINK FUNCTIONS
var emailLink = function()
{
    pageInfo = shareLink();
    var subject = "NUTRO(R) Knows Small Breeds";
var body = "Know%20Your%20Small%20Breeds%20from%20NUTRO(R)%20NATURAL%20CHOICE(R).%20Check%20out%20this%20small%20breed%20dog%27s%20personality%20and%20see%20which%20small%20breed%20dogs%20are%20feisty%2C%20which%20are%20friendly%20and%20which%20are%20good%20with%20kids. \n\n ";
    var linkFormat = ['mailto:?Subject=', encodeURL(subject), '&Body=', body + pageInfo.linkURL];
    addLink('#email', linkFormat); 
}

var facebookLink = function()
{
    pageInfo = shareLink();
    var text = "NUTRO® Knows Small Breeds. Do you?This small breed dog's got serious personality.Check it out!" ;
    var linkFormat = ['http://www.facebook.com/sharer.php?u=', pageInfo.linkURL, '&t=', text];
addLink('#facebook', linkFormat); 
}
var twitterLink = function()
{
    pageInfo = shareLink();
var URLToPost = pageInfo.linkURL;
//var myWin = window.open('socialConnection.html','mywindow','width=800,height=400');
                        
            BitlyCB.shortenResponse = function(data) {
               var s = '';
               var first_result;
                // Results are keyed by longUrl, so we need to grab the first one.
                for (var r in data.results) {
                    first_result = data.results[r]; break;
                }
                
                for (var key in first_result) {
                        s += key + ":" + first_result[key].toString() + "\n";
                }
                
                  var message = "This small breed\'s got serious personality. Check it out! " + first_result.shortUrl;
                //myWin.location = 'http://twitter.com/home?status=' + message;
var linkFormat = ['http://twitter.com/home?status=', message];
    addLink('#twitter', linkFormat);
               }
            
            BitlyClient.shorten(URLToPost, 'BitlyCB.shortenResponse');
        
}
var shareLink = function()
{
    var linkURL = getURL();
    var linkTitle = getTitle();
    var linkDescription = 'NUTRO(R)';
    return {'linkURL': linkURL, 'linkTitle':linkTitle, 'linkDescription':linkDescription}
}
var addLink = function(linkSelector, linkArray)
{
var linkString = linkArray.join('');
    debug('linkString : ' + linkString);
    var selectorString = linkSelector + ' > a'; 
    $(selectorString).attr('href', linkString);
}
var getURL = function()
{
    return location.href;
}
var getTitle = function()
{
    return document.title;
}
var getDescription = function()
{
    return document.getElementsByName('meta')['description'].content;
}
var encodeURL = function(urlString)
{
    return escape(urlString);
}
/* hero rotate
/*-------------------------------------------------------------------------------*/
var init_bgImage = function()
{
if(document.getElementById("hero") !=null)
{
    bgImageTotal=2;
        var img2 = '/assets/images/banner/hero-rotate-2.jpg';
        var img4 = '/assets/images/banner/hero-rotate-4.jpg';
    randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
    if(randomNumber==1)
    {
    $('#hero').css('background-image', ('url("'+img2+'")'));
        document.getElementById("heroSlides").style.display = 'none';
    document.getElementById("heroSlides2").style.display = 'block';
    }
    else if(randomNumber==2)
    {
    $('#hero').css('background-image', ('url("'+img4+'")'));
    document.getElementById("heroSlides").style.display = 'block';
    document.getElementById("heroSlides2").style.display = 'none';
    }
}
}
/* product rotate
/*-------------------------------------------------------------------------------*/
var init_bgproductImage = function()
{
    bgImageTotal=2;
    randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
    if(randomNumber==1)
    {
    imgPath=('/assets/images/banner/nutro-products-banner-1.jpg');
    }
    else
    {
    imgPath=('/assets/images/banner/nutro-products-banner-2.jpg');
    }
    var sfEls = document.getElementById("producthero")
    sfEls.src=imgPath;
}
var init_bgnutritionalImage = function()
{
    bgImageTotal=2;
    randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
    if(randomNumber==1)
    {
    imgPath=('/assets/images/banner/nutritional-banner-1.jpg');
    }
    else
    {
    imgPath=('/assets/images/banner/nutritional-banner-2.jpg');
    }
    var sfEls = document.getElementById("nutritionalhero")
    sfEls.src=imgPath;
}
/*
var init_bgproductImage = function()
{
    bgImageTotal=2;
    var img1 = '';
    var img2 = '/assets/images/banner/hero-rotate-1.jpg';
    randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
    if(randomNumber==1)
    {
    $('#producthero').css('background-image', ('url("'+img1+'")'));
    }
    else
    {
    $('#producthero').css('background-image', ('url("'+img2+'")'));
    }
    
}
*/
/* init
/*-------------------------------------------------------------------------------*/
$(document).ready(function()
{ 
    init_pngFix();
    init_labelify();
    init_cufon();
    init_tabs();
    init_newWindow();
    init_bgImage();
    if (document.getElementById("producthero") != null)
    {
    init_bgproductImage();
    }
    if (document.getElementById("nutritionalhero") != null)
    {
    init_bgnutritionalImage();
    }
    if (document.getElementById("veterhero") != null)
    {
    init_bgveterImage();
    }
    /*init_bgproductImage();*/
    if (document.getElementById("details_tabs") != null)
    {
    init_detailsRollover();
    }
    if(document.getElementById("nav") != null)
    {
    sfHover();
    }
    if (document.getElementById("pack_tabs") != null)
    {
    init_packRollover();
    }
if (document.getElementById("testimonial_main") != null)
    {
    init_getTestimonial();
    }
});
 
/*Individual Products tab change */
var init_detailsRollover = function()
{   
    var input=document.getElementById('details_tabs').getElementsByTagName('div');   
    var value=0;
    for(i=0;i<input.length;i++)
    { 
    
         if(input[i].style.display=='block')
         {
             if(value==0)
             {    
                 input[i].style.backgroundPosition='top';
                 input[i].onmouseover=function(){this.style.backgroundPosition='top';}
                 input[i].onmouseout=function(){this.style.backgroundPosition='top';}
                 document.getElementById(input[i].id.replace("details_","")).style.display = "block";
             }         
             else
             {
                 input[i].onmouseover=function(){this.style.backgroundPosition='top';}
                 input[i].onmouseout=function(){this.style.backgroundPosition='bottom';}
                 document.getElementById(input[i].id.replace("details_","")).style.display = "none";
             }  
             value=1;  
         }
         input[i].onclick=function()
         {       
              var inputDiv=document.getElementById('details_tabs').getElementsByTagName('div'); 
              for(i=0;i<input.length;i++)
                { 
                    if(this.id==inputDiv[i].id)
                    {
                        this.onmouseover=function(){this.style.backgroundPosition='top';}
                        this.onmouseout=function(){this.style.backgroundPosition='top';}
                        document.getElementById(this.id.replace("details_","")).style.display = "block";
                    }
                else
                {
                 
                    input[i].style.backgroundPosition='bottom';
                    input[i].onmouseover=function(){this.style.backgroundPosition='top';}
                    input[i].onmouseout=function(){this.style.backgroundPosition='bottom';}
                    document.getElementById(input[i].id.replace("details_","")).style.display = "none";
                }        
        }         
        }    
    }
}
/*Individual Products tab change */
var init_packRollover = function()
{    
    var input=document.getElementById('pack_tabs').getElementsByTagName('div');        
    var url;     
    var catId=document.getElementById("divCatId").innerHTML;
    if(document.getElementById('pack_tabs').getElementsByTagName('div')!=null)
    {
        packId=document.getElementById('pack_tabs').getElementsByTagName('div')[0].id.replace("package_","");    
        document.getElementById('divPackId').innerHTML=packId;
    }
     for(i=0;i<input.length;i++)
    {    
      url='/assets/images/products/'+input[i].id+'.gif';
      input[i].style.backgroundImage  = 'url('+url+')';
      if(i==0)
      {    
         input[i].style.backgroundPosition='top';
         input[i].onmouseover=function(){this.style.backgroundPosition='top';}
         input[i].onmouseout=function(){this.style.backgroundPosition='top';}
     }
     else
     {
         input[i].style.backgroundPosition='bottom';;
         input[i].onmouseover=function(){this.style.backgroundPosition='top';}
         input[i].onmouseout=function(){this.style.backgroundPosition='bottom';}
     } 
      input[i].onclick=function()
     {
        var filter=document.getElementById("divFilterId").innerHTML; 
        filter=filter.substring(1,filter.length);   
        var catId=document.getElementById("divCatId").innerHTML;
        var inputDiv=document.getElementById('pack_tabs').getElementsByTagName('div'); 
        for(i=0;i<input.length;i++)
           { 
                if(this.id==inputDiv[i].id)
                {
                    input[i].onmouseover=function(){this.style.backgroundPosition='top';}
                    input[i].onmouseout=function(){this.style.backgroundPosition='top';}
                    document.getElementById('divPackId').innerHTML=this.id.replace("package_","");
                    LoadData(filter, this.id.replace("package_",""), catId);                }
                else
                {
                  input[i].style.backgroundPosition='bottom';;
                  input[i].onmouseover=function(){this.style.backgroundPosition='top';}
                  input[i].onmouseout=function(){this.style.backgroundPosition='bottom';}
                }        
           }         
     }     
   }
  var value =GetFilterQueryString();  
  if(value=='')
  {
       LoadData('', packId, catId.toString());
       document.getElementById("divFilterId").innerHTML=',';
   }
   else
   {   
       LoadData(value+',', packId, catId.toString());
       document.getElementById("divFilterId").innerHTML=','+value+',';
       var input=document.getElementById('ProductSummary1_divFilterMain').getElementsByTagName('input');
       for(i=0;i<input.length;i++)
         {             
            if(input[i].id.replace("chkbox_","")==value)
            {
            input[i].checked=true;
            }
            else
            {
            input[i].checked=false;
            }
        }
   }     
}
//If filter checked  and uncked conditions
function GetFilterData(id)
{    
 if(document.getElementById(id).checked==true)
 {
 AddFilter(id,"1");
 }
 else
 {   
 AddFilter(id,"0");
 }
}
//AddFilters
function AddFilter(id,status)
{
//Get the checkbox id
var filterId= id.replace("chkbox_","");
var uiId=document.getElementById("divFilterId").innerHTML;
//Add/Remove the filter id from the text box
var position=uiId.indexOf(','+filterId+',');
    if(status=="1") 
    {
      if(position==-1)
       document.getElementById("divFilterId").innerHTML=uiId+filterId+',';
    }        
    else
    {    
        if(position!=-1){
        document.getElementById("divFilterId").innerHTML=uiId.replace(','+filterId+',',",");}
    }
    var filter=document.getElementById("divFilterId").innerHTML;
    filter=filter.substring(1,filter.length);    
    //var packId=document.getElementById('pack_tabs').getElementsByTagName('div')[0].id.replace("package_","");
    var packId=document.getElementById('divPackId').innerHTML;
    var catId=document.getElementById("divCatId").innerHTML;               
    LoadData(filter, packId, catId);  
}
/* Products Details
/*-------------------------------------------------------------------------------*/
function LoadData(filterid, packid, catId) 
{
if(filterid=='')
{
document.getElementById('checkbox_all').checked=true;
}
else
{
document.getElementById('checkbox_all').checked=false;
}
$('#result').html('<p style="padding-left:20px;padding-top:20px;"><img src="/assets/images/layout/ajax-loader.gif" /></p>');
$('#result').load('/products.aspx?filterid='+filterid+'&packid='+packid+'&catid='+catId);    
}
/* Png fix function
/*-------------------------------------------------------------------------------*/
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
       var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
       var imgTitle = (myImage.title) ? 
                     "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
       var imgStyle = "display:inline-block;" + myImage.style.cssText
       var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
       myImage.outerHTML = strNewHTML      
    }
}
function GetAllProduct(id)
{
var catId=document.getElementById("divCatId").innerHTML;
var packId=document.getElementById('divPackId').innerHTML;
document.getElementById("divFilterId").innerHTML=',';
LoadData('',packId,catId)
var input=document.getElementById('ProductSummary1_divFilterMain').getElementsByTagName('input');
 for(i=0;i<input.length;i++)
 { 
input[i].checked=false;
}
}
function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=900,height=500');return false;}
 
 /********************Pure-Purpose Starts*************/
function ShowPopup(hoveritem)
{
hp = document.getElementById("hoverpopup");
// Set position of hover-over popup
hp.style.top = hoveritem.offsetTop + 18;
hp.style.left = hoveritem.offsetLeft + 20;
// Set popup to visible
hp.style.visibility = "Visible";
hp.style.backgroundImage = "/assets/images/contents/Roll_over.gif"
}
function HidePopup()
{
hp = document.getElementById("hoverpopup");
hp.style.visibility = "Hidden";
}
 /********************Pure-Purpose Ends*************/
 
 /********************Veterinarians Starts*************/
var init_bgveterImage = function()
{
    bgImageTotal=2;
    randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
    if(randomNumber==1)
    {
    imgPath=('/assets/images/banner/Our-Commitment-To-Veterinary-Community1.jpg');
    }
    else
    {
    imgPath=('/assets/images/banner/Our-Commitment-To-Veterinary_Community2.jpg');
    }
    var sfEls = document.getElementById("veterhero")
    sfEls.src=imgPath;
}
 
  /********************Veterinarians Ends*************/
/********OODS Method begins******************/
function HideIfCatSizeVisible(divsize)
{
    document.getElementById(divsize).className = "hidediv";
    
}
function CheckAdultCatAge(strddlMonth,strddlYear,strDivDog,strdivsize)
{
    var month=document.getElementById(strddlMonth).value;
    var year = document.getElementById(strddlYear).value;
if(month != 'select' && year !='select')
{
    today = new  Date();
    t1="01/"+month+"/"+year;
    t2=today.getDate()+"/"+today.getMonth()+"/"+today.getFullYear();
    var one_day=1000*60*60*24; 
    var x=t1.split("/");     
    var y=t2.split("/");
    var date1=new Date(x[2],(x[1]-1),x[0]);
    var date2=new Date(y[2],(y[1]-1),y[0])
    var month1=x[1]-1;
    var month2=y[1]-1;
_Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
    if(_Diff <= 365)
    {
        if ((document.getElementById(strDivDog).checked ==true))
        {
            document.getElementById(strdivsize).className = "hidediv";
        } 
    }
    else if((document.getElementById(strDivDog).checked ==false))
        {
        document.getElementById(strdivsize).className = "showdiv";
        }
  }
}
 function SetVisibility(strDivDog,strDivCat)
{
 
 document.getElementById(strDivDog).className = "showdiv";
 document.getElementById(strDivCat).className = "hidediv";
   
}
function SetPurchaseVisibility()
{
if((document.getElementById('Contestform1_rblPet5TypeDog').checked == true)||(document.getElementById('Contestform1_rblPet4TypeDog').checked == true) ||(document.getElementById('Contestform1_rblPet3TypeDog').checked == true)|| (document.getElementById('Contestform1_rblPet2TypeDog').checked == true)||(document.getElementById('Contestform1_rblPet1TypeDog').checked == true))
{
     document.getElementById('Contestform1_divDogPurchased').className = "showdiv";
}
else
{
    document.getElementById('Contestform1_divDogPurchased').className = "hidediv";
}
if((document.getElementById('Contestform1_rblPet5TypeCat').checked == true)||(document.getElementById('Contestform1_rblPet4TypeCat').checked == true) ||(document.getElementById('Contestform1_rblPet3TypeCat').checked == true)|| (document.getElementById('Contestform1_rblPet2TypeCat').checked == true)||(document.getElementById('Contestform1_rblPet1TypeCat').checked == true))
{
    document.getElementById('Contestform1_divCatPurchased').className = "showdiv";
}
else
{
    document.getElementById('Contestform1_divCatPurchased').className = "hidediv";
}
}
function SetBrandsVisibility()
{
if((document.getElementById('FrequencyForm1_rblPet5TypeDog').checked == true)||(document.getElementById('FrequencyForm1_rblPet4TypeDog').checked == true) ||(document.getElementById('FrequencyForm1_rblPet3TypeDog').checked == true)|| (document.getElementById('FrequencyForm1_rblPet2TypeDog').checked == true)||(document.getElementById('FrequencyForm1_rblPet1TypeDog').checked == true))
{
      if(document.getElementById('FrequencyForm1_trDogBraqn')!=null)
         document.getElementById('FrequencyForm1_trDogBraqn').className = "showtr";
      if(document.getElementById('FrequencyForm1_trDogBraans')!=null)
        document.getElementById('FrequencyForm1_trDogBraans').className = "showtr";
      if(document.getElementById('FrequencyForm1_trDogBagSize')!=null)
        document.getElementById('FrequencyForm1_trDogBagSize').className = "showtr";
      if(document.getElementById('FrequencyForm1_trDogBrandsddl')!=null)
        document.getElementById('FrequencyForm1_trDogBrandsddl').className = "showtr";
      if(document.getElementById('FrequencyForm1_trDogNutroBrands')!=null)
        document.getElementById('FrequencyForm1_trDogNutroBrands').className = "showtr";
      if(document.getElementById('FrequencyForm1_trDogTotalBags')!=null) 
        document.getElementById('FrequencyForm1_trDogTotalBags').className = "showtr";
      if(document.getElementById('FrequencyForm1_divNoofDogs')!=null) 
        document.getElementById('FrequencyForm1_divNoofDogs').className = "showtr"; 
     }
else
{
    if(document.getElementById('FrequencyForm1_trDogBraqn')!=null)
        document.getElementById('FrequencyForm1_trDogBraqn').className = "hidediv";
    if(document.getElementById('FrequencyForm1_trDogBraans')!=null)
        document.getElementById('FrequencyForm1_trDogBraans').className = "hidediv";
    if(document.getElementById('FrequencyForm1_trDogBagSize')!=null)
        document.getElementById('FrequencyForm1_trDogBagSize').className = "hidediv";
    if(document.getElementById('FrequencyForm1_trDogBrandsddl')!=null)
        document.getElementById('FrequencyForm1_trDogBrandsddl').className = "hidediv";
    if(document.getElementById('FrequencyForm1_trDogNutroBrands')!=null)
        document.getElementById('FrequencyForm1_trDogNutroBrands').className = "hidediv";
    if(document.getElementById('FrequencyForm1_trDogTotalBags')!=null)
        document.getElementById('FrequencyForm1_trDogTotalBags').className = "hidediv";
    if(document.getElementById('FrequencyForm1_divNoofDogs')!=null) 
        document.getElementById('FrequencyForm1_divNoofDogs').className = "hidediv"; 
        
}
if((document.getElementById('FrequencyForm1_rblPet5TypeCat').checked == true)||(document.getElementById('FrequencyForm1_rblPet4TypeCat').checked == true) ||(document.getElementById('FrequencyForm1_rblPet3TypeCat').checked == true)|| (document.getElementById('FrequencyForm1_rblPet2TypeCat').checked == true)||(document.getElementById('FrequencyForm1_rblPet1TypeCat').checked == true))
{
     if(document.getElementById('FrequencyForm1_trCatBraqn')!=null)
          document.getElementById('FrequencyForm1_trCatBraqn').className = "showtr";
     if(document.getElementById('FrequencyForm1_trCatBraans')!=null)
          document.getElementById('FrequencyForm1_trCatBraans').className = "showtr";
     if(document.getElementById('FrequencyForm1_trCatBagSize')!=null)
          document.getElementById('FrequencyForm1_trCatBagSize').className = "showtr";
     if(document.getElementById('FrequencyForm1_trCatBrandsddl')!=null)
          document.getElementById('FrequencyForm1_trCatBrandsddl').className = "showtr";
     if(document.getElementById('FrequencyForm1_trCatNutroBrands')!=null)
          document.getElementById('FrequencyForm1_trCatNutroBrands').className = "showtr";
     if(document.getElementById('FrequencyForm1_trCatTotalBags')!=null)
          document.getElementById('FrequencyForm1_trCatTotalBags').className = "showtr";
     if(document.getElementById('FrequencyForm1_divNoofCats')!=null) 
        document.getElementById('FrequencyForm1_divNoofCats').className = "showtr";
}
else
{
     if(document.getElementById('FrequencyForm1_trCatBraqn')!=null)
         document.getElementById('FrequencyForm1_trCatBraqn').className = "hidediv";
     if(document.getElementById('FrequencyForm1_trCatBraans')!=null)
        document.getElementById('FrequencyForm1_trCatBraans').className = "hidediv";
     if(document.getElementById('FrequencyForm1_trCatBagSize')!=null)
        document.getElementById('FrequencyForm1_trCatBagSize').className = "hidediv";
     if(document.getElementById('FrequencyForm1_trCatBrandsddl')!=null)
        document.getElementById('FrequencyForm1_trCatBrandsddl').className = "hidediv";
     if(document.getElementById('FrequencyForm1_trCatNutroBrands')!=null)
        document.getElementById('FrequencyForm1_trCatNutroBrands').className = "hidediv";
     if(document.getElementById('FrequencyForm1_trCatTotalBags')!=null)
        document.getElementById('FrequencyForm1_trCatTotalBags').className = "hidediv";
         if(document.getElementById('FrequencyForm1_divNoofCats')!=null) 
        document.getElementById('FrequencyForm1_divNoofCats').className = "hidediv";
}
}
function popNewsLetter(winwidth,winheight,url)
        {
         
            
            document.getElementById('divopaque').className="opaquediv";
            document.getElementById('divopaque').style.height = (GetScrollHeight()+18)+"px";
            document.getElementById('divopaque').style.width = GetWidth();
            document.getElementById('divtoolbar').className="toolbar";
            document.getElementById('divwindow').className="windowstyle";
            document.getElementById('divwindow').style.height = (winheight)+"px";
            document.getElementById('divwindow').style.width = winwidth;
            document.getElementById('divwindow').style.top =((GetHeight()-winheight)/2)+"px";
            document.getElementById('divwindow').style.left = (((GetWidth()-winwidth)/2)+10)+"px";
            document.getElementById('divtoolbar').className="divShow";
            document.getElementById('DivNewsLetter').className="divShow";
            document.getElementById('frameNewsLetter').src=url;
        }
        function GetWidth()
        {
            var x = 0;
            if (self.innerHeight)
            {
                x = self.innerWidth;
            }
            else if (document.documentElement && document.documentElement.clientHeight)
            {
                x = document.documentElement.clientWidth;
            }
            else if (document.body)
            {
                x = document.body.clientWidth;
            }
            return x;
        }
function GetHeight()
        {
            var y = 0;
            if (self.innerHeight)
            {
                y = self.innerHeight;
            }
            else if (document.documentElement && document.documentElement.clientHeight)
            {
                y = document.documentElement.clientHeight;
            }
            else if (document.body)
            {
                y = document.body.clientHeight;
            }
            return y;
        }
        function GetParentWidth()
        {
            var x = 0;
            if (parent.self.innerHeight)
            {
                x = parent.self.innerWidth;
            }
            else if (parent.top.document.documentElement && parent.top.document.documentElement.clientHeight)
            {
                x = parent.top.document.documentElement.clientWidth;
            }
            else if (parent.top.document.body)
            {
                x = parent.top.document.body.clientWidth;
            }
            return x;
        }
function GetParentHeight()
        {
            var y = 0;
            if (parent.self.innerHeight)
            {
                y = parent.self.innerHeight;
            }
            else if (parent.top.document.documentElement && parent.top.document.documentElement.clientHeight)
            {
                y = parent.top.document.documentElement.clientHeight;
            }
            else if (parent.top.document.body)
            {
                y = parent.top.document.body.clientHeight;
            }
            return y;
        }
        function GetScrollHeight()
        {
            var y = 0;
            if (self.innerHeight)
            {
                y = self.innerHeight + self.scrollMaxY;
            }
            else if (document.body)
            {
                if (document.body.scrollHeight > document.body.offsetHeight)
                {
                    y = document.body.scrollHeight;
                }
                else
                {
                    y = document.body.offsetHeight;
                }
            }
            else if (document.documentElement && document.documentElement.clientHeight)
            {
                    y = document.documentElement.clientHeight;
            }
            return y;
        }
function popup_close_flash()
    {
    parent.top.document.getElementById('divwindow').className="hide";
    parent.top.document.getElementById('divopaque').className="hide";
    location.href='/assets/swf/what-makes-cat-popup.html';
    }
function popup_close()
    {
    parent.top.document.getElementById('divwindow').className="hide";
    parent.top.document.getElementById('divopaque').className="hide";
    }
function DateDifference(month,year,strradiobutton,strddlButton)
{
today = new  Date();
t1="26/"+document.getElementById(month).value+"/"+document.getElementById(year).value;
if(document.getElementById(month).value !='' && document.getElementById(year).value !='')
{
t2=today.getDate()+"/"+today.getMonth()+"/"+today.getFullYear();
var one_day=1000*60*60*24; 
var x=t1.split("/");     
var y=t2.split("/");
var date1=new Date(x[2],(x[1]-1),x[0]);
var date2=new Date(y[2],(y[1]-1),y[0])
var month1=x[1]-1;
var month2=y[1]-1;
_Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
if(_Diff >= 365)
{
if ((document.getElementById(strradiobutton).checked ==true))
{
document.getElementById(strddlButton).className = "showdiv";
} 
else
{
document.getElementById(strddlButton).className = "hidediv";
}
}
else
{
document.getElementById(strddlButton).className = "hidediv";
}
}
}
function SetPetBornDateDefault(ddlmonth,ddlyear)
{
   document.getElementById(ddlmonth).value="select";
   document.getElementById(ddlyear).value="select";
}
/********breeder Enrollement form methods ***********/
function BreederTypeSelect(ddlBreederControl)
{
var selectedvalue=document.getElementById(ddlBreederControl).options[document.getElementById(ddlBreederControl).selectedIndex].text;
if(selectedvalue =="Dog")
{
//alert(document.getElementById(ddlBreederControl).value);
document.getElementById('breeder_divDogPurchased').className = "showdiv";
document.getElementById('breeder_divmostoftenbrand_dog').className = "showdiv";
document.getElementById('breeder_divbagsize_dog').className = "showdiv";
}
else
{
//alert(document.getElementById(ddlBreederControl).value);
document.getElementById('breeder_divDogPurchased').className = "hidediv";
document.getElementById('breeder_divmostoftenbrand_dog').className = "hidediv";
document.getElementById('breeder_divbagsize_dog').className = "hidediv";
}
if(selectedvalue=="Cat Breeder" || selectedvalue=="Cat Handler")
{
document.getElementById('breeder_divCatPurchased').className = "showdiv";
document.getElementById('breeder_divmostoftenbrand_cat').className = "showdiv";
document.getElementById('breeder_divbagsize_cat').className = "showdiv";
}
else
{
document.getElementById('breeder_divCatPurchased').className = "hidediv";
document.getElementById('breeder_divmostoftenbrand_cat').className = "hidediv";
document.getElementById('breeder_divbagsize_cat').className = "hidediv";
}
}
/************** breeder Enrollement form methods*********/
/********OODS Method Ends******************/
var init_getTestimonial = function()
{
var catid=document.getElementById("divPromoCat").innerHTML;
$('#test_result').html('<p style="text-align:center;padding-top:70px;"><img src="/assets/images/layout/ajax-loader.gif" /></p>');
$('#test_result').load('/Testimonial.aspx?catid='+catid);
}
function GetTestimonial(status)
{
var catid=document.getElementById("divPromoCat").innerHTML;
var id=document.getElementById("testpromo_id").innerHTML;
$('#test_result').html('<p style="text-align:center;padding-top:70px;"><img src="/assets/images/layout/ajax-loader.gif" /></p>');
$('#test_result').load('/Testimonial.aspx?catid='+catid+'&id='+id+'&s='+status);
}
 
function GetFilterQueryString()
{       
    var search = window.location.search;
    var value;
    if(search!=null)
    {     
        search = search.replace(/\?/,'');
        var searchAttributes = search.split('&');
        if(searchAttributes!=null)
        {         
           var items = searchAttributes[0].split('=');          
           value=''+items[1];           
           if(!isNaN(value))
           {
            return value;
           } 
           else
           {
           return '';
           }         
        }        
    }    
}
 /******Hover BG effect*****/
/**
 This javascript file is used for USA map effects.
**/
var canvascheck = document.createElement('canvas');
var isIE = window.navigator.systemLanguage?1:0;
var isVM = document.namespaces?1:0; var isJG = 0;
var isCV = canvascheck.getContext?1:0; var jg = new Array();
if(isVM) {
    if(document.namespaces['v']==null) {
        var e=["shape","shapetype","group","background","path","formulas","handles","fill","stroke","shadow","textbox","textpath","imagedata","line","polyline","curve","roundrect","oval","rect","arc","image"],s=document.createStyleSheet(); 
        for(var i=0; i<e.length; i++) {s.addRule("v\\:"+e[i],"behavior: url(#default#VML); antialias: true;");} document.namespaces.add("v","urn:schemas-microsoft-com:vml");
    } 
}
function showCoords(map,ele,x,y,w,h) {}
function getClasses(classes,string){
    var temp = '';
    for (var j=0;j<classes.length;j++) {
        if (classes[j] != string) {
            if (temp) {temp += ' '; }
            temp += classes[j];
        }
    }
    return temp;
}
function getClassValue(classes,string){
    var temp = 0; var pos = string.length;
    for (var j=0;j<classes.length;j++) {
        if (classes[j].indexOf(string) == 0) {
            temp = Math.min(classes[j].substring(pos),100);
            break;
        }
    }
    return Math.max(0,temp);
}
function getClassRGBColor(classes,string,color){
    var temp, val = color, pos = string.length;
    for (var j=0;j<classes.length;j++) {
        if (classes[j].indexOf(string) == 0) {
            temp = classes[j].substring(pos);
            val = temp.toLowerCase();
            break;
        }
    }
    if(!val.match(/^[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i)) {val = color||'000000'; }
    if(!isCV) {return val; }else {
        function hex2dec(hex){return(Math.max(0,Math.min(parseInt(hex,16),255)));}
        var cr=hex2dec(val.substr(0,2)),cg=hex2dec(val.substr(2,2)),cb=hex2dec(val.substr(4,2));
        return cr+','+cg+','+cb;
    }
}
function getClassAttribute(classes,string){
    var temp = 0; var pos = string.length;
    for (var j=0;j<classes.length;j++) {
        if (classes[j].indexOf(string) == 0) {
            temp = 1; break;
        }
    }
    return temp;
}
function getMaps(className){
    var children = document.getElementsByTagName('img'); 
    var elements = new Array(); var i = 0; var mapname = '';
    var child; var classNames; var j = 0; var mapid = '';
    for(i=0;i<children.length;i++) {
        child = children[i]; classNames = child.className.split(' ');
        for(j=0;j<classNames.length;j++) {
            if(classNames[j]==className) {
                mapname = child.useMap.split("#");
                if(mapname[1]!=''&&mapname[1].length>=1) {
                    mapid = document.getElementsByName(mapname[1]);
                    if(mapid) {elements.push(child); break;}
                }
            }
        }
    }
    return elements;
}
function fadeCanvas(id,opac) {
    var obj = document.getElementById(id);
    if(obj.fading==1 && opac<=100) {
        obj.style.opacity = opac/100; opac += 10;
        window.setTimeout("fadeCanvas('"+id+"',"+opac+")",10);
    }
}
function setAreaOver(obj,id,bd,co,op,nb,f,z) {
    var a, i, j, d, c, o, b, n, l, r, v, u, x, y, p, k = 0, t = '', r = obj.getAttribute('rel'), context, canvas = document.getElementById(id);
    if(r!=null) {d = r.split(","); v = d.unshift(obj.id); }else {d = new Array(obj.id); }
    function setAttr() {
        if(l.indexOf('forcegroup')!=-1) {k = getClassAttribute(u,"forcegroup");}else {k=0;}
        if(l.indexOf('iopacity')!=-1) {o = getClassValue(u,"iopacity")/100;}else {o=op;}    
        if(l.indexOf('iborder')!=-1) {b = getClassRGBColor(u,"iborder",bd);}else {b=bd;}
        if(l.indexOf('icolor')!=-1) {c = getClassRGBColor(u,"icolor",co);}else {c=co;}
        if(l.indexOf('noborder')!=-1) {n = getClassAttribute(u,"noborder");}else {n=nb;}
    }
    if(isVM) {
        for(a=0;a<d.length;a++) {
            obj = document.getElementById(d[a]); if(obj) { 
            p = '', l = obj.className, u = l.split(" "), v = obj.coords.split(",");
            if(k==0) {setAttr();} 
            if(obj.shape.toLowerCase()=='rect') {
                t += '<v:rect strokeweight="1" filled="t" stroked="'+(n<1?"t":"f")+'" strokecolor="#'+b+'" style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+parseInt(v[0])+'px;top:'+parseInt(v[1])+'px;width:'+parseInt(v[2]-v[0])+'px;height:'+parseInt(v[3]-v[1])+'px;"><v:fill color="#'+c+'" opacity="'+o+'" /></v:rect>';
            }else if(obj.shape.toLowerCase()=='circle') {
                t += '<v:oval strokeweight="1" filled="t" stroked="'+(n<1?"t":"f")+'" strokecolor="#'+b+'" style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+parseInt(v[0]-v[2])+'px;top:'+parseInt(v[1]-v[2])+'px;width:'+(parseInt(v[2])*2)+'px;height:'+(parseInt(v[2])*2)+'px;"><v:fill color="#'+c+'" opacity="'+o+'" /></v:oval>';
            }else {
                for(j=2;j<v.length;j+=2) {p += parseInt(v[j])+','+parseInt(v[j+1])+',';}
                t += '<v:shape strokeweight="1" filled="t" stroked="'+(n<1?"t":"f")+'" strokecolor="#'+b+'" coordorigin="0,0" coordsize="'+canvas.width+','+canvas.height+'" path="m '+parseInt(v[0])+','+parseInt(v[1])+' l '+p+' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+canvas.width+'px;height:'+canvas.height+'px;"><v:fill color="#'+c+'" opacity="'+o+'" /></v:shape>'; 
            }}
        } canvas.innerHTML = t;
    }else if(isCV) {
        if(f<1) {canvas.fading = 0; canvas.style.opacity = 0;}
        context = canvas.getContext("2d");
        for(a=0;a<d.length;a++) {
            obj = document.getElementById(d[a]); if(obj) {
            l = obj.className, u = l.split(" "), v = obj.coords.split(",");
            if(k==0) {setAttr();} context.beginPath();
            if(obj.shape.toLowerCase()=='rect') {
                context.rect(0.5+parseInt(v[0]),0.5+parseInt(v[1]),parseInt(v[2]-v[0]),parseInt(v[3]-v[1])); context.closePath();
            }else if(obj.shape.toLowerCase()=='circle') {
                context.arc(0.5+parseInt(v[0]),0.5+parseInt(v[1]),parseInt(v[2]),0,(Math.PI/180)*360,false);        
            }else {
                context.moveTo(parseInt(v[0]),parseInt(v[1])); for(j=2;j<v.length;j+=2) {context.lineTo(parseInt(v[j]),parseInt(v[j+1]));} context.closePath();
            } context.fillStyle = 'rgba('+c+','+o+')'; context.strokeStyle = 'rgba('+b+',1)'; context.fill(); if(n<1) {context.stroke();}}
        } if(f<1) {canvas.fading = 1; fadeCanvas(id,0);}
    }else {
        o = op; l = obj.className; u = l.split(" ");
        if(l.indexOf('forcegroup')!=-1) { k = getClassAttribute(u,"forcegroup");
        if(k!=0) {if(l.indexOf('iopacity')!=-1) {o = getClassValue(u,"iopacity")/100; k=0;}}}
        if(isIE) {canvas.style.filter = "Alpha(opacity="+(o*100)+")";
        }else {canvas.style.opacity = o; canvas.style.MozOpacity = o; canvas.style.KhtmlOpacity = o;}
        for(a=0;a<d.length;a++) {
            obj = document.getElementById(d[a]); if(obj) {
            l = obj.className, u = l.split(" "), v = obj.coords.split(",");
            if(k==0) {
                if(l.indexOf('forcegroup')!=-1) {k = getClassAttribute(u,"forcegroup");}else {k=0;}
                if(l.indexOf('icolor')!=-1) {c = getClassRGBColor(u,"icolor",co);}else {c=co;}
            } jg[z].setColor("#"+c);
            if(obj.shape.toLowerCase()=='rect') {
                jg[z].fillRect(parseInt(v[0]),parseInt(v[1]),parseInt(v[2]-v[0])+1,parseInt(v[3]-v[1])+1);
            }else if(obj.shape.toLowerCase()=='circle') {
                jg[z].fillEllipse(parseInt(v[0]-v[2]),parseInt(v[1]-v[2]),parseInt(v[2])*2+1,parseInt(v[2])*2+1);
            }else {x = new Array(); y = new Array(); i = 0; for(j=0;j<v.length;j+=2) {x[i] = parseInt(v[j]); y[i] = parseInt(v[j+1]); i++;} jg[z].fillPolygon(x,y);
            } jg[z].paint();}
        }
    }
}
function setAreaOut(obj,id,f,z) {
    var canvas = document.getElementById(id);
    if(isVM) {canvas.innerHTML = '';}else 
    if(isJG) {jg[z].clear();}else if(isCV) {
        var context = canvas.getContext("2d");
        context.clearRect(0,0,canvas.width,canvas.height);
    }
}
function getCoords(e,n,a,i,x,y,w,h,pw,ph) {
    var t, o, ox, oy, ex, ey, cx, cy, px=0, py=0;
    if (!e) {e = window.event; }
    if (e.pageX || e.pageY) {px = e.pageX; py = e.pageY;}
    ex = e.clientX; ey = e.clientY;
    if(self.pageXOffset||self.pageYOffset) {
        ox = self.pageXOffset; if(ox>0 && px==ex) {ex -= ox; }
        oy = self.pageYOffset; if(oy>0 && py==ey) {ey -= oy; }
    }else if(document.documentElement) {
        ox = document.documentElement.scrollLeft; 
        oy = document.documentElement.scrollTop;
    }else if(document.body) {
        ox = document.body.scrollLeft; oy = document.body.scrollTop;
    } 
    if(document.body.scrollHeight!=ph||document.body.scrollWidth!=pw) {
        var o = document.getElementById(i);
        var t = findPosXY(o); x = t.x; y = t.y;
    }
    cx = Math.min(Math.max(ex+ox-x,0),w); 
    cy = Math.min(Math.max(ey+oy-y,0),h);
    showCoords(n,a,cx,cy,w,h);
}
function findPosXY(ele) {
    var t; var d = {x:ele.offsetLeft, y:ele.offsetTop };
    if(ele.offsetParent) { t = findPosXY(ele.offsetParent); d.x += t.x; d.y += t.y;}
    return d;
}
function roundedRect(ctx,x,y,width,height,radius,nopath){
    if (!nopath) ctx.beginPath();
    ctx.moveTo(x,y+radius);
    ctx.lineTo(x,y+height-radius);
    ctx.quadraticCurveTo(x,y+height,x+radius,y+height);
    ctx.lineTo(x+width-radius,y+height);
    ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius);
    ctx.lineTo(x+width,y+radius);
    ctx.quadraticCurveTo(x+width,y,x+width-radius,y);
    ctx.lineTo(x+radius,y);
    ctx.quadraticCurveTo(x,y,x,y+radius);
    if (!nopath) ctx.closePath();
}
function getRadius(radius,width,height){
    var part = (Math.min(width,height)/100);
    radius = Math.max(Math.min(100,radius/part),0);
    return radius + '%';
}
function addMapper() {
    var themaps = getMaps('mapper');
    var image, object, bgrnd, canvas, blind, context, mapid, mname, ele, atr; 
    var classes = '', newClasses = '', func = '', tmp, i, j, o, b, c, d, r, t, n, f, x, y, w, h, pw, ph;
    for(i=0;i<themaps.length;i++) {
        image = themaps[i]; object = image.parentNode;
        if(image.id=='') {image.id = "gmipam_"+i;}
        object.style.position = (object.style.position=='static'||object.style.position==''?'relative':object.style.position);
        object.style.height = image.height+'px';
        object.style.width = image.width+'px';
        object.style.padding = 0+'px';
        object.style.MozUserSelect = "none";
        object.style.KhtmlUserSelect = "none"; 
        object.unselectable = "on";
        r = 0; n = 0; f = 0; b = '95c033'; c = '95c033'; o = 500;
        if(isCV) {canvas = document.createElement('canvas');}else if(isVM) {
        canvas = document.createElement(['<var style="zoom:1;overflow:hidden;display:block;width:'+image.width+'px;height:'+image.height+'px;padding:0;">'].join(''));
        }else {canvas = document.createElement('div');}
        canvas.id = image.id+'_canvas';
        classes = image.className.split(' '); 
        r = getClassValue(classes,"iradius");
        o = getClassValue(classes,"iopacity");
        b = getClassRGBColor(classes,"iborder",'95c033');
        c = getClassRGBColor(classes,"icolor",'95c033');
        n = getClassAttribute(classes,"noborder");
        f = getClassAttribute(classes,"nofade");
        d = getClassAttribute(classes,"showcoords");
        o = o==0?.7:o/100; r = parseInt(Math.min(Math.min(image.width/4,image.height/4),r));
        newClasses = getClasses(classes,"mapper");
        image.className = newClasses;
        mname = image.useMap.split("#"); mname = mname[1];
        mapid = document.getElementsByName(mname);
        if(mapid.length>0) {    
            for(j=0;j<mapid[0].areas.length;j++) {
                if(mapid[0].areas[j].shape.match(/(rect|poly|circle)/i)) {
                    if(window.opera||mapid[0].areas[j].coords!='') {
                        if(mapid[0].areas[j].id=='') {mapid[0].areas[j].id = mname+'_'+j;}
                        if(isVM||isIE) {
                            func = mapid[0].areas[j].onmouseover; if(func!=null) {tmp=String(func); func=(tmp.indexOf('anonymous()')>=0?tmp.substr(23,tmp.length-25):tmp);}
                            mapid[0].areas[j].onmouseover = new Function('setAreaOver(this,"'+canvas.id+'","'+b+'","'+c+'","'+o+'",'+n+','+f+','+i+');'+func); 
                            func = mapid[0].areas[j].onmouseout; if(func!=null) {tmp=String(func); func=(tmp.indexOf('anonymous()')>=0?tmp.substr(23,tmp.length-25):tmp);}
                            mapid[0].areas[j].onmouseout = new Function('setAreaOut(this,"'+canvas.id+'",'+f+','+i+');'+func); 
                        }else {
                            func = mapid[0].areas[j].getAttribute("onmouseover"); mapid[0].areas[j].setAttribute("onmouseover","setAreaOver(this,'"+canvas.id+"','"+b+"','"+c+"','"+o+"',"+n+","+f+","+i+");"+func); 
                            func = mapid[0].areas[j].getAttribute("onmouseout"); mapid[0].areas[j].setAttribute("onmouseout","setAreaOut(this,'"+canvas.id+"',"+f+","+i+");"+func); 
                        }
                    }
                }
            }
        }
        canvas.style.height = image.height+'px';
        canvas.style.width = image.width+'px';
        canvas.height = image.height;
        canvas.width = image.width;
        canvas.left = 0; canvas.top = 0;
        canvas.style.position = 'absolute';
        canvas.style.left = 0+'px';
        canvas.style.top = 0+'px';
        canvas.fading = 0;
        image.className = '';
        image.style.cssText = '';
        image.left = 0; image.top = 0;
        image.style.position = 'absolute';
        image.style.height = image.height+'px';
        image.style.width = image.width+'px';
        image.style.left = 0+'px';
        image.style.top = 0+'px';
        image.style.MozUserSelect = "none";
        image.style.KhtmlUserSelect = "none"; 
        image.unselectable = "on";
        if(isIE) {image.style.filter = "Alpha(opacity=0)";
        }else {image.style.opacity = 0;
          image.style.MozOpacity = 0;
          image.style.KhtmlOpacity = 0;}
        if(isCV && r>0) {bgrnd = document.createElement('canvas');}else if(isVM && r>0) {
        bgrnd = document.createElement(['<var style="zoom:1;overflow:hidden;display:block;width:'+image.width+'px;height:'+image.height+'px;padding:0;">'].join(''));
        }else {bgrnd = document.createElement('img'); bgrnd.src = image.src;}
        bgrnd.id = image.id+'_image';
        bgrnd.left = 0; bgrnd.top = 0;
        bgrnd.style.position = 'absolute';
        bgrnd.style.height = image.height+'px';
        bgrnd.style.width = image.width+'px';
        bgrnd.style.left = 0+'px';
        bgrnd.style.top = 0+'px';
        object.insertBefore(canvas,image);
        blind = document.createElement('div');
        blind.id = mname+'_blind';
        blind.className = "blind_area";
        blind.left = 0; blind.top = 0;
        blind.style.position = 'absolute';
        blind.style.height = image.height+'px';
        blind.style.width = image.width+'px';
        blind.style.left = 0+'px';
        blind.style.top = 0+'px';
        blind.innerHTML = " ";
        object.insertBefore(blind,image);
        if(isCV) {
            context = canvas.getContext("2d");
            context.clearRect(0,0,canvas.width,canvas.height);
        }else if(!isVM && !isCV) {if(isIE) {
            canvas.style.filter = "Alpha(opacity="+(o*100)+")";
            }else { canvas.style.opacity = o;
              canvas.style.MozOpacity = o;
              canvas.style.KhtmlOpacity = o;}
            if(typeof(window['jsGraphics']) !== 'undefined') {
                jg[i] = new jsGraphics(canvas); isJG = 1;
            }
        }        
        object.insertBefore(bgrnd,canvas);
        if(isCV && r>0) {
            bgrnd.height = image.height; bgrnd.width = image.width;
            context = bgrnd.getContext("2d");
            context.clearRect(0,0,bgrnd.width,bgrnd.height);
            roundedRect(context,0,0,bgrnd.width,bgrnd.height,r);
            context.clip();
            context.fillStyle = 'rgba(0,0,0,0)';
            context.fillRect(0,0,bgrnd.width,bgrnd.height);
            context.drawImage(image,0,0,bgrnd.width,bgrnd.height);
        }else if(isVM && r>0) {
            bgrnd.height = image.height; bgrnd.width = image.width; r = getRadius(r,bgrnd.width,bgrnd.height);        
            bgrnd.innerHTML = '<v:roundrect arcsize="'+r+'" strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:0px;top:0px;width:'+bgrnd.width+'px;height:'+bgrnd.height+'px;"><v:fill src="'+image.src+'" type="frame" /></v:roundrect>';
        }        
        if(d>0) {
            ele = document.getElementById(image.id);
            w = parseInt(image.width); h = parseInt(image.height);
            t = findPosXY(ele); x = t.x; y = t.y;
            ph = document.body.scrollHeight; pw = document.body.scrollWidth;
            if(isVM||isIE) {
                func = image.onmousemove; if(func!=null) {tmp=String(func); func=tmp.substr(23,tmp.length-25);}
                image.onmousemove = new Function('getCoords(event,"'+mname+'",0,"'+image.id+'",'+x+','+y+','+w+','+h+','+pw+','+ph+');'+func); 
            }else {
                func = image.getAttribute("onmousemove"); 
                image.setAttribute("onmousemove","getCoords(event,'"+mname+"',0,'"+image.id+"',"+x+","+y+","+w+","+h+","+pw+","+ph+");"+func); 
            }
            if(mapid.length>0) {
                for(j=0;j<mapid[0].areas.length;j++) {
                    if(mapid[0].areas[j].shape.match(/(rect|poly|circle)/i)) { 
                        if(window.opera||mapid[0].areas[j].coords!='') {
                            atr = mapid[0].areas[j].id;
                            if(isVM||isIE) {
                                func = mapid[0].areas[j].onmousemove; if(func!=null) {tmp=String(func); func=tmp.substr(23,tmp.length-25);}
                                mapid[0].areas[j].onmousemove = new Function('getCoords(event,"'+mname+'","'+atr+'","'+image.id+'",'+x+','+y+','+w+','+h+','+pw+','+ph+');'+func); 
                            }else {
                                func = mapid[0].areas[j].getAttribute("onmousemove"); 
                                mapid[0].areas[j].setAttribute("onmousemove","getCoords(event,'"+mname+"','"+atr+"','"+image.id+"',"+x+","+y+","+w+","+h+","+pw+","+ph+");"+func); 
                            }
                        }
                    }
                }
            }
        }
    }
}
var mapperOnload = window.onload;
window.onload = function () { if(mapperOnload) mapperOnload(); addMapper(); }
var tooltip=function(){
    var id = 'tt';
    var top = 3;
    var left = 3;
    var maxw = 300;
    var speed = 10;
    var timer = 20;
    var endalpha = 95;
    var alpha = 0;
    var tt,t,c,b,h;
    var ie = document.all ? true : false;
    return{
        show:function(v,w){
            if(tt == null){
                tt = document.createElement('div');
                tt.setAttribute('id',id);
                t = document.createElement('div');
                t.setAttribute('id',id + 'top');
                c = document.createElement('div');
                c.setAttribute('id',id + 'cont');
                b = document.createElement('div');
                b.setAttribute('id',id + 'bot');
                tt.appendChild(t);
                tt.appendChild(c);
                tt.appendChild(b);
                document.body.appendChild(tt);
                tt.style.opacity = 0;
                tt.style.filter = 'alpha(opacity=0)';
                document.onmousemove = this.pos;
            }
            tt.style.display = 'block';
            c.innerHTML = v;
            tt.style.width = w ? w + 'px' : 'auto';
            if(!w && ie){
                t.style.display = 'none';
                b.style.display = 'none';
                tt.style.width = tt.offsetWidth;
                t.style.display = 'block';
                b.style.display = 'block';
            }
            if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
            h = parseInt(tt.offsetHeight) + top;
            clearInterval(tt.timer);
            tt.timer = setInterval(function(){tooltip.fade(1)},timer);
        },
        pos:function(e){
            var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
            var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
            tt.style.top = (u - h) + 'px';
            tt.style.left = (l + left) + 'px';
        },
        fade:function(d){
            var a = alpha;
            if((a != endalpha && d == 1) || (a != 0 && d == -1)){
                var i = speed;
                if(endalpha - a < speed && d == 1){
                    i = endalpha - a;
                }else if(alpha < speed && d == -1){
                    i = a;
                }
                alpha = a + (i * d);
                tt.style.opacity = alpha * .01;
                tt.style.filter = 'alpha(opacity=' + alpha + ')';
            }else{
                clearInterval(tt.timer);
                if(d == -1){tt.style.display = 'none'}
            }
        },
        hide:function(){
            clearInterval(tt.timer);
            tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
        }
    };
}();
  /******Hover BG effect*****/
/******** News & Offers section**********/
var ValidateNewsSignUp = function()
{
var emailid= document.getElementById('ucNewsoffer_txt_zipcode').value;
$.get("/OODS-newssignup-validate.aspx" + "?Email="+emailid, function(data){
if(data=='3')
{
alert('Enter Valid Email address');
}
else
{
    popNewsLetter(560,360,'/NewsandOffersPopup.aspx');
}
}
);
}
function popNewsLetterForNewsOffers(winwidth,winheight,url)
{
         
            
            document.getElementById('divopaquenewsoffer').className="opaquediv";
            document.getElementById('divopaquenewsoffer').style.height = (GetScrollHeight()+18)+"px";
            document.getElementById('divopaquenewsoffer').style.width = GetWidth();
            document.getElementById('divtoolbarnewsoffer').className="toolbar";
            document.getElementById('divwindownewsoffer').className="windowstyle";
            document.getElementById('divwindownewsoffer').style.height = (winheight)+"px";
            document.getElementById('divwindownewsoffer').style.width = winwidth;
            document.getElementById('divwindownewsoffer').style.top =((GetHeight()-winheight)/2)+"px";
            document.getElementById('divwindownewsoffer').style.left = (((GetWidth()-winwidth)/2)+10)+"px";
            document.getElementById('divtoolbarnewsoffer').className="divShow";
            document.getElementById('DivNewsLetternewsoffer').className="divShow";
            document.getElementById('frameNewsLetternewsoffer').src=url;
}
function popup_closenewsoffer()
{
    parent.top.document.getElementById('divwindownewsoffer').className="hide";
    parent.top.document.getElementById('divopaquenewsoffer').className="hide";
}
/******** News & Offers section**********/
function GoogleBoxFocus(value)
{
if((value)=='Enter Zip Code')document.getElementById('idFilter_zipcode').value='';
}
function GoogleBoxBlur(value)
{
if((value)=='')document.getElementById('idFilter_zipcode').value='Enter Zip Code';
}
 
/******** News & Offers section**********/
 
/***Pure purose Position***/
function divshow(flip,divcont)
{
if(flip=='0')
{
document.getElementById(divcont).style.display = "block";
}
else
{
document.getElementById(divcont).style.display = "none";
}
}
 
/***Pure purose Position***/
/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip
var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="/assets/images/layout/TooltipArrow.gif">') //write out pointer image
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}
function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}
function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip
 
/**************Add Another Pet ***************/
function ShowAnotherPet(divPet2,divPet3,divPet4,divPet5,divbtnAddPet)
{
 if (document.getElementById(divPet2).style.display=='none')
  document.getElementById(divPet2).style.display='block';
 else if (document.getElementById(divPet3).style.display=='none')
  document.getElementById(divPet3).style.display='block';
 else if (document.getElementById(divPet4).style.display=='none')
  document.getElementById(divPet4).style.display='block';
 else if (document.getElementById(divPet5).style.display=='none')
 {
 document.getElementById(divPet5).style.display='block';
 document.getElementById(divbtnAddPet).style.display='none';
 }
 return false;
}
/**************Add Another Pet ***************/
 function popcontestrules(winwidth,winheight,url)
        {
         
            
            document.getElementById('divopaque').className="opaquediv";
            document.getElementById('divopaque').style.height = (GetScrollHeight()+18)+"px";
            document.getElementById('divopaque').style.width = GetWidth();
            document.getElementById('divtoolbar').className="toolbar";
            document.getElementById('divwindow').className="windowstyle";
            document.getElementById('divwindow').style.height = (winheight)+"px";
            document.getElementById('divwindow').style.width = winwidth;
            document.getElementById('divwindow').style.top =((GetHeight()-winheight)/2)+"px";
            document.getElementById('divwindow').style.left = (((GetWidth()-winwidth)/2)+10)+"px";
            document.getElementById('divtoolbar').className="divShow";
            document.getElementById('DivNewsLetter').className="divShow";
            document.getElementById('frameNewsLetter').src=url;
            alert('test')
        }

    function checkRadio() {  
        var isChecked = false;  
         
             if(document.getElementById("nr_chkMarketPermissions").checked == true)  
                   isChecked = true;  
           
      
         if(!isChecked)  
           return confirm("You must opt-in to in order to receive the benefits of the MY NUTRO REWARDS™ program.  Please select “yes” and continue.");  
    
          
  }