var click=new Image(); 
var original=new Image(); 
var spacer=new Image(); 
var copytt=new Image(); 
click.src="images/TTclick.jpg";
original.src="images/TT.jpg";
spacer.src="images/spacer.gif";
copytt.src="images/CopyrighTTanimation.gif";
var vertical = false;
var currentImage = 0;
var lastImage = -1;
var currentGallery = new Array();

function press() {
	document.getElementById("phoTTo-home").src=click.src;
	document.getElementById("phoTTo-gallery").src=click.src;
}

function release() {
	document.getElementById("phoTTo-home").src=original.src;
	document.getElementById("phoTTo-gallery").src=original.src;
}

function changepic(source, url) {
	document.getElementById(source).src=url;
}

function changegallerypic(gallery, index) {
	orientation=gallery[index][1];
	url=gallery[index][0];
	checkFirstLast(-1);
	checkFirstLast(index);
	if (lastImage!=index) {
		show("loading-holder");
	}
	document.getElementById("copyTT").src=copytt.src;
	hide("image-holder");
	if (orientation=="vertical") {
		document.getElementById("loading-holder").style.left="186px";
		document.getElementById("image-holder").style.width="402px";
		document.getElementById("image-holder").style.height="602px";
		document.getElementById("image-holder").style.position="absolute";
		document.getElementById("image-holder").style.top="-101px";
		document.getElementById("image-holder").style.left="38px";
	}
	if (orientation=="horizontal" || orientation=="whosthatgirlpic") {
		document.getElementById("loading-holder").style.left="251px";
		document.getElementById("image-holder").style.width="602px";
		document.getElementById("image-holder").style.height="400px";
		document.getElementById("image-holder").style.position="absolute";
		document.getElementById("image-holder").style.top="0px";
		document.getElementById("image-holder").style.left="0px";
	}
	if (orientation=="vertical") {
		if (!vertical) {
			hide("pic");
			hide("whosthatgirlpic");				
		}
		changepic("pic", url);
		vertical=true;
	}
	if (orientation=="horizontal") {
		hide("whosthatgirlpic");
		if (vertical) {
			hide("pic");
		}
		changepic("pic", url);
		vertical=false;
	}
	if (orientation=="whosthatgirlpic") {
		hide("pic");
		hide("whosthatgirlpic");
		changepic("whosthatgirlpic", url);
		vertical=false;
	}
	show("image-holder");
	highlightCurrentImage(index);
	lastImage=index;
}

function hide() {
	for (var i=0; i<arguments.length; i++) {
		document.getElementById(arguments[i]).style.visibility='hidden';
		document.getElementById(arguments[i]).style.display='none';
	}
}

function hideAll() {
	hide("gallerytitle-whosthatgirl",
		 "gallerytitle-walls",
		 "gallerytitle-street",
		 "gallerytitle-hiking",
		 "gallerytitle-children",
		 "gallerytitle-animals",
		 "gallerytitle-sestmeseci",
		 "gallerytitle-ego",
		 "gallery",
		 "home",
		 "bio",
		 "news",
		 "galleryhover",
		 "gallerytitles",
		 "pic",
 		 "whosthatgirlpic");
}

function show() {
	for (var i=0; i<arguments.length; i++) {
		document.getElementById(arguments[i]).style.visibility='visible';
		document.getElementById(arguments[i]).style.display='block';
	}
}

function expand(element) {
	document.getElementById(element).style.visibility='visible';
	document.getElementById(element).style.display='inline';
}

function navigate(location) {
	hideAll();
	show(location);
}

