function getUrlVars() {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

function animate(item) {
    item.css('opacity', 0);
    item.css('top', '70px');
    item.css('display', 'block');
    
    item.delay(1000).animate({top:-60, opacity:1}, 900, function() {
        item.delay(2000).animate({top:-110, opacity:0}, 300, function() {
            item.css('display', 'none');
        });
    });
}

$(function() {

	// ############################## //
	// GESTION DU HIGHLIGHT
	// ############################## //
	
	// Si sur la page index, dans l'url je trouve un parametre appelé "h", et qu'il est egal à 1
	// ALors je fais la petite anim de l'infobulle pour attirer l'attention sur le menu déroulant
	
	var getHighlightIndex = getUrlVars()["start-here"]
	var choose_device = $("#choose-device");
	var choose_pass = $("#choose-pass");
	
	if (getHighlightIndex == 'choose-device') { 
        animate(choose_device);
	} else if (getHighlightIndex == 'choose-pass') {
        animate(choose_pass);
    }
});


