// JavaScript Document

//var sitePath = 'http://localhost/bocapa/halsey/';
var sitePath = 'http://www.halseydrive.school.nz/';

/* ajax paging for categories */

var queue = Effect.Queues.get('pageScope');
var queue2 = Effect.Queues.get('pagingScope');

function effectIn(pnl)
{
	new Effect.Appear(pnl, {queue:{position:'end',scope:'pageScope',limit:2}});
}

function effectOut(pnl)
{
	new Effect.Fade(pnl, {queue:{position:'end',scope:'pageScope',limit:2}});
}

function PagingeffectIn(pnl)
{
	new Effect.Appear(pnl, {queue:{position:'end',scope:'pagingScope',limit:2}});
}

function PagingeffectOut(pnl)
{
	new Effect.Fade(pnl, {queue:{position:'end',scope:'pagingScope',limit:2}});
}

function movePage(page, cat, current)
{
	//alert('the page is '+page+' and the cat is '+cat);
	if(Element.visible('gallerypage1')==true)
	{
		effectOut('gallerypage1');
		//Element.hide('gallerypage1');
		ajaxGalleryPage('gallerypage2', page, cat, current);
		effectIn('gallerypage2');
		//Element.show('gallerypage2');
	}else if(Element.visible('gallerypage2')==true)
	{
		//Element.hide('gallerypage2')
		effectOut('gallerypage2');
		ajaxGalleryPage('gallerypage1', page, cat, current);
		effectIn('gallerypage1');
		//Element.show('gallerypage1');
		
	}
	if(Element.visible('gallerypaging1')==true)
	{
		//PagingeffectOut('catpaging1');
		Element.hide('gallerypaging1');
		ajaxGalleryPaging('gallerypaging2', page, cat, current);
		Element.show('gallerypaging2');
		//PagingeffectIn('catpaging2');
	}else if(Element.visible('gallerypaging2')==true)
	{
		//PagingeffectOut('catpaging2');
		Element.hide('gallerypaging2');
		ajaxGalleryPaging('gallerypaging1', page, cat, current);
		Element.show('gallerypaging1');
		//PagingeffectIn('catpaging1');
	}	
}

function ajaxGalleryPage(pnl,page, cat, current)
{
	new Ajax.Updater(pnl, sitePath+'OMS/gallery/lib/galleryDisplay.action.php?page='+page+'&catid='+cat+'&current='+current, {method: 'get'});
}
function ajaxGalleryPaging(pnl,page, cat, current)
{
	new Ajax.Updater(pnl, sitePath+'OMS/gallery/lib/galleryPaging.action.php?page='+page+'&catid='+cat+'&current='+current, {method: 'get'});
}
