﻿BuildSubMenus = function() {
    var menuids = ["menu"];
    for (var i = 0; i < menuids.length; i++) {
        var ultags = document.getElementById(menuids[i]).getElementsByTagName("ul")
        for (var t = 0; t < ultags.length; t++) {
            if (ultags[t].parentNode.parentNode.id == menuids[i]) { 								    //if this is a first level submenu
                ultags[t].style.top = ultags[t].parentNode.offsetHeight + "px" 						    //dynamically position first level submenus to be height of main menu item
            }
            else { 																				        //else if this is a sub level menu (ul)
                ultags[t].style.left = ultags[t - 1].getElementsByTagName("a")[0].offsetWidth + "px" 	//position menu to the right of menu item that activated it
            }
            ultags[t].parentNode.onmouseover = function() {
                this.getElementsByTagName("ul")[0].style.visibility = "visible"
            }
            ultags[t].parentNode.onmouseout = function() {
                this.getElementsByTagName("ul")[0].style.visibility = "hidden"
            }
        }
    }
}

jQuery.ParseJsonDateTime = function(jsonDateTime) {
    var strValue = jsonDateTime.match('[0-9]{1,}');
    var intValue = parseInt(strValue);
    var realDate = new Date(intValue);

    realDate = realDate.getDate() + "/" + (realDate.getMonth() + 1) + "/" + realDate.getFullYear() + " " + realDate.getHours() + ":" + realDate.getMinutes();
    return realDate;
};

jQuery.ParseJsonDate = function(jsonDateTime) {
    var strValue = jsonDateTime.match('[0-9]{1,}');
    var intValue = parseInt(strValue);
    var realDate = new Date(intValue);

    realDate = realDate.getDate() + "/" + (realDate.getMonth() + 1) + "/" + realDate.getFullYear();
    return realDate;
};

var addthis_config = {
    ui_language: "fr"
}

$(window).bind('load', BuildSubMenus);

