﻿/// <reference path="jquery-1.3.2-vsdoc.js" />

var arrSize;
var newsCounter = 0;
var left = 0;
var command = 0;
var nomore = 0;
var shift;
var aIndex = 0;
var wrapperA;
var wrapperAlength;
var TotalCount;
var PageCount=20;
var PageIndex = 0;
var PageIndexRecipes = 0;
var TotalCountRecipes;
var NewsPageIndex = 0;
var NewsPageCount = 3;
var categoryNB = 0;
var categoryIndex;
var gettingProduct = 0;
var emailpopON = 0;
var feedTest = 0;
var glassTest = 0;
var fromBack;
var showTop = 1;
var newsArray;
var testOnBack;
var testOnBackResult;
var TotalCountNews;
var addrecipeBool = 0;
var letitrun = 0;
$(document).ready(function() {
//    newsArray = $('#sidebar').find('.latestnews');
//    arrSize = newsArray.length;
//    shuffle();
    $('#send-feedback').click(showFeed);
    $('#send_feed_popup > .close').click(hideFeed);
    $('#newnews').click(shownewnews);
    $('#newnews > .close').click(hidenewnews);
    $('#nextButton2').click(switchEmails);
    $('.email').click(showEmail);
    $('.tellAFriend > .close').click(closeEmailPop);
    $('#nextButton').click(switchName);
    $('#sendButton').click(mailfriend);
    $('.join-button').click(showNewsLetter);
    $('.glass-panel-2').click(hideNewsLetter);
    //    $('.view_all').click(showAll);
    ForAll();
    if ($('.footer_up').length == 0) {
        $.ajax({
            url: $('#urlBaseDir').val() + 'Product/getProductByCategory/1?PageCount=' + PageCount + '&PageIndex=0',
            success: function(data) {
                $('#top_sellers').html(data);
                $('#top_sellers > div').hover(function() { $(this).addClass('selected'); }, function() { $(this).removeClass('selected'); });
                ForAll();
                setTimeout(function() {
                    document.getElementById("previous-1").className = "previous end";

                    for (var i = 1; i <= TotalCount; i++) {
                        $('#pagesContainerProducts').append("<div>" + i + "</div>");
                    }
                    $("#pagesContainerProducts > div").addClass("page");
                    $("#pagesContainerProducts > div").click(function() { pageByNbProduct($(this).html(), categoryNB); });
                    var x = $("#pagesContainerProducts > div");
                    $(x[0]).addClass("selected");
                }, 1000);
                
                $('#currentpage').html(PageIndex + 1);
                $('#allpages').html(TotalCount);

            }
        });
    }
    wrapperA = $('#footer > .wrapper').find("a");
    wrapperAlength = wrapperA.length;
    $('.cat-next').click(forward);
    $('.cat-previous').click(backward);

    if ($('#categories').length != 0) {
        $('#categories > a').bind('click', function() {
            $('#categories > a').removeClass('selected');
            $(this).addClass('selected');
            categoryIndex = $(this).index();
        });
    }


    //    if (categoryIndex == -1) {
    //        $($('#categories > a')[0]).addClass('selected');
    //    }
    //    else 
    //    {
    //        categoryIndex = $('#categories > .selected').index();
    //        $($('#categories > a')[categoryIndex]).addClass('selected');
    // 
    //    }


setTimeout(function(){letitrun = 1},1000)

});




function pageByNbProduct(i, backcategory) {
if(letitrun == 1){
    i = i - 1;
    PageIndex = i;
   
    
    if (i != -1) {
        $('.footer > .loader').css("visibility", "visible");
    }
    $.ajax({
        url: $('#urlBaseDir').val() + 'Product/getProductByCategory/' + categoryNB + '?PageCount=' + PageCount + '&PageIndex=' + i + '&fromBack=' + testOnBackResult,
        success: function(data) {
            //                $('#recipes > .one_recipe').css("display", "inline-block");
            //                $('.footer > .loader').css("visibility", "hidden");
            $('#top_sellers').html(data);
            for (var i = 1; i <= TotalCount; i++) {
                $('#pagesContainerProducts').append("<div>" + i + "</div>");
            }
            if (PageIndex == 0) {
                $('#previous-1').addClass('end');
                $('#next-1').removeClass('end');
            }
            else {
                $('#previous-1').removeClass('end');
                if (PageIndex == TotalCount - 1) {
                    $('#next-1').addClass('end');
                }
                else { $('#next-1').removeClass('end'); }
            }
            resizeTest();
            $("#pagesContainerProducts > div").addClass("page");
            $("#pagesContainerProducts > div").click(function() { pageByNbProduct($(this).html(), categoryNB); });
            var x = $("#pagesContainerProducts > div");
            $(x[PageIndex]).addClass('selected');
        }
    });

}
}
function getProducts(id) {
//    $('#product_details').css("display", "none");
//    $('#top_sellers').css("visibility", "hidden");
//    $.ajax({
//    url: $('#urlBaseDir').val() + 'Product/getProductByCategory/' + id,
//        success: function(data) {
//            $('#top_sellers').html(data);
//            $('#top_sellers > div').hover(function() { $(this).addClass('selected'); }, function() { $(this).removeClass('selected'); });
//            resizeTest();
//            $('#top_sellers').css("visibility", "visible");
//        }
    //    });
    categoryNB = id;
     TotalCount=1;
     PageCount = 20;
     PageIndex = -1;
     gettingProduct = 2;
    fetchData(true);
}
function BackToProducts(backIndex, backcategory) {
    //    $('#product_details').css("display", "none");
    //    $('#top_sellers').css("visibility", "hidden");
    //    $.ajax({
    //    url: $('#urlBaseDir').val() + 'Product/getProductByCategory/' + id,
    //        success: function(data) {
    //            $('#top_sellers').html(data);
    //            $('#top_sellers > div').hover(function() { $(this).addClass('selected'); }, function() { $(this).removeClass('selected'); });
    //            resizeTest();
    //            $('#top_sellers').css("visibility", "visible");
    //        }
    //    });
    categoryNB = backcategory;
//    TotalCount = 2;
    PageCount = 20;
    PageIndex = backIndex;
    gettingProduct = 2;
    fetchBack(PageIndex, categoryNB);
}
function forward() {
    if (command == 0 && aIndex != (wrapperAlength - 5)) {
        shift = $(wrapperA[aIndex]).width() + 27;
        command = 1;
        $('#footer > .wrapper').animate({
            left: left - shift + "px"
        }, 800, updateMinus)
    }
}

