﻿
/*
---------------------------------------------------------
Guesbook Version 1.2.0.
Date: March 2005
(c) Created by Thang Nguyen, thang_toronto@yahoo.ca

This application is freely available. However, it uses
the vietuni.js  file that may have copyright applied.
---------------------------------------------------------
*/



// onload event occurs ATFER all the contents have been displayed
// init() code will be excuted to define the theme for the guest book.
window.onload = init;
var gbl_background;
var gbl_borderColor;


// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}



// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}



// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) 
{
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}



// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) 
{
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}


function setTimeExpired(days)
{
	// create an instance of the Date object
	var now = new Date();

	// fix the bug in Navigator 2.0, Macintosh
	fixDate(now);

	// cookie expires in number of days passed in
	// days is number of days
	// 24 hours in a day
	// 60 minutes in an hour
	// 60 seconds in a minute
	// 1000 milliseconds in a second
	if (days == "" || days == 0 ) days = 1;
	now.setTime(now.getTime() + days * 24 * 60 * 60 * 1000);

	return now; // time when cookie will expire
}


function init()
{
	var themeValue = getCookie("theme");
	
	if (!themeValue)
	{	
		// Default theme
		setCookie ("theme", "Green", setTimeExpired(365)); //365 days
	}	

	setTheme();
}

// This function is triggered when a theme square image is clicked
function resetThemeUsingImage (sThemeValue)
{
	setCookie("theme", sThemeValue, setTimeExpired(365)); //365 days
	setTheme();	
	// change the selected option
	var slcTheme = document.getElementById('slcTheme');
	for (var i=0; i<slcTheme.options.length; i++)
	{
	    if(slcTheme.options[i].value == sThemeValue) {
	        slcTheme.selectedIndex = i;		
	    }
	}
}

// This function is triggered when a theme option is selected from the dropdown list
function resetThemeDrpDwnLst(slcTheme)
{
	var themeValue = slcTheme.options[slcTheme.selectedIndex].value;
	if (themeValue != '') 
	{
	    setCookie("theme", themeValue, setTimeExpired(365)); //365 days
	    setTheme();	
	}	
}


//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// THEME SECTION /////////////////////////////////////////

