/*
id - background (DIV) ID
id2 - foreground (DIV) ID -> ebbe megy a tartalom
value - áttetszőségi szám (0 - 100; 0 = teljesen átlátszó, 100 = nem átlátszó)
bgColor - background DIV's color
fgW - foreground DIV's width
fgH - foreground DIV's height
v - kezdeti áttetszőségi szám
*/
//DIV eltűntetése
function setDisplay(id){
	document.getElementById(id).style.display = 'none';
}

//HÁTTÉR megjelenítése
function fadeInBackground(id, value, bgColor) {
	//contentDiv = document.createElement("div")
	//contentDiv.setAttribute("style", "position: absolute; left: 0px; top: 0px; display: none;");
	//contentDiv.setAttribute("id", id);
	//contentDiv.style.position = 'absolute';
	//contentDiv.style.top = '0px';
	//contentDiv.style.left = '0px';
	//document.getElementsByTagName("body").item(0).appendChild(contentDiv);
	
	var contentDiv = document.getElementById(id);
	
	contentDiv.style.display = 'block';
	contentDiv.style.height = document.body.scrollHeight+'px';
	contentDiv.style.width = document.body.scrollWidth+'px';
	contentDiv.style.backgroundColor = bgColor;
	contentDiv.style.zIndex = '99';
	
	if(contentDiv.style.filter != undefined){
    	contentDiv.style.filter = "alpha(opacity='"+value+"');";
  	}else{
    	contentDiv.style.opacity = ""+(value/100);
  	}
}
//ELŐTÉR megjelenítése
function fadeInForeground(id2, fgW, fgH){
	var contentDiv2 = document.getElementById(id2);
	
	contentDiv2.style.zIndex = '100';
	contentDiv2.style.width = fgW+'px';
	contentDiv2.style.height = fgH+'px';
	contentDiv2.style.left = '50%';
	
	contentDiv2.style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight/2)+'px';
	
	contentDiv2.style.marginLeft = '-'+(fgW/2)+'px';
	contentDiv2.style.marginTop = '-'+(fgH/2)+'px';
	contentDiv2.style.display = 'block';
}
//ANIMÁCIÓ
function fadeInBgAnim(id, value, bgColor, v){
	v+=2;
	document.getElementById('messageDiv').innerHTML = ''+v+'-'+value;
	fadeInBackground(id, v, bgColor);
	if(v < value){
		setTimeout("fadeInBgAnim('"+id+"', "+value+", '"+bgColor+"', "+v+")", 20);
	}
}
//LEGYEN ANIMÁCIÓ VAGY NE
function fadeInAorN(id, value, bgColor, v){
	if(v > -1){
		fadeInBgAnim(id, value, bgColor, v);
	}else{
		fadeInBackground(id, value, bgColor);
	}
}

//Dinamikusan generált oldal esetén
function fadeInForeground_Dyn(id2){
	var contentDiv2 = document.getElementById(id2);
	
	contentDiv2.style.zIndex = '100';
	contentDiv2.style.width = contentDiv2.scrollWidth+'px';
	contentDiv2.style.height = contentDiv2.scrollHeight+'px';
	contentDiv2.style.left = '50%';
	
	contentDiv2.style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight/2)+'px';
	
	contentDiv2.style.marginLeft = '-'+(contentDiv2.style.width/2)+'px';
	contentDiv2.style.marginTop = '-'+(contentDiv2.style.height/2)+'px';
	contentDiv2.style.display = 'block';
}
function fadeInBackground_Dyn(id, value, bgColor, plus, mainid) {
	var contentDiv = document.getElementById(id);
	
	contentDiv.style.display = 'block';
	contentDiv.style.height = (document.getElementById(mainid).scrollHeight+plus)+'px';
	contentDiv.style.width = document.body.scrollWidth+'px';
	contentDiv.style.backgroundColor = bgColor;
	contentDiv.style.zIndex = '99';
	
	if(contentDiv.style.filter != undefined){
    	contentDiv.style.filter = "alpha(opacity='"+value+"');";
  	}else{
    	contentDiv.style.opacity = ""+(value/100);
  	}
}