base = window.location.protocol + '//www.oxseed.com/';

function newsLoad() {
    $('#newsitems').fadeOut(1000, function() {
        $('#newsitems').load(base + 'getAjaxNews?pa=' + Math.floor(Math.random()*10000));
    });
    $('#newsitems').fadeIn(1000);
}

function eventsLoad() {
    $('#eventitems').fadeOut(1000, function() {
        $('#eventitems').load(base + 'getAjaxEvents?pa=' + Math.floor(Math.random()*10000));
    });
    $('#eventitems').fadeIn(1000);
}

function testimonialsLoad() {
    $('#testimonialitems').fadeOut(1000, function() {
        $('#testimonialitems').load(base + 'getAjaxTestimonials?pa=' + Math.floor(Math.random()*10000));
    });
    $('#testimonialitems').fadeIn(1000);
}

function showCustomerPortal(){
   $("#loginexp").dialog({height: 240, width: 266});
   $("#modalIframeId").attr("src","https://portal.oxseed.net/oxseed/externallogin/?portal=true");
   return false;
}

// customer portal
function activatePortal(lang) {
    $('.tab2').attr('id', 'active_tab');
    $('.tab1').attr('id', 'non_active_tab');
    $("#secondmodalIframeId").attr("src","https://portal.oxseed.net/oxseed/externallogin?lang="+lang);
}

// login
function activateLogin(lang) {
    $('.tab1').attr('id', 'active_tab');
    $('.tab2').attr('id', 'non_active_tab');
    $("#secondmodalIframeId").attr("src","https://my.oxseed.net/oxseed/externallogin?lang="+lang);
}


$(document).ready(
    function onDocumentLoad() {

        $(this).everyTime('15s', function() {
            newsLoad();
        });

        $(this).everyTime('25s', function() {
           eventsLoad();
        });

        newsLoad();
        eventsLoad();

});


