
var effect_1 = 400;

function ScrollWindow(objects, type) {
    
    this.defBegin = 1;
    this.defEnd = 3;
    
    this.type = type;
    this.objects = objects;
    this.beginIdx = this.defBegin;
    this.endIdx = this.defEnd;
    
    this.draw = function() {
        $_("content-" + type).innerHTML = this.getContent(this.beginIdx, this.endIdx);
    }
    
    this.getContent = function(begin, end) {
        var html = new String();
        var liClassName = "";
        if (this.objects.length > 0) {
            html += '<ul class="ul">';
            if (end > this.objects.length) {
                end = this.objects.length;
            }
            if (begin > this.objects.length) {
                begin = this.objects.length;
            }
            for (var i = begin - 1; i < end; i++) {
                if (i == end - 1) {
                    liClassName = ' class="last" ';
                }
                html += '<li' + liClassName +'><a href="' + this.objects[i].href + '">';
                html += '<img src="' + this.objects[i].src + '" alt="' + this.objects[i].alt + '" title="' + this.objects[i].title + '" width="43" height="43"/></a></li>';
            }
            html += '</ul>';
        }
        //alert(html);
        return html;
    }
    
    this.initActions = function() {
        $('a.link-' + this.type + '-prev').click(function() {
            var r = this.className.match(/link-(.*)-prev/i);
            eval(r[1] + "Prev('" + r[1] +"');");
        });
        $('a.link-' + this.type + '-next').click(function() {
            var r = this.className.match(/link-(.*)-next/i);
            eval(r[1] + "Next('" + r[1] + "');");
        });
    }
    
    this.prev = function() {
        if (this.beginIdx != this.defBegin) {
            this.beginIdx--;
            this.endIdx--;
            this.draw();
        }
        return false;
    }
    
    this.next = function() {
        if (this.endIdx != this.objects.length) {
            this.beginIdx++;
            this.endIdx++;
            this.draw();
        }
        return false;
    }
    
    this.initActions();
}

function talentsPrev(type) {
    $("#" + "content-" + type).fadeOut(effect_1);
    setTimeout(function() {fTalents.prev();}, effect_1);
    $("#" + "content-" + type).fadeIn(effect_1);
}

function talentsNext(type) {
    $("#" + "content-" + type).fadeOut(effect_1);
    setTimeout(function() {fTalents.next();}, effect_1);
    $("#" + "content-" + type).fadeIn(effect_1);
}

function groupsPrev(type) {
    $("#" + "content-" + type).fadeOut(effect_1);
    setTimeout(function() {aGroups.prev();}, effect_1);
    $("#" + "content-" + type).fadeIn(effect_1);
}

function groupsNext(type) {
    $("#" + "content-" + type).fadeOut(effect_1);
    setTimeout(function() {aGroups.next();}, effect_1);
    $("#" + "content-" + type).fadeIn(effect_1);
}

function enterprisesPrev(type) {
    $("#" + "content-" + type).fadeOut(effect_1);
    setTimeout(function() {rEnterprises.prev();}, effect_1);
    $("#" + "content-" + type).fadeIn(effect_1);
}

function enterprisesNext(type) {
    $("#" + "content-" + type).fadeOut(effect_1);
    setTimeout(function() {rEnterprises.next();}, effect_1);
    $("#" + "content-" + type).fadeIn(effect_1);
}

function Talent(id, alias, src, title, alt) {
    this.id = id;
    this.href = "../../talents/" + alias + ".html";
    this.src = src; 
    this.title = title;
    this.alt = alt;
}

function Group(id, href, src, title, alt) {
    this.id = id;
    this.href = "../../groupes/" + href;
    //this.href = "../../talents/index.php?view=GroupPost%2FIndex&groupId=" + href;
    this.src = "../../talents/" + src; 
    this.title = title;
    this.alt = alt;
}

function Enterprise(id, href, src, title, alt) {
    this.id = id;
    this.href = "../../talents/index.php?view=Enterprise%2FView&enterpriseId=" + href;
    this.src = src; 
    this.title = title;
    this.alt = alt;
}

