// Copyright Acro Media Inc. 1998-2009, www.acromediainc.com 

var copyrightYear = {
	init: function(){
		if(document.getElementById('insertYear')) document.getElementById('insertYear').innerHTML = new Date().getFullYear();
	}
}

var externalLinks = {
	init: function(){
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			if (anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "external") anchors[i].target = "_blank";
		}
	}
}

function siteOnload(){
	copyrightYear.init();
	externalLinks.init();
}

function addLoadEvent(func){
	var oldOnLoad = window.onload;
	if(typeof window.onload != 'function'){
		window.onload = func;
	}
	else{
		window.onload = function(){
			oldOnLoad();
			func();
		}
	}
}

// Shop By Brand - FlyOut
function toggleShopByBrandFlyOut()
{
	var brandFlyOut = document.getElementById('shopByBrandFlyOut');
  var brandFlyOutButton = document.getElementById('bShopByBrandMenu');
	if (brandFlyOut && brandFlyOutButton)
	{
		if (brandFlyOut.style.display == 'none' || brandFlyOut.style.display == '')
		{
			brandFlyOut.style.display = 'block';
      brandFlyOutButton.setAttribute("class", "active");
      brandFlyOutButton.setAttribute("className", "active"); // IE6 Fix
			return true;
		}
		if (brandFlyOut.style.display == 'block')
		{
			brandFlyOut.style.display = 'none';
      brandFlyOutButton.setAttribute("class", "null");
      brandFlyOutButton.setAttribute("className", "null"); // IE6 Fix
			return false;
		}
	}
}

// Featured Content Section
function toggleFeatButton1()
{
  var featButton1 = document.getElementById('bFeatProducts');
  var featButton2 = document.getElementById('bBestSellers');
  var featButton3 = document.getElementById('bBrandNewGraphics');
  var featButton4 = document.getElementById('bNewThisSpring');
  var featButton5 = document.getElementById('bClearanceItems');
  var option1 = document.getElementById('option1Content');
  var option2 = document.getElementById('option2Content');
  var option3 = document.getElementById('option3Content');
  var option4 = document.getElementById('option4Content');
  var option5 = document.getElementById('option5Content');
  
  if (featButton1)
  {
    option1.style.display = 'block';
  }            
  
  if (option1)
  {
   if (option1.style.display == 'block')
   {
    featButton1.setAttribute("class", "active");
    featButton1.setAttribute("className", "active"); // IE6 Fix
    featButton2.setAttribute("class", "null");
    featButton2.setAttribute("className", "null"); // IE6 Fix
    featButton3.setAttribute("class", "null");
    featButton3.setAttribute("className", "null"); // IE6 Fix
    featButton4.setAttribute("class", "null");
    featButton4.setAttribute("className", "null"); // IE6 Fix
    featButton5.setAttribute("class", "null");
    featButton5.setAttribute("className", "null"); // IE6 Fix                
    option2.style.display = 'none';
    option3.style.display = 'none';
    option4.style.display = 'none';
    option5.style.display = 'none';
   } 
  }  
  
}  

function toggleFeatButton2()
{
  var featButton1 = document.getElementById('bFeatProducts');
  var featButton2 = document.getElementById('bBestSellers');
  var featButton3 = document.getElementById('bBrandNewGraphics');
  var featButton4 = document.getElementById('bNewThisSpring');
  var featButton5 = document.getElementById('bClearanceItems');
  var option1 = document.getElementById('option1Content');
  var option2 = document.getElementById('option2Content');
  var option3 = document.getElementById('option3Content');
  var option4 = document.getElementById('option4Content');
  var option5 = document.getElementById('option5Content');
  
  if (featButton2)
  {
    option2.style.display = 'block';
  }            
  
  if (option2)
  {
   if (option2.style.display == 'block')
   {
    featButton1.setAttribute("class", "null");
    featButton1.setAttribute("className", "null"); // IE6 Fix
    featButton2.setAttribute("class", "active");
    featButton2.setAttribute("className", "active"); // IE6 Fix
    featButton3.setAttribute("class", "null");
    featButton3.setAttribute("className", "null"); // IE6 Fix
    featButton4.setAttribute("class", "null");
    featButton4.setAttribute("className", "null"); // IE6 Fix
    featButton5.setAttribute("class", "null");
    featButton5.setAttribute("className", "null"); // IE6 Fix   
    option1.style.display = 'none';
    option3.style.display = 'none';
    option4.style.display = 'none';
    option5.style.display = 'none';
   } 
  }    
  
}  