function backward() {
    if (command == 0 && aIndex != 0) {
        shift = $(wrapperA[aIndex - 1]).width() + 27;
        command = 1;
        $('#footer > .wrapper').animate({
            left: left + shift + "px"
        }, 800, updatePlus)
    }
}

function updateMinus() {
    aIndex = aIndex + 1;
    left = left - shift;
    command = 0;
    resetPrevious();
    endNext();
    
}

function updatePlus() {
    aIndex = aIndex - 1;
    left = left + shift;
    command = 0;
    resetNext();
    endPrevious();
}

function resetPrevious() {
    if (aIndex != 0) {
        $('.cat-previous').removeClass("end");
    }
}

function endPrevious() {
    if (aIndex == 0) {
        $('.cat-previous').addClass("end");
    }
}

function endNext() {
    if (aIndex == (wrapperAlength - 5)) {
        $('.cat-next').addClass("end");
    }
}

function resetNext() {
    if (aIndex != (wrapperAlength - 5)) {
        $('.cat-next').removeClass("end");
    }
}


function fetchBack(backIndex, backcategory) {
    PageIndex = backIndex;
    categoryNB = backcategory
    $('#product_details').css("display", "none");
    $('#top_sellers').css("visibility", "hidden");
    $('.center_division > .loader').css("display", "block");
    $.ajax({
    url: $('#urlBaseDir').val() + 'Product/getProductByCategory/' + categoryNB + '?PageCount=' + PageCount + '&PageIndex=' + PageIndex + '&fromBack=' + true,
    success: function(data) {
            $('.center_division > .loader').css("display", "none");
            $('.center_division > .loader').css("display", "none");
            $('#top_sellers').html(data);
            $('#top_sellers > div').hover(function() { $(this).addClass('selected'); }, function() { $(this).removeClass('selected'); });
            resizeTest();
            if (TotalCount > 1 && gettingProduct == 2) {
                document.getElementById("previous-1").className = "previous end";
                gettingProduct = 0;
            }
            $('#currentpage').html(PageIndex + 1);
            $('#allpages').html(TotalCount);

            $('#top_sellers').css("visibility", "visible");
            if (PageIndex == TotalCount - 1) {
                $('#next-1').addClass('end');
            }
        }
        
    });
    $('#centerDivisionHreader').css("visibility", "hidden");
    testOnBack = 1;
}




function fetchData(direction) {
    if (testOnBack == 1) {
        testOnBackResult = true;
    }
    else{

        testOnBackResult = false;
    }
    if (direction == true) {
        if (PageIndex != TotalCount - 1) {
            PageIndex = PageIndex + 1;
            $('#previous-1').removeClass('end');
            $('#product_details').css("display", "none");
            $('#top_sellers').css("visibility", "hidden");
            $('.center_division > .loader').css("display", "block");

            $.ajax({
                url: $('#urlBaseDir').val() + 'Product/getProductByCategory/' + categoryNB + '?PageCount=' + PageCount + '&PageIndex=' + PageIndex + '&fromBack=' + testOnBackResult,
                success: function(data) {
                    $('.center_division > .loader').css("display", "none");
                    $('#top_sellers').html(data);
                    $('#top_sellers > div').hover(function() { $(this).addClass('selected'); }, function() { $(this).removeClass('selected'); });
                    resizeTest();
                    if (TotalCount > 1 && gettingProduct == 2) {
                        document.getElementById("previous-1").className = "previous end";
                        gettingProduct = 0;
                    }
                    $('#currentpage').html(PageIndex + 1);
                    $('#allpages').html(TotalCount);

                    $('#top_sellers').css("visibility", "visible");
                    if (PageIndex == TotalCount - 1) {
                        $('#next-1').addClass('end');
                    }
                    for (var i = 1; i <= TotalCount; i++) {
                        $('#pagesContainerProducts').append("<div>" + i + "</div>");
                    }
                    $("#pagesContainerProducts > div").addClass("page");
                    $("#pagesContainerProducts > div").click(function() { pageByNbProduct($(this).html(), categoryNB); });
                    var x = $("#pagesContainerProducts > div");
                    $(x[PageIndex]).addClass('selected');
                }
            });
        }
        $('#centerDivisionHreader').css("visibility", "hidden");
    }
    else 
    {
        if (PageIndex == 0) {
        }
        else {
            PageIndex = PageIndex - 1;
            $('#next-1').removeClass('end');
            $('#product_details').css("display", "none");
            $('#top_sellers').css("visibility", "hidden");
            $('.center_division > .loader').css("display", "block");
            $.ajax({
            url: $('#urlBaseDir').val() + 'Product/getProductByCategory/' + categoryNB + '?PageCount=' + PageCount + '&PageIndex=' + PageIndex + '&fromBack=' + testOnBackResult,
                success: function(data) {
                    $('.center_division > .loader').css("display", "none");
                    $('#top_sellers').html(data);
                    $('#top_sellers > div').hover(function() { $(this).addClass('selected'); }, function() { $(this).removeClass('selected'); });
                    resizeTest();
                    $('#top_sellers').css("visibility", "visible");
                    if (PageIndex == 0) {
                        $('#previous-1').addClass('end');
                    }
                    for (var i = 1; i <= TotalCount; i++) {
                        $('#pagesContainerProducts').append("<div>" + i + "</div>");
                    }
                    $("#pagesContainerProducts > div").addClass("page");
                    $("#pagesContainerProducts > div").click(function() { pageByNbProduct($(this).html(), categoryNB); });
                    var x = $("#pagesContainerProducts > div");
                    $(x[PageIndex]).addClass('selected');
                    $('#currentpage').html(PageIndex + 1);
                    $('#allpages').html(TotalCount);

                }
            });   
        }
        $('#currentpage').html(PageIndex + 1);
        $('#allpages').html(TotalCount);
        $('#centerDivisionHreader').css("visibility", "hidden");
    }
    
//    $('#product_details').css("display", "none");
//    $('#top_sellers').css("visibility", "hidden");
//    $.ajax({
//    url: $('#urlBaseDir').val() + 'Product/getProductByCategory/' + categoryNB + '?PageCount=' + PageCount + '&PageIndex=' + PageIndex,
//        success: function(data) {
//            $('#top_sellers').html(data);
//            $('#top_sellers > div').hover(function() { $(this).addClass('selected'); }, function() { $(this).removeClass('selected'); });
//            resizeTest();
//            $('#top_sellers').css("visibility", "visible");
//        }
//    });

}
function showNewsLetter() {
    $('#email2').val($('#NewsletterMain').val());
    $('.newsletter_popup').fadeIn(500);
    $('.glass-panel-2').fadeIn(600);
    glassTest = 1;
}
function hideNewsLetter() {
    if(glassTest == 1){
        $('.newsletter_popup').fadeOut(500);
        $('.glass-panel-2').fadeOut(400);
        document.getElementById('newsletterForm').reset();
        $('#NewsletterMain').val("");
        glassTest = 0;
    }
}


