var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version <7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}



function calculateh(){

	var browser=navigator.appName;
	var divStangaH=document.getElementById('stanga').offsetHeight;
	var divDreaptah=document.getElementById('header').offsetHeight;

	//var menuh=document.getElementById('menu').offsetHeight;
	switch(browser){
	case 'Opera':
	
	wheight=document.documentElement.clientHeight-25;
	
	break;
	case 'Netscape':
	wheight=document.documentElement.clientHeight -25;
	break;
	case 'Microsoft Internet Explorer':
	wheight=document.documentElement.clientHeight  -25;
	break;
	}
	rr=wheight-headh-conh-footh;

	if(rr>0){
	document.getElementById('gunoi').style.height=rr.toString()+"px";
	}
	
}





function schimbapoza(g){
document.getElementById('pozalista').src=g;
}


function expFromFl(what){
	what=what.substr(1,what.length-2)
	myFdbk='';
	myFdbk+='<img src="'+what+'" alt="" style="width:100%" />';
	 //hs.expand (document.getElementById("maincontent"), { src: what } );
}






var curentelement=0;
var timpschimb=true;

function next(){
	
	dd=document.getElementById('pozapreview'+curentelement);
	//tid=document.getElementById('titlupreview'+curentelement);
		curentelement++;
	dn=document.getElementById('pozapreview'+curentelement);
	//tin=document.getElementById('titlupreview'+curentelement);
	if(dn){
		dd.style.display='none';
		dn.style.display='block';
		//tid.style.display='none';
		//tin.style.display='block';
		return true;
	
	} else {
	curentelement--;
	if(curentelement<0)
		curentelement=0;
		return false;
	}

}
function previous(){
	
	dd=document.getElementById('pozapreview'+curentelement);
	//tid=document.getElementById('titlupreview'+curentelement);
		curentelement--;
		if(curentelement<0)
			curentelement=0;
			
	dn=document.getElementById('pozapreview'+curentelement);
	//tin=document.getElementById('titlupreview'+curentelement);
	
	if(dn){
		dd.style.display='none';
		dn.style.display='block';
		//tid.style.display='none';
		//tin.style.display='block';
		return true;
	
	} else {
	curentelement++;
	if(curentelement<0)
		curentelement=0;
	}
	return false;

}

function schimbatimp(){

	if(timpschimb){
		if(!next()){
			previous();
		}
		
	}
setTimeout('schimbatimp()',10000)
}


function stopplay(t){
if(timpschimb){
	t.innerHTML=">";
} else {
t.innerHTML="||";
}
timpschimb=(!timpschimb);
}

function replacePoza(el){
	
dd=document.getElementById('pozapreview'+curentelement);

	curentelement=el
			
	dn=document.getElementById('pozapreview'+curentelement);
		dd.style.display='none';
		dn.style.display='block';
	//document.getElementById(id).src=picString;	
}


















function stiva(){
	this.allow=0;
	this.sens=1;
	this.yposit=0;
	this.factor=2;
	this.maheight=636;
}

function inceput(){
	startbanner();
	/*tempocent=document.getElementById('contentcentru');
	inaltimecentru=tempocent.offsetHeight;
	
	divulmiscare=document.getElementById('movezone');
	leftcolo=document.getElementById('colleft');
	leftcolo.style.height=inaltimecentru+"px";
	sss=inaltimecentru-110;
	divulmiscare.style.height=sss+"px";

	stoc.maheight=inaltimecentru-110;

	var IE = document.all?true:false;
	elementul=document.getElementById('mousearea');
	if(IE){
		elementul.attachEvent("onmousemove",showcoo);
		elementul.attachEvent("onmouseout",stopmove);
	} else {
		elementul.setAttribute("onmousemove","showcoo(event)");
		elementul.setAttribute("onmouseout","stopmove()");
	}*/
	
	
	
	
}
stoc=new stiva();
function showcoo(e){
		var IE = document.all?true:false;
		var gg=document.getElementById('yco');
		var mm=document.getElementById('xco');
	if(IE){
		xxval=e.offsetX;
		//yyval=e.offsetY;
		yyval=e.clientY + document.documentElement.scrollTop;
		//trg=e.target?e.target:e.srcElement;
		pffy=findPosition(document.getElementById('mousearea'));
		yyval=yyval-pffy;
	
	} else {
	//trg=e.target?e.target:e.srcElement;
	trg=document.getElementById('mousearea');
	pff=trg.offsetLeft;
	pffy=trg.offsetTop;
	
	
	xxval=e.pageX?e.pageX:e.clientX;
	yyval=e.pageY?e.pageY:e.clientY;

	xxval=xxval-pff;
	yyval=yyval-pffy;
	}
	if(yyval<20 || yyval>stoc.maheight+50){
	stoc.factor=10;
	} else {
	stoc.factor=1;
	}
	
	if(yyval<50 && stoc.allow==0){
		stoc.sens=1;
		stoc.allow=1;
		
		startmove();
		trg.style.cursor='hand';
	}
	if(yyval>stoc.maheight-14 && stoc.allow==0){
		stoc.sens=-1;
		stoc.allow=1;
		trg.style.cursor='hand';
		startmove();
	}
	if(yyval<stoc.maheight-14 && yyval>50){
		stoc.allow=0;
	trg.style.cursor='default';
	}
	
	
	
	
	mm.value=pffy;
	//mm.value=xxval;
	gg.value=yyval;

}
function startmove(){
	if(stoc.allow==1){
	primuxl=document.getElementById('primul');
	valoareacalc=stoc.yposit-(stoc.factor*stoc.sens);
	if(valoareacalc<0){
	valoareacalc=0;
	}
	maxv=primuxl.offsetHeight - stoc.maheight;
	if(valoareacalc>maxv){
	valoareacalc=maxv
	}
	
	stoc.yposit=valoareacalc;
		
	primuxl.style.margin="-"+valoareacalc+"px 0px 0px 0px";
	setTimeout('startmove()',50);
	}
	


}
function stopmove(){
	stoc.allow=0;
}

