/* <script language="JavaScript" type="text/javascript"> */

/* variabila globala */

var data=new Date();
var luna=new Array("ianuarie","februarie","martie","aprilie","mai","iunie","julie","august","septembrie","octombrie","noiembrie","decembrie");
var Ziua=data.getDate() + " " + luna[data.getMonth()] + " " + data.getFullYear();
var Versiune=parseInt(navigator.appVersion.split("MSIE")[1]);


/* functie */

function AfisareTimp(obiect)
	{
	var acum=new Date();
	var ora=acum.getHours();
	var minut=acum.getMinutes();
	var secunda=acum.getSeconds();
	if (ora<10)	{
		ora="0"+ora;}
	if (minut<10)	{
		minut="0"+minut;}
	if (secunda<10)	{
		secunda="0"+secunda;}
	document.getElementById(obiect).value=" "+ora+":"+minut+":"+secunda+" ";
	setTimeout("AfisareTimp('"+obiect+"')",1000);
	}

function IncarcaImagine()
	{
	with (document)	{
	var imagine=new Array();
	for(i=0;i<getElementsByTagName('img').length;i++)	{
		imagine[i]=new Image();
		imagine[i].src=getElementsByTagName('img')[i].src;}}
	}

function PanouFilm(obiect,ecran,lungime,frecventa)	{
	this.ecran=ecran;
	this.frecventa=frecventa;
	this.halta=true;
	this.lungime=lungime;
	this.obiect=document.getElementById(obiect);
	this.proces=0;
	this.sens=0;
	this.stinga=0;
	return this;
	}

PanouFilm.prototype=	{
	Afisare:function(referinta)	{
		with (referinta)	{
		if (sens==0)	{
			halta=true;}
		else	{
			if ((sens<0 && stinga==-lungime+ecran) || (sens>0 && stinga==0))	{
			halta=true;}
			else	{
			halta=false;
			stinga+=sens;
			obiect.style.left=stinga+"px";
			proces=window.setTimeout(function() {Afisare(referinta);},frecventa);}}
		if (halta)	{
			window.clearTimeout(proces);}}}
	}

function PanouRadio(obiect,locatie,numar,lista,format,frecventa)	{
	this.cintec=1;
	this.clapeta=new Array(false,false,false,true,false,false);
	this.durata=0;
	this.format=format;
	this.frecventa=frecventa;
	this.lista=lista;
	this.locatie=locatie;
	this.numar=numar;
	this.obiect=document.getElementById(obiect);
	this.pornit=false;
	this.volum=-1000;
	return this;
	}

PanouRadio.prototype.Afisare=function(referinta)	{
		with (referinta)	{
		if (clapeta[1] || clapeta[2] || clapeta[3] || clapeta[4] || clapeta[5])	{
		if (clapeta[3])	{
			clapeta[3]=false;
			obiect.src="";
			pornit=false;}
		else if (clapeta[2])	{
			clapeta[2]=false;
			volum-=100;
			obiect.volume=volum;}
		else	{
			if (clapeta[1])	{
			if (cintec>1)	{
			cintec--;}
			clapeta[1]=false;}
			if (clapeta[4])	{
			clapeta[4]=false;
			pornit=true;}
			if (clapeta[5])	{
			if (cintec<numar)	{
			cintec++;}
			clapeta[5]=false;}
			if (pornit)	{
			obiect.src=locatie+cintec+format;}}}
		window.setTimeout(function() {Afisare(referinta);},frecventa);}
	}

function LupaImagine(obiect,cursor,lupa,lentila,marja,raport)	{
	this.cursor=cursor;
	this.lentila=lentila;
	this.lupa=lupa;
	this.marja=marja;
	this.obiect=obiect;
	this.raport=raport;
	this.ramaX=0;
	this.ramaY=0;
	this.reperX=0;
	this.reperY=0;
	this.stare=2;
	with (obiect[2].style)	{
	height=(lupa+20)+"px";
	width=lupa+"px";}
	with (obiect[3].style)	{
	height=lentila+"px";
	left=(lupa-lentila)/2+"px";
	top=(lupa-lentila)/2+"px";
	width=lentila+"px";}
	this.Anulare();
	return this;
	}

