
function image_class()	{
	this.bckgrnd_path=new Image();
	this.logo_path= new Image();
	this.desc;
	this.id;

}

var slide=new Array();
var i=0,slider_timer=0;

var last_active=0;
var slide_counter=1;

function slider2() {
	var n=$('.gal-box a').length
	if (((last_active==slide_counter)&&(last_active+1>n))||(slide_counter>n))
		slide_counter=0;
		
	$('.gal-box a:eq('+slide_counter+')').click();
	slide_counter++;
}


$(document).ready(
		function () {
		$('.gal-box').find('[rel]').each(function ()	{
// get logo path and background path from rel attribute
			var temp=$(this).attr('rel').split(',');
			slide[i].bckgrnd_path.src=temp[0];
			slide[i].logo_path.src=temp[1];
// disable default click on a tag and bind a new functionality
			$(this).click(function (event)	{
				 event.preventDefault();
				 var index=$('.gallery a').index(this);
				 last_active=index;
//				 $(slide[(index-1)].bckgrnd_path).load (function () {
				$('.gallery img:first').attr('src',slide[(index-1)].bckgrnd_path.src);//.load (function () {
					$('.logo-txt img:first').attr('src',slide[(index-1)].logo_path.src);
					$('.bg-center-green-big').attr('href','view_episode.php?id='+slide[(index-1)].id);
					$('.info p:first').html(slide[(index-1)].desc);
	//			 }); 
			});
			i++;
		});
// slider activation
		$('.gallery').mouseover(function (){
			clearInterval(slider_timer);
		}).	mouseout(function(){
			slider_timer=setInterval('slider2()',3000);
		});
		
//		slider_timer=setInterval('slider2()',6000);
});

/*
$(document).ready(function () {
		$('.gal-box').find('[rel]').each(function ()	{
// get logo path and background path from rel attribute
			var temp=$(this).attr('rel').split(',');
			slide[i].bckgrnd_path.src=temp[0];
			slide[i].logo_path.src=temp[1];
// disable default click on a tag and bind a new functionality
			$(this).click(function (event)	{
				 event.preventDefault();
				 var index=$('.gallery a').index(this);
				 last_active=index;
//				 $(slide[(index-1)].bckgrnd_path).load (function () {
				$('.gallery img:first').attr('src',slide[(index-1)].bckgrnd_path.src);//.load (function () {
					$('.logo-txt img:first').attr('src',slide[(index-1)].logo_path.src);
					$('.bg-center-green-big').attr('href','view_episode.php?id='+slide[(index-1)].id);
					$('.info p:first').html(slide[(index-1)].desc);
	//			 }); 
			});
			i++;
		});
// slider activation
		$('.gallery').mouseover(function (){
			clearInterval(slider_timer);
		}).	mouseout(function(){
			slider_timer=setInterval('slider2()',3000);
		});
		
//		slider_timer=setInterval('slider2()',6000);
});
*/