var ie = (document.all)? 1 : 0 ;
var ns = (document.getElementById)? 1 : 0 ;
var ns4 = (document.layers)? 1 : 0 ;

function DetectBrowser(){ //Detectarea browserului folosit
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new DetectBrowser();


//----------------------------------------------------------------------------------------------------
//        Efectul de FADEin and FADEout ...
var viteza=4;
var ok1=0;
var opacity1=100;
var opacity2=40;
var opacity3=40;
var opacity4=40;
var imag="";


function efectOn1()
{imag="p1";
if(navigator.appName=="Microsoft Internet Explorer"){
efectOut(1);
if(window.timer11) clearTimeout(timer11);
if(opacity1<100){opacity1+=viteza;
                 img=eval("document."+imag);
                 img.style.filter='alpha(opacity=' + (opacity1)  + ')';
                 timer1=setTimeout("efectOn1()",50);
                 }
            else if(window.timer1) clearTimeout(timer1);
}}

function efectOn2()
{imag="p2";
if(navigator.appName=="Microsoft Internet Explorer"){
efectOut(2);
if(window.timer22) clearTimeout(timer22);
if(opacity2<100){opacity2+=viteza;
                 img=eval("document."+imag);
                 img.style.filter='alpha(opacity=' + (opacity2)  + ')';
                 timer2=setTimeout("efectOn2()",50);
                 }
            else if(window.timer2) clearTimeout(timer2);
}}

function efectOn3()
{imag="p3";
if(navigator.appName=="Microsoft Internet Explorer"){
efectOut(3);
if(window.timer33) clearTimeout(timer33);
if(opacity3<100){opacity3+=viteza;
                 img=eval("document."+imag);
                 img.style.filter='alpha(opacity=' + (opacity3)  + ')';
                 timer3=setTimeout("efectOn3()",50);
                 }
            else if(window.timer3) clearTimeout(timer3);
}}

function efectOn4()
{imag="p4";
if(navigator.appName=="Microsoft Internet Explorer"){
efectOut(4);
if(window.timer44) clearTimeout(timer44);
if(opacity4<100){opacity4+=viteza;
                 img=eval("document."+imag);
                 img.style.filter='alpha(opacity=' + (opacity4)  + ')';
                 timer4=setTimeout("efectOn4()",50);
                 }
            else if(window.timer4) clearTimeout(timer4);
}}


function efectOut1()
{ok1=1;
if(navigator.appName=="Microsoft Internet Explorer"){
if(window.timer1) clearTimeout(timer1);
if(opacity1>40){opacity1-=viteza;
                 img=eval("document.p1");
                 img.style.filter='alpha(opacity=' + (opacity1)  + ')';
                 timer11=setTimeout("efectOut1()",50);
                 }
            else if(window.timer11) clearTimeout(timer11);
}}

function efectOut2()
{
if(navigator.appName=="Microsoft Internet Explorer"){
if(window.timer2) clearTimeout(timer2);
if(opacity2>40){opacity2-=viteza;
                 img=eval("document.p2");
                 img.style.filter='alpha(opacity=' + (opacity2)  + ')';
                 timer22=setTimeout("efectOut2()",50);
                 }
            else if(window.timer22) clearTimeout(timer22);
}}

function efectOut3()
{
if(navigator.appName=="Microsoft Internet Explorer"){
if(window.timer3) clearTimeout(timer3);
if(opacity3>40){opacity3-=viteza;
                 img=eval("document.p3");
                 img.style.filter='alpha(opacity=' + (opacity3)  + ')';
                 timer33=setTimeout("efectOut3()",50);
                 }
            else if(window.timer33) clearTimeout(timer33);
}}

function efectOut4()
{
if(navigator.appName=="Microsoft Internet Explorer"){
if(window.timer4) clearTimeout(timer4);
if(opacity4>40){opacity4-=viteza;
                 img=eval("document.p4");
                 img.style.filter='alpha(opacity=' + (opacity4)  + ')';
                 timer44=setTimeout("efectOut4()",50);
                 }
            else if(window.timer44) clearTimeout(timer44);
}}


function efectOut(img_nr)
{
if( ((window.timer1)&&(img_nr!=1))||(!ok1) ) efectOut1();
if( (window.timer2)&&(img_nr!=2) ) efectOut2();
if( (window.timer3)&&(img_nr!=3) ) efectOut3();
if( (window.timer4)&&(img_nr!=4) ) efectOut4();
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}




function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_reloadPage() {  //reloads the window if resized
  location.reload();
}

function popup(adresa, w, h, scr){
var l=(screen.availWidth-w)/2 , t=(screen.availHeight-h)/2;
win=window.open(adresa,"_blank","width="+w+",height="+h+",left="+l+",top="+t+",statusbar=no,toolbar=no,scrollbars="+scr+",navbar=no");
win.focus();
}
//onresize = MM_reloadPage;

function createMarker(point, descriere) {
  var marker = new GMarker(point);
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(descriere);
  });
  return marker;
}

function createMarker(point, descriere) {
  var marker = new GMarker(point);
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(descriere);
  });
  return marker;
}