function initFeaturedTalents() {
    var ft = new Array();
        t = new Talent("ac8100d20ee398119e5453a5578e0f67", "ingrid", "http://www.jobmeeters.com/talents/data/photos/small/nophoto.jpg", "Ingrid&nbsp;D'Hulster", "Ingrid&nbsp;D'Hulster");
    ft.push(t);
        t = new Talent("091e7081b33a1223a00fdc11a5598452", "talentsupplychain", "http://www.jobmeeters.com/talents/data/photos/small/nophoto.jpg", "Marie-Aline&nbsp;Le Petit", "Marie-Aline&nbsp;Le Petit");
    ft.push(t);
        t = new Talent("d88d07f0ce0cf3e356578b9849138978", "Sandy Hadjeb", "http://www.jobmeeters.com/talents/data/photos/small/nophoto.jpg", "Sandy&nbsp;Hadjeb", "Sandy&nbsp;Hadjeb");
    ft.push(t);
        t = new Talent("91569fc31b46d08353868bb4943dbbda", "guibal", "http://www.jobmeeters.com/talents/data/photos/small/nophoto.jpg", "STEPHANE&nbsp;GUIBAL", "STEPHANE&nbsp;GUIBAL");
    ft.push(t);
        t = new Talent("f48111a34432384cab95ba779bf8d53e", "joelledevatine", "http://www.jobmeeters.com/talents/data/photos/small/nophoto.jpg", "Joëlle&nbsp;Devatine", "Joëlle&nbsp;Devatine");
    ft.push(t);
        t = new Talent("0438413d9c02e49747f1700723cf81ce", "alexandrak", "http://www.jobmeeters.com/talents/data/photos/small/nophoto.jpg", "alexandra&nbsp;K", "alexandra&nbsp;K");
    ft.push(t);
        t = new Talent("8186af56ea3b3f8da9bbdd350d3441f4", "olivierzara", "http://www.jobmeeters.com/talents/data/photos/small/nophoto.jpg", "Olivier&nbsp;Zara", "Olivier&nbsp;Zara");
    ft.push(t);
        t = new Talent("47762e076ae0c99839a9115368bc2818", "managerinterculturel", "http://www.jobmeeters.com/talents/data/photos/small/8acf8d229ccf2cb46569b7ceed492b54.png", "Fabien&nbsp;Guibert", "Fabien&nbsp;Guibert");
    ft.push(t);
        t = new Talent("b07a5b4c5a0d3c66d70a098418d2206f", "deigner-cpinog", "http://www.jobmeeters.com/talents/data/photos/small/a067d41d059d9a3cb8eec4884fe3d851.jpg", "Pino Traverso&nbsp;Cristobal", "Pino Traverso&nbsp;Cristobal");
    ft.push(t);
        t = new Talent("17a93b8a4ae6cbcb87d6d91ac363ea16", "louisherve", "http://www.jobmeeters.com/talents/data/photos/small/23c650e0cc6c5dfc18e00f7152114839.jpg", "LOUIS HERVE&nbsp;BILO'O BI NNA", "LOUIS HERVE&nbsp;BILO'O BI NNA");
    ft.push(t);
        t = new Talent("0981035c90799f8ce5fefe40886a13a1", "elenalevandowsky", "http://www.jobmeeters.com/talents/data/photos/small/6bad23894a3ed279d20c0eb97e33f2a8.jpg", "Elena&nbsp;Levandowsky", "Elena&nbsp;Levandowsky");
    ft.push(t);
        t = new Talent("c0b5c35a1c91b4708c5a8fca3a1faa69", "estrelladesignk", "http://www.jobmeeters.com/talents/data/photos/small/d1ec4d9b3f7c808bf39b5c3a11aaf74c.jpg", "SANDRINE&nbsp;MONIER", "SANDRINE&nbsp;MONIER");
    ft.push(t);
        t = new Talent("45ba9342cd92520dbb5c23edd91b79f8", "aurelien.degrenand", "http://www.jobmeeters.com/talents/data/photos/small/d4c93a4b4a993c1d59ae8772fe3863ca.jpg", "Aurélien&nbsp;Degrenand", "Aurélien&nbsp;Degrenand");
    ft.push(t);
        t = new Talent("fe1f25f3edf527372c9380d56d34d926", "rstephanie", "http://www.jobmeeters.com/talents/data/photos/small/35a51a300b738d217eaa13f112d5bbae.jpg", "Stéphanie&nbsp;Retailleau", "Stéphanie&nbsp;Retailleau");
    ft.push(t);
        t = new Talent("7fa9c6c414dd4941743636e2a3b31d30", "clairekrum", "http://www.jobmeeters.com/talents/data/photos/small/3fc1c71d415244e7cd9a7f2266738aa3.jpg", "Claire&nbsp;KRUMMENACKER", "Claire&nbsp;KRUMMENACKER");
    ft.push(t);
        t = new Talent("77fa15cc0584b81debf782c0025fd474", "mickaellerat", "http://www.jobmeeters.com/talents/data/photos/small/232eed8c17c1dacb7062b2f5bfec6473.jpg", "Mickael&nbsp;Lerat", "Mickael&nbsp;Lerat");
    ft.push(t);
        t = new Talent("8360a606d31e126d7e84f4c5cb6832fa", "alexisbranlard", "http://www.jobmeeters.com/talents/data/photos/small/bcc1a0fa7fbbc18260cbcf54cb41a2dd.jpg", "alexis&nbsp;branlard", "alexis&nbsp;branlard");
    ft.push(t);
        t = new Talent("995d17b9677b193c25d1a7846503e697", "mariannecassany", "http://www.jobmeeters.com/talents/data/photos/small/9131a16cafab671a365e16e24efbb333.jpg", "Marianne&nbsp;Cassany", "Marianne&nbsp;Cassany");
    ft.push(t);
        t = new Talent("2b5d7ff60274d3810582b31a7a091506", "christophe-meunier", "http://www.jobmeeters.com/talents/data/photos/small/affce38a82fac690580e213e5830e8b2.jpg", "christophe-meunier", "christophe-meunier");
    ft.push(t);
        t = new Talent("615393ba9326b082f15ef0f6fdd2d53a", "michael-w", "http://www.jobmeeters.com/talents/data/photos/small/42364e4ace3ae62d068ddc79b754e07c.jpg", "Michael&nbsp;Wurckler", "Michael&nbsp;Wurckler");
    ft.push(t);
        fTalents = new ScrollWindow(ft, "talents");
    fTalents.draw();
}

