﻿
//<--------------------------------------------------------------- General Code -------------------------------------------------------------------------------->// 			
			
//global vars for writing cookies			
			
var music=1;
var keyboard=1;
var lang = 'EN';
var dataP = '';
var keyPressState = 'def';

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}	

function getCookieData(labelName){
	var labelLen = labelName.length
	var cookieData = document.cookie
	var cLen = cookieData.length
	var i=0
	var cEnd
	while (i<cLen){
		var j = i + labelLen
		if (cookieData.substring(i,j) == labelName){
			cEnd = cookieData.indexOf(";",j)
			if (cEnd == -1){
				cEnd = cookieData.length
			}
			return unescape(cookieData.substring(j+1,cEnd))
		}
		i++
	}
	return ""
}

function searchCookie(labelName){
	var labelLen = labelName.length
	var cookieData = document.cookie
	var cLen = cookieData.length
	var l = 0;
	while (l<cLen){
		var m = l + labelLen
		if (cookieData.substring(l,m) == labelName){
			return true;
		}
		l++
	}
}


//all rollover functionality is added to the triggers on page load calls page specific init functions.  checks for lang pref to lood appropriate data and keyboard pref to control kb audio

function initiatePage(){
	for (var i = 0; i < document.images.length; i++){
		if (navigator.appVersion.indexOf("MSIE") == -1){
			if	(document.images[i].className == 'imgButt'){
				document.images[i].addEventListener('mouseover', imgOver, false);
				document.images[i].addEventListener('mousedown', imgDown, false);
				document.images[i].addEventListener('mouseup', imgUp, false);
				document.images[i].addEventListener('mouseout', imgOut, false);
				document.images[i].addEventListener('click', imgClick, false);
			} else if (document.images[i].className == 'imgButtA'){
				document.images[i].addEventListener('mouseover', imgOverA, false);
				document.images[i].addEventListener('mousedown', imgDownA, false);
				document.images[i].addEventListener('mouseup', imgUpA, false);
				document.images[i].addEventListener('mouseout', imgOutA, false);
			} else if (document.images[i].className == 'imgButtB'){
				document.images[i].addEventListener('mouseover', imgOverB, false);
				document.images[i].addEventListener('mousedown', imgDownB, false);
				document.images[i].addEventListener('mouseup', imgUpB, false);
				document.images[i].addEventListener('mouseout', imgOutB, false);
			}
		} else if (navigator.appVersion.indexOf("MSIE") != -1){
			if	(document.images[i].className == 'imgButt'){
				document.images[i].attachEvent('onmouseover', imgOver);
				document.images[i].attachEvent('onmousedown', imgDown);
				document.images[i].attachEvent('onmouseup', imgUp);
				document.images[i].attachEvent('onmouseout', imgOut);
				document.images[i].attachEvent('onclick', imgClick);
			} else if (document.images[i].className == 'imgButtA'){
				document.images[i].attachEvent('onmouseover', imgOverA);
				document.images[i].attachEvent('onmousedown', imgDownA);
				document.images[i].attachEvent('onmouseup', imgUpA);
				document.images[i].attachEvent('onmouseout', imgOutA);
			} else if (document.images[i].className == 'imgButtB'){
				document.images[i].attachEvent('onmouseover', imgOverB);
				document.images[i].attachEvent('onmousedown', imgDownB);
				document.images[i].attachEvent('onmouseup', imgUpB);
				document.images[i].attachEvent('onmouseout', imgOutB);
			}
		}
	}
	keyPressSate = 'def';
	if (document.title != 'Jitka Frankova Start Page'){
		readLang();
		setKeyboard();
	}
	if (document.title == 'JitkaData'){
		initData();
	} else if (document.title == 'JitkaIndex'){
		initIndex();
	} else if (document.title == 'JitkaGallery'){
		initGallery();
	} else if (document.title == 'JitkaAudio'){
		initAudio();
	} else if (document.title == 'JitkaPressKit'){
		initPressKit();
	}
}

//reads keyboard cookie val and controls global var

function setKeyboard(){
	var keysVal = getCookieData('keys');
	if(keysVal == 'on'){
		keyboard=1;
	}else if(keysVal == 'off'){
		keyboard=2;
	}
}