function loadNews() {
	navigate('news');	
	changepic('losthighway', 'images/losthighway.jpg');
	changepic('piroshajna', 'images/piroshajna.jpg');
	changepic('passenger', 'images/passenger.jpg');
	changepic('sestmeseci-ed-3581', 'images/EdvardMolnar-6meseci-3581.jpg');
	changepic('sestmeseci-ed-3592', 'images/EdvardMolnar-6meseci-3592.jpg');
	changepic('sestmeseci-ed-3597', 'images/EdvardMolnar-6meseci-3597.jpg');
	changepic('sestmeseci-ed-3638', 'images/EdvardMolnar-6meseci-3638.jpg');
	changepic('sestmeseci-ed-3641', 'images/EdvardMolnar-6meseci-3641.jpg');
	changepic('sestmeseci-ed-3670', 'images/EdvardMolnar-6meseci-3670.jpg');
	changepic('sestmeseci-ed-3675', 'images/EdvardMolnar-6meseci-3675.jpg');
	changepic('sestmeseci-ed-3687', 'images/EdvardMolnar-6meseci-3687.jpg');
	changepic('sestmeseci-ed-3694', 'images/EdvardMolnar-6meseci-3694.jpg');
	changepic('banner', 'images/phoTTo-banner.jpg');
	changepic('meghivo', 'images/TamasToth-kismeghivo.jpg');
	changepic('megnyito1', 'images/TamasToth-megnyiTTo.jpg');
	changepic('megnyito2', 'images/AntonToth-megnyiTTo.jpg');
	changepic('soltis1', 'images/NikolaTumbas-soltis1.jpg');
	changepic('soltis2', 'images/NikolaTumbas-soltis2.jpg');
	changepic('gornjimilanovac', 'images/AleksandarSnegic-gornjimilanovac.jpg');
	changepic('sestmeseci-1', 'images/TamasToth-6meseci-pozivnica.jpg');
}

function changetitle(newTitle) {
	show("gallerytitle");
	document.getElementById("gallerytitle").innerHTML=newTitle;
}

function changeOpacity(element, opacity) {
	document.getElementById(element).style.opacity=opacity/100;
	document.getElementById(element).style.filter="alpha(opacity=" + opacity + ")";
}

function changegallery(gallery, pic) {
	lastImage=-1;
	navigate("gallery");
	hide("galleryhover");
	show("gallerytitles", "gallerytitle-"+gallery.name);
	currentGallery=gallery;
	changegallerypic(gallery, pic);
}

function highlightCurrentImage(current) {	
	prefix = currentGallery.name;
	currentImage=current;
	for (iterator=0; iterator<currentGallery.length; iterator++) {
		if (iterator==current) {
			if (document.getElementById(prefix+iterator)) {
				changeClass(prefix+iterator, "activeImage");
			}
		} else {
			if (document.getElementById(prefix+iterator)) {
				changeClass(prefix+iterator, "");
			}
		}
	}
}

function checkFirstLast(current) {
	prefix = currentGallery.name;
	switch (current)
	{
	case 0:
	  changeOpacity(prefix+"Prev", 0);
	  document.getElementById(prefix+"Prev").style.cursor="default";
	  break;
	case currentGallery.length-1:
	  changeOpacity(prefix+"Next", 0);
	  document.getElementById(prefix+"Next").style.cursor="default";
	  break;
	default:
	  changeOpacity(prefix+"Prev", 100);
	  changeOpacity(prefix+"Next", 100);
	  document.getElementById(prefix+"Prev").style.cursor="pointer";
	  document.getElementById(prefix+"Next").style.cursor="pointer";
	}	
}

function changeClass(element, newClass) {
	if (document.getElementById(element)) document.getElementById(element).className=newClass;
}

function prevNext(direction) {
	currentImage += direction;
	if (currentImage < 0)
		currentImage = 0;
	if (currentImage == currentGallery.length)
		currentImage = currentGallery.length - 1;
	changegallerypic(currentGallery, currentImage);
	trackImageview(currentGallery[currentImage][0]);
}

