var main = {

    SERVERPATH		: '',
    PHPSESSID       : '',
    data            : '',
    fadeOutTime     : 4500,

	initialize: function(serverpath,phpsessid)
	{
		main.SERVERPATH = serverpath;
        main.PHPSESSID = phpsessid;
      
      var originalFontSize = $('html').css('font-size');
        
      $('#decreaseFontSize').click(main.decreaseFontSize);
      $('#increaseFontSize').click(main.increaseFontSize);
      $('#resetFontSize').click(main.resetFontSize);
      $('#favo_icon').jFav();
      $('[id^="faqItem"]').click(main.toggleFaqQuestion);
      $('#inschrijven').click(main.goToInschrijven);
      $('#nadbLogo').click(main.goToNadb);
      $('#bdfLogo').click(main.goToBdf);
      $('#istdLogo').click(main.goToIstd);
      $('#idtaLogo').click(main.goToIdta);
      $('#fdoLogo').click(main.goToFdo);
      $('a.lightbox').lightBox();

     // $('#headerImages').cycle('fade');

    },

    toggleFaqQuestion: function(){
      var questionID = this.id.replace('faqItem','');
      $('#faqAnswer' + questionID).toggle('slow');
    },

    showSubMenu: function(id){
        var subMenuID = id;
        $('#menuSub' + subMenuID).toggle();
        if($("#arrow" + subMenuID).attr('src') == main.SERVERPATH + 'public/img/main/icons/arrowopened.gif'){
            $("#arrow" + subMenuID).attr('src', main.SERVERPATH + 'public/img/main/icons/arrowclosed.gif');
        } else {
             $("#arrow" + subMenuID).attr('src', main.SERVERPATH + 'public/img/main/icons/arrowopened.gif');
        }


    },

    goToPage: function(url){
        window.location=url;
    },

    goToNadb: function(){
        window.location='http://www.nadb.eu';
    },

    goToBdf: function(){
        window.location='http://www.bdfonline.info';
    },
    
    goToIstd: function(){
        window.location='http://www.istd.org/main.html';
    },

    goToIdta: function(){
        window.location='http://www.idta.co.uk';
    },

    goToFdo: function(){
        window.location='http://www.dansleraar.com';
    },

    goToInschrijven: function(){
        window.location=main.SERVERPATH + 'cursussen/inschrijven';
    },

   resetFontSize: function(){
        var originalFontSize = 12;
        $('html').css('font-size', originalFontSize);
        $.get(main.SERVERPATH + 'user/setfontsize/fontSize/' + originalFontSize + '/rnd/' + Math.random()*99999,
        '');
    },

    increaseFontSize: function(){


        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum*1.2;

        if(currentFontSize != 20){

        $('html').css('font-size', newFontSize);
        $.get(main.SERVERPATH + 'user/setfontsize/fontSize/' + newFontSize + '/rnd/' + Math.random()*99999,
        '');
        return false;
       } 
    },

    decreaseFontSize: function(){
        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum*0.8;
        $('html').css('font-size', newFontSize);
        $.get(main.SERVERPATH + 'user/setfontsize/fontSize/' + newFontSize + '/rnd/' + Math.random()*99999,
        '');
        return false;
    }



};