//cross browser access of embedded flash object. returns flash object for javascript exposure

function getFlashMovieObject(soundObj){
	if (window.document[soundObj]){
	  return window.document[soundObj];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		if (document.embeds && document.embeds[soundObj])
			return document.embeds[soundObj]; 
	} else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById(soundObj);
	}
}

//javascript controls for embedded flash player objects. uses flashplayer external interface to call pSound() actionscript fucntion in KeyboardSound.swf
//checks audio preference before plaing flash sounds

function intKB(soundObj){
	if (keyboard == 1){
		playS(soundObj);
	}
}

function videoStatus(code){
	alert(code);
}

function playS(soundObj){
	var flashSound = getFlashMovieObject('KeyboardSound');
	flashSound.PlaySound(soundObj);
}
	
//functions to control the displayed language of the site
//entry page function sets lang pref by writing a cookie

function setLang(thisLang){
	createCookie('language','EN',-1);
	createCookie('language','CZ',-1);
	createCookie('language',thisLang,0);
}

//page init function reads lang cookie and changes images and text to fit prefernces.

function readLang(){
	lang = getCookieData('language');
	flipImages();
	switchText();
}

//lang change from mouse interaction rewrites cookie and apllies changes 

function switchLang(thisLang){
	lang = thisLang;
	setLang(thisLang);
	flipImages();
	switchText();
	
}

//page specific text and iframe changes for lang swap

function switchText(){
	if (document.title == 'JitkaIndex'){
		if (lang == 'EN'){
			qEN = Math.round(Math.random()*(quotesEN.length-1));
			document.getElementById('entryQuote').innerHTML = quotesEN[qEN];
			document.getElementById('entryText').innerHTML = entryTextEN;
			document.getElementById('jContact').innerHTML = jContactEN;
		} else if (lang == 'CZ'){
			qCZ = Math.round(Math.random()*(quotesCZ.length-1));
			document.getElementById('entryQuote').innerHTML = quotesCZ[qCZ];
			document.getElementById('entryText').innerHTML = entryTextCZ;
			document.getElementById('jContact').innerHTML = jContactCZ;
		}
	} else if (document.title == 'JitkaData'){
		if(dataP != 'events'){
			document.getElementById('dataFrame').setAttribute('src','fPages/'+dataP+lang+'.html');
		} else {
			document.getElementById('dataFrame').setAttribute('src','fPages/'+dataP+lang+'.php');
		}
	} else if (document.title == 'JitkaPressKit'){
		if (lang == 'EN'){
			document.getElementById('pkTitle').innerHTML = pkTitleEN;
			document.getElementById('pkText').innerHTML = pkTextEN;
		} else if (lang == 'CZ'){
			document.getElementById('pkTitle').innerHTML = pkTitleCZ;
			document.getElementById('pkText').innerHTML = pkTextCZ;
		}
	}
}

//change keyboard images to fit lang pref

function flipImages(){
	for (var i = 1; i < 20; i++){
		var keyImg = document.getElementById('key'+i)
		keyImg.setAttribute('src',keyImg.src.substring(0, keyImg.src.length-7) +'_'+lang+'.png');
	}
}
			
	

//rollover functions for imgButt class images operate on the event target by stripping the extension and rollover state from its 'src' attr., setting this substring to 'path' and then adding the appropriate rollover state and the extension

function imgOver(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	var path = targ.src.substring(0, targ.src.length-4);
	targ.setAttribute('src',path +'Over.png');
	keyPressState = 'over';
}

function imgDown(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	var path = targ.src.substring(0, targ.src.length-8);
	targ.setAttribute('src',path +'Down.png');
	keyPressState = 'down';
}

function imgUp(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	var path = targ.src.substring(0, targ.src.length-8);
	targ.setAttribute('src',path +'Over.png');
	keyPressState = 'over';
}

function imgClick(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	switch (targ.id){
		case 'galController01':
			galImageSwap('backward');
			break;
		case 'galController02':
			galImageSwap('forward');
			break;
		case 'galController03':
			thumbsReset();
			break;
		case 'americanFlag':
			switchLang('EN');
			break;
		case 'czechFlag':
			switchLang('CZ');
			break;
	}
}

