// JavaScript Document


//global variable to allow console inspection of tree:
var tree;

//anonymous function wraps the remainder of the logic:
(function() {

	//function to initialize the tree:
    function treeInit() {
        buildRandomTextNodeTree();
    }
    
	//Function  creates the tree and 
	//builds between 3 and 7 children of the root node:
    function buildRandomTextNodeTree() {
	
		//instantiate the tree:
        tree = new YAHOO.widget.TreeView("treeDiv1");

        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f1'>What is a gel nail?</h1>", tree.getRoot(), false);
		new YAHOO.widget.TextNode('<font size="1">Gel nail refers to the nail enhancement system that uses a special synthetic resin which cures and hardens when exposed to ultraviolet (UVA) light, and applying this to strengthens nails or create tip overlays and sculptures.</font><br><br>', tmpNode, false);
        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f2'>What is the gel made of?</h1>", tree.getRoot(), false);
            new YAHOO.widget.TextNode("<font size='1'>The gel is made of synthetic resin mixed with polymerization initiators. Polymerization refers to a chemical reaction, or curing in the case of gel nails. The gel itself does not react but it is the initiator that changes chemically under UV light, and hardens the gel. The color gel is made of the same gel, mixed with pigmentation. The glitter found in the gel is mica or glass. </font><br><br>", tmpNode, false);		
        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f3'>Can you use gel to sculpture?</h1>", tree.getRoot(), false);
		new YAHOO.widget.TextNode('<font size="1">Sculpturing is to create something three dimensional. In nail treatments, this is a nail extension technique where a nail form, which is like a template, is fit to the natural nail, upon which various materials are applied.<br>Sculptured nails mostly refer to the liquid “acrylic acid monomer” and powder “acrylic acid polymer,” used as dental materials for temporary fillings, which are mixed, polymerized and cured. This is the reason why sculpture is automatically equated with nail art that uses a mixture of powder and liquid. However, there is no difference when the material used is gel; applied on the nail form and cured, it becomes gel sculptured nails.</font><br><br>', tmpNode, false);		       
        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f4'>What is a tip overlay?</h1>", tree.getRoot(), false);
            new YAHOO.widget.TextNode("<font size='1'>In an overlay, a plastic nail tip is placed on the nail plate with a special adhesive. The tip is filed and blended into the natural nail at the seam, after which a mixture or gel is applied to strengthen the entire nail.<br>Generally speaking, nail technicians are not comfortable with the use of tips. When filed properly and the seam blended well, however, an appealing look can be achieved on the free edge. Additionally, applying a tip can reinforce natural nails that tend to be soft and brittle. <br>Tips can also be used on peeling nails or nails that have been bitten short.</font><br><br>", tmpNode, false);
        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f5'>What is refill and maintenance about?</h1>", tree.getRoot(), false);
            new YAHOO.widget.TextNode("<font size='1'>A refill (also known as ‘fill’) or touch up involves applying additional mixture or gel to the new growth of the natural nail plate, then touching up and balancing the overall shape to produce the desired finish.<br>How often a refill is required depends upon the product the particular salon uses, but it is recommended that clients get this treatment every 2 to 5 weeks.</font><br><br>", tmpNode, false);                    
        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f6'>Are there guidelines for home care?</h1>", tree.getRoot(), false);
            new YAHOO.widget.TextNode("<font size='1'>Home care of Calgel-enhanced nails should be done once a week. Calgel is a long-lasting nail system, and maintenance is very simple. All it takes is 10 minutes to re-apply the top coat. Not only will you protect the gel treatment, it will also keep that beautiful glow on your nails.</font><br><br>", tmpNode, false);
        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f7'>How do you remove the gel?</h1>", tree.getRoot(), false); 
		new YAHOO.widget.TextNode("<font size='1'>As it is the case with many products, the thick coating of cured gel is highly resistant and cannot be removed using acetone and other solvents, and the only way is to file the gel down. This can be a very time-consuming and tedious process. Extra caution is required for the removal as the nail can ‘heat up’ from the filing and can easily damage the layer of the natural nail.<br>Calgel is specially formulated so that a solution can safely remove the cured gel without damaging the natural nail. By using the Calaway, clients can remove Calgel even at home.</font><br><br>", tmpNode, false);
		var tmpNode = new YAHOO.widget.TextNode("<h1 class='f8'>How long does the gel last?</h1>", tree.getRoot(), false);   
		new YAHOO.widget.TextNode("<font size='1'>Calgel can last as long as 3 weeks to 5 weeks, although this varies by the lifestyle and nail condition of the client. Whether by occupation, lifestyle or daily activity, if pressure is applied or the hands are frequently immersed in water, the chances of damage on the natural nails are that much greater. The client may experience lifting and the gel nail simply won’t last very long. In the winter, dryness may also cause peeling of the natural nails, which can lift the gel from the edge. It is recommended to sculpture the nails or use tips and overlay as a way of strengthening the free edge. <br>Calgel is highly durable and can last 3 to 5 weeks on average; however, clients are advised to visit the nail salon once a month for proper maintenance.</font><br><br>", tmpNode, false);      
        var tmpNode = new YAHOO.widget.TextNode("<h1 class='f9'>Is it true that nails can’t ‘breathe’ when nail polish or gel is applied?</h1>", tree.getRoot(), false);
            new YAHOO.widget.TextNode("<font size='1'>Some people feel that their nails cannot ‘breathe,’ or dislike the ‘heaviness’ of products applied to their nails. Similar to the structure of hair, nails are made of a protein called keratin. It is not capable of breathing as it is non-living, which explains why there is no pain (or blood) involved when trimming the hair or nails. Applying any kind of coating on the nails has no interference whatsoever with the body’s breathing.People who are unaccustomed to the smell of nail products (thinners in nail polish, distinct smell of acrylic nails, etc.) will find such odors to be quite offensive. Cases have been reported of infants who suffered thinner poisoning after nail polish was applied to their nails. It should be remembered that any treatment of the nails must be done in a well-ventilated place.</font><br><br>", tmpNode, false);
		var tmpNode = new YAHOO.widget.TextNode("<h1 class='f10'>What should I do with peeling nails?</h1>", tree.getRoot(), false);
		new YAHOO.widget.TextNode("<font size='1'>The most obvious reason for peeling nails is dryness. What many people commonly think of as the nail is the nail plate, which consists of 3 layers. There is a very small amount of moisture and oil in or between these layers. When the moisture and oil are lost due to dryness, the nail may peel into 2 or 3 layers. <br>As mentioned above, the nail is non-living and does not breathe. Applying lotions and oils may not always provide the desired effect as nails don’t absorb moisturizing agents like the skin does. The tips of the finger are constantly in use for various daily activities, and difficult to keep moisturized. <br>Cuticle oils are recommended because jojoba oil, the main ingredient, is highly permeable and coats the surface of the nail to protect it from dryness. When using a cream, apply it on the cuticle and gently massage it in. <br>Ideally, it is better to treat the nails with a moisturizer every time we wash our hands. Wearing gloves while washing dishes or using household cleaning agents is also a good idea. Protecting the nails from drying and regular moisturizing can improve the problem of peeling nails. If you have peeling problems but wish to grow your nails or make nail polish last longer, the gel sculpture or tip overlay is the recommended treatment.</font><br><br>", tmpNode, false);
		var tmpNode = new YAHOO.widget.TextNode("<h1 class='f11'>How does gel sculpture differ from tip overlays?</h1>", tree.getRoot(), false);
		new YAHOO.widget.TextNode("<font size='1'>Many people feel unsure which of the two nail extension treatments is better for them. <br>As for the feel and durability of the nail extension, results may vary by the gel manufacturer. With Calgel, sculptured nails and tip overlays will last the same amount of time. The difference between the two is similar to an orthopedic cast and a soft dressing. The hard cast, which is frequently made of plaster, is usually used on more serious conditions such as a fracture. The cast will completely protect and stabilize the injured part of the body. A soft dressing with splints may be used on less serious or recovering injuries – it provides some level of protection but also allows flexibility of the body part. <br>The tip overlay is like the hard cast in that the nail tip covers and supports damaged nails. On the other hand, the gel accommodates the flexibility of the natural nail and is much like the soft dressing. <br>The choice between the two treatments is determined by the condition of the nails. The nail tip is recommended if there is significant damage to the nails, since sculptured Calgel will not be hard enough to provide the nails with sufficient support.</font><br><br>", tmpNode, false);
       // Expand and collapse happen prior to the actual expand/collapse,
       // and can be used to cancel the operation
       tree.subscribe("expand", function(node) {
              YAHOO.log(node.index + " was expanded", "info", "example");
              // return false; // return false to cancel the expand
           });

       tree.subscribe("collapse", function(node) {
              YAHOO.log(node.index + " was collapsed", "info", "example");
           });

       // Trees with TextNodes will fire an event for when the label is clicked:
       tree.subscribe("labelClick", function(node) {
              YAHOO.log(node.index + " label was clicked", "info", "example");
           });

		//The tree is not created in the DOM until this method is called:
        tree.draw();
    }

	//Add an onDOMReady handler to build the tree when the document is ready
    YAHOO.util.Event.onDOMReady(treeInit);

})();