function setTheme()
{
	var themeValue = getCookie("theme");
	//var background;
	var textColor;
	//var borderColor;
	var themeArrow;
	var linkColor;
	var inputFldBdrStyle;
	var msgShadeColor;

	var themeCode;			// Three hex values representing a color. i.g. 000 for black

		
	if (themeValue == "Orange")
	{
		gbl_background	= "#D74F34";
		textColor		= "#EEE";
		linkColor		= "#FFFF00"
		gbl_borderColor	= "#DDDDDD";
		inputFldBdrClr	= "#DDDDDD";
		msgShadeColor	= "#B43D23";
		//themeArrow = "images/dddarrow.png";
		themeCode		= "ddd";
	} 
	else if (themeValue == "BlackWhite")
	{
		gbl_background	= "#ffffff";
		textColor		= "#555555";	
		linkColor		= "#660000";
		gbl_borderColor	= "#888888";
		inputFldBdrClr	= "#888888";
		msgShadeColor	= "#CCCCCC";
		//themeArrow		= "images/555arrow.png";
		themeCode		= "555";
	}
	else if (themeValue == "Green")
	{
		gbl_background	= "#A5D581";
		textColor		= "#000000";
		linkColor		= "#006600";
		gbl_borderColor	= "#000000";
		inputFldBdrClr	= "#000000";
		msgShadeColor	= "#558B2E";
		themeCode		= "000";
	}

	else if (themeValue == "Purple")
	{
		gbl_background	= "#FFFFFF"; 
		textColor		= "#6600FF";
		linkColor		= "#6600FF";
		gbl_borderColor	= "#6600FF";
		inputFldBdrClr	= "#6600FF";
		msgShadeColor	= "#E1E1FF";
		themeCode		= "60f";
	}

		
	var bodyStyle = ""
		+ "	margin-top:0; margin-left:5; margin-bottom:0;"
		+ " color: " + textColor + "; "
		+ "background-color: " + gbl_background + ";";

	document.body.style.cssText = bodyStyle;
	
	// Change style for links 
	var _links = document.getElementsByTagName('a');
	for (var i = 0; i < _links.length; i++)
		_links[i].style.cssText = _links[i].style.cssText + "; color: " + linkColor + ";";
								

	// Change borders for TABLEs
	var tables = document.getElementsByTagName('table');
	for (var i = 0; i < tables.length; i++)
	{ 
		if(tables[i].className.indexOf("Lbdr") != -1)
			tables[i].style.borderLeftColor = gbl_borderColor;
		if(tables[i].className.indexOf("Rbdr") != -1)
			tables[i].style.borderRightColor = gbl_borderColor;
		if(tables[i].className.indexOf("Tbdr") != -1)
			tables[i].style.borderTopColor = gbl_borderColor;
		if(tables[i].className.indexOf("Bbdr") != -1)
			tables[i].style.borderBottomColor = gbl_borderColor;
		
	}

	// Change borders for TDs
	var tds = document.getElementsByTagName('td');
	for (var i = 0; i < tds.length; i++)
	{ 
		if(tds[i].className.indexOf("Lbdr") != -1)
			tds[i].style.borderLeftColor = gbl_borderColor;
		if(tds[i].className.indexOf("Rbdr") != -1)
			tds[i].style.borderRightColor = gbl_borderColor;
		if(tds[i].className.indexOf("Tbdr") != -1)
			tds[i].style.borderTopColor = gbl_borderColor;
		if(tds[i].className.indexOf("Bbdr") != -1)
			tds[i].style.borderBottomColor = gbl_borderColor;	
	}

	// Change src for IMGs
	var imgs = document.getElementsByTagName('img');
	for (var i = 0; i < imgs.length; i++)
	{ 
		var imageFolder = "images/";

		if(imgs[i].id.indexOf("thm") != -1)
		{
			// get the image scr, chop off the first three hex values, prefix the image/ foder
			// and put the new 3 hex values (themeCode) with the image name together.
			
			var prefixLen = 3; // it is the 000 

			if (imgs[i].id.indexOf("thm_gbtitle") != -1 &&
				LANG == 'vietnamese') 
			{
			
				if (imgs[i].src.indexOf ("vi_") != -1)
					prefixLen = 6; //cc_###

				imgs[i].src =  imageFolder +"vi_" 	+ themeCode 						
							+ imgs[i].src.substr(imgs[i].src.lastIndexOf('/') 
							+  prefixLen +1);	// advance 1 to the next char after the /		
				//alert (imgs[i].src);
			}
			else {

				imgs[i].src =  imageFolder + themeCode 
							+  imgs[i].src.substr(imgs[i].src.lastIndexOf('/') 
							+ prefixLen + 1);			
				//alert (imgs[i].src);
			}
		}

		if(imgs[i].id.indexOf("ctr") != -1)
		{
			imgs[i].style.borderWidth = 1;
			imgs[i].style.borderColor = gbl_background;
			imgs[i].style.borderStyle = "solid";
		}
		
	}

	// Change style for INPUTs
	var inputs = document.getElementsByTagName('input');
	for (var i = 0; i < inputs.length; i++)
	{ 
		//if they are buttons of radio buttons ...
		if (inputs[i].id.indexOf('btn') == -1 &&
			inputs[i].id.indexOf('rdb') == -1)
		{
			inputs[i].style.borderColor = inputFldBdrClr;
			inputs[i].style.borderWidth = 1;		
			inputs[i].style.borderStyle = 'solid';
		}
	}

	// Change style for INPUTs
	var textareas = document.getElementsByTagName('textarea');
	for (var i = 0; i < textareas.length; i++)
	{ 
		textareas[i].style.borderColor = inputFldBdrClr;
		textareas[i].style.borderWidth = 1;		
		textareas[i].style.borderStyle = 'solid';
	}

	// Change style for DIVs
	var divs = document.getElementsByTagName('div');
	for (var i = 0; i < divs.length; i++)
	{ 
		if (divs[i].className.indexOf("thm") != -1 ||
			divs[i].id.indexOf("thm_msg_front") != -1)
		{
			divs[i].style.borderColor = gbl_borderColor;
			divs[i].style.backgroundColor = gbl_background;			
		}

		if (divs[i].id.indexOf("thm_msg_shade") != -1)
		{
			divs[i].style.backgroundColor = msgShadeColor;			
		}		
	}

	
	// Change style for HRs
	var hrs = document.getElementsByTagName('hr');
	for (var i = 0; i < hrs.length; i++)
		hrs[i].style.color = gbl_borderColor;

	// slide show for Yahoo MSN Status
	//slideShowOn();
	
}

