$(document).ready(function(){
$("#demoOne").jqGalScroll();
if(window.location.hash != ""){
var hash = window.location.hash;
//we strip out the hash tag just in case because some browsers don't have it, some do in this line
hash = Number(hash.replace("#",""))-1
//then once it's gone, for sure add it back in.
hash = "#"+hash;
$(".jqGSPagination").find('a[href='+hash+']').click();
}
$(".next_btn").click(function(){
$li = $(".jqGSPagination ul").find('a.selected').parent();
if($li.next('li')[0]){
$li.next('li').find('a').click();
}
else{
$li.parent('ul').find('li:first').find('a').click();
}
jQuery.numberMe();
return false;
});
$('.jqGSPagination ul').hide()
$(".previous_btn").click(function(){
$li = $(".jqGSPagination ul").find('a.selected').parent();
if($li.prev('li')[0]){
$li.prev('li').find('a').click();
}
else{
$li.parent('ul').find('li:last').find('a').click();
}
jQuery.numberMe();
return false;
});
jQuery.numberMe();
});
jQuery.numberMe = function(){
if($('.jqGSPagination').find('#numbers')[0])
$('.jqGSPagination').find('#numbers').remove();
$len = $("#demoOne").find('li').length;
$total = $(".jqGSPagination").find('a.selected').text();
$(".jqGSPagination").append('<div id="numbers">' + $total + ' of ' + $len + '</div>');
jQuery.numberMe = function(){
var newhash = $(".jqGSPagination ul").find('a.selected').text();
location.hash = newhash;
if($('.jqGSPagination').find('#numbers')[0])
$('.jqGSPagination').find('#numbers').remove();
$len = $("#demoOne").find('li').length;
$total = $(".jqGSPagination").find('a.selected').text();
$(".jqGSPagination").append('<div id="numbers">' + $total + ' of ' + $len + '</div>');
}
}