﻿///<reference path="jquery-vsdoc.js"/>
// création du menu
function clignote() {
	var current = $('a.ongletInactif.highlight_on');
	var other = $('a.ongletInactif.highlight');
	$(current).each(function() {
		$(this).removeClass('highlight_on');
		$(this).addClass('highlight');
	});
	$(other).each(function() {
		$(this).addClass('highlight_on');
		$(this).removeClass('highlight');
	});
};

(function() {
    $(document).ready(function() {
        // décaler contact
        //$('ul.topnav > li:last').css('margin-left', '100px');
        // gestion menu
        $("ul.topnav li a").hover(function() {
            $(this).parent().find("ul.subnav").slideDown('fast').show();
            $(this).parent().hover(function() {
            }, function() {
                $(this).parent().find("ul.subnav").slideUp('slow');
            });
        });
		$('ul.subnav').hide().removeClass('menuActif');
        // gestion de l'opacité de la barre de sep corps menu
        $('div.menusep').animate({ opacity: '0.5' });
        // initialisation de la page d'accueil:
        //Menu.Actions.afficher('accueil');
		// clignotement des menus highlight:
		window.setInterval('clignote();', 1000);
    });
})();
// gestion des clicks sur menu
/*var Menu = {
    Current: {
        xmlDoc: null,
        numPage: 1
    },
    Init: {
        initAccueil: function() {
            //animation accueuil
            var img = new Image();
            $(img).load(function() {
                $(this).hide();
                $('div.accueil').append(this);
                $(this).fadeIn(1000);
                var img = new Image();
                $(img).load(function() {
                    $(this).hide();
                    $('div.accueil').append(this);
                    $(this).css('width', '50px').css('height', '35px').css('left', '47%').css('bottom', '157px').fadeIn();
                    $(this).animate({ width: '600px', bottom: '20px', left: '25%', height: '425px' }, 1000, 'swing', function() {
                        $('div.mediaspace').fadeIn();
                    });
                }).error(function() { }).addClass('tv').attr('src', './design/images/tv.png');
            }).error(function() {
                // notify the user that the image could not be loaded
            }).addClass('imagefond').attr('src', './design/images/fond.png');
        },
        initFormation: function() {
            return;
        }
    },
    Actions: {
        afficher: function(type) {
            var file = '';
            var init = function() { return; };
            switch (type) {
                case 'accueil':
                default:
                    file = './design/xml/pages/accueil.xml';
                    init = Menu.Init.initAccueil;
                    break;
                case 'formations':
                    file = './design/xml/pages/formations.xml';
                    init = Menu.Init.initFormation;
                    break;
            }
            $.get('./Pages/Accueil.aspx', {}, function(data) {
                $(data).find('body');
            });
            $.ajax({
                type: "GET",
                url: file,
                dataType: "xml",
                success: function(xml) {
                    Menu.Current.xmlDoc = xml;
                    Menu.Current.numPage = 1;
                    var page1 = $(xml).find('pages > page[num = "1"]');
                    var css = '<style type="text/css">' + $(page1).find('css').text() + '</style>';
                    var js = $(page1).find('js').text();
                    var html = $(page1).find('html').text();
                    $('div.content').html(css).append(js).append(html);
                    if (init && $.isFunction(init)) {
                        init.call(this);
                    }
                    $.ajax({
                        type: 'POST',
                        url: './webservices/FormarocWS.asmx/Test',
                        dataType: 'xml',
                        data: { toto: 'opiu', titi: 1 },
                        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                        processData: true,
                        success: function(xml) {
                            alert('ok')
                        },
                        error: function(xhr) {
                            if (xhr.readyState == 4) {
                                if (xhr.status == 200) {
                                    return;
                                } else {
                                    alert("Error code " + xhr.status + ": " + xhr.responseText);
                                }
                            }
                        }
                    });
                }
            });
        }
    }
};*/