function NewsLetterCall() {
   
    $("#JoinNewsLetter").attr("class", "menu " + "selected");
    $('.opacity_newsletter').css("display", "block");

}
function NewsLetterClose() {
    
   $('.opacity_newsletter').css("display", "none");
    $("#JoinNewsLetter").attr("class", "menu ");

}


////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////newsletter/////////////////////////////////////////////
function validateMessageUs() {
    var msg = "";
    var validator = 0;
    if ($('#nameNews').val() == '') {
        $('#nameNews').parent().css("border-color", "#E4A240");
        validator = 1;
        msg += " » Name \n";
    }
    if ($('#email2').val() == '' || !(($('#email2').val().indexOf(".") > 2) && ($('#email2').val().indexOf("@") > 0))) {
        $('#email2').parent().css("border-color", "#E4A240")
        validator = 1;
        msg += " » E-mail \n";
    }
    if (validator == 1) {
        return;
    }
    $('.newsletter_popup').addClass('loading');
    $.post($('#newsletterForm').attr('action'), { name: $('#nameNews').val(), email: $('#email2').val(), phone: $('#phoneNews').val(), country: $('#country2').val() },
                function(data) {
                    $('.newsletter_popup').removeClass('loading');
                    if (data == "1") {
                        $('.newsletter_popup').addClass('success');
                        setTimeout(function() { $('.newsletter_popup').removeClass('success'); }, 5000);
                        setTimeout(function() {hideNewsLetter();}, 4000);
                        setTimeout(function() { document.getElementById('newsletterForm').reset(); }, 8000);
                    }
                    else {
                        alert("Something went wrong during form submission. Please try again.");
                    }
                });
}
////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////send email/////////////////////////////////////////

function showEmail() {
    if (emailpopON == 0) {
        $('#friendsEmail').focus(function() {

            $(this).val('');

        });
        $('#sendersNameVal').focus(function() {

            $(this).val('');

        });
        $('#sendersEmail').focus(function() {

            $(this).val('');

        });
        $('.email').css("background-image", "none");
        $('.tellAFriend').fadeIn(500);
        $('.glass-panel-2').fadeIn(500);
        emailpopON = 1;
    }
}
function closeEmailPop() {
    $('.email').css("background-image", "");
    $('.tellAFriend').fadeOut(500);
    $('.glass-panel-2').fadeOut(500);
    emailpopON = 1;
    setTimeout(function() {
        $('#friendsText').fadeIn(2);
        $('#sendersName').css("display", "none");
        $('#sendersText').css("display", "none");
        $('.tellAFriend > .label').css("display", "block");
        document.getElementById('emailFriend').reset();
    }, 1000);
    $('#friendsEmail').parent().css("border-color", "#9A8478");
    $('#sendersEmail').parent().css("border-color", "#9A8478");
    setTimeout(function() { emailpopON = 0; }, 1000);
}
function switchName() {
    if ($('#friendsEmail').val() == '' || !(($('#friendsEmail').val().indexOf(".") > 2) && ($('#friendsEmail').val().indexOf("@") > 0))) {
        $('#friendsEmail').parent().css("border-color", "#E4A240");
        return;
    }

    $('#friendsText').fadeOut(200);
    setTimeout(function() { $('#sendersName').fadeIn(200); }, 210);
}

