﻿DesignGuide={

    init: function()
    {
        var click_images = document.getElementsByTagName("img");

        for(i = 0; i < click_images.length; i++)
        {
            var image_item = click_images[i];
            if(image_item.className == "plus-minus_click")
            {
                helper.addEvent(image_item, 'click', DesignGuide.ToggleDescription, false);
            }
        }
    },
    
    ToggleDescription: function(e)
    {
		var target = helper.getTarget(e);
		
		//toggle image - > plus/minus
		var image_name = target.getAttribute("src");

		//toggle border
		var first_td = target.parentNode.parentNode.parentNode.parentNode.parentNode;

		if(image_name.indexOf("plus.gif") >= 0)
		{
		    target.setAttribute("src", "images/minus.gif");
		    first_td.style.borderBottom = "0";
		}
		else
		{
		    target.setAttribute("src", "images/plus.gif");
		    first_td.style.borderBottom = "";
		}
				
		//category text
		var category_td = target.parentNode.nextSibling;
		
		if(category_td.nodeType == 3)//fix for IE
		{
		    category_td = category_td.nextSibling;
		}		
		
		if(category_td.className == "category_td")
		{
		    category_td.className = "category_td_red";
		}
		else if(category_td.className == "category_td_red")
		{
		    category_td.className = "category_td";
		}
		
		//toggle row
		//var next_row = target.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.nextSibling.nextSibling;
		var next_row = target.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.nextSibling;
		
		if(next_row.nodeType == 3)//fix for IE
		{
		    next_row = next_row.nextSibling;
		}

		if(next_row.className == "category_dropdown_row_off")
		{
		    next_row.className = "category_dropdown_row_on";
		}
		else if(next_row.className == "category_dropdown_row_on")
		{
		    next_row.className = "category_dropdown_row_off";
		}
		
    }
    
}