LupaImagine.prototype.Anulare=function()	{
	with (this)	{
	if (stare==2)	{
		obiect[1].style.cursor="pointer";
		with (obiect[2].style)	{
		left="20px";
		top="30px";}
		with (obiect[5].style)	{
		left=lentila+"px";
		top=lentila+"px";}
		stare=0;}}
	}

LupaImagine.prototype.Initiere=function(cod)	{
	with (this)	{
	if (cod==0)	{
		with (obiect[4])	{
		ramaX=offsetLeft;
		ramaY=offsetTop+marja+lupa/2;}
		with (obiect[1])	{
		reperX=offsetLeft+obiect[0].offsetLeft;
		reperY=offsetTop+obiect[0].offsetTop;
		style.cursor="url("+cursor+")";}
		stare=1;}
	else if (stare==1)	{
		stare=2;}}
	}

LupaImagine.prototype.Navigare=function()	{
	with (this)	{
	if (stare>0)	{
		with (document.documentElement)	{
		var x=event.clientX+scrollLeft-reperX;
		var y=event.clientY+scrollTop-reperY;}
		if (x>=0 && y>=0)	{
			with (obiect[2].style)	{
			left=(x-lupa/2)+"px";
			top=(y-lupa-marja)+"px";}
			with (obiect[5].style)	{
			left=(lentila/2-(x-ramaX)*raport)+"px";
			top=(lentila/2-(y-ramaY)*raport)+"px";}}}}
	}

function SchimbareImagine(obiect,imagine)	{
	var pozitie;
	document.getElementById(obiect+imagine).style.zIndex=-2;
	pozitie=document.getElementById(obiect+(++imagine));
	if (pozitie==null)	{
		imagine=1;
		pozitie=document.getElementById(obiect+"1");}
	with (pozitie.style)	{
		filter="alpha(opacity=100)";
		opacity=1;
		zIndex=0;}
	pozitie=document.getElementById(obiect+(++imagine));
	if (pozitie==null)	{
		pozitie=document.getElementById(obiect+"1");}
	with (pozitie.style)	{
		filter="alpha(opacity=50)";
		opacity=0.5;
		zIndex=-1;}
	}

function TrimiteMesaj(macheta,limba)	{
	with (document.getElementById(macheta))	{
	if (contactNume.value.length==0)	{
		alert("Nume necompletat !");}
	else if (contactPrenume.value.length==0)	{
		alert("Prenume necompletat !");}
	else if (contactLocalitate.value.length==0)	{
		alert("Localitate necompletatå !");}
	else if (contactAdresa.value.length==0)	{
		alert("Adresa e-mail necompletatå !");}
	else if (contactTelefon.value.length==0)	{
		alert("Telefon necompletat !");}
	else if (contactSubiect.value.length==0)	{
		alert("Rezervare necompletatå !");}
	else	{
		action="CasaContact.php?context="+limba+"&contact=1";submit();}}
	}

function SelectieContext(limba,optiune,casa)	{
	optiune="CasaPagina.php?context="+limba+"&optiune="+optiune;
	if (casa==0)	{
		optiune=optiune+"&casa="+casa;}
	window.open(optiune,"_self");
	}

function DetaliuImagine(imagine,titlu)	{
	obiect=window.open('','_blank','left='+(screen.availWidth/2-125)+',height=100,top='+(screen.availHeight/2-50)+',width=100,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0',0);
	with (obiect.document)	{
	writeln('<title>.. '+titlu+' ...</title>');
	writeln('<body bgcolor="#EEEEEE" style="color:red;margin:0px;"><i>... &icirc;nc&atilde;rcare imagine;</i><img src="'+imagine+'" style="left:0;position:absolute;top:0;" /></body>');
	imagine=getElementsByTagName('img')[0];
	imagine.onload=function()	{
		if (Versiune<7) {latime=0;} else {latime=148;}
		with (obiect)	{
		moveBy(-imagine.clientWidth/2+125,-imagine.clientHeight/2+50);
		resizeBy(imagine.clientWidth-latime-102,imagine.clientHeight-100);}}}
	}

/* </script> */

