/* 
 * make certain fields in the article open/close 
 */

function showHide(e) {
	
    var e = document.getElementById('friend-links');
    if(e.style.display == 'block')
       e.style.display = 'none';
    else
       e.style.display = 'block';
}


YUI().use('node', function(Y) {
	// using just on article page
	var tags = Y.one('#friends');
	if (tags == undefined) 
		return;

	Y.on("click", showHide, tags); 
});



/**
 * display flash messages as yui overlay
 */
 
/* 
    YUI().use("overlay", function(Y) {

        var overlay = new Y.Overlay({
            // Specify a reference to a content box, 
            // which already exists on the page and contains
            // header/body/footer content
            contentBox:"#flash-message",

            // Also set some of the attributes inherited from
            // the base Widget class.
            visible:true,
            width:"300px",
            height:"150px",
            centered: true,
            
        });

        overlay.render();     
        
    });
*/ 
 
 
 


/**
 * changes the input button to look like a flat button with a hover
 */


YUI().use("node-base", function(Y) {

    var button = Y.one(".flat-button");
    
    if (button != undefined) {
        button.on("mouseover", function (e) { 
            this.addClass('flat-button-hover');
        });
        
        button.on("mouseout", function (e) {
            this.removeClass('flat-button-hover');
        });
    }
});

/**
 * Hover effect for the product and its surrounding <div>
 * needed for ie6
 * maybe could use delegation later on, but make sure still workds if 
 * only one product on a page
 */

YUI().use("node-base", function(Y) {

    var products = Y.all(".product");
    if (products != undefined) {
        Y.each(products, function(v, k) {
        
            v.on("mouseover", function (e) { 
                this.addClass('over');
            });
            
            v.on("mouseout", function (e) {
                this.removeClass('over');
            });   
        });
    }
});

/* everything below needs documenting 
 *
 *
 */

function display(id) {
	var element_to_be_shown = document.getElementById(id);
	element_to_be_shown.style.display = 'block';	
}

/* i load the scripts on the bottom of the page now 
YAHOO.util.Event.addListener(window,'load', loader);

function loader() 
{
	// test for javascript : later add a message if javascript now supported
	var advancedJavaScriptSupport = document.createElement && document.getElementsByTagName; 
	
	if (!advancedJavaScriptSupport) return; 
	
	addHoverToInputSubmit.init();
}
*/