function trackImageview(image) {
	switch (image)
	{
	case "images/gallery/whosthatgirl/TamasToth-plavivoz.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/plavivoz');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-kutak.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/kutak');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-kisa.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/kisa');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-san.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/san');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-nightingale.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/nightingale');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-vidi.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/vidi');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-korak.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/korak');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-prizor.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/prizor');
	  break;
	case "images/gallery/whosthatgirl/TamasToth-suncica.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/suncica');
	  break;
	case "images/gallery/whosthatgirl/TinaSolar.jpg":
	  pageTracker._trackPageview('/gallery/whosthatgirl/www');
	  break;

	  case "images/gallery/ego/TTriglav.jpg":
	  pageTracker._trackPageview('/gallery/ego/triglav');
	  break;
	case "images/gallery/ego/TamasToth-kapecini.jpg":
	  pageTracker._trackPageview('/gallery/ego/kapecini');
	  break;
	case "images/gallery/ego/TamasToth-alien.jpg":
	  pageTracker._trackPageview('/gallery/ego/alien');
	  break;
	case "images/gallery/ego/TamasToth-cudovisteizledinackogjezera.jpg":
	  pageTracker._trackPageview('/gallery/ego/cudovisteizledinackogjezera');
	  break;
	case "images/gallery/ego/TamasToth-lokalpatrioTTa.jpg":
	  pageTracker._trackPageview('/gallery/ego/lokalpatriota');
	  break;
	case "images/gallery/ego/TamasToth-autoportretsadaljinskim.jpg":
	  pageTracker._trackPageview('/gallery/ego/autoportretsadaljinskim');
	  break;
	case "images/gallery/ego/TamasToth-ja.jpg":
	  pageTracker._trackPageview('/gallery/ego/ja');
	  break;
	default:
	}
}

var spacerGallery = new Array();
spacerGallery.name="spacer";
spacerGallery[0]=new Array("images/spacer.gif", "vertical");
spacerGallery[1]=new Array("images/spacer.gif", "horizontal");
spacerGallery[2]=new Array("images/spacer.gif", "whosthatgirlpic");

var streetGallery = new Array();
streetGallery.name="street";
streetGallery[0]=new Array("images/gallery/street/TamasToth-life.jpg", "vertical");
streetGallery[1]=new Array("images/gallery/street/TamasToth-marypoppins.jpg", "vertical");
streetGallery[2]=new Array("images/gallery/street/TamasToth-bezbrizno.jpg", "vertical");
streetGallery[3]=new Array("images/gallery/street/TamasToth-oktyabrskaya.jpg", "horizontal");
streetGallery[4]=new Array("images/gallery/street/TamasToth-boulevard.jpg", "horizontal");
streetGallery[5]=new Array("images/gallery/street/TamasToth-preseljeno.jpg", "horizontal");
streetGallery[6]=new Array("images/gallery/street/TamasToth-nikon.jpg", "vertical");
streetGallery[7]=new Array("images/gallery/street/TamasToth-cekajuci.jpg", "vertical");
streetGallery[8]=new Array("images/gallery/street/TamasToth-(k)raj.jpg", "horizontal");
streetGallery[9]=new Array("images/gallery/street/TamasToth-4353.jpg", "horizontal");
streetGallery[10]=new Array("images/gallery/street/TamasToth-mebijus.jpg", "horizontal");
streetGallery[11]=new Array("images/gallery/street/TamasToth-suboticatrans.jpg", "horizontal");
streetGallery[12]=new Array("images/gallery/street/TamasToth-polazak.jpg", "horizontal");
streetGallery[13]=new Array("images/gallery/street/TamasToth-zaprescen.jpg", "vertical");
streetGallery[14]=new Array("images/gallery/street/TamasToth-unrealtournament.jpg", "horizontal");
streetGallery[15]=new Array("images/gallery/street/TamasToth-suncandan.jpg", "vertical");
streetGallery[16]=new Array("images/gallery/street/TamasToth-spica.jpg", "vertical");

