//
// Fajlszerkezet:
//	kzs/
//		html/
//			index.html
//			common.js
//			tartalom.js
//			? layout.js
//			? foto.js
//			? alkotas.js
//			? check.html
//			images/
//		scans/		
//
//
//
//
//

// Utvonalak
imagesPath 	= './images';

pageWidth = 770;
menuWidth = 150;
textWidth = pageWidth - menuWidth;


//----------------------------- VIDEO DEF ----------------------------

// Video Constructor
function Video(iVideoId, iCim)
{
	this.videoId	= iVideoId;
	this.cim		= iCim;
	this.leiras		= '';
	this.fajlnev	= '';
	this.hossz		= '';
	this.preview	= '';
	this.writeVideo = writeVideo;
}

function writeVideo()
{
}

// Videok
videoArray = new Array();

// Uj video hozzafuzese
function addVideo(iVideo)
{
	videoArray[videoArray.length] = iVideo;
}

//----------------------------- ALKOTAS DEF ----------------------------

// Alkotasok
alkotasArray = new Array();

// Uj alkotas hozzafuzese
function addAlkotas(iAlkotas)
{
	if (alkotasArray.length == 0)
	{
		iAlkotas.elozoAlkotasId = iAlkotas.alkotasId;
		iAlkotas.kovetkezoAlkotasId = iAlkotas.alkotasId;
	}
	else
	{
		iAlkotas.elozoAlkotasId = alkotasArray[alkotasArray.length-1].alkotasId;
		iAlkotas.kovetkezoAlkotasId = alkotasArray[0].alkotasId;;
		alkotasArray[0].elozoAlkotasId = iAlkotas.alkotasId;
		alkotasArray[alkotasArray.length-1].kovetkezoAlkotasId = iAlkotas.alkotasId;

	}
	alkotasArray[alkotasArray.length] = iAlkotas;
}

// Alkotas kikeresese
function getAlkotas(iAlkotasId)
{
	//document.writeln('<br>getAlkotas: iAlkotasId=' + iAlkotasId);
	for (i=0; i<alkotasArray.length; i++)
	{
		//document.writeln('<br> i=' + i + '; alkotasArray[i].alkotasId=' + alkotasArray[i].alkotasId);
		if (alkotasArray[i].alkotasId == iAlkotasId)
		{
			return alkotasArray[i];
		}
	}
	return null;
}


// Alkotas Constructor
function Alkotas(iAlkotasId, iCim)
{
	this.alkotasId		= iAlkotasId;
	this.cim 		= iCim;
	this.meret 		= '';
	this.technika 		= '';
	this.mufajId		= '';
	this.keltezes		= '';
	this.szignalt		= '';
	this.zsuriszam 		= '';
	this.leiras		= '';
//	this.kiallitasok 	= '';
	this.fotoArray 		= new Array();
	this.addFoto		= addFoto;
	this.writeAlkotas	= writeAlkotas;

	this.eladasDatuma 	= '';
	this.vasarlo		= ''; // ha ki van toltve, akkor a hely= maganszemelynel!
	this.hely		= ''; // ha ures: művész tulajdona; egyebkent intézmény neve, cime
	this.megtekintheto	= ''; // ha igen, akkor be kell irni, hogy mikor es hogyan
	this.elado 		= 0;
	this.eladasiAr 		= 0;
	this.elozoAlkotasId = '';
	this.kovetkezoAlkotasId = '';
}

function addFoto(iFoto)
{
	this.fotoArray[this.fotoArray.length] = iFoto;
}

//----------------------------- FOTO DEF ----------------------------
// Foto Contructor
function Foto(iFotoId, iLeiras)
{
	this.fotoId		= iFotoId;
	this.leiras		= iLeiras;
	this.fajlNev1		= '';
	this.x1			= 0;
	this.y1			= 0;
	this.nagyitas   	= false;
	this.fajlNev2		= '';
	this.x2			= 0;
	this.y2			= 0;
	this.setImage1		= setImage1;
	this.setImage2		= setImage2;
	this.writeFoto 		= writeFoto;
	this.writeFotoAlt	= writeFotoAlt;
	this.writeFotoBig	= writeFotoBig;
}

