// tnav hover
$j(document).ready(function () {   
       
    $j('#newdesign_tnav li').hover(  
        function () {  
           $j('ul', this).show();  

       },   
       function () {  
            $j('ul', this).hide();           
        }  
    );  
       
 });  
// sign up drop down
$j(document).ready(function(){
	$j('#sign-upDiv').hide().load('/ajax/signup.html', function(){	
		$j('#signupbtn').click(function() {
 			$j('#sign-upDiv').slideToggle("slow");
        });
        $j('#hide-btn').click(function() {
 			$j('#sign-upDiv').slideUp("slow");
	    });
	});
     
});
// preload jquery plugin
$j(document).ready(function(){
  $j.preloadCssImages();
}); 

// active link based on tnid
function evalURL(){
	strCurrentUrl = window.location;
	strCurrentUrl = strCurrentUrl.toString();	
	strCurrentUrl = strCurrentUrl.toLowerCase();	
}

function setActiveTNav(){
	var strTNImgIds = "tnimgsnow,tnimgrun,tnimgshoes,tnimgtri,tnimgbike,tnimghike,tnimgswim,tnimgkids,tnimgteam,tnimgsale,tnimgbuzz";
	var arrTNImgIds;
	var strImgNames = "images/snow_icon.png,images/run_icon.png,images/shoes_icon.png,images/tri_icon.png,images/bike_icon.png,images/camp_icon.png,images/swim_icon.png,images/kids_icon.png,images/team_icon.png,images/sale_icon.png, buzz_icon.png";
	var arrImgNames;
	var tempTName;
	var tempImgSrc;
	evalURL();
	if (strCurrentUrl.indexOf('tnid=') != -1){	
		tempTName = strCurrentUrl.substring(strCurrentUrl.indexOf('tnid=')+5, strCurrentUrl.length);						
		tempTName = "tnimg" + tempTName;
		tempImgSrc = document.getElementById(tempTName).src;
		tempImgSrc = tempImgSrc.replace(".png","_active.png");
		document.getElementById(tempTName).src = tempImgSrc;
	}
}
//png fix for ie6
 var blank = new Image();
 blank.src = 'images/newdesign/blank.gif';
 
 $j(document).ready(function() {
   var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
   if (badBrowser) {
     // get all pngs on page
     $j('img[src$=.png]').each(function() {
       if (!this.complete) {
         this.onload = function() { fixPng(this) };
       } else {
         fixPng(this);
       }
     });
   }
 });
 
 function fixPng(png) {
   // get src
   var src = png.src;
   // set width and height
   if (!png.style.width) { png.style.width = $j(png).width(); }
   if (!png.style.height) { png.style.height = $j(png).height(); }
   // replace by blank image
   png.onload = function() { };
   png.src = blank.src;
   // set filter (display original image)
   png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
 }
//hover fix for ie6
$j(document).ready(function () {   
      $j('li#tnsnow').hover(function() {
        $j(this).addClass('hover-snow');
      }, function() {
        $j(this).removeClass('hover-snow');
      });
	   $j('li#tnrun').hover(function() {
        $j(this).addClass('hover-run');
      }, function() {
        $j(this).removeClass('hover-run');
      });
	   	 $j('li#tnshoes').hover(function() {
        $j(this).addClass('hover-shoes');
      }, function() {
        $j(this).removeClass('hover-shoes');
      });
		  $j('li#tntri').hover(function() {
        $j(this).addClass('hover-tri');
      }, function() {
        $j(this).removeClass('hover-tri');
      });
		  $j('li#tnbike').hover(function() {
        $j(this).addClass('hover-bike');
      }, function() {
        $j(this).removeClass('hover-bike');
      });
			$j('li#tnhike').hover(function() {
        $j(this).addClass('hover-camp');
      }, function() {
        $j(this).removeClass('hover-camp');
      });
			$j('li#tnswim').hover(function() {
        $j(this).addClass('hover-swim');
      }, function() {
        $j(this).removeClass('hover-swim');
      });
		$j('li#tnkids').hover(function() {
        $j(this).addClass('hover-kids');
      }, function() {
        $j(this).removeClass('hover-kids');
      });
		$j('li#tnteam').hover(function() {
        $j(this).addClass('hover-team');
      }, function() {
        $j(this).removeClass('hover-team');
      });
		$j('li#tnsale').hover(function() {
        $j(this).addClass('hover-sale');
      }, function() {
        $j(this).removeClass('hover-sale');
      });
		$j('li#tnbuzz').hover(function() {
        $j(this).addClass('hover-buzz');
      }, function() {
        $j(this).removeClass('hover-buzz');
      });	   				
});