var wallsGallery = new Array();
wallsGallery.name="walls";
wallsGallery[0]=new Array("images/gallery/walls/TamasToth-falak-35.jpg", "vertical");
wallsGallery[1]=new Array("images/gallery/walls/TamasToth-falak-18.jpg", "horizontal");
wallsGallery[2]=new Array("images/gallery/walls/TamasToth-falak-104-alkony.jpg", "horizontal");
wallsGallery[3]=new Array("images/gallery/walls/TamasToth-falak-gyules.jpg", "horizontal");
wallsGallery[4]=new Array("images/gallery/walls/TamasToth-falak-42.jpg", "vertical");
wallsGallery[5]=new Array("images/gallery/walls/TamasToth-falak-76.jpg", "horizontal");
wallsGallery[6]=new Array("images/gallery/walls/TamasToth-falak-84.jpg", "vertical");
wallsGallery[7]=new Array("images/gallery/walls/TamasToth-falak-169.jpg", "vertical");
wallsGallery[8]=new Array("images/gallery/walls/TamasToth-falak-228.jpg", "horizontal");
wallsGallery[9]=new Array("images/gallery/walls/TamasToth-falak-340.jpg", "horizontal");
wallsGallery[10]=new Array("images/gallery/walls/TamasToth-falak-azra.jpg", "horizontal");
wallsGallery[11]=new Array("images/gallery/walls/TamasToth-falak-dukenukem.jpg", "vertical");
wallsGallery[12]=new Array("images/gallery/walls/TamasToth-falak-hmm.jpg", "horizontal");
wallsGallery[13]=new Array("images/gallery/walls/TamasToth-falak-183.jpg", "horizontal");
wallsGallery[14]=new Array("images/gallery/walls/TamasToth-falak-nyakiglab.jpg", "vertical");
wallsGallery[15]=new Array("images/gallery/walls/TamasToth-falak-tel.jpg", "horizontal");
wallsGallery[16]=new Array("images/gallery/walls/TamasToth-falak-291.jpg", "vertical");
wallsGallery[17]=new Array("images/gallery/walls/TamasToth-falak-autoportreTT.jpg", "horizontal");

var hikingGallery = new Array();
hikingGallery.name="hiking";
hikingGallery[0]=new Array("images/gallery/hiking/TamasToth-icecave.jpg", "horizontal");
hikingGallery[1]=new Array("images/gallery/hiking/TamasToth-view.jpg", "horizontal");
hikingGallery[2]=new Array("images/gallery/hiking/TamasToth-umrakudivancvijet.jpg", "horizontal");
hikingGallery[3]=new Array("images/gallery/hiking/TamasToth-mostnasoci.jpg", "vertical");
hikingGallery[4]=new Array("images/gallery/hiking/TamasToth-america.jpg", "horizontal");
hikingGallery[5]=new Array("images/gallery/hiking/TamasToth-blackforest.jpg", "horizontal");
hikingGallery[6]=new Array("images/gallery/hiking/TamasToth-travnik.jpg", "vertical");
hikingGallery[7]=new Array("images/gallery/hiking/TamasToth-logarskadolina.jpg", "horizontal");
hikingGallery[8]=new Array("images/gallery/hiking/TamasToth-djurdjevicatara.jpg", "horizontal");
hikingGallery[9]=new Array("images/gallery/hiking/TamasToth-dvoje.jpg", "horizontal");
hikingGallery[10]=new Array("images/gallery/hiking/TamasToth-szamartovis.jpg", "horizontal");
hikingGallery[11]=new Array("images/gallery/hiking/TamasToth-gerinc.jpg", "horizontal");
hikingGallery[12]=new Array("images/gallery/hiking/TamasToth-s.jpg", "vertical");
hikingGallery[13]=new Array("images/gallery/hiking/TamasToth-bajka.jpg", "vertical");
hikingGallery[14]=new Array("images/gallery/hiking/TamasToth-maglic.jpg", "horizontal");
hikingGallery[15]=new Array("images/gallery/hiking/TamasToth-namarsu.jpg", "vertical");
hikingGallery[16]=new Array("images/gallery/hiking/TamasToth-pejzaz.jpg", "vertical");
hikingGallery[17]=new Array("images/gallery/hiking/TamasToth-povetarac.jpg", "horizontal");
hikingGallery[18]=new Array("images/gallery/hiking/TamasToth-usamljenodrvo.jpg", "horizontal");

