/*
Copyright (c) 2009, Swati Raju. All rights reserved.
Author: Swati Raju
version: 1.0.0
*/
var Y = YAHOO;
var yud = YAHOO.util.Dom;
var yue = YAHOO.util.Event;
var yua = YAHOO.util.Anim;
Y.namespace("LBF");
Y.namespace("LBF.locations");

/**
    * LBF locations
    *
    * @module LBF locations
    * @title LBF locations
    * @namespace YAHOO.LBF.locations
    * @requires YAHOO, dom, event
    */
Y.LBF.locations = function() {
    var hideArrow = function(e){
        var oRelatedTarget = yue.getRelatedTarget(e);
        if (oRelatedTarget == this || !yud.isAncestor(this, oRelatedTarget)){
            var arrow = yud.getElementsByClassName("arrow", "div", this);
            var myAnim = new yua(arrow[0], { 
                right: { to: -141 },
                opacity: {to: 0}  
            }, .30, YAHOO.util.Easing.easeOut);
            myAnim.animate();
        }
     };
     
     var showArrow = function(e){
         var arrow = yud.getElementsByClassName("arrow", "div", this);
         var myAnim = new yua(arrow[0], { 
                right: { to: 0 },
                opacity: {to: 1}  
            }, .30, YAHOO.util.Easing.easeOut);
         myAnim.animate(); 
     };
     
    return{
        /**
        * init page
        *
        * @method init
        * @param
        * @returns
        */
        init: function() {
            var grid = yud.get("mod-grid");
            var pA = yud.getElementsByClassName("loc", "a", grid);
            yue.on(pA, "mouseover", showArrow);
            yue.on(pA, "mouseout", hideArrow);  
        }
    };
}();
Y.LBF.locations.init();