$(document).ready(function(){
	$('#top-carousel').tinycarousel(); 
    //To set tiny carousel
    $('#slider-events').tinycarousel({
	pager: true,
	interval: false
    });
    //To Set Light Box on load
    $('#gallery a').lightBox();
    //To add selected class to numbers in pagination
    $('.gnav-one li a').click(function(){
        $('.gnav-one li a').removeClass('selected-nav');
        var clickedParent, clickedChild;
        clickedParent = $(this).parent().index();
        clickedChild = clickedParent+1;        
        if(clickedChild != 1 && clickedParent !=9){
            $('.gnav-one li:nth-child'+'('+clickedChild+')'+' a').addClass('selected-nav');
            $('.previous').removeClass('previous-selected');
            $('.next').removeClass('next-selected');
        }
        else if(clickedChild == 1)
        {
            $('.previous').addClass('previous-selected');
            $('.next').removeClass('next-selected');
        }
        else if(clickedChild == 9)
        {
            $('.previous').removeClass('previous-selected');
            $('.next').addClass('next-selected');
        }
    })
});
function loadPage(pageNum){    
    var path = getHost();
	var pageName = path+"../galleryfiles/g"+pageNum+".html"; //This path need to be edited after making the site live
    //var pageName = path+"/galleryfiles/g"+pageNum+".html"; // uncomment this line and comment above line after making the site live
    $.get(pageName, function(data) {
      $('#gallery-cont').html(data);
      $('#gallery a').lightBox(); // To set light box after ajax call
    });
}
function getHost()
{
    var host = window.location.host;
    var protocol = window.location.protocol;
    var url = protocol+"//"+host;
    return url;
}