function imgOut(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	if ((keyPressState == 'over') || (keyPressState == 'down')){
		var path = targ.src.substring(0,targ.src.length-8);
	} else if (keyPressState == 'def'){
		var path = targ.src.substring(0,targ.src.length-4);
	}
	targ.setAttribute('src',path +'.png');
	keyPressState = 'def';
}

//imgbuttA class images on the keyboard have dependent images whose rollover states they must trigger as well as dependent audio. switch functions grab the event target and opeerate on the dependent images and audio. also sensitive to language switching

function mainOver(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	var path = targ.src.substring(0, targ.src.length-7);
	targ.setAttribute('src', path + 'Over_'+lang+'.png');
	keyPressState = 'over';
}

function mainDown(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	var path = targ.src.substring(0, targ.src.length-11);
	targ.setAttribute('src', path + 'Down_'+lang+'.png');
	keyPressState = 'down';
}

function mainUp(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	var path = targ.src.substring(0, targ.src.length-11);
	targ.setAttribute('src', path + 'Over_'+lang+'.png');
	keyPressState = 'over';
}

function mainOut(evt){
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	if ((keyPressState == 'over') || (keyPressState == 'down')){
		var path = targ.src.substring(0,targ.src.length-11);
	} else if (keyPressState == 'def'){
		var path = targ.src.substring(0,targ.src.length-7);
	}
	targ.setAttribute('src', path + '_'+lang+'.png');
	keyPressState = 'def';
}

function dpOver(id){
	var obj = document.getElementById(id);
	var path = obj.src.substring(0, obj.src.length-7);
	obj.setAttribute('src', path + 'Over_'+lang+'.png');
}

function dpDown(id){
	var obj = document.getElementById(id);
	var path = obj.src.substring(0, obj.src.length-11);
	obj.setAttribute('src', path + 'Down_'+lang+'.png');
}

function dpUp(id){
	var obj = document.getElementById(id);
	var path = obj.src.substring(0, obj.src.length-11);
	obj.setAttribute('src', path + 'Over_'+lang+'.png');
}

function dpOut(id){
	var obj = document.getElementById(id);
	var path = obj.src.substring(0, obj.src.length-11);
	obj.setAttribute('src', path + '_'+lang+'.png');
}

//calls trigger and dependent 'over' states and plays flash sounds in the keyboard is enabled

function imgOverA(evt){
	mainOver(evt);
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	switch(targ.id){
		case 'key2':
			dpOver('key1');
			intKB('b');
			break;
		case 'key3':
			intKB('aSharp');
			break;
		case 'key4':
			dpOver('key5');
			intKB('a');
			break;
		case 'key6':
			intKB('gSharp');
			break;
		case 'key7':
			dpOver('key8');
			intKB('g');
			break;
		case 'key9':
			intKB('fSharp');
			break;
		case 'key10':
			dpOver('key11');
			intKB('f');
			break;
		case 'key13':
			dpOver('key12');
			intKB('e');
			break;
		case 'key14':
			intKB('dSharp');
			break;
		case 'key15':
			dpOver('key16');
			intKB('d');
			break;
		case 'key17':
			intKB('cSharp');
			break;
		case 'key18':
			dpOver('key19');
			intKB('c');
			break;
	}
}

//calls trigger and dependent 'down' states and calls function to write a cookie for interpreting which data page to load 

function imgDownA(evt){
	mainDown(evt);
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	switch(targ.id){
		case 'key2':
			dpDown('key1');
			break;
		case 'key4':
			dpDown('key5');
			setData('news');
			break;
		case 'key7':
			dpDown('key8');
			setData('events');
			break;
		case 'key10':
			dpDown('key11');
			setData('other');
			break;
		case 'key13':
			dpDown('key12');
			setData('bio');
			break;
		case 'key14':
			setData('CV');
			break;
		case 'key15':
			dpDown('key16');
			setData('rep');
			break;
		case 'key17':
			setData('teaching');
			break;
		case 'key18':
			dpDown('key19');
			break;
	}
}