function switchEmails() {
//    if ($('#sendersName').val() == '') {
//        $('#sendersName').css("border", "2px solid #E4A240");
//        return;
//    }
    $('#sendersName').fadeOut(200);
    setTimeout(function() { $('#sendersText').fadeIn(200); }, 210);
}
function mailfriend() {
    if ($('#sendersEmail').val() == '' || !(($('#sendersEmail').val().indexOf(".") > 2) && ($('#sendersEmail').val().indexOf("@") > 0))) {
        $('#sendersEmail').parent().css("border-color", "#E4A240");
        return;
    }

    //    if ($('#txtmessage').val() == '') {
    //        $('#txtmessage').parent().addClass('required');
    //        msg += " » Message \n";
    //    }
//    if (validator == 1) {
//        alert('Kindly, fill the following fields: \n' + msg);
//        return;
//    }
    $('.tellAFriend').addClass('loading');
    $.post($('#emailFriend').attr('action'), { friendsEmail: $('#friendsEmail').val(), sendersEmail: $('#sendersEmail').val(), sendersNameVal: $('#sendersNameVal').val(), UrlofPage: window.location.href },
                function(data) {
                        $('.tellAFriend').removeClass('loading');
                if (data == "1") {
                         $('.tellAFriend').addClass('success');
                         setTimeout(function() { $('.tellAFriend').removeClass('success'); }, 5000);
                         setTimeout(function() { closeEmailPop(); }, 4000);
                         setTimeout(function() { document.getElementById('emailFriend').reset(); }, 8000);
                     }
                    else {
                        alert("Something went wrong during form submission. Please try again.");
                    }
                });
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////Send YOUR FEEDBACK//////////////////////////////////////////
function showFeed() {
    if (feedTest == 0 && newsTest == 0) {
        feedTest = 1;
        $('#send_feed_popup').fadeIn(500);
        $('.glass-panel-2').fadeIn(500);
    }
}
var newsTest = 0;
function shownewnews() {
    if (newsTest == 0 && feedTest == 0) {
        newsTest = 1;
        $('#newnews').fadeIn(500);
        $('.glass-panel-2').fadeIn(500);
    }
}


function hideFeed() {
    $('#send_feed_popup').fadeOut(500);
    $('.glass-panel-2').fadeOut(500);
    feedTest = 1;
    setTimeout(function() { feedTest = 0; }, 1000);
}
function hidenewnews() {
    $('#newnews').fadeOut(500);
    $('.glass-panel-2').fadeOut(500);
    newsTest = 1;
    setTimeout(function() { newsTest = 0; }, 1000);
}


function sendFeedback() {
    var msg = "";
    var validator = 0;
    if ($('#emailFeed').val() == '' || !(($('#emailFeed').val().indexOf(".") > 2) && ($('#emailFeed').val().indexOf("@") > 0))) {
        $('#emailFeed').parent().css("border-color", "#E4A240");
        validator = 1;
        msg += " » Your E-mail \n";
    }
    else {
        $('#emailFeed').parent().css("border-color", "#9A8478");
    }
    if ($('#nameFeed').val() == '') {
        msg += " » Name \n";
        $('#nameFeed').parent().css("border-color", "#E4A240");
        validator = 1;
    }      
    else {
        $('#nameFeed').parent().css("border-color", "#9A8478");
    }
    if ($('#CountryIDFeed').val() == '') {
        msg += " » Your Country \n";
        $('#CountryIDFeed').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#CountryIDFeed').parent().css("border-color", "#9A8478");
    }
    if ($('#messageFeed').val() == '') {
        msg += " » Your Country \n";
        $('#messageFeed').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#messageFeed').parent().css("border-color", "#9A8478");
    }
    if (validator == 1) {
        return;
    }
    $('#send_feed_popup').addClass('loading');
    $.post($('#feedback').attr('action'), { emailFeed: $('#emailFeed').val(), nameFeed: $('#nameFeed').val(), CountryIDFeed: $('#CountryIDFeed').val(), topicFeed: $('#topicFeed').val(), messageFeed: $('#messageFeed').val() },
    function(data) {
    $('#send_feed_popup').removeClass('loading');
    if (data == "1") {
//                    alert("sent")
            $('#send_feed_popup').addClass('successful');
            setTimeout(function() { $('#send_feed_popup').removeClass('successful'); }, 2000);
            setTimeout(function() { hideFeed(); }, 2000);
            setTimeout(function() { document.getElementById('feedback').reset(); }, 4000);
        }
        else {
            alert("Something went wrong during form submission. Please try again.");
        }
    });
}

////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////Newsletter////////////////////////////////////
function newsletterSubmit() {
    var msg = "";
    var validator = 0;
    if ($('#email2').val() == '' || !(($('#email2').val().indexOf(".") > 2) && ($('#email2').val().indexOf("@") > 0))) {
        $('#email2').parent().css("border-color", "#E4A240");
        validator = 1;
        msg += " » Your E-mail \n";
    }
    else {
        $('#email2').parent().css("border-color", "#9A8478");
    }


    if ($('#phoneNews').val() == '') {
        msg += " » Name \n";
        $('#phoneNews').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#phoneNews').parent().css("border-color", "#9A8478");
    }



    if ($('#nameNews').val() == '') {
        msg += " » Your Country \n";
        $('#nameNews').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#nameNews').parent().css("border-color", "#9A8478");
    }



    if ($('#country2').val() == '') {
        msg += " » Your Country \n";
        $('#country2').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#country2').parent().css("border-color", "#9A8478");
    }
    if (validator == 1) {
        return;
    }
    $('#newnews').find('#newsletterForm').hide();
    $('#newnews').find('.loader').show();
    $.post($('#newsletterForm').attr('action'), { name: $('#nameNews').val(), email: $('#email2').val(), phone: $('#phoneNews').val(), country: $('#country2').val() },
    function(data) {
        $('#newnews').find('.loader').hide();
        if (data == "1") {
            //                    alert("sent")
            $('#newnews').addClass('successful');
            setTimeout(function() { $('#newnews').removeClass('successful'); }, 4000);
            setTimeout(function() { hidenewnews(); }, 4000);
            setTimeout(function() { document.getElementById('newsletterForm').reset(); $('#newnews').find('#newsletterForm').show(); }, 5000);
        }
        else {
            alert("Something went wrong during form submission. Please try again.");
        }
    });
}









////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////Online Inquiry////////////////////////////////////
function OnlineInquiry() {
    var msg = "";
    var validator = 0;
    if ($('#Inquiryemail').val() == '' || !(($('#Inquiryemail').val().indexOf(".") > 2) && ($('#Inquiryemail').val().indexOf("@") > 0))) {
        $('#Inquiryemail').parent().css("border-color", "#E4A240");
        validator = 1;
        msg += " » Your E-mail \n";
    }
    else {
        $('#Inquiryemail').parent().css("border-color", "#9A8478");
    }
    if ($('#Inquiryname').val() == '') {
        msg += " » Name \n";
        $('#Inquiryname').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#Inquiryname').parent().css("border-color", "#9A8478");
    }
    if ($('#InquiryCountryID').val() == '') {
        msg += " » Your Country \n";
        $('#InquiryCountryID').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#InquiryCountryID').parent().css("border-color", "#9A8478");
    }
    if ($('#InquiryInterested').val() == '') {
        msg += " » Your Country \n";
        $('#InquiryInterested').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#InquiryInterested').parent().css("border-color", "#9A8478");
    }
    if ($('#Inquirymessage').val() == '') {
        msg += " » Your Country \n";
        $('#Inquirymessage').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#Inquirymessage').parent().css("border-color", "#9A8478");
    }
    if ($('#Inquirycompany').val() == '') {
        msg += " » Your Country \n";
        $('#Inquirycompany').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#Inquirycompany').parent().css("border-color", "#9A8478");
    }
    if (validator == 1) {
        $('.exclamation').fadeIn(500);
        return;
    }
    else {
        $('.exclamation').fadeOut(500);

    }
    $('#Inquiry').addClass('fade');
    $('.glass-panel-2').fadeIn(300);
    $('#second_part > .loader').fadeIn(300);
    $.post($('#Inquiry').attr('action'), { Inquiryemail: $('#Inquiryemail').val(), Inquiryname: $('#Inquiryname').val(), InquiryCountryID: $('#InquiryCountryID').val(), InquiryInterested: $('#InquiryInterested').val(), Inquirymessage: $('#Inquirymessage').val(), Inquirycompany: $('#Inquirycompany').val(), Inquirymobile: $('#Inquirymobile').val() },
    function(data) {
        $('#second_part > .loader').fadeOut(300);
        if (data == "1") {
                $('.success').fadeIn(300);
                setTimeout(function() { $('.glass-panel-2').fadeOut(300); $('.success').fadeOut(300); }, 5000);
                setTimeout(function() { document.getElementById('Inquiry').reset(); $('#Inquiry').removeClass('fade'); }, 5300);
            }
            else {
                alert("Something went wrong during form submission. Please try again.");
            }
        });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////TRADE FORM////////////////////////////////////////////////////////////
function TradeSubmit() {
    var msg = "";
    var validator = 0;
    if ($('#tradeemail').val() == '' || !(($('#tradeemail').val().indexOf(".") > 2) && ($('#tradeemail').val().indexOf("@") > 0))) {
        $('#tradeemail').parent().css("border-color", "#E4A240");
        validator = 1;
        msg += " » Your E-mail \n";
    }
    else {
        $('#tradeemail').parent().css("border-color", "#9A8478");
    }
    if ($('#tradename').val() == '') {
        msg += " » Name \n";
        $('#tradename').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#tradename').parent().css("border-color", "#9A8478");
    }
    if ($('#tradeCountryID').val() == '') {
        msg += " » Your Country \n";
        $('#tradeCountryID').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#tradeCountryID').parent().css("border-color", "#9A8478");
    }
    if ($('#tradecity').val() == '') {
        msg += " » Your Country \n";
        $('#tradecity').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#tradecity').parent().css("border-color", "#9A8478");
    }
    if ($('#tradeaddress').val() == '') {
        msg += " » Your Country \n";
        $('#tradeaddress').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#tradeaddress').parent().css("border-color", "#9A8478");
    }
    if ($('#trademessage').val() == '') {
        msg += " » Your Country \n";
        $('#trademessage').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#trademessage').parent().css("border-color", "#9A8478");
    }
    if ($('#tradecompany').val() == '') {
        msg += " » Your Country \n";
        $('#tradecompany').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#tradecompany').parent().css("border-color", "#9A8478");
    }
    if ($('#tradearea').val() == '') {
        msg += " » Your Country \n";
        $('#tradearea').parent().css("border-color", "#E4A240");
        validator = 1;
    }
    else {
        $('#tradearea').parent().css("border-color", "#9A8478");
    }
    if (validator == 1) {
        $('.exclamation').fadeIn(500);
        return;
    }
    else {
        $('.exclamation').fadeOut(500);
    }
    $('#tradeform').addClass('fade');
//    $('.glass-panel-2').fadeIn(300);
    $('#second_part > .loader').fadeIn(300);
    $.post($('#tradeform').attr('action'), { tradeemail: $('#tradeemail').val(), tradename: $('#tradename').val(), tradeCountryID: $('#tradeCountryID').val(), tradecity: $('#tradecity').val(), trademessage: $('#trademessage').val(), tradecompany: $('#tradecompany').val(), trademobile: $('#trademobile').val(), tradearea: $('#tradearea').val(), tradecode: $('#tradecode').val(), tradedate: $('#tradedate').val(), tradelist: $('#tradelist').val(), tradeaddress: $('#tradeaddress').val() },
    function(data) {
        $('#second_part > .loader').fadeOut(300);
        if (data == "1") {
            $('#second_part > .success').fadeIn(300);
            setTimeout(function() { $('#second_part > .success').fadeOut(300); }, 5000);
                        setTimeout(function() { document.getElementById('tradeform').reset(); $('#tradeform').removeClass('fade'); }, 5300);
        }
        else {
            alert("Something went wrong during form submission. Please try again.");
        }
    });
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////NEWS SLIDESHOW////////////////////////////////////////////////////////
function shuffle() {
    if (newsCounter == arrSize) {
        newsCounter = 0;
        $(newsArray[newsCounter]).fadeIn(500);
        setTimeout(function() { $(newsArray[newsCounter]).fadeOut(500); }, 10000);
    }
    else {
        $(newsArray[newsCounter]).fadeIn(500);
        setTimeout(function() { $(newsArray[newsCounter]).fadeOut(500); }, 10000);
    }
    setTimeout(setShuffle, 11000);
}
function setShuffle() {
    newsCounter++;
    shuffle();
}

function filterNewsAndEvents() {
//    if ($('#newsEventFilterYear').val() == null) {
//        year = "2011";
//    }
//    else{
//        year = $('#newsEventFilterYear').val();
//    }
//    if ($('#newsEventFilterMonth').val() == null) {
//        month = "january";
//    }
//    else {
//        month = $('#newsEventFilterMonth').val();
//    }
    $.ajax({
    url: $('#urlBaseDir').val() + 'NewsAndEvent/GetNewsEventsByDate/?year=' + $('#newsEventFilterYear').val() + '&month=' + $('#newsEventFilterMonth').val() + '&pageCount=' + "50" + '&pageNB=' + "0",
        success: function(data) {
            $('#news_or_event').html(data);

        }
    });
}
/*******************************************************************************************************************/
/*******************************************************************************************************/
/****************news and events paging*****************/
function fetchDataNews(direction) {
    var year;
    var month;
    if ($('#newsEventFilterMonth').val() == null) {
        month = -1;
    }
    else {
        month = $('#newsEventFilterMonth').val();
    }
    if ($('#newsEventFilterYear').val() == null) {
        year = -1;
    }
    else {
        year = $('#newsEventFilterYear').val();
    }
    if (direction == true) {

        if (NewsPageIndex != TotalCountNews - 1) {
            NewsPageIndex = NewsPageIndex + 1;
            $('.previousNews').removeClass('end');
            $('.news_or_event').hide();
            $('#newsAndEventsLoader').show();
            $.ajax({
                url: $('#urlBaseDir').val() + 'NewsAndEvent/GetNewsEventsByDate/?year=' + "-1" + '&month=' + "-1" + '&pageCount=' + NewsPageCount + '&pageNB=' + NewsPageIndex,
                success: function(data) {
                    $('#newsAndEventsLoader').hide();
                    $('.news_or_event').show();
                    $('#news_or_event').html(data);
//                    if (TotalCountNews > 1) {
//                        $('.previousNews').addClass("end");
//                    }
                    if (NewsPageIndex == TotalCountNews - 1) {
                        $('.nextNews').addClass('end');
                    }
                }
            });
        }
    }
    else {
        if (NewsPageIndex == 0) {
        }
        else {
            NewsPageIndex = NewsPageIndex - 1;
            $('.nextNews').removeClass('end');
            $('.news_or_event').hide();
            $('#newsAndEventsLoader').show();
            $.ajax({
            url: $('#urlBaseDir').val() + 'NewsAndEvent/GetNewsEventsByDate/?year=' + "-1" + '&month=' + "-1" + '&pageCount=' + NewsPageCount + '&pageNB=' + NewsPageIndex,
            success: function(data) {
                    $('#newsAndEventsLoader').hide();
                    $('.news_or_event').show();
                    $('#news_or_event').html(data);
                    if (NewsPageIndex == 0) {
                        $('.previousNews').addClass('end');
                    }
                }
            });
        }
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////recipe paging///////////////////////////////////////////////////
function fetchDataRecipes(direction) {
   
    if (direction == true) {
        if (PageIndexRecipes < TotalCountRecipes - 1) {
            PageIndexRecipes = PageIndexRecipes + 1;
            $('#recipesprevious-1').removeClass('end');
            $('#recipes > .one_recipe').css("display", "none");
            $('.footer > .loader').css("visibility", "visible");

            $.ajax({
                url: $('#urlBaseDir').val() + 'Recipe/PagingRecipes/?pageCount=' + "4" + '&pageNB=' + PageIndexRecipes,
                success: function(data) {
                    $('#recipes > .one_recipe').css("display", "inline-block");
                    $('.footer > .loader').css("visibility", "hidden");
                    $('#recipesContainer').html(data);
                    if (TotalCountRecipes > 1) {
                        //document.getElementById("recipesprevious-1").className = "previous end" ;
                    }

                    var indexofselected = $("#pagesContainer > .selected").index();
                    $("#pagesContainer > .selected").removeClass("selected");
                    var cascade = $("#pagesContainer > .page");
                    $(cascade[indexofselected+1]).addClass("selected");
                    $('#currentpagerecipes').html(PageIndexRecipes + 1);
                    //                    for (var i = 1; i < TotalCountRecipes; i++) {
                    //                        $('#pagesContainer').append("<div>" + i + "</div>").attr("class","page");
                    //                    }
                    $('#allpagesrecipes').html(TotalCountRecipes);


                    if (PageIndexRecipes == TotalCountRecipes - 1) {
                        $('#recipesnext-1').addClass('end');
                    }
                }
            });
        }
    }
    else {
        if (PageIndexRecipes == 0) {
        }
        else {
            PageIndexRecipes = PageIndexRecipes - 1;
            $('#recipesnext-1').removeClass('end');
            $('#recipes > .one_recipe').css("display", "none");
            $('.footer > .loader').css("visibility", "visible");
            $.ajax({
            url: $('#urlBaseDir').val() + 'Recipe/PagingRecipes/?pageCount=' + "4" + '&pageNB=' + PageIndexRecipes,
                success: function(data) {
                $('#recipes > .one_recipe').css("display", "inline-block");
                $('.footer > .loader').css("visibility", "hidden");
                $('#recipesContainer').html(data);
                    if (PageIndexRecipes == 0) {
                        $('#recipesprevious-1').addClass('end');
                    }
                    var indexofselected = $("#pagesContainer > .selected").index();
                    $("#pagesContainer > .selected").removeClass("selected");
                    var cascade = $("#pagesContainer > .page");
                    $(cascade[indexofselected - 1]).addClass("selected");
                    $('#currentpagerecipes').html(PageIndexRecipes + 1);
                    $('#allpagesrecipes').html(TotalCountRecipes);

                }
            });
        }
        $('#currentpagerecipes').html(PageIndexRecipes + 1);
        $('#allpagesrecipes').html(TotalCountRecipes);
    }
}
function fetchSideDataRecipes(direction) {

    if (direction == true) {
        if (PageIndexRecipes != TotalCountRecipes - 1) {
            PageIndexRecipes = PageIndexRecipes + 1;
            $('#recipesprevious-1').removeClass('end');
            $('#recipes > .one_recipe').css("display", "none");
            $('#recipes > .loader').css("visibility", "visible");

            $.ajax({
                url: $('#urlBaseDir').val() + 'Recipe/PagingRecipes/?pageCount=' + "3" + '&pageNB=' + PageIndexRecipes,
                success: function(data) {
                    $('#recipes > .one_recipe').css("display", "inline-block");
                    $('#recipes > .loader').css("visibility", "hidden");
                    $('#recipesContainer').html(data);
                    if (TotalCountRecipes > 1) {
                        //document.getElementById("recipesprevious-1").className = "previous end" ;
                    }
                    $('#currentpagerecipes').html(PageIndexRecipes + 1);
                    $('#allpagesrecipes').html(TotalCountRecipes);


                    if (PageIndexRecipes == TotalCountRecipes - 1) {
                        $('#recipesnext-1').addClass('end');
                    }
                }
            });
        }
    }
    else {
        if (PageIndexRecipes == 0) {
        }
        else {
            PageIndexRecipes = PageIndexRecipes - 1;
            $('#recipesnext-1').removeClass('end');
            $('#recipes > .one_recipe').css("display", "none");
            $('#recipes > .loader').css("display", "block");
            $.ajax({
                url: $('#urlBaseDir').val() + 'Recipe/PagingRecipes/?pageCount=' + "3" + '&pageNB=' + PageIndexRecipes,
                success: function(data) {
                    $('#recipes > .one_recipe').css("display", "inline-block");
                    $('#recipes > .loader').css("display", "none");
                    $('#recipesContainer').html(data);
                    if (PageIndexRecipes == 0) {
                        $('#recipesprevious-1').addClass('end');
                    }
                    $('#currentpagerecipes').html(PageIndexRecipes + 1);
                    $('#allpagesrecipes').html(TotalCountRecipes);

                }
            });
        }
        $('#currentpagerecipes').html(PageIndexRecipes + 1);
        $('#allpagesrecipes').html(TotalCountRecipes);
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////add recipe////////////////////////////////////////////////////////
function SendRecipe() {
//    var msg = "";
    var validator = 0;
    if ($('#emailaddrecipe').val() == '' || !(($('#emailaddrecipe').val().indexOf(".") > 2) && ($('#emailaddrecipe').val().indexOf("@") > 0))) {
        $('#emailaddrecipe').parent().css("border-color", "#E4A240");
        validator = 1;
     //   msg += " » Your E-mail \n";
   }
    else {
        $('#emailaddrecipe').parent().css("border-color", "#9A8478");
    }
//    if ($('#nameFeed').val() == '') {
//        msg += " » Name \n";
//        $('#nameFeed').parent().css("border-color", "#E4A240");
//        validator = 1;
//    }
//    else {
//        $('#nameFeed').parent().css("border-color", "#9A8478");
//    }
//    if ($('#CountryIDFeed').val() == '') {
//        msg += " » Your Country \n";
//        $('#CountryIDFeed').parent().css("border-color", "#E4A240");
//        validator = 1;
//    }
//    else {
//        $('#CountryIDFeed').parent().css("border-color", "#9A8478");
//    }
//    if ($('#messageFeed').val() == '') {
//        msg += " » Your Country \n";
//        $('#messageFeed').parent().css("border-color", "#E4A240");
//        validator = 1;
//    }
//    else {
//        $('#messageFeed').parent().css("border-color", "#9A8478");
//    }
   if (validator == 1) {
        return;
    }
    $('#addRecipePopUp').addClass('loading');
    $.post($('#addrecipeform').attr('action'), { emailaddrecipe: $('#emailaddrecipe').val(), nameaddrecipe: $('#nameaddrecipe').val(), CountryIDaddrecipe: $('#CountryIDaddrecipe').val(), titleaddrecipe: $('#titleaddrecipe').val(), ingredientsaddrecipe: $('#ingredientsaddrecipe').val(), preperationaddrecipe: $('#preperationaddrecipe').val() },
    function(data) {
        $('#addRecipePopUp').removeClass('loading');
        if (data == "1") {
            $('#addRecipePopUp').addClass('loading');
            $('#addRecipePopUp > .loader').fadeOut(50);
            $('#addRecipePopUp > .success').fadeIn(50);
            setTimeout(function() { $('#addRecipePopUp > .success').fadeOut(50); }, 3500);
            // setTimeout(function() { hideFeed(); }, 2000);
            setTimeout(function() { $('#addRecipePopUp').fadeOut(200); $('.glass-panel-2').fadeOut(150); document.getElementById('addrecipeform').reset(); }, 4000);
        }
        else {
            alert("Something went wrong during form submission. Please try again.");
        }
    });
}

function showAddRecipe() {
    if (addrecipeBool == 0) {
        $('#addRecipePopUp').fadeIn(200);
        $('.glass-panel-2').fadeIn(300);
    }
}
function hideAddRecipe() {
    addrecipeBool = 1;
    $('#addRecipePopUp').fadeOut(300);
    $('.glass-panel-2').fadeOut(200)
    setTimeout(function() { addrecipeBool = 0; }, 500);
}
function enlargeIMG() {
    x = $('.pic_container').find("img"); 3
    var myImage = new Image();
    myImage.src = $(x[index]).attr("src");
    $('.glass-panel-2').fadeIn(500);
    $('.enlarge_img').fadeIn(500);
    $('.newImg').css("display", "none");
    $('.newImg').html(myImage)
    $('.newImg').fadeIn(500);
}
function CloseEnlargeIMG() {
    $('.glass-panel-2').fadeOut(500);
    $('.enlarge_img').fadeOut(500);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////CAREER APPLICATION FORM////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function SubmitCareer() {


    var validator = 0;
    if ($('#personal_Email').val() == '' || !(($('#personal_Email').val().indexOf(".") > 2) && ($('#personal_Email').val().indexOf("@") > 0))) {
        $('#personal_Email').parent().css("border-color", "#E4A240");
        validator++;
        //   msg += " » Your E-mail \n";
    }
    else {
        $('#personal_Email').parent().css("border-color", "#9A8478");
        //document.allforms.submit();
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if ($('#personal_name').val() == '') {
        $('#personal_name').parent().css("border-color", "#E4A240");
        validator++;
    }
    else {
        $('#personal_name').parent().css("border-color", "#9A8478");
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if ($('#personal_date').val() == '') {
        $('#personal_date').parent().css("border-color", "#E4A240");
        validator++;
    }
    else {
        $('#personal_date').parent().css("border-color", "#9A8478");
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if ($('#personal_home').val() == '') {
        $('#personal_home').parent().css("border-color", "#E4A240");
        validator++;
    }
    else {
        $('#personal_home').parent().css("border-color", "#9A8478");
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if ($('#personal_mobile').val() == '') {
        $('#personal_mobile').parent().css("border-color", "#E4A240");
        validator++;
    }
    else {
        $('#personal_mobile').parent().css("border-color", "#9A8478");
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if ($('#personal_Address').val() == '') {
        $('#personal_Address').parent().css("border-color", "#E4A240");
        validator++;
    }
    else {
        $('#personal_Address').parent().css("border-color", "#9A8478");
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if ($('#position_Salary').val() == '') {
        $('#position_Salary').parent().css("border-color", "#E4A240");
        validator++;
    }
    else {
        $('#position_Salary').parent().css("border-color", "#9A8478");
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if ($('#position_Date').val() == '') {
        $('#position_Date').parent().css("border-color", "#E4A240");
        validator++;
    }
    else {
        $('#position_Date').parent().css("border-color", "#9A8478");
    }
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    if (validator > 0) {
        $('.careerNotMsg').html("Please Fill in the required fields");
    }
    else {
        document.allforms.submit();
    }

}

///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
function GWT_entryPoint() {
    if(document.getElementById("month_news_dropie") != null) {
//        alert('Hello');
        showEventsDropies();
    }
//    alert('f');
//    if (document.getElementById("calendargoeshere1") != null) {
//        var Editndate = "";

//        if (document.getElementById("Editndate") != null) {
//            Editndate = document.getElementById("Editndate").value;
//        }
//        else {
//            var Editndate = "";
//        }
//        //calendarPath = document.getElementById('CalendarPath').value;
//        showCalendar('calendargoeshere1', 'employment_Commenced', 'employment_Commenced', true, false, '', 'MM/dd/yyyy', Editndate);
//    }

    if (document.getElementById("calendargoeshere_delovery") != null) {
        var Editndate = "";

        if (document.getElementById("Editndate") != null) {
            Editndate = document.getElementById("Editndate").value;
        }
        else {
            var Editndate = "";
        }

        calendarPath = document.getElementById('CalendarPath').value;
        showCalendar('calendargoeshere_delovery', 'employment_Commenced', 'deliveryDate', true, false, '', 'MM/dd/yyyy', Editndate, false, false, true);
    }
    if (document.getElementById("calendargoeshere_gardenia") != null) {
        var Editndate = "";
        //alert(Editndate+"1")
        if (document.getElementById("Editndate") != null) {
            // alert(Editndate+"2")
            var Editndate = document.getElementById("Editndate").value;
        }
        else {

            var Editndate = "";
            //alert(Editndate+"3")
        }
        //alert(Editndate)
        //calendarPath = document.getElementById('CalendarPath').value;
        showAge('calendargoeshere_gardenia', 'personal_date', true, '', Editndate, 'dd MMMM yyyy');
        // showAge(''+calendarPath+'', 'calendargoeshere_regidter', 'age1', true, false, '', 'MM/dd/yyyy', Editndate);
    }
    if (document.getElementById("calendargoeshere1") != null) {
        var Editndate = "";

        if (document.getElementById("Editndate") != null) {
            Editndate = document.getElementById("Editndate").value;
        }
        else {
            var Editndate = "";
        }
        //calendarPath = document.getElementById('CalendarPath').value;
        showCalendar('calendargoeshere1', 'calendargoeshere1', 'FromDate', true, false, '', 'MM/dd/yyyy', Editndate);
    }
    if (document.getElementById("calendargoeshere2") != null) {
        var Editndate = "";

        if (document.getElementById("Editndate2") != null) {
            Editndate = document.getElementById("Editndate2").value;
        }
        else {
            var Editndate = "";
        }
        //calendarPath = document.getElementById('CalendarPath').value;
        showCalendar('calendargoeshere2', 'calendargoeshere2', 'ToDate', true, false, '', 'MM/dd/yyyy', Editndate);
    }
    if (document.getElementById("minicalendargoeshere") != null) {
        var Editndate = "";

        if (document.getElementById("minidate") != null) {
            Editndate = document.getElementById("minidate").value;
        }
        else {
            var Editndate = "";
        }
        calendarPath = document.getElementById('CalendarPath').value;
        // alert('f')
        showCalendar('' + calendarPath + '', 'minicalendargoeshere', 'date', true, false, '', 'MM/dd/yyyy', Editndate);
    }
}
