
// Fat Kitty Archive Javascript

var galleries 
var panels
var gcount = -1
var pcount = 0
var multi = false

function pageSet(){
galleries = document.getElementById('strips').getElementsByTagName('div')
// Passed value for facebook links
var passval = location.search.split("=")
if(typeof passval[1]!="undefined"){
gcount = passval[1] -1
}
nextStrip()
}

function nextStrip(){
gcount++
if(gcount==galleries.length){
gcount = 0
}
pcount = 0
if(multi==true){
multi = false
document.getElementById('gn1').style.display = 'block'
document.getElementById('gn2').style.display = 'none'
}
var heads = galleries[gcount].getElementsByTagName('h5')
if(heads[0].getAttribute('class')=='multi'){
multi = true
}
document.getElementById('date').innerHTML = heads[0].innerHTML
document.getElementById('gal').innerHTML = galleries[gcount].innerHTML
panels = document.getElementById('gal').getElementsByTagName('p')
panels[pcount].style.display = 'block'
fbSet()
}

function nextPanel(){
panels[pcount].style.display = 'none'
pcount++
if(pcount==panels.length){
pcount=panels.length - 1
}
if(multi==true){
if(pcount==panels.length-4){
document.getElementById('gn1').style.display = 'none'
document.getElementById('gn2').style.display = 'block'
}
}
panels[pcount].style.display = 'block'
}

function lastPanel(){
panels[pcount].style.display = 'none'
pcount--
if(pcount==-1){
pcount=0
}
panels[pcount].style.display = 'block'
}

function multiVue(increment){
panels[pcount].style.display = 'none'
pcount=panels.length-increment
panels[pcount].style.display = 'block'
}

// Set facebook passed value
function fbSet(){
document.getElementById('fb_share').setAttribute('href','http://www.facebook.com/sharer.php?u=http://www.fat-kitty.com/archive.html?='+ gcount)
//alert(document.getElementById('fb_share').getAttribute('href'))
}
