function albumPicBig(val) {
	document.getElementById('album_pic_big').src = val;
}
function bgCycle() {
	$("#adbanner_img").animate({opacity: "0"}, 0);
	arrCurr += 1;
	if (arrCurr > arrBgs.length - 1)
		arrCurr = 0;
	document.getElementById('adbanner_img').src = arrBgs[arrCurr];
	document.getElementById('adbanner_a').href = arrLinks[arrCurr];
	if (arrLinks[arrCurr].substr(0, 4) == 'http' || arrLinks[arrCurr] == '#')
		document.getElementById('adbanner_a').target = "_self";
	else
		document.getElementById('adbanner_a').target = "content";
	$("#adbanner_img").animate({opacity: "1"}, 800, function() {
		document.getElementById('adbanner_container').style.background = "url('" + arrBgs[arrCurr] + "') no-repeat white";
	});
	clearTimeout(bgCycleTimer);
	bgCycleTimer = setTimeout(function() {
		bgCycle();
	}, arrDur[arrCurr] * 1000);
}
function changeTextBlock(obj, blk) {
	obj.innerHTML = blk;
}
function clearWatermark(obj, wmark) {
	currVal = obj.value;
	if (currVal == wmark)
		obj.value = '';
}
function confirmAction() {
	var res = confirm('Are you sure?');
	return res;
}
function litebox(open) {
	if (open) {
		$("#cover").animate({opacity: "0.7"}, 0);
		$("#cover").fadeIn(500);
		$("#litebox_container").fadeIn(500, function() {
			document.getElementById('login_username').focus();
		});
	}
	else {
		$("#cover").fadeOut(500);
		$("#litebox_container").fadeOut(500);
	}
}
function litebox2(open) {
	if (open == 1) {
		$("#litebox_container").fadeOut(500);
		$("#litebox_container2").fadeIn(500, function() {
			document.getElementById('forgot_username_email').focus();
		});
	}
	else if (open == 0) {
		$("#cover").fadeOut(500);
		$("#litebox_container2").fadeOut(500);
	}
	else if (open == 2) {
		$("#litebox_container2").fadeOut(500);
		$("#litebox_container").fadeIn(500, function() {
			document.getElementById('login_username').focus();
		});
	}
}
function litebox3(open) {
	if (open == 1) {
		$("#litebox_container").fadeOut(500);
		$("#litebox_container3").fadeIn(500, function() {
			document.getElementById('forgot_password_username').focus();
		});
	}
	else if (open == 0) {
		$("#cover").fadeOut(500);
		$("#litebox_container3").fadeOut(500);
	}
	else if (open == 2) {
		$("#litebox_container3").fadeOut(500);
		$("#litebox_container").fadeIn(500, function() {
			document.getElementById('login_username').focus();
		});
	}
}
function reply(val) {
	if (val == 0) {
		document.getElementById('reply_val').value = "0";
		document.getElementById('chat_status').innerHTML = "Posting message...";
		document.getElementById('reply_cancel').style.visibility = "hidden";
	}
	else {
		document.getElementById('reply_val').value = val;
		document.getElementById('chat_status').innerHTML = "Replying to post...";
		document.getElementById('reply_cancel').style.visibility = "visible";
	}
}
function restoreWatermark(obj, wmark) {
	currVal = obj.value;
	if (currVal == '')
		obj.value = wmark;
}
function scrollUp() {
	goScroll = setTimeout(function() {
		$().scrollTo("#content", 0);
	}, 50);
}
function sliderCycle(num) {
	if (sliderCurr != num) {
		sliderCurr = num;
		if (sliderAutoCycle)
			clearTimeout(sliderTimer);
		next = num + 1;
		if (next >= sliderArr.length)
			next = 0;
		if (num == 0 && sliderCurrThumbSec != 0)
			sliderShiftThumbs(-sliderCurrThumbSec);
		if (num > 2) {
			calc = num;
			while (calc > 2) {
				calc -= 3;
				if (calc == 0) {
					sliderShiftThumbs(1);
					break;
				}
			}
		}
		if (sliderAutoCycle) {
			sliderTimer = setTimeout(function() {
				sliderCycle(next);
			}, sliderDur[num] * 1000);
		}
	}
}
function sliderShiftThumbs(phase) {
	shift = sliderCurrThumbSec + phase;
	if (shift < sliderThumbSecCount && shift >= 0) {
		sec = $("#slider_thumb_sec" + shift);
		$("#slider_thumb_container").scrollTo(sec, 800, function() {
			sliderCurrThumbSec = shift;
		});
	}
}
function sliderViewEnlarged(src, h, w) {
	myWindow = window.open('http://www.salsachocolate.com/img/slider/' + src, '', 'width=' + w + ',height=' + h + ',channelmode=1,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,fullscreen=0')
	myWindow.focus()
}
function testimonialsCycle() {
	clearTimeout(testimonialsTimer);
	testimonialsCurr++;
	if (testimonialsCurr >= testimonialsArr.length)
		testimonialsCurr = 0;
	obj = $("#testimonialsBox");
	$(obj).fadeOut(250, function() {
		$(obj).html(testimonialsArr[testimonialsCurr]);
		$(obj).fadeIn(250);
	});
	testimonialsTimer = setTimeout(function() {
		testimonialsCycle();
	}, testimonialsDur[testimonialsCurr] * 1000);
}