function imgUpA(evt){
	mainUp(evt);
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	switch(targ.id){
		case 'key2':
			dpUp('key1');
			break;
		case 'key4':
			dpUp('key5');
			break;
		case 'key7':
			dpUp('key8');
			break;
		case 'key10':
			dpUp('key11');
			break;
		case 'key13':
			dpUp('key12');
			break;
		case 'key15':
			dpUp('key16');
			break;
		case 'key18':
			dpUp('key19');
			break;
	}
}

function imgOutA(evt){
	mainOut(evt);
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	switch(targ.id){
		case 'key2':
			dpOut('key1');
			break;
		case 'key4':
			dpOut('key5');
			break;
		case 'key7':
			dpOut('key8');
			break;
		case 'key10':
			dpOut('key11');
			break;
		case 'key13':
			dpOut('key12');
			break;
		case 'key15':
			dpOut('key16');
			break;
		case 'key18':
			dpOut('key19');
			break;
	}
}

//<------------------------------------------------------------------------JitkaIndex Code-------------------------------------------------------------------------------------->//

//vars to hold text area welcoming text. sensitive to lang swap

var eAdd1 = 'jitka';
var eAdd2 = 'ff';
var eAdd3 = '@';
var eAdd4 = 'gmail'
var eAdd5 = '.com';

var entryText_storage_EN = '<p>Jitka Fowler Fraňková is a Czech pianist who has studied and performed in many countries around the world.  She has recently returned from a prolonged stay in the United States. She now lives in Prague and is active performing and teaching.</p><p> Jitka\'s playing is radiant with her natural qualities, unique talent and finely-honed skills. She always connects with the audience and delivers and unforgettable experience.</p>'

var entryText_storage_CZ = '<p>Klavíristka Jitka Fowler Fraňková studovala a koncertovala v mnoha zemích Evropy a Ameriky.  Nedávno se vrátila z prodlouženého pobytu ve Spojených státech.  Žije momentálně v Praze.  Věnuje se aktivně koncertování a výuce klavíru.</p><p>V Jitčině hře se odráží její osobnost, zcela výjmečný talent a přirozená muzikalita.</p>';

var entryTextCZ = '<p>Jitka zahraje benefiční koncert v Klášteře sváté Anežky České v Praze dne 6. června, který bude zahajením projektu EPTA Česká republika na získání financí pro nový koncertní klavír do sálu kláštera. Více informací na <a href="http://www.epta-cz.com/projects_EPTA.html">EPTA České republiky</a>.</p>';

var entryTextEN = '<p>Jitka will be playing a benefit concert at the Monastery of Saint Agnes in Prague on June 6, as part of a fund-raising campaign by EPTA Czech republic to purchase a new concert piano for the monastery\'s hall.  More information at <a href="http://www.epta-cz.com/projects_EPTA.html">EPTA Czech Republic</a>.</p>';

var jContactEN = 'Jitka can be reached at:';
var jContactCZ = 'Kontakt:';

var qEN = 0;
var qCZ = 0;

var quotesCZ = new Array();
quotesCZ[0] = '';
quotesCZ[1] = '';
quotesCZ[2] = '';

var quotesEN = new Array();
quotesEN[0] = '<i>Music is the mediator between the spiritual and the sensual life.  ~Ludwig van Beethoven</i>';
quotesEN[1] = '<i>Music is what feelings sound like.  ~Unknown</i>';
quotesEN[2] = '<i>Without music life would be a mistake.  ~Friedrich Wilhelm Nietzsche</i>';
quotesEN[3] = '<i>If a composer could say what he had to say in words he would not bother trying to say it in music.  ~Gustav Mahler</i>';

//var to hold bg music pref

var musicVal;

//listens for a response from flash player for music preferences before writing a cookie which is read on page load

function jsListens(cState){
	if (cState == 'on'){
		createCookie('music','off',-1);
		createCookie('music','on',0);
	} else if (cState == 'off'){
		createCookie('music','on',-1);
		createCookie('music','off',0);
	}
}

//unique mouse events are attached to the kbpedal image to control its roll over states as well as the on/off states of the keyboard sounds and the dependent piano image 

