﻿// initialise plugins
jQuery(function() {
    jQuery('ul.sf-menu').superfish();
});

$(document).ready(function() {
    $().piroBox({
        my_speed: 600, //animation speed
        bg_alpha: 0.3, //background opacity
        radius: 4, //caption rounded corner
        scrollImage: true, // true == image follows the page, false == image remains in the same open position
        pirobox_next: 'piro_next', // Nav buttons -> piro_next == inside piroBox , piro_next_out == outside piroBox
        pirobox_prev: 'piro_prev', // Nav buttons -> piro_prev == inside piroBox , piro_prev_out == outside piroBox
        close_all: '.piro_close', // add class .piro_overlay(with comma)if you want overlay click close piroBox
        slideShow: 'slideshow', // just delete slideshow between '' if you don't want it.
        slideSpeed: 4 //slideshow duration in seconds(3 to 6 Recommended)
    });
});

function init() {
    timeDisplay = document.createTextNode("");
    document.getElementById("clock").appendChild(timeDisplay);
}

function updateClock() {
    var currentTime = new Date();
    var currentHours = currentTime.getHours();
    var currentMinutes = currentTime.getMinutes();
    var currentSeconds = currentTime.getSeconds();
    var currentDate = currentTime.getDate();
    var currentMonth = currentTime.getMonth() + 1;
    var currentYear = currentTime.getFullYear();
    // Pad the minutes and seconds with leading zeros, if required
    currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes;
    currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds;

    // Choose either "AM" or "PM" as appropriate
    var timeOfDay = (currentHours < 12) ? "AM" : "PM";

    // Convert the hours component to 12-hour format if needed
    currentHours = (currentHours > 12) ? currentHours - 12 : currentHours;

    // Convert an hours component of "0" to "12"
    currentHours = (currentHours == 0) ? 12 : currentHours;

    // Compose the string for display
    var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay + " - " + currentDate + "/" + currentMonth + "/" + currentYear;

    // Update the time display
    document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}