var childrenGallery = new Array();
childrenGallery.name="children";
childrenGallery[0]=new Array("images/gallery/children/TamasToth-heyyou.jpg", "vertical");
childrenGallery[1]=new Array("images/gallery/children/TamasToth-dalmaportre.jpg", "horizontal");
childrenGallery[2]=new Array("images/gallery/children/TamasToth-sankanje.jpg", "horizontal");
childrenGallery[3]=new Array("images/gallery/children/TamasToth-osvezenje.jpg", "horizontal");
childrenGallery[4]=new Array("images/gallery/children/TamasToth-veselaporodica.jpg", "vertical");
childrenGallery[5]=new Array("images/gallery/children/TamasToth-mona.jpg", "horizontal");
childrenGallery[6]=new Array("images/gallery/children/TamasToth-keklilafiu.jpg", "horizontal");
childrenGallery[7]=new Array("images/gallery/children/TamasToth-cekajucitatu.jpg", "horizontal");
childrenGallery[8]=new Array("images/gallery/children/TamasToth-ifjhamingway.jpg", "horizontal");
childrenGallery[9]=new Array("images/gallery/children/TamasToth-marslakok.jpg", "horizontal");
childrenGallery[10]=new Array("images/gallery/children/TamasToth-kakosezoves.jpg", "vertical");
childrenGallery[11]=new Array("images/gallery/children/TamasToth-virko.jpg", "horizontal");
childrenGallery[12]=new Array("images/gallery/children/TamasToth-vattacukor.jpg", "horizontal");

var animalsGallery = new Array();
animalsGallery.name="animals";
animalsGallery[0]=new Array("images/gallery/animals/TamasToth-blup.jpg", "vertical");
animalsGallery[1]=new Array("images/gallery/animals/TamasToth-rupicapra.jpg", "vertical");
animalsGallery[2]=new Array("images/gallery/animals/TamasToth-palic.jpg", "vertical");
animalsGallery[3]=new Array("images/gallery/animals/TamasToth-cricket.jpg", "vertical");
animalsGallery[4]=new Array("images/gallery/animals/TamasToth-drotmadar.jpg", "vertical");
animalsGallery[5]=new Array("images/gallery/animals/TamasToth-jendva.jpg", "horizontal");
animalsGallery[6]=new Array("images/gallery/animals/TamasToth-woops.jpg", "vertical");
animalsGallery[7]=new Array("images/gallery/animals/TamasToth-NStaxi.jpg", "horizontal");
animalsGallery[8]=new Array("images/gallery/animals/TamasToth-vonatpuli.jpg", "horizontal");
animalsGallery[9]=new Array("images/gallery/animals/TamasToth-passenger.jpg", "horizontal");

