﻿/* vertical scroll content
----------------------------------------------------------------*/
jQuery(document).ready(function () {
    if (jQuery(".scroll-pane").html() != null && jQuery("#filmstrip").html() != null) {
        jQuery(".scroll-pane").jScrollPane({ showArrows: false });
    }
    if (jQuery("#features").html() != null) {
        jQuery("#features").jcarousel({
            wrap: 'circular'
        });
    }
});

/* horizontal scroll content
----------------------------------------------------------------*/
jQuery(document).ready(function () {
    if (jQuery("#mycarousel").html() != null) {
        jQuery('#mycarousel').jcarousel({
            visible: 1,
            scroll: 1,
            wrap: 'circular'
        });
    }
});

/* hide and show
----------------------------------------------------------------*/
function show(id) {
    if (document.getElementById(id).style.display == "none" || document.getElementById(id).style.display == '') {
        document.getElementById(id).style.display = "block";
    } else {
        document.getElementById(id).style.display = "none";
    }
}

/* menu expanded and collapse
----------------------------------------------------------------*/
var liId_over = '';
//Drupal.behaviors.loginform = function () {
//    jQuery('#nav').children().children('li.active-trail').children('div.sub').css("display", "block");
//    jQuery('#nav').children().children('li').mouseenter(function () {
//        //jQuery('#nav').children().children('li.active-trail').children('div.sub').css("display", "none");
//        /*jQuery(this).children('div.sub').css("display", "block");
//        var ulWidth = jQuery(this).children('div.sub').children('ul').width();
//        jQuery(this).children('div.sub').css("width", ulWidth);*/
//        //i = jQuery(this).attr('id');


//        liId_over = jQuery(this).attr('id');
//        setTimeout("menu_timeout_over(liId_over)", 400);
//        //jQuery('#nav').children().children('li.active-trail').children('div.sub').css("display", "block");
//    }).mouseleave(function () {
//        //alert(jQuery(this).attr('id'))
//        liId = jQuery(this).attr('id');
//        setTimeout("menu_timeout(liId)", 400);
//        //jQuery(this).children('div.sub').css("display", "none");	
//    });


    jQuery(document).ready(function () {
        jQuery('#nav').children().children('li.active-trail').children('div.sub').css("display", "block");
        jQuery('#nav').children().children('li').mouseenter(function () {
            liId_over = jQuery(this).attr('id');
            setTimeout("menu_timeout_over(liId_over)", 400);
        }).mouseleave(function () {
            liId = jQuery(this).attr('id');
            setTimeout("menu_timeout(liId)", 400);
        });
    });


    if (jQuery("#node_hover_image").html() != null && jQuery(".innerBanner").html() != null) {
        jQuery(".innerBanner").mouseenter(function () {
            jQuery('.innerBanner').children('img').css("display", "none");
            jQuery("#node_hover_image").css("display", "block");
        }).mouseleave(function () {
            jQuery("#node_hover_image").css("display", "none");
            jQuery('.innerBanner').children('img').css("display", "block");
        });
    }

    if (jQuery("#node_video").html() != null && jQuery(".innerBanner").html() != null) {
        jQuery('.innerBanner').click(function () {
            jQuery('.innerBanner').css("display", "none");
            jQuery("#node_hover_image").css("display", "none");
            jQuery("#node_video").css("display", "block");
        });
    }
    if (jQuery(".publish_node_link").html() != null) {
        jQuery('.publish_node_link').click(function () {
            var status = jQuery(this).html();
            if (status == 'Yes') {
                status = 1;
                changeStatus = "No";
            }
            else {
                status = 0;
                changeStatus = "Yes";
            }
            var nidStr = jQuery(this).attr('id');
            var nid = nidStr.substr(nidStr.lastIndexOf('_') + 1);

            document.getElementById("edit-node-id").value = nid;
            document.getElementById("edit-status").value = status;

            frm = document.getElementById('node-publish-form');
            var result = frm.submit();
            jQuery(this).html(changeStatus);
            return false;
        });
    }

function menu_timeout(a) {
    //jQuery("#"+a).children('div.sub').css("display", "none");
    jQuery('#nav').children().children('li').children('div.sub').css("display", "none");
    //alert(i+"hhhh"+a)
    if (liId_over == a) {
        jQuery('#nav').children().children('li.active-trail').children('div.sub').css("display", "block");
    }
}

function menu_timeout_over(over_id) {
    jQuery('#nav').children().children('li.active-trail').children('div.sub').css("display", "none");
    jQuery("#" + over_id).children('div.sub').css("display", "block");
    var ulWidth = jQuery("#" + over_id).children('div.sub').children('ul').width();
    jQuery("#" + over_id).children('div.sub').css("width", ulWidth + 1);
}