////////////////////////////////// END THEME SECTION /////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////


// before submitting form, check first
function validForm(frmId)
{
	var ofrm = document.getElementById(frmId);
	var msg = "Fields suffixed with (*) are required. Please complete them before posting.";

	if (LANG == "vietnamese")
		msg = "Những ô có sao (*) đi kèm là bắt buộc. Xin bạn vui lòng điền chi tiết.";
	
	if (ofrm.UserName.value.trim() == "" || ofrm.UserMsg.value.trim() == "" 
		|| ofrm.captcha_code.value.trim() == "")
	{
		window.alert(msg);
		return false;
	}

	return true;
}

// for paging links
function gotoPage (pageNum)
{
	if (isDigit(pageNum))
		window.location = "index.php?pageno=" + pageNum;
	else 
		return false;	
}

function isDigit(str)
{
	if(isNaN(str) || str.trim() == "" || str.indexOf(".") != -1 )
	//or if( ! /^\d(+)$/.test(str))
	  return false;
	else 
	  return true;
}

String.prototype.trim = function() 
{
     return this.replace(/^\s*/,"").replace(/\s*$/,"")
}


// This function will insert a piece of text, myValue,
// to the field, myField.
function insertAtCursor(myField, myValue) 
{
	//IE support
	if (document.selection)
	{
		myField.focus();
		var sel = document.selection.createRange();
		sel.text = myValue;
	}
	//MOZILLA/NETSCAPE support
	else if (myField.selectionStart || myField.selectionStart == '0') 
	{
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		myField.value = myField.value.substring(0, startPos)
					+ myValue
					+ myField.value.substring(endPos, myField.value.length);
	} 
	else 
	{
		myField.value += myValue;
	}
}


// This function returns an empty string or
// the selected string in the field myField

function getSelectedText(myField)
{
	var strSelected = "";

	//IE support
	if (document.selection)
	{
		myField.focus();
		var sel = document.selection.createRange();
		strSelected = sel.text;
	}
	//MOZILLA/NETSCAPE support
	else if (myField.selectionStart || myField.selectionStart == '0') 
	{
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		strSelected = myField.value.substring(startPos, endPos);
	} 

	return strSelected;
}


// Formatting text in the field oField
// - oField - has value to be formatted
// - oCtr - the control that triggers this function
// If no text selected in advance, then user will be promted to enter the text
// if no text is entered, nothing will be formatted.

function formatText(oCtr, oField)
{
	hideBoards(null);

	if ( oCtr.id == 'ctr_image')
	{
		var imagePath = window.prompt("Enter the path to the image:", "http://path_to_image");	
		if (imagePath != null)
		{
			imagePath = imagePath.trim();
		
			if (imagePath.trim() != "" && 			
				imagePath.trim() != "http://path_to_image")
			{		
				text = "[im]" + imagePath.trim() + "[/im]"; 
				insertAtCursor(oField, text);
			}
		}

	}
	else 
	{
		var text = getSelectedText(oField).trim();

		if (text == "")
		{
			text = window.prompt("Enter text:", "");

			if (text != null)
				text = text.trim();
		}

		if (text != "" && text != null )
		{					
			
			switch (oCtr.id)
			{
				case "ctr_bold":		text = "[b]" + text + "[/b]"; break;
				case "ctr_italic":		text = "[i]" + text + "[/i]"; break;
				case "ctr_underline":	text = "[u]" + text + "[/u]"; break;
				case "ctr_center":		text = "[c]" + text + "[/c]"; break;
				case "ctr_quote":		text = "[q]" + text + "[/q]"; break;
				
				case "ctr_web":			
					var url = window.prompt("Enter URL value:", "http://");
					if (url != null)
					{
						url = url.trim();
						if (url != "" && url != "http://")
							text = "[w=" + url + "]" + text + "[/w]"; 
					}
					
					break;
					
				case "ctr_email":
					var emailAddr = window.prompt("Enter email address:", "your_email@domain.com");	
					if (emailAddr != null)
					{
						emailAddr = emailAddr.trim();
						if (emailAddr != "" && 
							emailAddr != "your_email@domain.com")
							text = "[e="+ emailAddr +"]" + text + "[/e]"; 
					}
					 
					break;			
			}//switch

			insertAtCursor(oField, text);
			
		}//if		
			
	}// else
}