function imgOverB(evt){
	var path;
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	if (keyboard == 1){
		path = targ.src.substring(0, targ.src.length-4);
		targ.setAttribute('src',path +'Over.png');
	} else if (keyboard == 2){
		path = targ.src.substring(0, targ.src.length-9);
		targ.setAttribute('src',path+'OverClick.png');
	}
}

function imgDownB(evt){
	var path;
	var pPic = document.getElementById('piano');
	var pPath;
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	if (keyboard == 1){
		path = targ.src.substring(0, targ.src.length-8);
		targ.setAttribute('src',path +'Down.png');
		pPath = pPic.src.substring(0, pPic.src.length-4);
		pPic.setAttribute('src',pPath+'Click.png');
		createCookie('keys','on',-1);
		createCookie('keys','off',0);
		keyboard = 2;
	} else if (keyboard == 2){
		path = targ.src.substring(0, targ.src.length-13);
		targ.setAttribute('src',path +'DownClick.png');
		pPath = pPic.src.substring(0, pPic.src.length-9);
		pPic.setAttribute('src',pPath+'.png');
		createCookie('keys','off',-1);
		createCookie('keys','on',0);
		keyboard = 1;
	}
}

function imgUpB(evt){
	var path;
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	if (keyboard == 1){
		path = targ.src.substring(0, targ.src.length-13);
		targ.setAttribute('src',path +'Over.png');
	} else if (keyboard == 2){
		path = targ.src.substring(0, targ.src.length-8 );
		targ.setAttribute('src',path +'OverClick.png');
	}
}

function imgOutB(evt){
	var path;
	if (!evt){
		evt = window.event;
	}
	var targ;
	if (navigator.appVersion.indexOf("MSIE") == -1){
		targ = evt.target;
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		targ = evt.srcElement;
	}
	if (keyboard == 1){
		path = targ.src.substring(0, targ.src.length-8);
		targ.setAttribute('src',path+'.png');
	} else if (keyboard == 2){
		path = targ.src.substring(0, targ.src.length-13);
		targ.setAttribute('src',path+'Click.png');
	}
}

//sets cookie for keyboard sound preference on page unload

function soundValue(){
	if (keyBoard==1){
		createCookie('keys','off',-1);
		createCookie('keys','on',0);
	}else if(keyBoard==2){
		createCookie('keys','on',-1);
		createCookie('keys','off',0);
	}
}

//sends bg music preference to flash player 

function flashInt(){
	var retToFlash;
	
	if (musicVal == 'on'){
		 retToFlash = 'on';
	} else if (musicVal == 'off'){
		retToFlash = 'off';
	} else if (musicVal == ''){
		retToFlash = 'notSet';
	}
	var thisFlash = getFlashMovieObject('entryAudio');
	thisFlash.jsSends(retToFlash);
}

//init function called by general page init, checks cookie for bg music. switches images based on keyboard and call function to send bg music pref to flash player

function initIndex(){
	musicVal = getCookieData('music');
	if(keyboard==1){
		window.document.getElementById('piano').setAttribute('src','./images/kbContr/piano.png');
		window.document.getElementById('kbPedal').setAttribute('src','./images/kbContr/kbPedal.png');
	}else if(keyboard=2){
		window.document.getElementById('piano').setAttribute('src','./images/kbContr/pianoClick.png');
		window.document.getElementById('kbPedal').setAttribute('src','./images/kbContr/kbPedalClick.png');
	}
	document.getElementById('emAdd').innerHTML = eAdd1+eAdd2+eAdd3+eAdd4+eAdd5;
	waiting = setTimeout (flashInt, 1000);
	
}


//<-----------------------------------------------------------------------JitkaGallery Code--------------------------------------------------------------------------->//

