﻿Sys.Application.add_init(InitNewsUpdatesPOD);
Sys.Application.add_init(InitMediaGalleryPOD);


// ******* START MEDIA GALLERY ***************** //

function InitMediaGalleryPOD() {
    
    PODService.GetPOD('ucMediaGalleryPOD', OnSuccessMediaGalleryPOD, OnFailureMediaGalleryPOD);
    
}

function OnSuccessMediaGalleryPOD(result) {
    $get('ucMediaGalleryPOD').style.display = 'none';
    //$('#ucMediaGalleryPOD').children('div').animate({ 'left': '-=200px' }, 'slow');
    Sys.UI.DomElement.removeCssClass($get('ucMediaGalleryPOD'), 'loading-POD-extended');
    $get('ucMediaGalleryPOD').innerHTML = result;
    $('#ucMediaGalleryPOD').fadeIn(500);
    $("a.imgview").fancybox({
        'width': '50%',
        'height': '85%',
        'type': 'iframe',
        'scrolling': 'Yes',
        'opacity': 'true'
    });
    

}

function OnFailureMediaGalleryPOD(error) {
    $get('ucMediaGalleryPOD').style.display = 'none';
    Sys.UI.DomElement.removeCssClass($get('ucMediaGalleryPOD'), 'loading-POD-extended');
    $get('ucMediaGalleryPOD').innerHTML = error.get_message();
    $('#ucMediaGalleryPOD').fadeIn(500);
    $("a.imgview").fancybox({
        'width': '50%',
        'height': '85%',
        'type': 'iframe',
        'scrolling': 'Yes',
        'opacity': 'true'
    });
}

function MediaGallery(currentPage, maxPage) {
    $('#ucMediaGalleryPOD').block({
        message: '<h5>Please wait, Loading ..</h5>',
        css: { backgroundColor: '#F7F7F7', border: '1px solid #c0c0c0' }, overlayCSS: { backgroundColor: '#EEE' }
    });
    PODService.GetPagingPOD('mediagallery', currentPage, maxPage, OnSuccessMediaGalleryPOD, OnFailureMediaGalleryPOD);
}

// ******* END MEDIA GALLERY ***************** //

// ******* START NEWS UPDATES ***************** //


function InitNewsUpdatesPOD() {
    
    PODService.GetPOD('ucNewsUpdatesPOD', OnSuccessNewsUpdatesPOD, OnFailureNewsUpdatesPOD);
}

function OnSuccessNewsUpdatesPOD(result) {
    $get('ucNewsUpdatesPOD').style.display = 'none';
    Sys.UI.DomElement.removeCssClass($get('ucNewsUpdatesPOD'), 'loading-POD');
    $get('ucNewsUpdatesPOD').innerHTML = result;
    $('#ucNewsUpdatesPOD').fadeIn(500);
    $("a.imgview").fancybox({
        'width': '50%',
        'height': '85%',
        'type': 'iframe',
        'scrolling': 'Yes',
        'opacity': 'true'
    });
}

function OnFailureNewsUpdatesPOD(error) {
    $get('ucNewsUpdatesPOD').style.display = 'none';
    Sys.UI.DomElement.removeCssClass($get('ucNewsUpdatesPOD'), 'loading-POD');
    $get('ucNewsUpdatesPOD').innerHTML = error.get_message();
    $('#ucNewsUpdatesPOD').fadeIn(500);
    $("a.imgview").fancybox({
        'width': '50%',
        'height': '85%',
        'type': 'iframe',
        'scrolling': 'Yes',
        'opacity': 'true'
    });
}

function NewsUpdates(currentPage, maxPage) {
    $('#ucNewsUpdatesPOD').block({
        message: '<h5>Please wait, Loading ..</h5>',
        css: { backgroundColor: '#F7F7F7', border: '1px solid #c0c0c0' }, overlayCSS: { backgroundColor: '#EEE' }
    });
    PODService.GetPagingPOD('newsupdates', currentPage, maxPage, OnSuccessNewsUpdatesPOD, OnFailureNewsUpdatesPOD);
}


// ******* END NEWS UPDATES ***************** //