function setImage1(iFajlNev, iX, iY)
{
	this.fajlNev1 = iFajlNev;
	this.x1 = iX;
	this.y1 = iY;
}

function setImage2(iFajlNev, iX, iY)
{
	this.nagyitas = true;
	this.fajlNev2 = iFajlNev;
	this.x2 = iX;
	this.y2 = iY;
}

function writeFoto(iZoom)
{
	if (this.nagyitas)
		document.write('<a href="' + imagesPath + '/' + this.fajlNev2 + '">');
		 
	document.write(
	'<img SRC="' + imagesPath + '/' + this.fajlNev1 +
	'" BORDER=0 NOSAVE width=' + (this.x1 * iZoom) +
	' height=' + (this.y1 * iZoom) + '>');
	
	if (this.nagyitas)
		document.write('</a>');
}

function writeFotoAlt(iZoom, iAltText)
{
	if (this.nagyitas)
		document.write('<a href="' + imagesPath + '/' + this.fajlNev2 + '">');
		 
	document.write(
	'<img SRC="' + imagesPath + '/' + this.fajlNev1 +
	'" BORDER=0 NOSAVE alt="' + iAltText + '" ' +
	'width=' + (this.x1 * iZoom) +
	' height=' + (this.y1 * iZoom) + '>');
	
	if (this.nagyitas)
		document.write('</a>');
}

function writeFotoBig(iZoom)
{
	if (this.nagyitas)
		document.write('<a href="' + imagesPath + '/' + this.fajlNev2 + '">');
		 
	document.write(
	'<img SRC="' + imagesPath + '/' + this.fajlNev2 +
	'" BORDER=0 NOSAVE width=' + (this.x2 * iZoom) +
	' height=' + (this.y2 * iZoom) + '>');
	
	if (this.nagyitas)
		document.write('</a>');
}

//----------------------------- MUFAJ DEF ----------------------------

// Mufaj kikeresese
function getMufaj(iMufajId)
{
	//document.writeln('<br>getMufaj: iMufajId=' + iMufajId);
	for (i=0; i<mufajArray.length; i++)
	{
		//document.writeln('<br> i=' + i + '; mufajArray[i].mufajId=' + mufajArray[i].mufajId);
		if (mufajArray[i].mufajId == iMufajId)
		{
			return mufajArray[i];
		}
	}
	return null;
}

// Mufaj Constructor
function Mufaj(iMufajId, iNev)
{
	this.mufajId 	= iMufajId;
	this.nev	= iNev;
	this.leiras	= '';
	this.foto	= null;
	this.writeMufaj = writeMufaj;
}

function writeMufaj()
{
  
}

// Mufajok
mufajArray = new Array();

// Uj mufaj hozzafuzese
function addMufaj(iMufaj)
{
	mufajArray[mufajArray.length] = iMufaj;
}

//----------------------------- KIALLITAS DEF ----------------------------

// Kiallitas Constructor
function Kiallitas(iKiallitasId, iCim)
{
	this.kiallitasId	= iKiallitasId;
	this.cim		= iCim; // kiallitas cime
	this.tol		= null;
	this.ig			= null;
	this.leiras		= ''; // egyedi v. csoportos kiallitas, 
	this.hely		= ''; // intezmeny, terem, cim
	this.szervezo		= ''; // intezmeny, szemely
	this.informacio		= ''; // tovabbi informaciok (tel, URL)
	this.foto		= null; // meghivo, plakat v. intezmeny
}

function writeKiallitas()
{
  
}

// Kiallitasok
kiallitasArray = new Array();

// Uj kiallitas hozzafuzese
function addKiallitas(iKiallitas)
{
	kiallitasArray[kiallitasArray.length] = iKiallitas;
}