//galley vars: counter, animation frame, and variable to be used in galImageSwap, which determines whether galImageSwap has been called since page load or the last call to thumbsReset
var k;
var galState = 0;
var swpAccess = 0;
var tBF = new Array();
	tBF[0] = new Image(30,100);
	tBF[0].src = '../images/photos/galImages/tableBoxFill00.png';
	tBF[1] = new Image(30,100);
	tBF[1].src = '../images/photos/galImages/tableBoxFill01.png';
	tBF[2] = new Image(30,100);
	tBF[2].src = '../images/photos/galImages/tableBoxFill02.png';
	tBF[3] = new Image(30,100);
	tBF[3].src = '../images/photos/galImages/tableBoxFill03.png';
	tBF[4] = new Image(30,100);
	tBF[4].src = '../images/photos/galImages/tableBoxFill04.png';
	tBF[5] = new Image(30,100);
	tBF[5].src = '../images/photos/galImages/tableBoxFill05.png';
	tBF[6] = new Image(30,100);
	tBF[6].src = '../images/photos/galImages/tableBoxFill06.png';
	tBF[7] = new Image(30,100);
	tBF[7].src = '../images/photos/galImages/tableBoxFill07.png';
var tBFa = new Array();
	tBFa[0] = new Image(30,100);
	tBFa[0].src = '../images/photos/galImages/tableBoxFill00a.png';
	tBFa[1] = new Image(30,100);
	tBFa[1].src = '../images/photos/galImages/tableBoxFill01a.png';
	tBFa[2] = new Image(30,100);
	tBFa[2].src = '../images/photos/galImages/tableBoxFill02a.png';
	tBFa[3] = new Image(30,100);
	tBFa[3].src = '../images/photos/galImages/tableBoxFill03a.png';
	tBFa[4] = new Image(30,100);
	tBFa[4].src = '../images/photos/galImages/tableBoxFill04a.png';
	tBFa[5] = new Image(30,100);
	tBFa[5].src = '../images/photos/galImages/tableBoxFill05a.png';
	tBFa[6] = new Image(30,100);
	tBFa[6].src = '../images/photos/galImages/tableBoxFill06a.png';
	tBFa[7] = new Image(30,100);
	tBFa[7].src = '../images/photos/galImages/tableBoxFill07a.png';
//loads images from galleryphotos.html into array

var galImage = new Array();
	galImage[0] = new Image(373,498);
	galImage[0].src = './images/photos/galImages/galImage00.jpg';
	galImage[1] = new Image(373,498);
	galImage[1].src = './images/photos/galImages/galImage01.jpg';
	galImage[2] = new Image(373,498);
	galImage[2].src = './images/photos/galImages/galImage02.jpg';
	galImage[3] = new Image(373,498);
	galImage[3].src = './images/photos/galImages/galImage03.jpg';
	galImage[4] = new Image(373,498);
	galImage[4].src = './images/photos/galImages/galImage04.jpg';
	
//writes a cookie which will be used to set k as negative one for purposes of scrolling through gallery
	
function setGallery(){
	createCookie('kSet',-1,0);
}

//ensures that kSet == -1 on age load 

function initGallery(){
	setGallery();
}

//called when a gallery image is clicked. writes a cookie which will be used to set k to the number of the image clicked then calls enlarging function.

function imageEnlarge(largeImage,imageNum){
	createCookie ('kSet',imageNum,0);
	bigPic(largeImage);
}

//called by imageEnlarge. checks dimensions of the clicked image then removes gallery iframe and displays large image

function bigPic(largeImage){
	window.parent.focus();
	var classObj = document.getElementById(largeImage).className;
	if (classObj == 'gImg'){
		window.parent.document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:1px; left:106px; border:thin; border-style:solid; border-color:0x000000; height:498px; width:373px;" src="images/photos/galImages/'+largeImage+'.jpg"/></div>';
	} else if (classObj == 'gImgA' ){
		window.parent.document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:63px; left:43px; border:thin; border-style:solid; border-color:0x000000; height:373px; width:498px;" src="images/photos/galImages/'+largeImage+'.jpg"/></div>';
	}
}

//animation of gallery image filler to highlight which image mouse is hovering over.  mod identifies dimensions of image and filler

var anPic;

function parseMod(anPic, mod, num){
	if (mod == ''){
		anPic.setAttribute('src', tBF[num].src);
	} else if (mod == 'a'){
		anPic.setAttribute('src', tBFa[num].src);
	}
}

