function initIndexScripts(base_url)
{
        /* open the layer to select the category. */
        if( $('inscrire_mem') )
        {
            $('inscrire_mem').getElement('a').addEvent('click', function(e)
            {
                    e = new Event(e).stop();
                    url = base_url+'/layers/member_inscrire.php';
                    createLayer_ins( 1008 , 400 , 'Inscription à la newsletter Devispresto', url );
            });
        }

        /* open the layer to select the category in  visitor proof page */
        if( $('inscrire_mem1') )
        {
            $('inscrire_mem1').getElement('a').addEvent('click', function(e){
                    e = new Event(e).stop();
                    url = base_url+'/layers/member_inscrire.php';
                    createLayer_ins( 1008 , 400 , 'Inscription à la newsletter Devispresto', url );
            });
        }

        if($("creerun_compte"))
        {
            $("creerun_compte").addEvent("click", function(e)
            {
                    e = new Event(e).stop();
                    url = base_url + '/layers/member_inscrire.php';
                    createLayer_ins( 1008 , 400 , 'Inscription à la newsletter Devispresto', url );
            });
        }

        /* just to clear the values in the fields. */
        if($("input_username"))
        {
            $("input_username").addEvent("click",function()
            {
                    $("input_username").set("value","");
            });
        }

        if($("input_password"))
        {
            $("input_password").addEvent("click",function()
            {
                    $("input_password").set("value","");
            });
        }

        /* redirect to the category home pages. */
        if($("CH_catblock"))
        {
            $("CH_catblock").addEvent("click",function()
            {
                window.location = $("CH_title_img").getElement("a").get("href");
            });
        }

        if($("SE_catblock"))
        {
            $("SE_catblock").addEvent("click",function()
            {
                window.location = $("SE_title_img").getElement("a").get("href");
            });
        }

        if($("SP_catblock"))
        {
            $("SP_catblock").addEvent("click",function()
            {
                window.location = $("SP_title_img").getElement("a").get("href");
            });
        }

        /* validate the prospect fax code. */
        if($("continuer_button"))
        {
            $("continuer_button").addEvent("click", function()
            {
                    new Request.HTML({url: "checkcode.php", data:"code="+$("code").value, evalResponse: true, onComplete:
                    function(responseTree, responseElements, responseHTML, responseJavaScript)
                    {
                            if(responseHTML == "fail")
                            {
                                    $("err_msg").set("html","Ce code n'existe pas");
                            }
                            else
                            {
                                    $("prospectfax").submit();
                            }
                    }
                    }).post();
            });
        }
        

        /* validate the password when the password are reset. */
        if($("reset-password"))
        {
            $("reset-password").addEvent("submit", function(e)
            {
                    var event = new Event(e);
                    if($("password1").value == "" && $("password2").value == "")
                    {
                        $("err_msg").set("html","Merci de remplir les 2 champs du formulaire");
                        event.stop();
                    }
                    else if($("password1").value != $("password2").value)
                    {
                        $("err_msg").set("html","Les 2 mots de passe sont différents");
                        event.stop();
                    }
                    else if($("password1").value.length < 5 || $("password2").value.length < 5)
                    {
                        $("err_msg").set("html","Le mot de passe est trop court (5 caractères minimum)");
                        event.stop();
                    }
            });
        }

        /* redirect to index page when the devispresto logo is clicked */
        if($("logo_block"))
        {
            $("logo_block").addEvent("click", function()
            {
                window.location = base_url;
            });
        }

        if($("user_header"))
        {
            $("user_header").target = "_blank";
        }
}

