/*@cc_on(function(a,b){function r(a){var b=-1;while(++b<f)a.createElement(e[b])}if(!(!window.attachEvent||!b.createStyleSheet||!function(){var a=document.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}())){a.iepp=a.iepp||{};var c=a.iepp,d=c.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",e=d.split("|"),f=e.length,g=new RegExp("(^|\\s)("+d+")","gi"),h=new RegExp("<(/*)("+d+")","gi"),i=/^\s*[\{\}]\s*$/,j=new RegExp("(^|[^\\n]*?\\s)("+d+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),k=b.createDocumentFragment(),l=b.documentElement,m=l.firstChild,n=b.createElement("body"),o=b.createElement("style"),p=/print|all/,q;c.getCSS=function(a,b){if(a+""===undefined)return"";var d=-1,e=a.length,f,g=[];while(++d<e){f=a[d];if(f.disabled)continue;b=f.media||b,p.test(b)&&g.push(c.getCSS(f.imports,b),f.cssText),b="all"}return g.join("")},c.parseCSS=function(a){var b=[],c;while((c=j.exec(a))!=null)b.push(((i.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(g,"$1.iepp_$2")+c[4]);return b.join("\n")},c.writeHTML=function(){var a=-1;q=q||b.body;while(++a<f){var c=b.getElementsByTagName(e[a]),d=c.length,g=-1;while(++g<d)c[g].className.indexOf("iepp_")<0&&(c[g].className+=" iepp_"+e[a])}k.appendChild(q),l.appendChild(n),n.className=q.className,n.id=q.id,n.innerHTML=q.innerHTML.replace(h,"<$1font")},c._beforePrint=function(){o.styleSheet.cssText=c.parseCSS(c.getCSS(b.styleSheets,"all")),c.writeHTML()},c.restoreHTML=function(){n.innerHTML="",l.removeChild(n),l.appendChild(q)},c._afterPrint=function(){c.restoreHTML(),o.styleSheet.cssText=""},r(b),r(k);if(c.disablePP)return;m.insertBefore(o,m.firstChild),o.media="print",o.className="iepp-printshim",a.attachEvent("onbeforeprint",c._beforePrint),a.attachEvent("onafterprint",c._afterPrint)}})(this,document);@*/

/* INI: SCROLL UP FOR RESULTS */
window.move_scroll = function( top ){
	
	if( !top )
		top = 0;
	
	if( typeof top == "string" )
		top = parseInt( $( '#'+ top ).offset().top - 10 );
	
	var scroll = self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
	
	if( top == scroll )
		return;
	
	if( window.int_scroll )
		clearInterval( window.int_scroll );

	var 
		time = new Date(),
		time_start = time.getTime(),
		time_final = time_start + 1000,
		func = 'window.move_scroll_update(' + top + ',' + time_start + ',' + time_final + ')';
	
	window.int_scroll = setInterval( func ,10 );
};

window.move_scroll_update = function(prop_dest, time_start, time_dest){
	
	var 
		time = new Date(),
		time_now = time.getTime(),
		prop_start = self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop,
		t = time_now - time_start,
		b = prop_start,
		c = prop_dest - prop_start,
		d = time_dest - time_start,
		newValue = Math.round( ( t == d ) ? b + c : c * ( -Math.pow( 2, -10 * t / d ) + 1 ) + b );
	
	if ( time_now >= time_dest || prop_start == prop_dest ){
		clearInterval( window.int_scroll );
		window.int_scroll = undefined;
	} else
		window.scrollTo(0, newValue);
		
};
/* END: SCROLL UP FOR RESULTS */

if( top != self ){ top.location.href = location.href; } //remove iframe

$(function(){

    $( 'a#irTopo').click(function(e){ e.preventDefault(); move_scroll(0); })

    if( $('#home').size() == 1 || $('#perfil').size() == 1 || $('#musica').size() == 1 ){ slideHome( 0 ); }

    if( $('#contato').size() == 1 ){ contato() }

})

function slideHome( current ){

	var 
		numImg = $( 'figure img' ).size() - 1,
		img = $( 'figure img' );
	
	img.hide();
	img.eq( current ).fadeIn( 'slow' );
    
	current = current >= numImg ? 0 : current + 1;

	setTimeout( 'slideHome( ' + current + ' )', 4000 );
}

/* INI: CHECK FORM */

function contato(){
    
    $( '#assunto' ).focus();
    
    $('#formContato').submit(function(){
        
        var
            er = new RegExp(/\b[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,4}\b/),
            assunto = $('input#assunto').val(),
            nome = $('input#nome').val(),
            email = $('input#email').val(),
            site = $('input#site').val(),
            texto = $('textarea#texto').val();
            
        if( assunto == "" ){
            
            statusM('Assunto');
            return false;
            
        }else if( nome == "" ){
            
            statusM('Nome');
            return false;
            
        }else if( !er.test( email ) ){
            
            statusM('Email');
            return false;
            
        }else if( texto == "" ){
            
            statusM('Texto');
            return false;
            
        }else{
            
            $('#statusMessage').html( '<span> Aguarde... </span>' );
            
            $.ajax({
                
                type: 'POST',
                url: 'mail.html',
                data: 'assunto=' + assunto + '&nome=' + nome + '&email=' + email + '&site=' + site + '&texto=' + texto,
                success: function( msg ){
                
                    $('#statusMessage').html( msg );
                    
                }
                
            });
            
        }
        return false;
        
    });
}

/* END: CHECK FORM */

/* INI: RETURN STATUS MESSAGE */
function statusM( campo ){
    
    $('#statusMessage').html( '<span style="color:red">O campo <strong>' + campo + '</strong> é requerido!</span>' );
    $( '#' + campo.toLowerCase() ).focus();  

}
/* END: RETURN STATUS MESSAGE */
