hex=255 // Initial color value.
	i=-5;
function fadetext(id){ 
	if(hex>0 && hex<256) { //If color is not black yet
	
		hex+=i; // increase color darkness
		a=hex<199?199:hex;
		x=hex<104?104:hex;
//		x=hex*104/255;199 104 0
		document.getElementById(id).style.color="rgb("+a+","+x+","+hex+")";
		setTimeout("fadetext('"+id+"')",1); 
	}else{
		i*=-1;
		hex+=i;
		setTimeout("fadetext('"+id+"')",1);
	}
}

function kepcseren(){
	var n=16;
	var it=new Array();
	it[0]=Math.round(Math.random()*(n-1))+1;
	it[1]=Math.round(Math.random()*(n-1))+1;
	it[2]=Math.round(Math.random()*(n-1))+1;
	while(it[0]==it[1] || it[0]==it[2] || it[1]==it[2]){
		if(it[0]==it[1]){
			it[0]=Math.round(Math.random()*(n-1))+1;
			it[1]=Math.round(Math.random()*(n-1))+1;
		}else if(it[0]==it[2]){
			it[0]=Math.round(Math.random()*(n-1))+1;
			it[2]=Math.round(Math.random()*(n-1))+1;
		}else{
			it[1]=Math.round(Math.random()*(n-1))+1;
			it[2]=Math.round(Math.random()*(n-1))+1;
		}
	}
	for (k=1; k<=3; k++)
	{
		document.getElementById("kep"+k).src="images/deco/nn_"+it[k-1]+".jpg"; //itt hasznalod az a-t
		document.getElementById("kepcim"+k).href="javascript:example2('example.php?id="+(it[k-1]+129)+"')";
	}
	var t=setTimeout("kepcseren()",10000);
}
function kepcserek(){
	var n=25;
	var it=new Array();
	it[0]=Math.round(Math.random()*(n-1))+1;
	it[1]=Math.round(Math.random()*(n-1))+1;
	it[2]=Math.round(Math.random()*(n-1))+1;
	while(it[0]==it[1] || it[0]==it[2] || it[1]==it[2]){
		if(it[0]==it[1]){
			it[0]=Math.round(Math.random()*(n-1))+1;
			it[1]=Math.round(Math.random()*(n-1))+1;
		}else if(it[0]==it[2]){
			it[0]=Math.round(Math.random()*(n-1))+1;
			it[2]=Math.round(Math.random()*(n-1))+1;
		}else{
			it[1]=Math.round(Math.random()*(n-1))+1;
			it[2]=Math.round(Math.random()*(n-1))+1;
		}
	}
	for (k=1; k<=3; k++)
	{
		document.getElementById("kep"+k).src="images/deco/nk_"+it[k-1]+".jpg"; //itt hasznalod az a-t
		document.getElementById("kepcim"+k).href="javascript:example2('ponti_image_big.php?cim=images/noilap/n_"+it[k-1]+".jpg')";
	}
	var t=setTimeout("kepcserek()",10000);
}

function dokukepcsere(a,n){//az a-val mondod meg neki, hogy melyik temakor kepeit akarod
	//alert(n);
	//alert(a);
	if(n==-1)n=101;
	var it=new Array();
	it[0]=Math.round(Math.random()*(n-1))+1;
	it[1]=Math.round(Math.random()*(n-1))+1;
	it[2]=Math.round(Math.random()*(n-1))+1;
	while(it[0]==it[1] || it[0]==it[2] || it[1]==it[2]){
		if(it[0]==it[1]){
			it[0]=Math.round(Math.random()*(n-1))+1;
			it[1]=Math.round(Math.random()*(n-1))+1;
		}else if(it[0]==it[2]){
			it[0]=Math.round(Math.random()*(n-1))+1;
			it[2]=Math.round(Math.random()*(n-1))+1;
		}else{
			it[1]=Math.round(Math.random()*(n-1))+1;
			it[2]=Math.round(Math.random()*(n-1))+1;
		}
	}
	for (k=1; k<=3; k++)
	{
		document.getElementById("kep"+k).src="images/deco/"+a+it[k-1]+".jpg"; //itt hasznalod az a-t
	}
	//ez került be újonnan
		var s="dokukepcsere('"+a+"',"+n+")";
//		alert(s);
		var t=setTimeout("dokukepcsere('"+a+"',"+n+")",10000);
	//eddig
}
function hatterkep1(){
	//document.body.background="../images/background/bgn"+Math.round(Math.random()*17)+1;
	document.body.background="../images/background/bgn"+(Math.round(Math.random()*17)+1)+".jpg";
}
function hatterkep2(x){
			

	if (x=="ker")
	{
		document.getElementById("kepablak").background="./images/background/bgn"+(Math.round(Math.random()*17)+1)+".jpg";
	}
	else if (x=="moz")
	{
		document.getElementById("kepablak").background="./images/background/bgnm"+(Math.round(Math.random()*1)+1)+".jpg";
	}
}

function alma123(){
	document.getElementById("alma").innerHTML='<B>Mouseout to change back.</B>';
}

function example(page){
	newWindow=window.open(page,"ablak","width=450,height=450,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no");
}

function example2(page){
	newWindow=window.open(page,"ablak","width=650,height=650,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no");
}

function example3(page){
	newWindow=window.open(page,"ablak","width=575,height=575,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no");
}

function example4(page){
	newWindow=window.open(page,"ablak","width=300,height=200,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no");
}

function f(x){
	
	if (x=="action")
	{
		
		hatterkep1();
		example(page);
	}
	else if (x=="ref")
	{
		hatterkep1();
		example2(page);
	}
	else if(x=="ser")
	{
		hatterkep1();
	}
	else if(x=="ele")
	{
		hatterkep1();
		example3(page);
	}
}

function initImage() {
	imageId1 = 'thephoto1';
	image1=document.getElementById(imageId1);
	setOpacity(image1,0);
	imageId = 'thephoto2';
	image = document.getElementById(imageId);
	setOpacity(image, 100);
	image.style.visibility = "visible";
//	fadeIn(imageId,0);
//	fadeOut(imageId,100);
	rajzol();
}
function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 1;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}
function fadeOut(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 1;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
		}
	}
}
function fadeInOut(objId_in,objId_out,opacity,serNo){
	if (document.getElementById) {
		obj_in = document.getElementById(objId_in);
		obj_out = document.getElementById(objId_out);
		if (opacity <= 100) {
			setOpacity(obj_in, opacity);
			setOpacity(obj_out, 100-opacity);
			opacity += 1;
			window.setTimeout("fadeInOut('"+objId_in+"','"+objId_out+"',"+opacity+","+serNo+")", 100);
		}else{
			obj_out.src="./images_bg/"+serNo+".jpg";
			setOpacity(obj_out,100);
			setOpacity(obj_in,0);
			serNo++;
			if(serNo==12)serNo=1;
			obj_in.src="./images_bg/"+serNo+".jpg";
			opacity=0;
			window.setTimeout("fadeInOut('"+objId_in+"','"+objId_out+"',"+opacity+","+serNo+")", 10000);
		}
	}
}

function rajzol(){
	imageID1 = 'thephoto1';
	imageID2 = 'thephoto2';
	opacity=100;
	fadeInOut(imageID2,imageID1,opacity,1);
}



function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

