function toggleFeaturedItems() {
    var fiDiv = $('fiDiv');
    var fiShowHideLink = $('fiHideShowLink');
    if ( ! fiShowHideLink )
        alert('Could not locate fiShowHideLink');
    if ( fiDiv.style.display == 'none' ) {
        fiDiv.style.display = '';
        fiShowHideLink.className = "right hideitems";
        fiShowHideLink.innerHTML = "Hide This";
        SetCookie("hidefi", "", 2000, "/", ".thesimsresource.com");  
    } else {
        fiDiv.style.display = 'none';
        fiShowHideLink.className = "right showthis";
        fiShowHideLink.innerHTML = "Show This";
        SetCookie("hidefi", "1", 2000, "/", ".thesimsresource.com"); 
    }
}

var downloadRules =
{   
    'body' : function(el)
    {
        if($('fiDiv'))
        {
            if(CheckCookie("hidefi")!="1")
            {
               toggleFeaturedItems();
            }    
        }
    }
    ,
	'a.bdownload' : function(el)
	{
		if(!auth_isLoggedIn())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/not-logged-in/feature/download"); return false; }
			return false;
		}
		el.style.display = "block";
		el.onclick = function(e)
		{
	 		var ret = checkRequirements(this);
	 		/*
            if(!auth_isSubscriber())
	 			return nonSubscriberLightbox(this);
            */
	 		return(ret);
		}
	}
	,
	'a.dl' : function(el)
	{
		if(!auth_isLoggedIn())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/not-logged-in/feature/download"); return false; }
			return false;
		}
		el.style.display = "block";
		el.onclick = function(e)
		{
            var itemid = this.getAttribute("itemid");
            if ( itemid > 0 ) {
                var feedbackbox = $('feedbackbox_' + itemid);
                if ( feedbackbox ) feedbackbox.style.visibility = 'visible';
            }
	 		var ret = checkRequirements(this);
            /*
	 		if(!auth_isSubscriber())
	 			return nonSubscriberLightbox(this);
	 		*/
            return(ret);
		}
	}
	,
	'a.dll' : function(el)
	{
		if(!auth_isLoggedIn())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/not-logged-in/feature/download"); return false; }
			return false;
		}
		el.style.display = "block";
		el.onclick = function(e)
		{
	 		var ret = checkRequirements(this);
	 		/*
            if(!auth_isSubscriber())
	 			return nonSubscriberLightbox(this);
	 		*/
            return(ret);
		}
	}
	,
	'a.s2p' : function(el)
	{
		if(!auth_isLoggedIn())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/not-logged-in/feature/download"); return false;  }
			return false;
		}
		el.style.display = "block";
		el.onclick = function(e)
		{
            var itemid = this.getAttribute("itemid");
            if ( itemid > 0 ) {
                var feedbackbox = $('feedbackbox_' + itemid);
                if ( feedbackbox ) feedbackbox.style.visibility = 'visible';
            }
	 		var ret = checkRequirements(this);
	 		/*
            if(!auth_isSubscriber())
	 			return nonSubscriberLightbox(this);
	 		*/
            return(ret);
		}
	}
    ,
    'a.s3p' : function(el)
    {
        if(!auth_isLoggedIn())
        {
            el.onclick = function() { LightBox.LoadTemplate("/account/not-logged-in/feature/download"); return false;  }
            return false;
        }
        el.style.display = "block";
        el.onclick = function(e)
        {
            var itemid = this.getAttribute("itemid");
            if ( itemid > 0 ) {
                var feedbackbox = $('feedbackbox_' + itemid);
                if ( feedbackbox ) feedbackbox.style.visibility = 'visible';
            }
             var ret = checkRequirements(this);
             /*
            if(!auth_isSubscriber())
                 return nonSubscriberLightbox(this);
             */
            return(ret);
        }
    }    
	,	
	'a.bsk' : function(el)
	{     
		if(!auth_isLoggedIn())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/not-logged-in/feature/download"); return false;  }
			return false;
		}
		else if(!auth_isSubscriber())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/subscriber-feature/feature/downloadbasket"); return false;  }
		 	return false;
		}
		else
		{
	 		el.onclick = function()
	 		{		
				if(!checkRequirements(this)) return false;
				addToBasket(this);
			}
		}
		return false;
	}
	,	
	'a.bskl' : function(el)
	{
		if(!auth_isLoggedIn())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/not-logged-in/feature/download"); return false;  }
			return false;
		}
		else if(!auth_isSubscriber())
		{
			el.onclick = function() { LightBox.LoadTemplate("/account/subscriber-feature/feature/downloadbasket"); return false;  }
		 	return false;
		}
		else
		{
	 		el.onclick = function()
	 		{		
				if(!checkRequirements(this)) return false;
				addToBasket(this);
			}
		}
		return false;
	}
}

Behaviour.register(downloadRules);
                