/* AJAX-hoz */

function requestCustomerInfo($id) {
	top.frames["hiddenFrame"].location = "./pages/szallashely_kepek.php?id=" + $id;
}

function displayCustomerInfo($text, $id) {
	$puff = "divReklamKepek_" + $id;
	var divCustomerInfo = document.getElementById($puff);		
	divCustomerInfo.innerHTML = $text;
	LyteBox.prototype.updateLyteboxItems();	
}

function futtasd_ezt($ez, $target, $command, $page) {

	$ez = $ez + "?tar=" + $target + "&com=" + $command + "&page=" + $page;
//	alert($ez);
	top.frames["hiddenFrame"].location = $ez;	
}

function rakd_ezt_ide($cucc, $ide) {
	$puff = "" + $ide;
	var hova = document.getElementById($puff);		
	hova.innerHTML = $cucc;
//	LyteBox.prototype.updateLyteboxItems();	
}

/* galériához  */
	$eger_kintvan_e = false;
	$ablak_kintvan_e = false;

	function mutat(){
		document.getElementById('light').style.display='block';
		document.getElementById('fade').style.display='block';
		$ablak_kintvan_e = true;
	}

	function rejt(){
		document.getElementById('light').style.display='none';
		document.getElementById('fade').style.display='none';
		$ablak_kintvan_e = false;
	}


/* galériához vége */




/* scroll */


 var pos = 0;  
 function Scroll() {  
   if (!document.getElementById) return;  
   obj=document.getElementById("scroll_up");  

   pos -= 10;

   if (pos < 0 - obj.offsetHeight) {	
	   	$puff = Math.round(Math.random()*10);
//		alert ( $puff ) ;
	if ($puff < 10 ) $puff += 1; else $puff = 1;

	document.scroll_kep.src = 'pics/top/' + $puff + '.jpg';
	
	obj.style.height = document.scroll_kep.height + 'px';
	pos = 0;  
//	alert ( obj.style.height ) ;
//   	return;  
   }
	
   obj.style.top=pos + 'px';    
   window.setTimeout("Scroll();", 40);   
 }  


/*   cserel    */
 function cserel($x) {  
   if (!document.getElementById) return;  

	if ($x < 10 ) $x += 1; else $x = 1;

	document.scroll_kep.src = 'pics/top/' + $x + '.jpg';

//	alert ('csere');
   window.setTimeout("cserel(" + $x + ");", 10000); 
 }  


/* reklám középre*/

function reklam(width,height){

var div = document.getElementById('reklam');

div.style.width = width + "px";
div.style.height = height + "px";

div.style.left = (parseInt(document.body.clientWidth)-parseInt(div.style.width))/2;
div.style.top = (parseInt(document.body.clientHeight)-parseInt(div.style.height))/2;
}


function mutat_rejt(mit){
// alert ( document.getElementById(mit).style.display );

if ((document.getElementById(mit).style.display == 'none') || (document.getElementById(mit).style.display == '')){
	document.getElementById(mit).style.display = 'block';
}
else
	document.getElementById(mit).style.display = 'none';
}









function adatok(){
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth + '\n\r' + 'Height = ' + myHeight );
}

function meretre($mit){
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth + '\n\r' + 'Height = ' + myHeight );


	var div = document.getElementById($mit);
	
	myWidth = myWidth - 30 ;
	myHeight = myHeight - 30;
	
	div.style.width = myWidth + "px";
	div.style.height = myHeight + "px";
	
}


function ekkorara($mit, $w, $h){

	var div = document.getElementById($mit);
	
	div.style.width = $w + "px";
	div.style.height = $h + "px";
	
}

/* -----------------------------  pics changer-hez  ---------------------------------------------- */

var picsmax = 82;


function ujkep(){
	num = Math.round( Math.random() * (picsmax-1) )+1;
	fajl = num +'.jpg';
//	alert( document['bann_pic_1'].src +'\n\r'+ document['bann_pic_2'].src +'\n\r'+ document['bann_pic_3'].src +'\n\r'+ document['bann_pic_4'].src +'\n\r'+ kep);
/*
var hova = document.getElementById('mutat');		
	hova.innerHTML = document['bann_pic_1'].src.substring(document['bann_pic_1'].src.lastIndexOf("/")+1) +'<br>'+ 
					 document['bann_pic_2'].src.substring(document['bann_pic_2'].src.lastIndexOf("/")+1) +'<br>'+ 
					 document['bann_pic_3'].src.substring(document['bann_pic_3'].src.lastIndexOf("/")+1) +'<br>'+ 
					 document['bann_pic_4'].src.substring(document['bann_pic_4'].src.lastIndexOf("/")+1) +'<br>'+ fajl;
*/	
	while( !((document['bann_pic_1'].src.substring(document['bann_pic_1'].src.lastIndexOf("/")+1) != fajl) &&
			 (document['bann_pic_2'].src.substring(document['bann_pic_2'].src.lastIndexOf("/")+1) != fajl) && 
			 (document['bann_pic_3'].src.substring(document['bann_pic_3'].src.lastIndexOf("/")+1) != fajl) && 
			 (document['bann_pic_4'].src.substring(document['bann_pic_4'].src.lastIndexOf("/")+1) != fajl) )){
		num = Math.round( Math.random() * (picsmax-1) )+1;
		fajl = num +'.jpg';
	}
	return 'pics/top_pics/' + fajl;
}

function opacity_uj(id, millisec) { 
//	alert(id);
    //speed for each frame 
    var speed = Math.round(millisec / 1000); 
    var timer = 0; 


    //determine the direction for the blending, if start and end are the same nothing happens 
        for(i = 100; i >= 0; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
		
		document[id].src = ujkep();
		
	timer = 0; 
        for(i = 0; i <= 100; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 	

} 


//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function change_header_pics(hanykep){
	
	melyikkepet = Math.round( Math.random() * (hanykep-1) )+1;
	keses = Math.round( Math.random() * (3000) );

	id = "bann_pic_" + melyikkepet;
	
	opacity_uj(id, 2); 

	setTimeout("change_header_pics(" + hanykep + ")", (6000 + keses));

}