// display or hide the Emotion Board
// - oCtr is the image the trigger this function
// - ebId is the ID of the object to be shown / hidden

function showEmotionBoard (ebId, oCtl)
{
	var emoBoard = document.getElementById(ebId);

	if (emoBoard.style.display == 'none')
	{
		emoBoard.style.position = 'absolute';
		emoBoard.style.display = 'block';
		emoBoard.style.height = 151;
		
		// make the emotion board stand right on top of the oCtr, centered.
		emoBoard.style.top = oCtl.offsetTop - emoBoard.offsetHeight - 5;
		emoBoard.style.left = oCtl.offsetLeft - 50;
		
		emoBoard.style.overflow ='auto';

		hideBoards (emoBoard);		
		
	}
	else
	{
		emoBoard.style.display = 'none';		
	}
}


// this function insert a piece of text defined for  
// an emotion. The emotion is defined by the imgfile value passed in
function insertEmotion (imgfile, ebId, oField)
{
	// the image file name, imgfile, HAS this naming format:
	// icon_nnn.ext
	// where nnn is part to be injected to the textfield, oField.

	var startPos = imgfile.indexOf("_")+1;
	var len = imgfile.indexOf(".") - startPos;
	var text = "[" + imgfile.substr(startPos, len) + "]";
	insertAtCursor (oField, text);

	var emoBoard = document.getElementById(ebId);
	emoBoard.style.display = 'none';
}


// display or hide the Text Color Board
// - oCtr is the image the trigger this function
// - tcbId is the ID of the object to be shown / hidden

function showTextColorBoard (tcbId, oCtl)
{
	var txtclrBoard = document.getElementById(tcbId);

	if (txtclrBoard.style.display == 'none')
	{
		txtclrBoard.style.position = 'absolute';
		txtclrBoard.style.display = 'block';
		//emoBoard.style.height = 151;
		
		// make the text color board stand right on top of the oCtr, centered.
		txtclrBoard.style.top = oCtl.offsetTop - txtclrBoard.offsetHeight - 5;
		txtclrBoard.style.left = oCtl.offsetLeft - 65;		
		txtclrBoard.style.overflow ='auto';
		
		hideBoards (txtclrBoard)
		
	}
	else
	{
		txtclrBoard.style.display = 'none';		
	}	
}


function insertTextColor(color, oField)
{
	hideBoards(null);

	var text = window.prompt("Enter text to be colored:", "");
	if (text != null)
		text = text.trim();
	
	if (text != "" && text != null )
	{
		text = "[clr=" + color + "]" + text + "[/clr]";
		insertAtCursor(oField, text);
	}
}


// Hide other board except oNotMe
// - oNotMe is an object that just got displayed and 
// and other objects needs to be hidden
//
function hideBoards(oNotMe)
{
	var boards = document.getElementsByTagName('div');
	if (oNotMe == null)
	{
		// hide all boards
		for (var i = 0; i < boards.length ; i++ )
			if (boards[i].id.indexOf('Board') != -1)
				boards[i].style.display = 'none';
	}
	else 
	{
		// hide all boards except oNotMe
		for (var i = 0; i < boards.length ; i++ )
			if (boards[i].id != oNotMe.id && boards[i].id.indexOf('Board') != -1)
				boards[i].style.display = 'none';		
	}
}


function showCtrBorder (oCtr)
{
	if (oCtr != null)
		oCtr.style.borderColor = gbl_borderColor;
}

function hideCtrBorder (oCtr)
{
	if (oCtr != null)
		oCtr.style.borderColor = gbl_background;  		
}


