<ja:if test=<%=chameleon.includeIndexGuestBookTop || chameleon.includeIndexGuestBookBottom%>><script type="text/javascript" src="$resPath/embedguestbook.js"></script></ja:if>
<script type="text/javascript">
/* <![CDATA[ */
<ja:if test=${enableKeyboard}>
function preventDefault(e) {
	if (document.addEventListener) e.preventDefault();
	else e.returnValue=false;
	return false;
}
function keypress(e) {
	if(typeof _jaWidgetFocus != 'undefined' && _jaWidgetFocus) return true;
	if(!e) var e = window.event;
	if(e.keyCode) keyCode = e.keyCode; 
	else if(e.which) keyCode = e.which;
	switch(keyCode) {
		<ja:if exists="parentIndexPage">case 8: window.location="$parentIndexPage"; return preventDefault(e); break;</ja:if><ja:else><ja:if test=<%=chameleon.useUpLinkThis || (chameleon.useUpLinkDefault && parentIndexPage != void)%>>case 8: window.location="<%=(chameleon.useUpLinkDefault)? parentIndexPage:upLink%>"; return false; break;</ja:if></ja:else>
		<ja:if exists="nextIndexPage">case 63235: case 39: window.location="$nextIndexPage"; return preventDefault(e); break;</ja:if>
		<ja:if exists="previousIndexPage">case 63234: case 37: window.location="$previousIndexPage"; return preventDefault(e); break;</ja:if>
		<ja:if exists="firstIndexPage">case 63273: case 36: window.location="$firstIndexPage"; return preventDefault(e); break;</ja:if>
		<ja:if exists="lastIndexPage">case 63275: case 35: window.location="$lastIndexPage"; return preventDefault(e); break;</ja:if>
		<ja:if test=${doIndexSlideShow}>case 32: show_down(); setTimeout('show_out()', 200); return preventDefault(e); break;</ja:if>
	${slideShowCode}}
	return true;
}
function setuplisteners() {
	if (document.addEventListener) document.addEventListener('keypress',keypress,false);
	else if (document.attachEvent) document.attachEvent('onkeydown',keypress);
}</ja:if>
up0 = new Image(31,31); up0.src = "$resPath/up.gif";
up1 = new Image(31,31); up1.src = "$resPath/up1.gif";
next0 = new Image(31,31); next0.src = "$resPath/next.gif";
next1 = new Image(31,31); next1.src = "$resPath/next1.gif";
prev0 = new Image(31,31); prev0.src = "$resPath/prev.gif";
prev1 = new Image(31,31); prev1.src = "$resPath/prev1.gif";
<ja:if test=${doIndexSlideShow}>
show0 = new Image(31,31);show0.src = "$resPath/show.gif";
show1 = new Image(31,31);show1.src = "$resPath/show1.gif";
stop0 = new Image(31,31);stop0.src = "$resPath/stop.gif";
stop1 = new Image(31,31);stop1.src = "$resPath/stop1.gif";