function galCycle(anPic, mod){
	galState ++;
	if (galState <= 15){
		switch (galState){
			case 0:
				parseMod(anPic, mod, 0);
				break;
			case 1:
				parseMod(anPic, mod, 1);
				break;
			case 2:
				parseMod(anPic, mod, 2);
				break;
			case 3:
				parseMod(anPic, mod, 3);
				break;
			case 4:
				parseMod(anPic, mod, 4);
				break;
			case 5:
				parseMod(anPic, mod, 5);
				break;
			case 6:
				parseMod(anPic, mod, 6);
				break;
			case 7:
				parseMod(anPic, mod, 7);
				break;
			case 8:
				parseMod(anPic, mod, 7);
				break;
			case 9:
				parseMod(anPic, mod, 6);
				break;
			case 10:
				parseMod(anPic, mod, 5);
				break;
			case 11:
				parseMod(anPic, mod, 4);
				break;
			case 12:
				parseMod(anPic, mod, 3);
				break;
			case 13:
				parseMod(anPic, mod, 2);
				break;
			case 14:
				parseMod(anPic, mod, 1);
				break;
			case 15:
				parseMod(anPic, mod, 0);
				break;
		}
	} else if (galState > 15){
		galState = 0;
	}
}

function breakGalCycle(pic, mod){
	clearInterval(galOverCycle);
	parseMod(anPic, mod, 0);
	galState = 0;
}

function galOver(pic, mod){
	anPic = document.getElementById(pic);
	if (navigator.appVersion.indexOf("MSIE") == -1){
		galOverCycle = setInterval(galCycle, 75, anPic, mod);
	} else if (navigator.appVersion.indexOf("MSIE") != -1){
		galOverCycle = setInterval(function(){galCycle(anPic,mod)}, 75);
	}
	
}

//called by mouse click.  returns galleryphotos.html iframe clears k, registers the call to itsself (for use by galImageSwap), and writes kVal cookie to -1

function thumbsReset(){
	document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><iframe style="position:absolute; top:0px; left:5px; height:495px; width:575px;" src="./fPages/galleryphotos.html"></iframe></div>';
	k = '';
	swpAccess = 0;
	setGallery();
}

//called by mouse click. first chhecks if this is first call to itsself since page load or a previous call to thumbsReset.  if so sets k to val of the kVal cookie. cycles through images in the gallery.  sensitive to image dimensions and direction of cycling. 

function galImageSwap(direction){
	if (swpAccess == 0){
		k = getCookieData('kSet');
		swpAccess = 1;
	}
	if (direction == 'forward'){
		if (k < (galImage.length - 1)){
			k++;
			
			if (galImage[k].height == 498){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:1px; left:106px; border:thin; border-style:solid; border-color:0x000000; height:498px; width:373px;" src="'+galImage[k].src+'"/></div>';
			} else if (galImage[k].height == 373){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:63px; left:43px;  border:thin; border-style:solid; border-color:0x000000; height:373px; width:498px;" src="'+galImage[k].src+'"/></div>';
			}
		} else {
			k = 0;
		
			if (galImage[k].height == 498){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:1px; left:106px; border:thin; border-style:solid; border-color:0x000000; height:498px; width:373px;" src="'+galImage[k].src+'"/></div>';
			} else if (galImage[k].height == 373){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:63px; left:43px;  border:thin; border-style:solid; border-color:0x000000; height:373px; width:498px;" src="'+galImage[k].src+'"/></div>';
			}
		}
	} else if(direction == 'backward'){
		if (k > 0){
			k--;
			if (galImage[k].height == 498){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:1px; left:106px; border:thin; border-style:solid; border-color:0x000000; height:498px; width:373px;" src="'+galImage[k].src+'"/></div>';
			} else if (galImage[k].height == 373){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:63px; left:43px;  border:thin; border-style:solid; border-color:0x000000; height:373px; width:498px;" src="'+galImage[k].src+'"/></div>';
			}
		} else {
			k = (galImage.length - 1);
			if (galImage[k].height == 498){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:1px; left:106px; border:thin; border-style:solid; border-color:0x000000; height:498px; width:373px;" src="'+galImage[k].src+'"/></div>';
			} else if (galImage[k].height == 373){
				document.getElementById('frameDiv').innerHTML = '<div id="frameSet" style="position:absolute; top:0px; left:0px; height:500px; width:585px;"><img style="position:absolute; top:63px; left:43px;  border:thin; border-style:solid; border-color:0x000000; height:373px; width:498px;" src="'+galImage[k].src+'"/></div>';
			}
		}
	}
}
		
