Current File : /home/inlingua/public_html/icentex/pg/js/common.js
// JavaScript Document
$(function () {
    //JS for Left Navigation
    $('.content-leftsec').on('mouseenter', function () {
        if ($(this).hasClass("direct")) {
            $(this).stop(true, false).animate({ width: '235px' }, 200);
            return false;
        }
    });
    $('.content-leftsec').on('mouseleave', function () {
        if ($(this).hasClass("direct")) {
            $(this).stop(true, false).animate({ width: '56px' }, 200);
            $('.content-rightsec').stop(true, false).animate({ paddingLeft: '75px' }, 200);
            $('.content-leftsec .submenu ul').hide();
            return false;
        }
        else {
            $('.content-rightsec').stop(true, false).animate({ paddingLeft: '275px' }, 200);
        }
    });

    // Search animation
    $('.showSearchSec').on("click", function () {
        $(this).next('.showSection').show().animate({ width: '212px' }, 200);
        $('.showSection').find('INPUT').focus();
    });

    $(document).mouseup(function () {
        $('.showSection').animate({ width: '0' }, 100).hide();
    });

    $('.showSection').mouseup(function () {
        return false;
    });
	
	$('.reslist-box li').on("click", function(){
		$(this).toggleClass("active");
		});

    // Accordion for Left Menu
    $('.content-leftsec nav > ul > li > a').on('click', function () {
        if (!$(this).parent().find('ul').is(":visible")) {
            $(this).parent().siblings().find("ul").slideUp();
            $(this).parent().find('ul').slideDown();
        }
        else {
            $(this).parent().find('ul').slideUp();
        }
    });

    //lock left panel 
    $('.content-leftsec .show-hide').on('click', function () {
        if ($(this).hasClass("open")) {
            $(this).parent().addClass("direct");
            $(this).removeClass("open");
        }
        else {
            $(this).addClass("open");
            $(this).parent().removeClass("direct");
        }
    });

    if ($('#resigApproval .tableData').innerHeight() > 217) {
        $('#resigApproval .tableData').css({'height':217, 'overflow': 'auto'});
        $('#resigApproval .tableHeading').css({'padding-right': '17px' });
    }
    if ($('#resigRevoke .tableData').innerHeight() > 93) {
        $('#resigRevoke .tableData').css({ 'height': 93, 'overflow': 'auto' });
        $('#resigRevoke .tableHeading').css({ 'padding-right': '17px' });
    }

    if ($('#pendClearance .tableData').innerHeight() > 371) {
        $('#pendClearance .tableData').css({ 'height': 371, 'overflow': 'auto' });
        $('#pendClearance .tableHeading').css({ 'padding-right': '17px' });
    }    
	// Multi select
	$('.setMultipleList span').on("click", function(){
		$(this).next().trigger("click");
	});
});

/* Designer Element JS */
//select dropdown
setTimeout(function () {
    designerSelect();
    designerSelectKeyChange();
    designerSelectKeyChange1();
    $('select.designer').css({ 'opacity': '0' });
    //hack for mac safari and windows safari
    if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
        //
        setTimeout(function () {
            $('select.designer').css('line-height', '26px');
        });
    }
    //end
}, 500);
function designerSelect() {
    $("select.designer").change(function () {
        var ds1 = "";
        var deId = this.id;
        $("#" + deId + " option:selected").each(function () {
            ds1 = $(this).text();
        });
        $(this).prev().text(ds1);
    }).change();
}

function designerSelectKeyChange() {
    $("select.designer").keypress(function () {
        var ds1 = "";
        var deId = this.id;
        $("#" + deId + " option:selected").each(function () {
            ds1 = $(this).text();
        });
        $(this).prev().text(ds1);
    }).keypress();
}

function designerSelectKeyChange1() {
    $("select.designer").keyup(function () {
        var ds1 = "";
        var deId = this.id;
        $("#" + deId + " option:selected").each(function () {
            ds1 = $(this).text();
        });
        $(this).prev().text(ds1);
    }).keyup();
}

function resizeDivisions() {
    var vph = $(window).height();
    var headerHeight = $('.mainheader').outerHeight(true);
    var footerHeight = $('footer').outerHeight(true);
    vph -= headerHeight + footerHeight;
    $('.content-leftsec').css({ 'min-height': vph });
    $('.content-rightsec').css({ 'min-height': vph - 10 });
}
$(window).resize(function () {
    resizeDivisions();
});