var sestmeseciGallery = new Array();
sestmeseciGallery.name="sestmeseci";
sestmeseciGallery[0]=new Array("images/gallery/6meseci/TamasToth-buco.jpg", "horizontal");
sestmeseciGallery[1]=new Array("images/gallery/6meseci/TamasToth-jutarnjevezbe.jpg", "horizontal");
sestmeseciGallery[2]=new Array("images/gallery/6meseci/TamasToth-marenda.jpg", "horizontal");
sestmeseciGallery[3]=new Array("images/gallery/6meseci/TamasToth-orao.jpg", "horizontal");
sestmeseciGallery[4]=new Array("images/gallery/6meseci/TamasToth-budnjenje.jpg", "horizontal");
sestmeseciGallery[5]=new Array("images/gallery/6meseci/TamasToth-dnevnazapovest.jpg", "horizontal");
sestmeseciGallery[6]=new Array("images/gallery/6meseci/TamasToth-gadjanje.jpg", "vertical");
sestmeseciGallery[7]=new Array("images/gallery/6meseci/TamasToth-radovi.jpg", "horizontal");
sestmeseciGallery[8]=new Array("images/gallery/6meseci/TamasToth-smotra.jpg", "horizontal");
sestmeseciGallery[9]=new Array("images/gallery/6meseci/TamasToth-Rvovic.jpg", "horizontal");
sestmeseciGallery[10]=new Array("images/gallery/6meseci/TamasToth-sdo.jpg", "horizontal");
sestmeseciGallery[11]=new Array("images/gallery/6meseci/TamasToth-izlezavanje.jpg", "horizontal");
sestmeseciGallery[12]=new Array("images/gallery/6meseci/TamasToth-kantina.jpg", "horizontal");
sestmeseciGallery[13]=new Array("images/gallery/6meseci/TamasToth-komunikacija.jpg", "horizontal");
sestmeseciGallery[14]=new Array("images/gallery/6meseci/TamasToth-oraozovesokola.jpg", "horizontal");
sestmeseciGallery[15]=new Array("images/gallery/6meseci/TamasToth-prvisneg.jpg", "horizontal");
sestmeseciGallery[16]=new Array("images/gallery/6meseci/TamasToth-prvisnegciscenje.jpg", "horizontal");
sestmeseciGallery[17]=new Array("images/gallery/6meseci/TamasToth-ponossrbije.jpg", "vertical");
sestmeseciGallery[18]=new Array("images/gallery/6meseci/TamasToth-kupanje.jpg", "horizontal");

var whosthatgirlGallery = new Array();
whosthatgirlGallery.name="whosthatgirl";
whosthatgirlGallery[0]=new Array("images/gallery/whosthatgirl/TamasToth-plavivoz.jpg", "horizontal");
whosthatgirlGallery[1]=new Array("images/gallery/whosthatgirl/TamasToth-kutak.jpg", "vertical");
whosthatgirlGallery[2]=new Array("images/gallery/whosthatgirl/TamasToth-kisa.jpg", "horizontal");
whosthatgirlGallery[3]=new Array("images/gallery/whosthatgirl/TamasToth-san.jpg", "vertical");
whosthatgirlGallery[4]=new Array("images/gallery/whosthatgirl/TamasToth-nightingale.jpg", "vertical");
whosthatgirlGallery[5]=new Array("images/gallery/whosthatgirl/TamasToth-vidi.jpg", "horizontal");
whosthatgirlGallery[6]=new Array("images/gallery/whosthatgirl/TamasToth-korak.jpg", "horizontal");
whosthatgirlGallery[7]=new Array("images/gallery/whosthatgirl/TamasToth-prizor.jpg", "horizontal");
whosthatgirlGallery[8]=new Array("images/gallery/whosthatgirl/TamasToth-suncica.jpg", "vertical");
whosthatgirlGallery[9]=new Array("images/gallery/whosthatgirl/TinaSolar.jpg", "whosthatgirlpic");

var egoGallery = new Array();
egoGallery.name="ego";
egoGallery[0]=new Array("images/gallery/ego/TTriglav.jpg", "horizontal");
egoGallery[1]=new Array("images/gallery/ego/TamasToth-kapecini.jpg", "vertical");
egoGallery[2]=new Array("images/gallery/ego/TamasToth-alien.jpg", "horizontal");
egoGallery[3]=new Array("images/gallery/ego/TamasToth-cudovisteizledinackogjezera.jpg", "horizontal");
egoGallery[4]=new Array("images/gallery/ego/TamasToth-lokalpatrioTTa.jpg", "horizontal");
egoGallery[5]=new Array("images/gallery/ego/TamasToth-autoportretsadaljinskim.jpg", "horizontal");
egoGallery[6]=new Array("images/gallery/ego/TamasToth-ja.jpg", "vertical");