function init(){
    cascade(1);
}
// Requires position absolute
// Uses  cascadeToggle  attribute to activate childs
// Requires Cascade  to group elements 
// <img id="grap1Part1" cascade="1" parent="0" cascadeToggle="1" class="" src="img/grapSeq1P1.png" alt=""/> 
function cascade(cascadeGroup){
   var elements = $('[cascade='+cascadeGroup+']');
   var firstGroup = $('[cascade='+cascadeGroup+'][parent=0]');
   var restGroup = $('[cascade='+cascadeGroup+'][parent!=0]');
   var toggleElements = $('[cascade='+cascadeGroup+'][cascadeToggle]');

    restGroup.hide(); // Leave only initial show elements  (parent =0)

    toggleElements.each(function(){
        $(this).on('click', function(){
            var keyToggle = $(this).attr('cascadeToggle');
            var childs = $('[cascade='+cascadeGroup+'][parent='+keyToggle+']');
            childs.toggle("fold");
            $(this).unbind('click');
            sg.sound('success-low');
        })

    })
}


function setMsgClick( msg ){
    msg =  typeof(msg) != 'undefined' ? msg:'para ver la información';
    var htmlMsg =  'Haz <span class="icon click">clic</span> '+msg;
    $(".ggd_text_exp").html( htmlMsg);
}

// Requires  Animate.css
// Author Carlos u
// magicSequence(magicGroup, Time);
// <tag1 magicGroup="x" ... <tag2 magicGroup="1" magicEffect="zoomInUp"
function magicAnimate(groupSequence){

    var DEFAULT_EFFECT = 'bounceInLeft';
    var RECURSION_LIMIT = 20;  // Limito por seguridad

    groupSequence  = (typeof groupSequence === "undefined") ? 1 : groupSequence;
    elements = $('[magicGroup="' + groupSequence + '"]');

    elements.each(function(i){
        attrEffect = $(this).attr('magicEffect');
        effect = (typeof attrEffect === "undefined" || attrEffect=='') ? DEFAULT_EFFECT : attrEffect;
        $(this).addClass('animated '+ effect);
        $(this).css('visibility','visible');

    });

}