//<-----------------------------------------------------------------------JitkaData Code---------------------------------------------------------------------------->//				

//rewrites data cookie, and if jitkadata.html is loaded switches out the approriate data page

function setData(dVal){
	dataP = dVal;
	createCookie('data','other',-1);
	createCookie('data','events',-1);
	createCookie('data','bio',-1);
	createCookie('data','rep',-1);
	createCookie('data','news',-1);
	createCookie('data','CV',-1);
	createCookie('data','teaching',-1);
	createCookie('data',dataP,0);
	
	if (document.title == 'JitkaData' ){
		if (dataP != 'events'){
			document.getElementById('dataFrame').setAttribute('src','fPages/'+dataP+lang+'.html');
		} else {
			document.getElementById('dataFrame').setAttribute('src','fPages/'+dataP+lang+'.php');
		}
	}
}

//reads data cooie and sets appropriate data page

function initData(){
	var dataVal = getCookieData('data');
	dataP = dataVal;
	if(dataP != 'events'){
		document.getElementById('dataFrame').setAttribute('src','fPages/'+dataP + lang + '.html');
	} else {
		document.getElementById('dataFrame').setAttribute('src','fPages/'+dataP + lang + '.php');
	}
																
}

	var colorCycle;
	var cCycState = 0;
	var colObj;
	
	function getStyleObject(objectId) {
		if(document.getElementById && document.getElementById(objectId)) {
			return document.getElementById(objectId).style;
		} else if (document.all && document.all(objectId)) {
			return document.all(objectId).style;
		}else {
			return false;
		}
		
	} 
	
	function changeColor(){
		colObj = getStyleObject('tdEvents');
		if (navigator.appVersion.indexOf("MSIE") == -1){
			colorCycle = setInterval(colCycle, 66);
		} else if (navigator.appVersion.indexOf("MSIE") != -1){
			colorCycle = setInterval(function(){colCycle()}, 66);
		}
	}
	
	function colCycle(){
		if (cCycState < 14){
			cCycState++;
		} else {
			cCycState = 0;
		}
		switch (cCycState){
			case 0:
				colObj.borderColor = "#90278E";
				break;
			case 1:
				colObj.borderColor = "#A72474";
				break;
			case 2:
				colObj.borderColor = "#BE2259";
				break;
			case 3:
				colObj.borderColor = "#D51F3F";
				break;
			case 4:
				colObj.borderColor = "#EC1C24";
				break;
			case 5:
				colObj.borderColor = "#EC1C24";
				break;
			case 6:
				colObj.borderColor = "#BD2156";
				break;
			case 7:
				colObj.borderColor = "#8D2789";
				break;
			case 8:
				colObj.borderColor = "#5E2CBB";
				break;
			case 9:
				colObj.borderColor = "#2E31ED";
				break;
			case 10:
				colObj.borderColor = "#2E31ED";
				break;
			case 11:
				colObj.borderColor = "#472FD5";
				break;
			case 12:
				colObj.borderColor = "#5F2CBE";
				break;
			case 13:
				colObj.borderColor = "#782AA6";
				break;
			case 14:
				colObj.borderColor = "#90278E";
				break;
		}
	}


//<-------------------------------------------------------------- Press Kit Code --------------------------------------------------------------------------------->//			

//vars for holding the lang sensitive text in the page

var pkTitleEN = 'Information for print'
var pkTitleCZ = 'Informace pro tisk'
var pkTextEN = 'The buttons below link to files that contain useful presskits for Jitka Frankova.  They include a photograph and a short biography suitable for concert programs.'
var pkTextCZ = 'Detailní informace ke stažení - životopis a fotografie - je možné získat po kliknutí na níže zvolené tlačítko.'

function initPressKit(){
	
}

function initAudio(){
	
}


window.onunload="soundValue();"