function initActiveGroups() {
    var ag = new Array();
        g = new Group("86", "ESCEM-(ESC-Tours-Poitiers).html", "data/group/d47fc9f95e68d110646ca91c12452350/86/43_43/20080325_110502_escem.gif", "ESCEM (ESC Tours-Poitiers)", "ESCEM (ESC Tours-Poitiers)");
    ag.push(g);
        g = new Group("79", "Grenoble-Ecole-de-Management.html", "data/group/a5fe60f1c7959d272176ff3f0a9bc638/79/43_43/20080117_135215_logo_GEM_petit.GIF", "Grenoble Ecole de Management", "Grenoble Ecole de Management");
    ag.push(g);
        g = new Group("68", "Travailler-dans-les-startups.html", "data/group/78cf4a9f5ac717263261dc8940a3575a/68/43_43/20071126_130350_startup.jpg", "Travailler dans les startups", "Travailler dans les startups");
    ag.push(g);
        g = new Group("66", "Aidons-les-jeunes-talents.html", "data/group/78cf4a9f5ac717263261dc8940a3575a/66/43_43/20071116_142724_help.jpg", "Aidons les jeunes talents", "Aidons les jeunes talents");
    ag.push(g);
        g = new Group("62", "ICN-Nancy.html", "data/group/d4e547412de10188272d3e1804bd9198/62/43_43/20071117_152329_logo_nancy2.gif", "ICN Nancy", "ICN Nancy");
    ag.push(g);
        g = new Group("56", "coachings.html", "data/group/2000bbd0521df2e8430bfeb5c038e713/56/43_43/20071218_095712_j0387131.jpg", "coachings", "coachings");
    ag.push(g);
        g = new Group("55", "Les-applications-web-open-source.html", "data/group/c24015f931fed0b51dde8cb65bfc189a/55/43_43/20071018_111213_wos.png", "Les applications web open source", "Les applications web open source");
    ag.push(g);
        g = new Group("53", "Pluriactivite.html", "data/group/43_43_nophoto.jpg", "Pluriactivite", "Pluriactivite");
    ag.push(g);
        g = new Group("51", "Les-services-2.0-utilisés-pour-bosser.html", "data/group/3921052f8cd9adefa11d0c1b459d96e5/51/43_43/20071018_155744_web2.0.gif", "Les services 2.0 utilisés pour bosser", "Les services 2.0 utilisés pour bosser");
    ag.push(g);
        g = new Group("50", "LYON---et-sa-Région.html", "data/group/7ce3941621bf2ae9c24752880e919197/50/43_43/20071010_175830_Lyon logo98.jpg", "LYON - et sa Région", "LYON - et sa Région");
    ag.push(g);
        g = new Group("48", "Question-pour-un-emploi-!.html", "data/group/ab7d7f41a3c08d87f77fea4a7cba0b21/48/43_43/20070921_182431_images.jpg", "Question pour un emploi !", "Question pour un emploi !");
    ag.push(g);
        g = new Group("36", "Café-Emploi.html", "data/group/7f9577f3d56ae92c8ea7b4a8e3cfa765/36/43_43/20070718_230304_Star Skype.png", "Café Emploi", "Café Emploi");
    ag.push(g);
        g = new Group("35", "Ma-réputation-numérique-!?.html", "data/group/78cf4a9f5ac717263261dc8940a3575a/35/43_43/20070627_091722_trace.jpg", "Ma réputation numérique !?", "Ma réputation numérique !?");
    ag.push(g);
        g = new Group("32", "Bienvenue-sur-JobMeeters.html", "data/group/16359e842f31d33ad3eac0cf90ce0078/32/43_43/20070620_120946_start.jpg", "Bienvenue sur JobMeeters", "Bienvenue sur JobMeeters");
    ag.push(g);
        g = new Group("25", "Bordeaux-Ecole-de-Management.html", "data/group/b533e4249a20c7b829102eb99c189d7c/25/43_43/20070531_153637_n2430441492_2856.jpg", "Bordeaux Ecole de Management", "Bordeaux Ecole de Management");
    ag.push(g);
        g = new Group("24", "Médias-en-France-et-a-l'international.html", "data/group/c25a6d5dacd0ed5d1ab4a1b5fd163c4e/24/43_43/20070531_100530_Fireworks[1].jpg", "Médias en France et a l'international", "Médias en France et a l'international");
    ag.push(g);
        g = new Group("9", "Oracliens.html", "data/group/78cf4a9f5ac717263261dc8940a3575a/9/43_43/20070524_161626_oracle.jpg", "Oracliens", "Oracliens");
    ag.push(g);
        g = new Group("3", "Les-anciens-d'ADIA.html", "data/group/16359e842f31d33ad3eac0cf90ce0078/3/43_43/20070525_103238_Adia.jpg", "Les anciens d'ADIA", "Les anciens d'ADIA");
    ag.push(g);
        g = new Group("2", "Le-CV-sous-toutes-ses-formes.html", "data/group/16359e842f31d33ad3eac0cf90ce0078/2/43_43/20070525_021341_Picture 328.png", "Le CV sous toutes ses formes", "Le CV sous toutes ses formes");
    ag.push(g);
        g = new Group("1", "Les-animaux-sur-les-lieux-de-travail.html", "data/group/16359e842f31d33ad3eac0cf90ce0078/1/43_43/20070525_021927_Picture 329.png", "Les animaux sur les lieux de travail", "Les animaux sur les lieux de travail");
    ag.push(g);
        aGroups = new ScrollWindow(ag, "groups");
    aGroups.draw();
}

function initRecruitingEnterprise() {
    var re = new Array();
        rEnterprises = new ScrollWindow(re, "enterprises");
    rEnterprises.draw();
}

function initAllTags() {
    $("a.talent").click(function(){
        var r = this.className.match(/talent-([0-9]+)$/i);
        window.location="../../talents/index.php?view=Main&searchType=10&searchValue=" + r[1];
    });
    $("a.group").click(function(){
        var r = this.className.match(/group-([0-9]+)$/i);
        window.location="../../talents/index.php?view=Group%2FIndex&searchType=10&searchValue=" + r[1];
    });
}

function contentInit() {
  	if (typeof($) == 'undefined') {
		return false;
	}
    initFeaturedTalents();
    initActiveGroups();
    initRecruitingEnterprise();
    initAllTags();
}