// This function copies the selected text in the textarea
// of the form to the clipboard. 
// If no text has been selected nothing will be copied
function copyToClipboard()
{
	hideBoards(null);
	var selText = getSelectedText(document.frmWriteMsg.UserMsg);	
	if (selText != "" && selText != null )
		window.clipboardData.setData("Text", selText);	
}

// This function pastes the copied text in the clipboard
// to the current cursor location of the textarea in the form

function pasteToMsg ()
{
	hideBoards(null);
	var copiedText = window.clipboardData.getData ('Text');	
	if (copiedText != "" && copiedText != null)
		insertAtCursor(document.frmWriteMsg.UserMsg, copiedText)
}


function TdotFlash(fileName)
{
	return ""
		+ "<OBJECT  classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' "
		+ "codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "
		+ " WIDTH=103 HEIGHT=123 id='Object1' VIEWASTEXT vspace=10 hspace=10> "
		+ "<PARAM NAME=movie VALUE='" + fileName + "'> " 
		+ "<PARAM NAME=menu VALUE=false> "
		+ "<PARAM NAME=quality VALUE=high>"
		+ "<EMBED src='"+ fileName +"' menu=false quality=high "
		+ " WIDTH=103 HEIGHT=123 NAME='tdot1' TYPE='application/x-shockwave-flash' " 
		+ "PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' id='TEST'></EMBED>"
		+ "</OBJECT>";
}

/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// LANGUAGES SECTION //////////////////////////////////////////////

var LANG = getCookie("language");
if (LANG == null)  LANG = "english";


function setLanguage (language)
{
	setCookie("language", language , setTimeExpired(365)); //365 days
	window.location.reload();
}

// Default values are in English
// All variables regarding languages start with 'lang_'
// and are global.
//----------------------------------------------------------

// LANG == 'english'
//--------------------
var lang_title			= "GUEST BOOK";
var lang_homePage		= "Homepage";
var lang_composeMsg		= "Compose message";
var lang_viewMsgs		= "View messages";
var lang_userName		= "Your name*";
var lang_userEmail		= "E-mail";
var lang_userWeb		= "Your Web site";
var lang_userCountry		= "You're from";
var lang_userMsg		= "Message*";
var lang_postedOn		= "Posted on";
var lang_postedFrom		= "- from";
var lang_designedBy		= "Designed by";
var lang_note1			= "Thanks for visting my website. Your message will be most welcome here." + 
						"<br><br>Have a great day.";

// Theme option values
var lang_themeNames	= new Array ("Orange", "BlackWhite",	"Green", "Purple"); 
// Theme ontion text to display to users
var lang_themeValues	= new Array ("Orange", "Black & White", "Green", "Purple"); 

var lang_noMessage		= "The guest book has not been signed yet. Be the first to <a href='index.php?action=write'>sign now.</a>";
var lang_totalMessages	= "Total messages";
var lang_totalPages		= "Total pages";
var lang_linkPage		= "Pages";
var lang_languages		= "LANGUAGES"