function toggleFeatButton3()
{
  var featButton1 = document.getElementById('bFeatProducts');
  var featButton2 = document.getElementById('bBestSellers');
  var featButton3 = document.getElementById('bBrandNewGraphics');
  var featButton4 = document.getElementById('bNewThisSpring');
  var featButton5 = document.getElementById('bClearanceItems');
  var option1 = document.getElementById('option1Content');
  var option2 = document.getElementById('option2Content');
  var option3 = document.getElementById('option3Content');
  var option4 = document.getElementById('option4Content');
  var option5 = document.getElementById('option5Content');
  
  if (featButton3)
  {
    option3.style.display = 'block';
  }            
  
  if (option3)
  {
   if (option3.style.display == 'block')
   {
    featButton1.setAttribute("class", "null");
    featButton1.setAttribute("className", "null"); // IE6 Fix
    featButton2.setAttribute("class", "null");
    featButton2.setAttribute("className", "null"); // IE6 Fix
    featButton3.setAttribute("class", "active");
    featButton3.setAttribute("className", "active"); // IE6 Fix
    featButton4.setAttribute("class", "null");
    featButton4.setAttribute("className", "null"); // IE6 Fix
    featButton5.setAttribute("class", "null");
    featButton5.setAttribute("className", "null"); // IE6 Fix   
    option1.style.display = 'none';
    option2.style.display = 'none';
    option4.style.display = 'none';
    option5.style.display = 'none';
   } 
  }    
  
}  

function toggleFeatButton4()
{
  var featButton1 = document.getElementById('bFeatProducts');
  var featButton2 = document.getElementById('bBestSellers');
  var featButton3 = document.getElementById('bBrandNewGraphics');
  var featButton4 = document.getElementById('bNewThisSpring');
  var featButton5 = document.getElementById('bClearanceItems');
  var option1 = document.getElementById('option1Content');
  var option2 = document.getElementById('option2Content');
  var option3 = document.getElementById('option3Content');
  var option4 = document.getElementById('option4Content');
  var option5 = document.getElementById('option5Content');
  
  if (featButton4)
  {
    option4.style.display = 'block';
  }            
  
  if (option4)
  {
   if (option4.style.display == 'block')
   {
    featButton1.setAttribute("class", "null");
    featButton1.setAttribute("className", "null"); // IE6 Fix
    featButton2.setAttribute("class", "null");
    featButton2.setAttribute("className", "null"); // IE6 Fix
    featButton3.setAttribute("class", "null");
    featButton3.setAttribute("className", "null"); // IE6 Fix
    featButton4.setAttribute("class", "active");
    featButton4.setAttribute("className", "active"); // IE6 Fix
    featButton5.setAttribute("class", "null");
    featButton5.setAttribute("className", "null"); // IE6 Fix   
    option1.style.display = 'none';
    option2.style.display = 'none';
    option3.style.display = 'none';
    option5.style.display = 'none';
   } 
  }    
  
}  

function toggleFeatButton5()
{
  var featButton1 = document.getElementById('bFeatProducts');
  var featButton2 = document.getElementById('bBestSellers');
  var featButton3 = document.getElementById('bBrandNewGraphics');
  var featButton4 = document.getElementById('bNewThisSpring');
  var featButton5 = document.getElementById('bClearanceItems');
  var option1 = document.getElementById('option1Content');
  var option2 = document.getElementById('option2Content');
  var option3 = document.getElementById('option3Content');
  var option4 = document.getElementById('option4Content');
  var option5 = document.getElementById('option5Content');
  
  if (featButton5)
  {
    option5.style.display = 'block';    
  }            
  
  if (option5)
  {
   if (option5.style.display == 'block')
   {
    featButton1.setAttribute("class", "null");
    featButton1.setAttribute("className", "null"); // IE6 Fix
    featButton2.setAttribute("class", "null");
    featButton2.setAttribute("className", "null"); // IE6 Fix
    featButton3.setAttribute("class", "null");
    featButton3.setAttribute("className", "null"); // IE6 Fix
    featButton4.setAttribute("class", "null");
    featButton4.setAttribute("className", "null"); // IE6 Fix
    featButton5.setAttribute("class", "active");
    featButton5.setAttribute("className", "active"); // IE6 Fix   
    option1.style.display = 'none';
    option2.style.display = 'none';
    option3.style.display = 'none';
    option4.style.display = 'none';
   } 
  }    
  
}  

addLoadEvent(siteOnload);