function findPosition( oElement ) {
  if( typeof( oElement.offsetParent ) != 'undefined' ) {
    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
      posX += oElement.offsetLeft;
      posY += oElement.offsetTop;
    }
    return  posY;
  } else {
    return oElement.y ;
  }
}

function getElementsByName_iefix(tag, name) {
     
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}



function startbanner(){
zonez=document.getElementById('zonma');
elementele=zonez.firstChild;
listatotala= new Array();
marginile=new Array();

	while(elementele.nodeType == 3) {
		elementele = elementele.nextSibling;
	}
	stocbannere.curentchild=elementele;
i=0;
	while(elementele.getAttribute('id')!='laste'){
			listatotala[i++]=elementele;
		elementele=elementele.nextSibling
		while(elementele.nodeType == 3) {
			elementele = elementele.nextSibling;
		}	
	
	}
	
	marginea=0;
	for(i=0;i<listatotala.length;i++){
		marginile[i]=marginea;
		listatotala[i].style.margin="0px "+marginea+"px";
		marginea=listatotala[i].offsetWidth+marginea;
		listatotala[i].style.position="absolute";
		
		
	}
	stocbannere.lista=listatotala;
	stocbannere.lastx=listatotala.length-1;
	stocbannere.lmargini=marginile;
	movebannere();
}

function stivabannere(){
	this.currentx=0;
	this.lastx=null;
	
	this.curentchild=null;
	this.lista= new Array();
	this.lmargini=new Array();


}
stocbannere= new stivabannere();

function movebannere(){
		valoarealeft=stocbannere.curentchild.style.marginLeft;
		
		
		
		valoareamleft=valoarealeft.substr(0,valoarealeft.length-2);
		
		
		if(valoareamleft < (-1)*stocbannere.curentchild.offsetWidth){
			
			nouamargine=stocbannere.lmargini[stocbannere.lastx]+stocbannere.lista[stocbannere.lastx].offsetWidth;
		
			stocbannere.curentchild.style.margin="0px "+nouamargine+"px";
			stocbannere.lmargini[stocbannere.currentx]=nouamargine;
			
			stocbannere.lastx=stocbannere.currentx;
			
			stocbannere.currentx++;
			
			
			
			if(stocbannere.currentx>stocbannere.lista.length-1){
				stocbannere.currentx=0;
				stocbannere.lastx=stocbannere.lista.length-1;
				
			}
			stocbannere.curentchild=stocbannere.lista[stocbannere.currentx];
		
		}


	for(i=0;i<stocbannere.lista.length;i++){
		stocbannere.lista[i].style.margin="0px "+(stocbannere.lmargini[i]--)+"px"
	}
	
	
setTimeout('movebannere()',40);
}
		 function playthissong(str){
			flashul=document.getElementById('flashplayer');
			flashul.playsong('morefiles/'+str);
		 
		 }
		 
		 


function showPozaContact(totalpoze,idpic){
	for(i=0;i<totalpoze;i++){
		document.getElementById('poza_contact'+i).style.display='none';
		document.getElementById('textcontact'+i).style.background='#ffffff';
		document.getElementById('textcontact'+i).style.border='';
	}
		document.getElementById('poza_contact'+idpic).style.display='';
		document.getElementById('textcontact'+idpic).style.background='#EEEDEB';
		document.getElementById('textcontact'+i).style.border='1px solid #ccc';
		
}