// Other languages
//-----------------
switch (LANG)
{
	case "vietnamese":

		lang_title			= "SỔ LƯU BÚT";
		lang_composeMsg		= "Đăng bài mới";
		lang_viewMsgs		= "Xem lưu bút";
		lang_homePage		= "Trang chủ";
		lang_userName		= "Tên bạn*";
		lang_userEmail		= "E-mail";
		lang_userWeb		= "Web của bạn";
		lang_userCountry	= "Bạn đến từ";
		lang_userMsg		= "Lời lưu bút*";
		lang_designedBy		= "Thiết kế bởi";
		lang_postedOn		= "Đăng ngày";
		lang_postedFrom		= "- từ";
		lang_note1		= "Cảm ơn bạn đã ghé thăm và lưu lại đôi dòng lưu bút. Chúc bạn một ngày tốt lành.";
		lang_themeValues	= new Array ("Gạch Đỏ", "Trắng Đen", "Xanh Lá Cây", "Mực Tím");
		lang_noMessage		= "Sổ lưu bút chưa có bài viết.";
		lang_totalMessages	= "Tổng số bài";
		lang_totalPages		= "Tổng số trang";
		lang_linkPage		= "Trang";
		lang_languages		= "NGÔN NGỮ";

		break;

	case "french":

		lang_title			= "LIVRE D'INVITÉ";
		lang_composeMsg		= "Faire une inscription";
		lang_viewMsgs		= "Livre dhote's";
		lang_homePage		= "Accueil";
		lang_userName		= "Votre nom*";
		lang_userEmail		= "Votre e-mail";
		lang_userWeb		= "Votre page web";
		lang_userCountry	= "Votre localite";
		lang_userMsg		= "Votre commentaire*";
		lang_designedBy		= "Conçu près";
		lang_postedOn		= "a ecrit a`";
		lang_postedFrom		= "- de";
		lang_note1			= "Merci pour être intéressé à laisser tomber quelques lignes." + 
							  " S'il est un commentaire ou un curieux examinez le message. C'est tout exact." +
							  "<br><br>Ayez un jour splendide.";
		lang_themeValues	= new Array ("Orange", "Noir & Blanc", "Vert", "Pourpre"); 
		lang_noMessage 		= "Non inscription.";
		lang_totalMessages	= "Inscriptions totals:";
		lang_totalPages		= "Page totals";
		lang_linkPage		= "Pages";
		lang_languages		= "LANGUES";

		break;
		
	case "german":

		lang_title			= "GAST-BUCH"; 
		lang_composeMsg		= "Eintragen";
		lang_viewMsgs		= "Eintragen lesen";
		lang_homePage		= "Homepage";
		lang_userName		= "Deine name*";
		lang_userEmail		= "Deine e-mail";
		lang_userWeb		= "Deine web";
		lang_userCountry	= "Du kommst aus";
		lang_userMsg		= "Deine nachricht*";
		lang_designedBy		= "Erstellt von";
		lang_postedOn		= "Am";
		lang_postedFrom		= "- aus";
		lang_note1			= "Dank für Sein interessiert, an, einige Linien fallenzulassen. " + 
							  " Ob er eine Anmerkung oder ein neugieriges ist, prüfen Sie Anzeige." +
							  "<br><br>Haben Sie einen großen Tag.";
		lang_themeValues	= new Array ("Orange", "Schwarzes & Weiß", "Grün", "Purpurrot"); 
		lang_noMessage		= "Nein eintragen";
		lang_totalMessages	= "Total eintragen";
		lang_totalPages		= "Total saiten";
		lang_linkPage		= "Seiten";
		lang_languages		= "SPRACHEN";

		break;

	// Add more languages below here ...
		

}// switch


///////////////////////////////// END LANGUAGES SECTION //////////////////////////////////////////////
///////////////////////////////// END LANGUAGES SECTION //////////////////////////////////////////////



///////////////////// RUN SLIDESHOW ////////////////////////////////////////////

// define the following variables for use

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 2000;

// Duration of crossfade (seconds)
var crossFadeDuration = 3;

// Specify the image files
var arPics = new Array(	"images/t1.png",
						"images/t2.png");
		
// Caution! Standard code. NO EDITING
// =======================================	
//indexes
var sldshwTimeout;
var sldshwIndex = 0;
var sldshwImgObj = null;
	
var preLoad = new Array()
for (var i = 0; i < arPics.length; i++)	
{
   preLoad[i] = new Image()
   preLoad[i].src = arPics[i]
}

// run

function slideShowOn()
{
	sldshwImgObj = document.getElementById('YM_thang_toronto_img');
	if (sldshwImgObj)
	{
		//alert("on");
		runSlideShow();
	}	
}

function runSlideShow()
{
	if (sldshwImgObj)
	{
		//if (document.all)
		//{
			//document.images.SlideShow.style.filter="blendTrans(duration=2)"
			//sldshwImgObj.style.filter="blendTrans(duration=2)";
			//sldshwImgObj.style.filter="blendTrans(duration=crossFadeDuration)";
			//sldshwImgObj.filters.blendTrans.Apply() ;    
		//}
		
		sldshwImgObj.src = preLoad[sldshwIndex].src;
			
		//if (document.all)
		//	sldshwImgObj.filters.blendTrans.Play();
		

		sldshwIndex++; 
		if (sldshwIndex > (arPics.length-1)) { sldshwIndex = 0; }

		sldshwTimeout = setTimeout('runSlideShow()', slideShowSpeed);
	}
}

