var video = new Array();
var interval;

function cycleNext(code) {	
	var i=video[code];			
	video[code]++;
	i=video[code];	
	if(i >= video[code+'_screencaps'].length) {
		i=0;
		video[code]=0;
	}
	document.getElementById(code).src=video[code+'_screencaps'][i];		
}

function cycleStart(code) {
	interval = setInterval("cycleNext('"+code+"')", 500);	
}

function cycleBack(code) {
	clearInterval(interval);
	video[code]=0;
	document.getElementById(code).src=video[code+'_screencaps'][0];	
}

function gi_setCookie(name, value, expire_days) {
	var ex_date = new Date();
	ex_date.setDate(ex_date.getDate()+expire_days);
	document.cookie = name+"="+escape(value)+
		((ex_date==null) ? "" : ";expires="+ex_date.toGMTString());
}

function gi_getCookie(name) {
	if(document.cookie.length > 0) {			
		start = document.cookie.indexOf(name+"=");
		if(start != -1) {
			start = start+(name.length+1);
			var end = document.cookie.indexOf(";", start);
			if(end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(start,end));
		}
	}
	return "";
}

$(document).ready(function() {		if(gi_getCookie('pba') != '')	{			$('#pxl').hide();		gi_setCookie('pba', 1, 1);	}	
});