var crt = 0;
var notclose = 1;
var array_vals = new Array();
array_vals[0] = "prima clinica din Romania ce opereaza cu tehnologia laser Allegretto Wave";
array_vals[1] = "Telefon: 0256 292 295&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Str. Romulus, nr. 41";
var x = document.getElementById('popupb') || 1;
var nv = (navigator.appName.indexOf("Netscape") != -1) || window.opera;

var ajax_handler="lib/ajax_handler.php";

function initSettings()
{
	MM_preloadImages('media/img/mnu/home_on.jpg','media/img/mnu/functii_on.jpg','media/img/mnu/tratament_on.jpg','media/img/mnu/avantaj_on.jpg','media/img/mnu/calitate_on.jpg','media/img/mnu/rezultate_on.jpg','media/img/mnu/consideratii_on.jpg','media/img/popup/detalii_over.png','media/img/popup/contact_over.png');	
	
	if(document.getElementById('popupb')){
		setTimeout("goBottom()",100);
		setTimeout("efect1()",1000);
		window.onscroll = function(){ goBottom(); //setTimeout("goBottom()",500);
		};
	}
}

function showExtended(){
	Effect.SlideDown('h_popup_on', { duration: 0.5 });
	//Effect.SlideUp('h_popup_off', { duration: 1.0 });
	bkf = document.getElementById('bkg_f');
	bkf.style.width = document.body.clientWidth+ 'px';
	bkf.style.height = document.body.clientHeight+ 'px';
	bkf.style.visibility = 'visible';
}

function hideExtended(){
	Effect.SlideUp('h_popup_on', { duration: 0.5 });
	bkf.style.visibility = 'hidden';
}

function goBottom()
{
	if(notclose == 0) return;
	x = document.getElementById('popupb');
	scrTop  = nv ? pageYOffset : ieTest().scrollTop;
	x.style.top = (bodySize('H')+ scrTop - x.clientHeight) + 'px';
	x.style.visibility = 'visible';
	Effect.Appear('popupb',{duration:0.9, from:0,to:0.8});
}

function efect1()
{
	document.getElementById('pf').style.visibility = 'visible';
	document.getElementById('pf').innerHTML = array_vals[crt]; crt = Math.abs(crt-1);
	Effect.Appear('pf',{duration:0.9,from:0,to:1,afterFinishInternal:function(){setTimeout("ef_fade()",3000)} });
}

function ef_apear()
{
	document.getElementById('pf').innerHTML = array_vals[crt]; crt = Math.abs(crt-1);
	if(notclose)
	Effect.Appear('pf',{duration:0.9, from:0,to:1,afterFinishInternal:function(){setTimeout("ef_fade()",3000);}});
}

function ef_fade()
{
	Effect.Fade('pf',{duration:0.9, from:1,to:0,afterFinishInternal:function(){setTimeout("ef_apear()",500);}});
}

function hidePopup()
{
	//Effect.SwitchOff('popupb');
	new Effect.Move(document.getElementById('popupb'), { duration:0.4, x: 0, y: 80,afterFinishInternal:function(){document.getElementById('popupb').style.display='none';} });
	notclose = 0;
	//disablePopup();
	send_request(site_root+'lib/ajax_handler.php?action=disable_popup');
}

function disablePopup()
{
	var ajax = new Ajax.Request (
					ajax_handler,
					{
						parameters:"&action=disable_popup",
						method:'post', 
						onFailure: function (t)
						{ 
							//alert("ajax communication error occured"); 					
						},
						onLoading: function(t){},
						onComplete: function (t){
							alert(t.responseText);
							}
					} 
			 );		
}

function setCookie(value)
	{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+1);
	document.cookie="banner_at=" +value+";path=/;domain=laser-allegretto.ro;expires="+exdate.toGMTString();
	}	
