<!--
/*********************************************************************
 ***  Desenvolvido por Adriano Oliveira - www.adrianooliveira.com  ***
 *********************************************************************/
	
	// slide de imagens 
	function imgRandom() {
		img = new Array(3)
		img[0] = "/img/ilustra_01.jpg";
		img[1] = "/img/ilustra_02.jpg";
		img[2] = "/img/ilustra_03.jpg";
		img[3] = "/img/ilustra_04.jpg";
		img[4] = "/img/ilustra_05.jpg";
		img[5] = "/img/ilustra_06.jpg";
		img[6] = "/img/ilustra_07.jpg";
		img[7] = "/img/ilustra_08.jpg";
		img[8] = "/img/ilustra_09.jpg";
		img[9] = "/img/ilustra_10.jpg";
		index = Math.round(Math.random()*9);
		return img[index];
	}
	
	function slideit(){
		var slidespeed=30000
		var ie55=window.createPopup
		var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0
	
		if (!document.images) return
		if (ie55) document.images.slide.filters[0].apply()
		document.getElementById('slide').src=imgRandom() //imageholder[whichimage].src
		if (ie55) document.images.slide.filters[0].play()
		setTimeout("slideit()",slidespeed+pixeldelay)
	}
	
	// form
	function MailMask(account) {
		document.location.href = 'mailto:'+ account +'@adrianooliveira.com';
	}
	
	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_validateForm() { //v4.0
	  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
		if (val) { nm=val.name; if ((val=val.value)!="") {
		  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
			if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve conter um endereço válido.\n';
		  } else if (test!='R') { num = parseFloat(val);
			if (isNaN(val)) errors+='- '+nm+' deve conter um número.\n';
			if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
			  min=test.substring(8,p); max=test.substring(p+1);
			  if (num<min || max<num) errors+='- '+nm+' deve conter números entre '+min+' e '+max+'.\n';
		} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' é necessário.\n'; }
	  } if (errors) alert('Erros:\n'+errors);
	  document.MM_returnValue = (errors == '');
	}
	
	// slide menu portfolio
	var slideMenu=function(){
	var sp,st,t,m,sa,l,w,sw,ot;
	return{
		build:function(sm,sw,mt,s,sl,h){
			sp=s; st=sw; t=mt;
			m=document.getElementById(sm);
			sa=m.getElementsByTagName('li');
			l=sa.length; w=m.offsetWidth; sw=w/l;
			ot=Math.floor((w-st)/(l-1)); var i=0;
			for(i;i<l;i++){s=sa[i]; s.style.width=sw+'px'; this.timer(s)}
			if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)}
		},
		timer:function(s){s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}},
		slide:function(s){
			var cw=parseInt(s.style.width,'10');
			if(cw<st){
				var owt=0; var i=0;
				for(i;i<l;i++){
					if(sa[i]!=s){
						var o,ow; var oi=0; o=sa[i]; ow=parseInt(o.style.width,'10');
						if(ow>ot){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}
						owt=owt+(ow-oi)}}
				s.style.width=(w-owt)+'px';
			}else{clearInterval(m.timer)}
		}
	};
}();
	

// -->	