function showVideo(id) {
	document.write("<object width=\"291\" height=\"225\"><param name=\"movie\" value=\"http://www.youtube.com/v/"+id+">&amp;hl=en&amp;fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/"+id+"&amp;hl=en&amp;fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"291\" height=\"225\"></embed></object>");
}

var autoSlide = true;
var autoSlideSecs = 13;

var proj = 0;
var interval = null;
//custom added
var photo_time = 1000;
var text_time = 1500;
var effect_time = 1200;//700
var initial = true;
// end custom
function textSlideIn(proj) {
	$('ul.text').children('li:eq('+proj+')').animate({ right: "-1px" }, effect_time);
}
function textSlideOut(proj) {
	$('ul.text').children('li:eq('+proj+')').animate({ right: "-280px" }, effect_time);
}
function photoFadeIn(proj) {
	if(!initial)
	  $('ul.photo').children('li:eq('+proj+')').fadeIn(effect_time);
	else
	  $('ul.photo').children('li:eq('+proj+')').css("z-index",2);
}
function photoFadeOut(proj) {
	//if(!initial)
	  $('ul.photo').children('li:eq('+proj+')').fadeOut(effect_time);
	//else
	  //$('ul.photo').children('li:eq('+proj+')').css("z-index",0);
}
function photoPutBehind(proj) {
	$('ul.photo').children('li:eq('+proj+')').css('z-index', 0);
}
function photoPutFront(proj) { // custom added
	$('ul.photo').children('li:eq('+proj+')').css('z-index', 2);
}
function nextSlide() {
	//$('ul.photo').children('li:eq('+proj+')').css("z-index", 2);
	setTimeout('photoFadeOut('+proj+')', photo_time);
	//setTimeout('photoPutBehind('+proj+')', text_time);
	textSlideOut(proj);
	proj++;
	var i = $('ul.text li').size() - 1;
	if (proj>i){ proj = 0;initial=false;}
	setTimeout('photoFadeIn('+proj+')', photo_time);		
	setTimeout('textSlideIn('+proj+')', text_time);
}

$(function() {
	if (autoSlide) interval = setInterval('nextSlide()', autoSlideSecs*1000);
	jQuery('.next').click(function() {
		clearInterval(interval);
		nextSlide();
		if (autoSlide) interval = setInterval('nextSlide()', autoSlideSecs*1000);
		return false;
	});
});