<ja:if test=${indexSlideShowStartsSlides}>
var delay = ${slideShowDelay};
function show_over() { 
	document.getElementById("show").src = show1.src;;
}
function show_out() { 
	document.getElementById("show").src = show0.src;
}
function show_down() { 
	window.location="${firstSlideLink}?show_param="+delay+ "${internalLink}";
}
function change_delay() { 
	delay = prompt('$text.delay', ${slideShowDelay});
}
function redirect() {
}
</ja:if><ja:else>
var delay = ${indexSlideShowDelay};
var show_param = -1;
if (window.location.search.length > 1) {
	var parms = window.location.search.substring(1,location.search.length).split("&");
	for (var i = 0; i < parms.length; i++) {		
		if (parms[i].substring(0, parms[i].indexOf("=")) == "show_param")
		delay = show_param = parms[i].substring(parms[i].indexOf("=")+1, parms[i].length);
	}
}
var show_delay = show_param;
function show_timer() {
	if (show_delay >= 0) {
		if (--show_delay < 0 && show_param > 0) {
			<ja:if exists="nextIndexPage">window.location="$nextIndexPage?show_param="+show_param;</ja:if>
			<ja:else><ja:if test=${indexSlideShowLoop}>window.location="$firstIndexPage?show_param="+show_param;</ja:if><ja:else>show_down(); setTimeout('show_out()', 200);</ja:else></ja:else>
		}
		else if(show_param > 0)
			window.status='Time left: '+(show_delay+1)+' s'; 
	}
	setTimeout('show_timer()', 1000);	
}
function show_over() { 
	document.getElementById("show").src = (show_param >= 0)? stop1.src : show1.src;;
	window.status = '$text.startStopSlideShow - $text.changeSpeed';
}
function show_out() { 
	document.getElementById("show").src = (show_param >= 0)? stop0.src : show0.src;
}
function show_down() { 
	if (show_param >= 0) { 
		show_param = -1; 
		document.getElementById("show").src = stop1.src; 
		window.status=''; 
	} 
	else { 
		show_param = delay; 
		document.getElementById("show").src=show1.src; 
	} 
	show_delay = show_param; 
}
function change_delay() { 
	delay = prompt('$text.delay', (show_param < 0)? ${indexSlideShowDelay} : show_param);
	show_param = show_delay = delay; 
	document.getElementById("show").src = show1.src;
}
</ja:else></ja:if>
<ja:if test=${newLabel}>
function generatenew(fDays) {
  now = new Date();
  nDays = now.getTime() / 86400000;
  if((nDays - fDays) <= ${newLabelDaysCount})
    document.write('<span class="newlabel">&nbsp;$text.new&nbsp;<\/span><%=("$text.new".length() > 4)? "<br />":"&nbsp;"%>');
}
</ja:if>
<ja:if test=${autoMaximize}>
top.window.moveTo(0,0);
if (document.all) {
	top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers || document.getElementById) {
	if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
		top.window.outerHeight = screen.availHeight;
		top.window.outerWidth = screen.availWidth;
	}
}
</ja:if>
<ja:if test=<%=(chameleon.includeIndexGuestBookTop || chameleon.includeIndexGuestBookBottom) && (level == 0 || !chameleon.indexGuestBookOnlyTop)%>>
var color = "#cccccc";
var bgcolor = "#333333";
function rgb2hex(c) {
	if (c.charAt(0) == '#') return c;
	var i = c.indexOf('(');
	if (i > 0) {
		c = c.substring(i+1).split(',');
		var s = '#', n;
		for (i = 0; i < 3; i++) {
			if ((n = parseInt(c[i])) != 'NaN') s += ((n < 16)? '0':'') + n.toString(16);
			else s += '00';
		}
		return s;
	}
	else return '#cccccc';
}
function getColors() {
	var el = document.getElementById("body");
	if (!el) return;
	var computedStyle = null;
	if (typeof el.currentStyle != "undefined")
		computedStyle = el.currentStyle;
	else
		computedStyle = document.defaultView.getComputedStyle(el, null);	
	color = rgb2hex(computedStyle['color']);
	bgcolor = rgb2hex(computedStyle['backgroundColor']);
	if (color == bgcolor) color = '#cccccc';
}
function showGuestbook() {
	getColors();
	embedGuestbook("${guestBookPath}/guestbook.swf", ${guestBookWidth}, ${guestBookHeight}, "xmlfile=${guestBookFile}.xml&xmlphp_path=${guestBookPath}/&width=${guestBookWidth}&width=${guestBookHeight}&basefontsize=${guestbookBaseFontSize}&bgcolor=" + bgcolor + "&countcolor=" + color + "&usercolor=${guestbookHighlightColor}&commentscolor=" + color + "&pagelabel=$text.page&namelabel=$text.name&msglabel=$text.message&nameerror=$text.enterName&msgerror=$text.enterMessage&welcomemsg=$text.welcomeMessage&showrating=${guestBookRating}&ratinglabel=$text.rating&avgratinglabel=$text.avgRating&ascending=${guestbookAscending}&dateFormat=${gbDateFormat}&msgscount=${guestbookEntries}");
}
</ja:if>
<ja:if test=${printingPhotobox}>
function selectallItems(setto) { 
	var allBox = document.getElementsByTagName("input"); cnt = 0;
	for(i = 0; i < allBox.length; i++) {
		var input = allBox[i];
		if(input.name.indexOf("xc") == 0) {
			input.checked = setto; cblist[cnt++] = setto;
		}
	}
}
</ja:if>
window.onload = function() {
	<ja:if test=${enableKeyboard}>setuplisteners();</ja:if>
	<ja:if test=<%=chameleon.doIndexSlideShow && !chameleon.indexSlideShowStartsSlides%>>show_timer(); show_out(); </ja:if>
};
/* ]]> */
</script>
<ja:if test=${printingPhotobox}>
<script type="text/javascript" src="http://printbutton.com/${companyId}.js"></script>
</ja:if>


