window.addEvent('domready', function(){
	// inicialmente o menu esta aberto e parado
	var aberto = 1;
	var animado = 0;
	var scrollFX1 = new Fx.Scroll('menuEsqWrapper', {duration: 400, transition: Fx.Transitions.Quad.easeInOut});
	var scrollFX2 = new Fx.Scroll('menuEsqWrapper', {duration: 400, transition: Fx.Transitions.Quad.easeInOut});	
	var heightFX1 = new Fx.Morph('menuEsqBot', {duration: 100});
	var heightFX2 = new Fx.Morph('menuEsqWrapper', {duration: 100});
	var elem1 = $('menuEsqBot');
	heightFX1.addEvents({
		'complete': function(){	desanimado.delay(400); }
	});
	scrollFX2.addEvents({
		'complete': function(){
			heightFX2.start({'height': 30});
		}  
	});		
	elem1.addEvents({
		'mouseenter': function(e){
			if ((!animado) && (!aberto)) { mostraMenu(); }
		},
		'mouseleave': function(e){
			if ((!animado) && (aberto)) { escondeMenu(); }
		},
		'mouseup': function(e){
			if ((!animado) && (aberto)) { escondeMenu(); }
		}	
	});
	var fecha = function(){
		if ((!animado) && (aberto)) {
			escondeMenu();
			$clear(timer);
		}
	}
	function escondeMenu(){
		animado = 1;
		scrollFX2.toElement('menuEsqPoint2');
		heightFX1.start({'height': 0});	
		aberto = 0;		
	}
	function mostraMenu() {
		animado = 1;
		$clear(timer);
		scrollFX1.toElement('menuEsqPoint1');
		heightFX2.start({'height': 182});
		heightFX1.start({'height': 150});		
		aberto = 1;
	}
	function desanimado() {
		animado = 0;
	}
	var timer = fecha.periodical(5000);
}); 
function mostraDadosInc() {
	if( document.all ) {
		document.all.dadosIncorrectos.style.display='inline';
	} else {
		document.getElementById("dadosIncorrectos").style.display ='inline';
	}
}
function escondeDadosInc() {
	if( document.all ) {
		document.all.dadosIncorrectos.style.display='none';		
	} else {
		document.getElementById("dadosIncorrectos").style.display ='none';		
	}
}
function mostraEsqPass() {
	if( document.all ) {
		document.all.esqPass.style.display='inline';
		document.all.esqPassIn.style.display='inline';		
	} else {
		document.getElementById("esqPass").style.display ='inline';
		document.getElementById("esqPassIn").style.display ='inline';
	}
}
function escondeEsqPass() {
	if( document.all ) {
		document.all.esqPassIn.style.display='none';		
		document.all.esqPass.style.display='none';
	} else {
		document.getElementById("esqPassIn").style.display ='none';		
   		document.getElementById("esqPass").style.display ='none';
	}
}
function mostraAutorizacao() {
	if( document.all ) {
		document.all.avisoMenores18.style.display='inline';
	} else {
		document.getElementById("avisoMenores18").style.display ='inline';
	}
}
function escondeAutorizacao() {
	if( document.all ) {
		document.all.avisoMenores18.style.display='none';
	} else {
   		document.getElementById("avisoMenores18").style.display ='none';
	}
}
function CopyToClipBoard(inElement, path) {
    inElement.select();
    /*
    Funciona no IE e o Opera tambem vem aqui
    mas não funciona com o Opera
    else if (inElement.createTextRange) {
        alert('opera');
        var range = inElement.createTextRange();
        //if (range && BodyLoaded==1)
        if (range)
        range.execCommand('Copy');
        }
    */
    if( window.clipboardData && clipboardData.setData )
    {
        clipboardData.setData("text", inElement.value);
    }   
    else {
        var flashcopier = 'flashcopier';
        if(!document.getElementById(flashcopier)) {
            var divholder = document.createElement('div');
            divholder.id = flashcopier;
            document.body.appendChild(divholder);
            }
        document.getElementById(flashcopier).innerHTML = '';
        var divinfo = '<embed src="'+path+'Flash/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
        document.getElementById(flashcopier).innerHTML = divinfo;
    }
}
function mudaEstiloIrrequietos(id){
	var id = id;
	var lt = document.getElementsByTagName('link');
	//alert(lt.length);
	for(var i=0, a=[]; lt[i]; i++){
		
		if(lt[i].href){
			var href = lt[i].href;
		}else if(lt[i].getAttribute){
			var href = lt[i].getAttribute('href');	
		}else{
			var href = "";	
		}
		
		if(typeof(href)=='string' && href.toLowerCase().indexOf("irrequietos.css")>0){
			//a.push(lt[i]);	
			if(lt[i].href){
				
				lt[i].href = "App_Themes/"+id+"/irrequietos.css";
			}
		}
	}
	
}
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];}
}