(function($){
	
	
	var controller = {
			
			_urlSite : function(){
				if(location.href.search('localhost')>1 || location.href.search('192.168.0.1')>1 || location.href.search('10.0.2.2')>1){
					return $('#container').attr('data-basejs')+'/';
				} else {
					return $('#container').attr('data-basejs');
				}
			},
			_window : $(window).width(),
			_hash: location.hash,
			_navControl : function(){

				// se clicar em algum link
				$('a').live('click', function(e){
					
					var href = $(this).attr('href');

					if(pages.homeSlider!=""){clearInterval(pages.homeSlider);}
					
					if( $(this).attr('rel') === "external" ){
						return true;
					} else if( $(this).attr('rel') === "self" ){
						e.preventDefault();
						if($(this).hasClass('btBlog')){
							location.href = controller._urlSite()+'blog';
						}
					} else if( $(this).attr('rel') === "open" ){
						var $this = $(this);
						controller._hash = controller._hash.replace('#!/','');
						var hashRedirect = controller._hash;
						$.ajax({
							url : controller._urlSite()+'principal/regiao/'+$this.attr('data-lang'),
							type : 'POST',
							success : function(data){
								location.href = controller._urlSite()+hashRedirect;
							}
						});

					} else { 
						/* se tiver hash */
						e.preventDefault();

						if($(this).attr('rel') === ""){
							if(location.href.search('localhost')>1 || location.href.search('192.168.0.1')>1){
								href = href.replace('http://localhost/web/waymodel/website','');
								href = href.replace('http://localhost/Way','');
							} else {
								href = href.replace('http://www.waymodel.com.br','');
								href = href.replace('http://waymodel.com.br','');
								href = href.replace('/#!/','');
								href = href.replace('/','');
							}
							controller._hashController(href);
						} else {
							href = href.replace(controller._urlSite(),'');
							controller._hashController(href);
						}
						
					} 
					
				});
				
			}, // end navControl
			
			
			
			// se a hash mudar
			_changeHash : function(){
				
				$(window).hashchange( 
					
					function(){
						
						// se trocar de hash, esse escopo é executado
						controller._hash = location.hash;
						var hash = controller._hash.replace('#!/','');

						var hash_old = false;
						if(pages._old){ hash_old = pages._old.split('/');}
						
						var hash_active = hash.split('/');
						
						/*
						 * se hash 1, nao for nem feminino nem masculino
						 * ele executa essa funcao para verificar se estar na interna de modelo
						 * pra fazer o efeito de rolagem
						 * */
						if(hash_old[1]){ // if capa/book existe 
							if(hash_old[1] == 'feminino' || hash_old[1] == 'masculino'){
								pages._control(hash);
							} else {
								if(hash_active[1]){ 
									if(hash_active[1]=='masculino' || hash_active[1]=='feminino'){
										pages._control(hash);
									} else {
										// se no hash atual existir /videos /book /capa /polaroid
										pages.scrollModeloSingle(hash_active[1], false);
									}
								} else { 
									// ajax para verificar se existe algum modelo com a hash_active[0]
									// se existir despacha para abrir a pagina
									if(hash_active[0]=='home' || hash_active[0]=='seja-um-modelo' || hash_active[0]=='staff' || 
											hash_active[0]=='quem-somos' || hash_active[0]=='contato' || hash_active[0]=='casting'){
										pages._control(hash);
									} else {
										$.ajax({
											url:controller._urlSite()+'modelos/is-model/'+hash_active[0],
											type:'POST',
											success:function(data){
												if(data=='0'){
													pages.scrollModeloSingle('capa', false);
												} else {
													//pages._control(hash);
													location.href = controller._urlSite()+hash_active[0];
												}
											}
										});
										
									} // end else
									
								} // end else
							} // end else
						} else { 
							
							// se existe hash_old com alguma pagina dessa, 
							// eh sinal que estou tentando voltar para uma interna de modelo
							if(hash_old[0]=='home' || hash_old[0]=='seja-um-modelo' || hash_old[0]=='staff' || 
									hash_old[0]=='quem-somos' || hash_old[0]=='contato' || hash_old[0]=='casting'){
								pages._control(hash);
								return false;
							}
							
							// se nao existir capa/book/polaroids - masculino/feminino
							// se a nova hash (hash_active[0]) nao tiver modelos, home, contato etc... eh a interna da modelo
							// caso contrario eh outra page
							if(hash_active[0]!='home' && hash_active[0]!='modelos' && hash_active[0]!='seja-um-modelo' && 
									hash_active[0]!='staff' && hash_active[0]!='quem-somos' && hash_active[0]!='contato' && hash_active[0]!='casting') {
								
								if(hash_active[1]==undefined || hash_active[1]==null) {
									// ajax para verificar se existe algum modelo com a hash_active[0]
									// se existir despacha para abrir a pagina
									$.ajax({
										url:controller._urlSite()+'modelos/is-model/'+hash_active[0],
										type:'POST',
										success:function(data){
											if(data=='0'){
												pages.scrollModeloSingle('capa', false);
											} else {
												//pages._control(hash);
												location.href = controller._urlSite()+hash_active[0];
											}
										}
									});
								} else {			
									pages.scrollModeloSingle(hash_active[1], false);
								}
							} else {
								pages._control(hash);
							}
							
						} // end else
						
					}
				
				);
				
			}, // end _changeHash
			
			
			/*
			 * hashController
			 * refina e valida o hash
			 * usada para retirar o #/ do link que foi passado
			 * */
			_hashController : function(url){
				
				var url = url;
				if(url.search('#!/') != -1){
					url = url.replace('#!/','');
				}
				location.hash = "#!/"+url;
				
			},
			
			
			/*
			 * resizeImage
			 * */ 
			resizeImage : function(){
				
				var $elemImage = $('.imgFull');
				var $elemBox = $('.home .box');
				
				/* 
				 * onresize window
				 * */
				$(window).bind('resize', function(){
					
					controller._window = $(window).width(); // update
					
					var offsetY = 0;
					$elemBox.width(controller._window);
					
					$('#content, .pos').width(controller._window);
					
					$elemBox.each(function(){
						$(this).attr('data-offsetY', offsetY * ($(window).height()) );
						
						if (offsetY==0){
							$(this).height($(window).height()-100);
						} else if(offsetY+1==$('.home .box').length){	
							$(this).height($(window).height()+100);
						} else {
							$(this).height($(window).height());
						}
						offsetY++;
					});
					
					$elemImage.scaleOnResize();
					
				});

				
				
			}, // resize image
			
			
			resizeImageSingle : function(){
				
				var $elemImage = $('.imgFull');

				var $elemBoxImage = $('.modeloSingle .image');
				var $elemBoxAndImage = $('.modeloSingle .boxContent, .modeloSingle .boxContent .image');
				var $elemBox = $('.modeloSingle .boxContent');
				var numBoxMedium = $('.modeloSingle .boxMedium').length;
				
				$('.modeloSingle').find('.info').width(controller._window);
				
				/*
				 * onresize window
				 * */
				$(window).bind('resize', function(){
					
					controller._window = $(window).width(); // update
					$('#content, .pos').width(controller._window);
					$elemBoxAndImage.width(controller._window);
					$('.modeloSingle').find('.info').width(controller._window);
					
					$elemImage.scaleOnResize();
					
					if($(window).height()>640){
						
						var offsetY = 0, heightOffset=parseInt(0), heightWindow=$(window).height();
						
						$('.modeloSingle .boxFull').each(function(){
							$(this).find('.image').height(heightWindow/*-100*/);
							$(this).height(heightWindow/*-100*/);
						});
						
						if(numBoxMedium){
							$('.modeloSingle .boxMedium').each(function(){						
								$(this).height(heightWindow);
							});
						}
						
					} // if height > 640
					
					$('.modeloSingle .boxContent').each(function(){
						if($(window).height()>640){
							if(offsetY==1){
								heightOffset = heightOffset/* - 100*/;
							}
							
							$(this).attr('data-offsetY', heightOffset);
							heightOffset = heightOffset + heightWindow;
							
							offsetY++;
						}
						$(this).width(controller._window);
					});
					
				});
				//$('.imgMedium').resizeModelo();
				if($('.modeloSingle .boxComposite').length > 0){
					
					$('.boxComposite').resizeModelo();
					$('.boxComposite .imgMedium').width($('.boxComposite').width()).height($('.boxComposite').height());
					$('.boxComposite').css({'margin-left':'-'+($('.boxComposite').width())/2+'px', 'margin-top':'-'+($('.boxComposite').height())/2+'px'});
					
				}
				
				if($('.modeloSingle .boxSlider').length > 0){
					
					$('.boxSlider .slider').resizeModelo();

					var larguraSlider = parseInt($('.slider').width());
					var larguraBoxSlider = parseInt($('.boxSlider').width());
					
					$('.boxSlider .slider').width(larguraSlider);
					$('.boxSlider').width(larguraSlider+120).height($('.slider').height());
					$('.boxSlider').css({'margin-left':'-'+($('.boxSlider').width())/2+'px', 'margin-top':'-'+($('.boxSlider').height()+10)/2+'px'});
					$('.boxSlider .slider ul li, .boxSlider .slider ul li img, .boxSlider .slider ul li iframe').width(larguraSlider).height($('.slider').height());
					$('.boxSlider .slider ul li a.itemVideo').width(larguraSlider).css({'padding':'10px 10px', 'margin-left':'-'+(larguraSlider+30)/2+'px'});
					$('.boxSlider .slider ul li iframe').attr('width',larguraSlider);
					$('.boxSlider .slider ul li iframe').attr('height',$('.slider').height());
				}
				
			}, // resize image single
			
			resizePage : function(){
				
				$(window).bind('resize', function(){
					controller._window = $(window).width(); // update
					$('#content, .pos').width(controller._window);
				});
				
			},
			
			/*
			 * activeNav
			 * */
			activeNav : function(target){
				
				$('div.top a').not('div.top a.pt, div.top a.en').css('text-decoration','none');
				
				switch(target){
					case 'home' : $('div.top .btHome').css('text-decoration','underline'); break;
					case 'modelos' : $('div.top .btModelo').css('text-decoration','underline'); break;
					case 'seja-um-modelo' : $('div.top .btSejaModelo').css('text-decoration','underline'); break;
					case 'staff' : $('div.top .btStaff').css('text-decoration','underline'); break;
					case 'quem-somos' : $('div.top .btQuemSomos').css('text-decoration','underline'); break;
					case 'contato' : $('div.top .btContato').css('text-decoration','underline'); break;
					case 'casting' : $('div.top .btCasting').css('text-decoration','underline'); break;
					default : $('div.top .btModelo').css('text-decoration','underline'); break;
				}
				// reseta iframe videos, stop videos
				var tamSliderVideo = $('#videos').length;
				if(tamSliderVideo>0){
					var sliderAtual = $('#videos').find('.slider').attr('data-pos');
					var html = $('#videos').find('.slider ul li:eq('+sliderAtual+')').html();
					$('#videos').find('.slider ul li:eq('+sliderAtual+')').html(' ');
					$('#videos').find('.slider ul li:eq('+sliderAtual+')').html(html);
				}		
			},
			
			_init : function(){
				
				controller._navControl();
				controller._changeHash();
				
			}
			
			
	};
	
	
	
	
	
	
	var pages = {
			
			_active:null, // page active
			_old:null, // page active old
			posActive : null,
			
			/*
			 * callAjaxPage
			 * carrega pagina via ajax
			 * @params url, é a url que vai ser acessada
			 * @params page, é a pagina que vai ser exibida
			 * */
			_callAjaxPage : function(url,page){
				
				var $div = '', numberActive = parseInt(0);

				if(pages.posActive==0 && pages._active!='home') { 
					numberActive=1; 
					$('#content').append('<div class="pos" style="width:'+$(window).width()+'px; left:'+$(window).width()+'px;" />');
				} else if(pages.posActive==-1 && pages._active=='home'){
					numberActive=0;
					$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:0px" />');
				} else if(pages._active=='home'){
					numberActive=0; 
					$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:-'+$(window).width()+'px;" />');
				}else if(pages.posActive==-1){
					numberActive=0;
					$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:'+$(window).width()+'px" />');
				}
				$div = $('#content .pos:eq('+numberActive+')');

				var showHome = function(){ pages.home(numberActive); }
				var showSejaUmModelo = function(){ pages.sejaUmModelo(numberActive); }
				var showStaff = function(){ pages.staff(numberActive); }
				var showQuemSomos = function(){ pages.quemSomos(numberActive); }
				var showContato = function(){ pages.contato(numberActive); }
				var showCasting = function(){ pages.casting(numberActive); }
				
				/*
				 * callActiveNav
				 **/
				controller.activeNav(page);
				
				var sucessoAjax = function(data){
					
					var execContentAjax = function(data){
						switch(page){
							case 'home': if (jQuery.browser.msie) { $div.html(data); } else { $div.html(data); } pages.home(numberActive); break;
							case 'seja-um-modelo': if (jQuery.browser.msie) { $div.html(data); } else { $div.html(data); } var loader= new Loader($div, {userCallback:showSejaUmModelo}); loader.Start(); break;
							case 'staff': if (jQuery.browser.msie) { $div.html(data); } else { $div.html(data); } var loader= new Loader($div, {userCallback:showStaff}); loader.Start(); break;
							case 'quem-somos': if (jQuery.browser.msie) { $div.html(data); } else { $div.html(data); } var loader= new Loader($div, {userCallback:showQuemSomos}); loader.Start(); break;	
							case 'contato': if (jQuery.browser.msie) { $div.html(data); } else { $div.html(data); } var loader= new Loader($div, {userCallback:showContato}); loader.Start(); break;
							case 'casting': if (jQuery.browser.msie) { $div.html(data); } else { $div.html(data); } var loader= new Loader($div, {userCallback:showCasting}); loader.Start(); break;
						}
					}
					
					
					var countPage = parseInt(0); // entrar apenas 1 vez
					if ($(window).scrollTop()>0) {
						$('html, body').animate({scrollTop:0}, 1000, function(){ 
							if(countPage==0){ 
								$('.modeloSingle div.info .infoModelo').animate({bottom:'-200px'}, 500);
								setTimeout(function(){	
									var count = $('.modeloSingle .navModelo li').length, loop;
									loop = window.setInterval(function(){
										if(count=-1){
											clearInterval(loop);
											$('.modeloSingle div.info').animate({bottom:'-200px'}, 600);
										} else {
											$('.modeloSingle .navModelo li').eq(count).fadeOut();
											count--;
										}
									}, 100);
								}, 500);
								setTimeout(function(){execContentAjax(data);}, 900);
							} 
							countPage++; 
						});
					} else {
						$('.modeloSingle div.info .infoModelo').animate({bottom:'-200px'}, 500);
						setTimeout(function(){	
							var count = $('.modeloSingle .navModelo li').length, loop;
							loop = window.setInterval(function(){
								if(count=-1){
									clearInterval(loop);
									$('.modeloSingle div.info').animate({bottom:'-200px'}, 600);
								} else {
									$('.modeloSingle .navModelo li').eq(count).fadeOut();
									count--;
								}
							}, 100);
						}, 500);
						setTimeout(function(){execContentAjax(data);}, 900);
						countPage++;
					}
					
				} // sucessoAjax
				

				$.ajax({
					url : controller._urlSite()+url,
					type: 'POST',
					success: function(data){
						setTimeout(function(){
							sucessoAjax(data);
						},600);
					}
				});
				
				
			}, //callAjaxPage
			
			
			
			/*
			 * ajaxModeloSingle
			 * */
			ajaxModeloSingle : function(hash){
				
				/*
				 * INTERNA MODELO
				 * */
				var $div = '', numberActive = parseInt(0);

				if(pages.posActive==0 && pages._active!='home') { 
					numberActive=1; 
					$('#content').append('<div class="pos" style="width:'+$(window).width()+'px; left:'+$(window).width()+'px;" />');
				} else if(pages.posActive==-1 && pages._active=='home'){
					numberActive=0;
					//$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:'+$(window).width()+'px" />');
					$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:0px" />');
				} else if(pages._active=='home'){
					numberActive=0; 
					$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:-'+$(window).width()+'px;" />');
				}else if(pages.posActive==-1){
					numberActive=0;
					$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:'+$(window).width()+'px" />');
				}
				$div = $('#content .pos:eq('+numberActive+')');

				
				var showContentPos3 = function(){ pages.modeloSingle(numberActive); }
				
				var sucessoModeloSingle = function(data){
					
					var execModeloSingleAjax = function(data){
						if (jQuery.browser.msie) {
							$div.html(data);
						} else {
							$div.html(data);
						}
						showContentPos3();
					}
					
					var countPage = parseInt(0); // entrar apenas 1 vez
					if ($(window).scrollTop()>0) {
						$('html, body').animate({scrollTop:0}, 1000, function(){ if(countPage==0){ execModeloSingleAjax(data); } countPage++; });
					} else {
						execModeloSingleAjax(data);
						countPage++;
					}
					
				}
					

				$.ajax({
					url : controller._urlSite()+'modelos/detalhe/'+hash,
					type: 'POST',
					cache: false,
					success: function(data){
						if(data == '404'){
							location.href = controller._urlSite();
						} else {
							setTimeout(function(){
								sucessoModeloSingle(data);
							},600);
						}
					}
					

				});
				
				
			},
			
			
			// pega a pagina destino, e despacha
			_control : function(content){
				
				var hashShort = content; // hash encurtada
				var hashFull = content; // hash full
				
				if(hashShort.search('/') != -1){
					hashShort = hashShort.split('/');
					hashShort = hashShort[0];
				}
				
				// modifica pagina active
				pages._old = content;
				pages._active = hashShort;
				
				var showHome = function(){
					controller.activeNav('home'); 
					pages._callAjaxPage('principal/home', 'home'); 	
				}
				
				$('.loading').fadeIn();

				_gaq.push(['_setAccount', 'UA-27454669-1']);
				_gaq.push(['_trackEvent', hashFull, 'clicked', hashFull]);

				switch(pages._active){
					case 'home': 
						/*
						 * funcao para rolar o scroll para o topo
						 * antes de entrar em alguma pagina
						 * */
						var countPage = parseInt(0); // entrar apenas 1 vez
						if ($(window).scrollTop()>0) {
							$('html, body').animate({scrollTop:0}, 1000, function(){ 
								if(countPage==0){
									$('.modeloSingle div.info .infoModelo').animate({bottom:'-200px'}, 500);
									setTimeout(function(){	
										var count = $('.modeloSingle .navModelo li').length, loop;
										loop = window.setInterval(function(){
											if(count=-1){
												clearInterval(loop);
												$('.modeloSingle div.info').animate({bottom:'-200px'}, 600);
											} else {
												$('.modeloSingle .navModelo li').eq(count).fadeOut();
												count--;
											}
										}, 100);
									}, 500);
									setTimeout(function(){showHome();}, 900); 
								} 
								countPage++; 
							});
						} else {
							$('.modeloSingle div.info .infoModelo').animate({bottom:'-200px'}, 500);
							setTimeout(function(){	
								var count = $('.modeloSingle .navModelo li').length, loop;
								loop = window.setInterval(function(){
									if(count=-1){
										clearInterval(loop);
										$('.modeloSingle div.info').animate({bottom:'-200px'}, 600);
									} else {
										$('.modeloSingle .navModelo li').eq(count).fadeOut();
										count--;
									}
								}, 100);
							}, 500);
							setTimeout(function(){showHome();}, 900);
							countPage++;
						}
						break;
					case 'modelos': controller.activeNav('modelos'); pages.modelo(hashFull); break;
					case 'seja-um-modelo': pages._callAjaxPage('oportunidade', 'seja-um-modelo'); break;
					case 'staff': pages._callAjaxPage('staff', 'staff'); break;
					case 'quem-somos': pages._callAjaxPage('quemsomos', 'quem-somos'); break;
					case 'casting': pages._callAjaxPage('casting', 'casting'); break;
					case 'contato': pages._callAjaxPage('contato', 'contato'); break;
					default : controller.activeNav(' '); pages.ajaxModeloSingle(pages._active);  break
				}
				
			},
			

			verificaHash : function(hash){
				
				
					
			},

			delCol : function(numberActive){
				
				pages.posActive = numberActive;

				//$('#content').width($(window).width()).css({'left':0});
				pages.posActive = 0; $('#content').attr('data-pos',pages.posActive);
				if(numberActive==0){
					$('#content .pos:eq(1)').remove();
				} else if(numberActive==1){
					$('#content .pos:eq(0)').remove();
				}

			},


			includePage : function(numberActive){
				
				pages.modeloSingleTrueFalse = false;
				
				$('.loading, div.bgHeader').fadeOut();

			},

			slideAnimation : function(numberActive, page){
				pages.homeActive = false;
				if(pages.posActive==-1){
					$('#content .pos:eq(0)').delay(300).animate({ left:'0px' }, 1200, function(){ pages.delCol(numberActive); pages.execFinalAnimation(page); });
				} else if(numberActive==0){ // home
					$('#content .pos:eq(0)').delay(300).animate({ left:'0px' }, 1200);
					$('#content .pos:eq(1)').delay(300).animate({ left:$(window).width()+'px' }, 1200, function(){ pages.delCol(numberActive); pages.execFinalAnimation(page); });
				} else if(numberActive==1){ // pagina normal
					$('#content .pos:eq(0)').delay(300).animate({ left:'-'+$(window).width()+'px' }, 1200);
					$('#content .pos:eq(1)').delay(300).animate({ left:'0px' }, 1200, function(){ pages.delCol(numberActive); pages.execFinalAnimation(page); });
				}
					
			},

			execFinalAnimation : function(page){
				
				switch(page){
					case 'home' : 
						break;
					case 'modeloSingle':
						$('.modeloSingle').css('min-height',$(window).height());
						break;
					case 'modeloMasculino':
						$('.modelo').css('min-height',$(window).height());
						$('div.bgHeader').fadeIn();
						if(pages.arrBackModelo.length==2){
							var pai = '', cancelCor = false;
							if(pages.arrBackModelo[1]=='modelos/feminino'){
								cancelCor = true;
								var newLetra = $('.letter').attr('id');
								newLetra = newLetra.replace('modelo-','');
								pages.arrBackModelo = [newLetra,'modelos/masculino'];	
							}
							pai = pages.arrBackModelo[0];
							if(!cancelCor){
								$('.modelo .thumb').find('p span').css({'color':'#838383'});
								$('.modelo .thumb[data-pai='+pai+']').find('p span').css({'color':'#ff5800'});
								$('html, body').animate({ scrollTop: $('#modelo-'+pai).offset().top - 160 }, 1300);
							}
							cancelCor = false;
							pages.arrBackModelo = [];
						}
						break;
					case 'modeloFeminino':
						$('.modelo').css('min-height',$(window).height());
						$('div.bgHeader').fadeIn();
						if(pages.arrBackModelo.length==2){
							var pai = '', cancelCor = false;;
							if(pages.arrBackModelo[1]=='modelos/masculino'){
								cancelCor = true;
								var newLetra = $('.letter').attr('id');
								newLetra = newLetra.replace('modelo-','');
								pages.arrBackModelo = [newLetra,'modelos/feminino'];	
							}
							pai = pages.arrBackModelo[0];
							if(!cancelCor){
								$('.modelo .thumb').find('p span').css({'color':'#838383'});
								$('.modelo .thumb[data-pai='+pai+']').find('p span').css({'color':'#ff5800'});
								$('html, body').animate({ scrollTop: $('#modelo-'+pai).offset().top - 160 }, 1300);
							}
							cancelCor = false;
							pages.arrBackModelo = [];
						}
						break;
					case 'seja-um-modelo':
						$('.sejaUmModelo').css('min-height',$(window).height()-190);
						$('div.bgHeader').fadeIn();
						break;
					case 'quem-somos':
						$('.quemsomos').css('min-height',$(window).height()-190);
						$('div.bgHeader').fadeIn();
						break;
					case 'staff':
						$('.staff').css('min-height',$(window).height()-190);
						$('div.bgHeader').fadeIn();
						break;
					case 'contato':
						$('.contato').css('min-height',$(window).height()-190);
						$('div.bgHeader').fadeIn();
						break;
					case 'casting':
						$('.casting').css('min-height',$(window).height()-190);
						$('div.bgHeader').fadeIn();
						break;
				}
					
			},
			
			// PAGES
			homeActive : false,
			homeSlider : '',
			homeCount : parseInt(0), // nao rodar mais de 1 vez o script
			home : function(numberActive){

				
				pages.includePage(numberActive);
				$('.contato').delay(200).fadeIn(400);
				
				pages.slideAnimation(numberActive, 'home');
				pages.homeActive = true; // active pagina home

				/* call function resize */
				controller.resizeImage();

				var $style, $speed, tela = $(window).width(), telaHeight = $(window).height();
				
				if(tela<1450){
					$('.pos .box').each(function(){
						$style = $(this).attr('style');
						$style = $style.replace('grande','original');
						$(this).attr('style', $style);
					});
				}
				if(telaHeight>600 && telaHeight<750){
					$('.home .box').each(function(){
						$speed = parseInt($(this).attr('data-speed'));
						if($speed==20){$speed = 29;} else {$speed = 27}
						$(this).attr('data-speed', $speed);
					});
				} else if(telaHeight>750) {
					$('.home .box').each(function(){
						$speed = parseInt($(this).attr('data-speed'));
						if($speed==20){$speed = 49;} else {$speed = 47}
						$(this).attr('data-speed', $speed);
					});
				}
				
				$('.home').delay(400).fadeIn(400, function(){
					if(pages.homeCount==0){
						var qtdThumb = $('.home .box').length, countQtd = 0;
						var showBoxHome = function(num){
							$('.home .box:eq('+num+')').find('.loaderBox').fadeOut();
							$('.home .box:eq('+num+')').find('.info').delay(400).fadeIn();
						}
						var loop = window.setInterval(function(){
							if(countQtd==qtdThumb){
								clearInterval(loop);
							} else {
								var loader= new Loader($('.home .box:eq('+countQtd+')'), {userCallback:showBoxHome(countQtd)});
								loader.Start();
								countQtd++;
							}
						}, 3000);
					} else {
						$('.home .box .loaderBox').fadeOut();
						$('.home .box .info').fadeIn();
					}
				});
				
				
				pages.homeSlider = window.setInterval(function(){
					
					var hash = location.hash.split('/'),
						currentSlider = $('.home').attr('data-pos'),
						nextSlider = 0,
						totalSlider = $('.home .box').length;
					hash = hash[1];
					if(currentSlider==totalSlider-1){
						nextSlider = 0;
					} else {
						nextSlider = parseInt(currentSlider)+1;
					}
					
					if(hash=='home'){
						$('.home').attr('data-pos', nextSlider);
						$('html, body').animate({scrollTop:$('.home .box:eq('+(nextSlider)+')').attr('data-offsety')+'px'}, 1000, 'easeInOutCubic');
					} else {
						clearInterval(pages.homeSlider);
					}
					
				}, 10000);
				
					$('.home').attr('data-pos','0');
					
					// Cache the Window object
					$window = $(window);
					
					// Cache the Y offset and the speed of each sprite
					$('.home [data-type]').each(function() {	
						$(this).data('offsetY', parseInt($(this).attr('data-offsetY')));
						$(this).data('Xposition', $(this).attr('data-Xposition'));
						$(this).data('speed', $(this).attr('data-speed'));
					});
					
					var zindex = 40, offsetY = 0, $window = $(window);
					var tam = $('.home div[data-type="background"]').length, counter=1;
					
					$('.home [data-type="background"]').each(function(){
						
						var $self = $(this),
							offsetCoords = $self.offset(),
							topOffset = offsetCoords.top;
						
						$self.css('z-index',zindex);
						$self.attr('data-offsetY', offsetY * ($(window).height()) );
						
						if(offsetY+1==$('.home [data-type="background"]').length){ 
							$self.children('.info').css('bottom','28px'); 
						}
						
						if (offsetY==0){
							$self.height($(window).height()-100);
						} else if(offsetY+1==$('.home [data-type="background"]').length){	
							$self.height($(window).height()+100);
						} else {
							$self.height($(window).height());
						}
						
						zindex--;
						offsetY++;
						
						// When the window is scrolled...
					    $(window).scroll(function() {
					    	
							// If this section is in view
							if ( ($window.scrollTop() + $window.height()) > $self.attr('data-offsety') &&
								 ( ($self.attr('data-offsety') + $self.height()) > $window.scrollTop() ) ) {
					
								// Scroll the background at var speed
								// the yPos is a negative value because we're scrolling it UP!								
								var yPos = -($window.scrollTop() / $self.data('speed')); 
								
								
								// If this element has a Y offset then add it on
								if ($self.data('offsetY')) {
									yPos += $self.data('offsetY');
								}
								
								// Put together our final background position
								var coords = '50% '+ yPos + 'px';
	
								// Move the background
								$self.css({ backgroundPosition: coords });
							
							}; // in view
					
						}); // window scroll
							
					});	// each data-type
					
					pages.homeCount = 1;
					
				// functions page
				$('.home .nextPost a').live('click', function(e){
					clearInterval(pages.homeSlider);
					$('html, body').animate({scrollTop:$(this).parents('.box').next('.box').attr('data-offsety')}, 1200);
				});
					
			}, // end home
			
			
			
			
			
			
			
			countModelo : 0,
			modelo : function(hash){	
					
					var _hash = hash;
					_hash = hash.split('/');
					
					/*
					 * MODELO
					 * */
					var $div = '', numberActive = parseInt(0);
					if(pages.posActive==0 && pages.homeActive==true) { 
						numberActive=1; 
						$('#content').append('<div class="pos" style="width:'+$(window).width()+'px; left:'+$(window).width()+'px;" />');
					} else if(pages.posActive==0 && pages._active!='home') { 
						numberActive=0; 
						$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:-'+$(window).width()+'px;" />');
					}else if(pages.posActive==-1){
						numberActive=0;
						$('#content').prepend('<div class="pos" style="width:'+$(window).width()+'px; left:'+$(window).width()+'px" />');
					}
					$div = $('#content .pos:eq('+numberActive+')');

					if (_hash[1]){ 
						

						// code valido para fem/masc
						if(pages.countModelo==0){
							$('.modelo .thumb').live('mouseenter mouseleave', function(e){
								var $this = $(this).find('a'), 
									numImg = $this.find('img').length, 
									srcImg = $this.find('img:eq(0)').attr('src');
								
								if (e.type == 'mouseenter'){
									if(numImg==1){
										$this.append('<img src=\"'+srcImg.replace('pb','original')+'\" class="cor" />');
										$this.find('.pb').stop().delay(500).animate({'opacity':'0'},500);
									} else {
										$this.find('.pb').stop().animate({'opacity':'0'},500);
									}
								} else if(e.type == 'mouseleave'){ $this.find('.pb').stop().animate({'opacity':'1'},150); }
								
							});

							pages.countModelo = 1;
						}



						/* 
						 * se existir feminino ou masculino
						 * */
						var showContentFem = function() { pages.modeloFem(numberActive); }
						var showContentMasc = function() { pages.modeloMasc(numberActive); }
						
						var sucessoModelo = function(data){
							
							var execModelo = function(data){
									switch(_hash[1]){
										case 'feminino' : 
											if (jQuery.browser.msie) { 
												$div.html(data);
											} else {
												$div.html(data);
											} 
										showContentFem();
										break;
										
										case 'masculino' : 
											if (jQuery.browser.msie) { 
												$div.html(data);
											} else {
												$div.html(data);
											} 
										showContentMasc();									
										break;
									} // switch
							} // execModelo
							
							var countPage = parseInt(0); // entrar apenas 1 vez
							if ($(window).scrollTop()>0) {
								$('html, body').animate({scrollTop:0}, 1000, function(){ 
									if(countPage==0){ 
										$('.modeloSingle div.info .infoModelo').animate({bottom:'-200px'}, 600);
										setTimeout(function(){	
											var count = $('.modeloSingle .navModelo li').length, loop;
											loop = window.setInterval(function(){
												if(count=-1){
													clearInterval(loop);
													$('.modeloSingle div.info').animate({bottom:'-200px'}, 500);
												} else {
													$('.modeloSingle .navModelo li').eq(count).fadeOut();
													count--;
												}
											}, 100);
										}, 500);
										setTimeout(function(){execModelo(data);}, 600);
									} 
									countPage++; 
								});
							} else {
								$('.modeloSingle div.info .infoModelo').animate({bottom:'-200px'}, 600);
								setTimeout(function(){	
									var count = $('.modeloSingle .navModelo li').length, loop;
									loop = window.setInterval(function(){
										if(count=-1){
											clearInterval(loop);
											$('.modeloSingle div.info').animate({bottom:'-200px'}, 500);
										} else {
											$('.modeloSingle .navModelo li').eq(count).fadeOut();
											count--;
										}
									}, 100);
								}, 500);
								setTimeout(function(){execModelo(data);}, 600);
								countPage++;
							}
							
							
						} // sucesso modelo


						$.ajax({
							url : controller._urlSite()+'modelos/'+_hash[1],
							type: 'POST',
							cache: false,
							success: function(data){
								setTimeout(function(){
									sucessoModelo(data);
								},600);
							}
						});
						

					} else {
						
					}
				
			}, // end modelo
				
				
				modeloGeral : function(numberActive){
					
					// modelos
					
				},
				
				countFem : 0,
				modeloFem : function(numberActive){
					
					pages.includePage(numberActive);
					controller.resizePage();
					
					var loopFem;
					
					$('div.top a, .modelo .thumb a').live('click', function(){
						clearInterval(loopFem);
					});
					
					if(pages.countFem==0){

						/*var images = [];
						$('.modelo .thumb').each(function(e){
							images.push($(this).find('.pb').attr('src'));
						});
						*/
						$('.modelo').delay(200).fadeIn(400, function(){

							// OK
							/*$('.thumb a img').imgpreload({
								each: function(){
									var ind = 0;
									//console.log($(this).attr('src'));
									for(var i=0; i<images.length; i++){
										if($(this).attr('src') == images[i]){ ind = i; }
									}
									$('.thumb:eq('+ind+')').find('a').fadeIn();
									$('.thumb:eq('+ind+')').find('loaderThumb').fadeOut();
								}
							});*/



							setTimeout(function(){
								var qtdThumb = $('.modelo .thumb').length, countQtd = 0;
								var showThumbModelo = function(num){
									$('.modelo .thumb:eq('+num+') a').fadeIn();
									$('.modelo .thumb:eq('+num+') .loaderThumb').fadeOut();
								}
								loopFem = window.setInterval(function(){
									if(countQtd==qtdThumb){
										clearInterval(loopFem);
									} else {
										var loader= new Loader($('.modelo .thumb:eq('+countQtd+')'), {userCallback:showThumbModelo(countQtd)});
										loader.Start();
										/*$('.thumb:eq('+countQtd+') a img').imgpreload({
											each: function(){
												showThumbModelo(countQtd);
											}
										});*/
										countQtd++;
									}
								}, 100);
							}, 1200);

						});

							
						$('.modelo .thumb a').live('click', function(e){
							e.preventDefault();
							pages.arrBackModelo = [$(this).parent('.thumb').attr('data-pai'),'modelos/feminino'];
						});
						$('.modelo .letter a').live('click', function(e){
							e.preventDefault();
							pages.arrBackModelo = [$(this).attr('data-id'),'modelos/feminino'];
							var pai = $(this).attr('data-id');
							$('.modelo .thumb').find('p span').css({'color':'#838383'});
							$('.modelo .thumb[data-pai='+pai+']').find('p span').css({'color':'#ff5800'});
							$('html, body').animate({
							    scrollTop: $('#modelo-'+$(this).attr('data-id')).offset().top - 160
							}, 1300);
						});

						pages.countFem = 1;
					} else {
						$('.modelo').delay(200).fadeIn(400);
						$('.modelo .thumb a').fadeIn();
						$('.modelo .loaderThumb').fadeOut();
					}

					pages.slideAnimation(numberActive, 'modeloFeminino');
					
					

				},
				
				countMasc : 0,
				modeloMasc : function(numberActive){
					
					pages.includePage(numberActive);
					controller.resizePage();
					
					var loopMasc;
					
					$('div.top a, .modelo .thumb a').live('click', function(){
						clearInterval(loopMasc);
					});
					
					if(pages.countMasc==0){
						$('.modelo').delay(200).fadeIn(400, function(){
							setTimeout(function(){
								var qtdThumb = $('.modelo .thumb').length, countQtd = 0;
								var showThumbModelo = function(num){
									$('.modelo .thumb:eq('+num+') a').fadeIn();
									$('.modelo .thumb:eq('+num+') .loaderThumb').fadeOut();
								}
								loopMasc = window.setInterval(function(){
									if(countQtd==qtdThumb){
										clearInterval(loopMasc);
									} else {
										var loader= new Loader($('.modelo .thumb:eq('+countQtd+')'), {userCallback:showThumbModelo(countQtd)});
										loader.Start();
										/*$('.thumb:eq('+countQtd+') a img').imgpreload({
											each: function(){
												showThumbModelo(countQtd);
											}
										});*/
										countQtd++;
									}
								}, 150);
							}, 1200);
						});

						$('.modelo .thumb a').live('click', function(e){
							e.preventDefault();
							pages.arrBackModelo = [$(this).parent('.thumb').attr('data-pai'),'modelos/masculino'];
						});
						$('.modelo .letter a').live('click', function(e){
							e.preventDefault();
							pages.arrBackModelo = [$(this).attr('data-id'),'modelos/masculino'];
							var pai = $(this).attr('data-id');
							$('.modelo .thumb').find('p span').css({'color':'#838383'});
							$('.modelo .thumb[data-pai='+pai+']').find('p span').css({'color':'#ff5800'});
							$('html, body').animate({
							    scrollTop: $('#modelo-'+$(this).attr('data-id')).offset().top - 160
							}, 1300);
						});

						pages.countMasc = 1;
					} else {
						$('.modelo').delay(200).fadeIn(400);
						$('.modelo .thumb a').fadeIn();
						$('.modelo .loaderThumb').fadeOut();
					}
					
					pages.slideAnimation(numberActive, 'modeloMasculino');

				},
				
				timeInfoModelo : null, // var do setTimeout boxBranco
				downInfoModelo : function(){
					var $this = $('.modeloSingle .navModelo a.btShowHidden'), $infoModelo = $('.modeloSingle .infoModelo');
					$this.attr('data-status','inactive');
					$('.navModelo div.block').fadeIn();
					$this.find('span').animate({'backgroundPosition':'-14px -57px'},200);
					$infoModelo.find('h2, p').fadeOut(200, function(){
						$infoModelo.find('h2, p, h3').fadeOut();
						$infoModelo.animate({bottom:'-50px'}, 300, function(){
							$infoModelo.find('h2, p').fadeOut();
							$('.navModelo div.block').fadeOut();
							$('.navModelo').find('h3').fadeIn();
						});
					});
				},

				arrBackModelo : [],
				loopScroll : false,
				countModeloSingle : parseInt(0), // nao executar mais de uma vez
				modeloSingle : function(numberActive){
					
					pages.includePage(numberActive);
					
					$('.modeloSingle').delay(200).fadeIn(400);
					pages.slideAnimation(numberActive, 'modeloSingle');
					
					setTimeout(function(){ initAnimationBox(); },1500);
					
					var initAnimationBox = function(){
						$('.modeloSingle .info').delay(500).animate({bottom:0},1000);
						// show Menu
						setTimeout(function(){
							var count = 0, loop;
							loop = window.setInterval(function(){
								if(count==$('.modeloSingle .navModelo li').length){
									clearInterval(loop);
								} else {
									$('.modeloSingle .navModelo li').eq(count).fadeIn();
									count++;
								}
							}, 200);
							
						}, 2000);
					}
					
					// timeOut to slideDown infoModelo
					$('.modeloSingle .info .infoModelo').delay(2500).animate({'bottom':'70px'}, 800, function(){ 
						$(this).find('h2').fadeIn(1500);
						pages.timeInfoModelo = setTimeout(function(){ pages.downInfoModelo(); }, 5000); 
					});
						
					$('.modeloSingle .infoModelo').live('mouseenter mouseleave', function(e){
						if (e.type == 'mouseenter'){
							clearTimeout(pages.timeInfoModelo);
						} else if(e.type == 'mouseleave') {
							pages.timeInfoModelo = setTimeout(function(){ pages.downInfoModelo(); }, 2000);
						}
						
					});
					
					/*
					 * LOADING
					 * */
					setTimeout(function(){
						if($('.modeloSingle #capa').length!=0){
							var showBio = function(){ $('#capa .boxLoader').fadeOut(); }
							var loaderBio = new Loader('.modeloSingle #capa', {userCallback:showBio});
							loaderBio.Start();
						}
						if($('.modeloSingle #book').length!=0){
							var showBook = function(){ $('.modeloSingle #book .boxLoader').fadeOut(); }
							var loaderBook= new Loader('.modeloSingle #book', {userCallback:showBook});
							loaderBook.Start();
						}
						if($('.modeloSingle #polaroids').length!=0){
							var showPolaroids = function(){ $('.modeloSingle #polaroids .boxLoader').fadeOut(); }
							var loaderPolaroids= new Loader('.modeloSingle #polaroids', {userCallback:showPolaroids});
							loaderPolaroids.Start();
						}
						if($('.modeloSingle #composite').length!=0){
							var showComposite = function(){ $('.modeloSingle #composite .boxLoader').fadeOut(); }
							var loaderComposite= new Loader('.modeloSingle #composite', {userCallback:showComposite});
							loaderComposite.Start();
						}
					}, 2000);
					
					
					$('.imgFull').scaleOnResize();
					

					// btBackModelo
					
					$('.backModelos').live('click',function(e){
						if(pages.arrBackModelo.length==0){ 
							location.hash = '#!/modelos/'+$('.modeloSingle').attr('data-genero');
						} else {
							location.hash = '#!/'+pages.arrBackModelo[1];
						}
					});

					// scroll bio
					if($('#bio').length==1){
						
						var boxBio = $('.boxBio'),
							heightScroll = boxBio.find('.textScroll').height(),
							textScroll = boxBio.find('.textScroll'),
							btDown = boxBio.find('a.down'),
							btUp = boxBio.find('a.up'),
							heightBox = 0,
							countBox = new Number(0),
							novoCountBox = 0;
						

						var heightBoxBio = $(window).height()-300;
						boxBio.attr('data-pos',countBox).height(heightBoxBio).css({'margin-top':'-'+((heightBoxBio/2)+30)+'px'});
						boxBio.find('.scroll').height(heightBoxBio-120);

						heightBox = heightBoxBio;

						var ativaBts = function(count, heightTextScroll){
							
							boxBio.attr('data-pos',count);

							if(count==0){
								btUp.animate({backgroundPosition:'-298px -110px'},150);
							} else {
								btUp.animate({backgroundPosition:'-298px -67px'},150);
							}

							if(heightTextScroll>((count+0.3)*boxBio.find('.scroll').height())+(boxBio.find('.scroll').height()-100)){
								btDown.animate({backgroundPosition:'-253px -67px'},150);
							} else {
								btDown.animate({backgroundPosition:'-253px -110px'},150);
							}


						} // ativaBts

						boxBio.find('.bts a').live('click', function(e){
							e.preventDefault();
							
							var $this = $(this),
								heightTextScroll = boxBio.find('.textScroll').height();
							
							if($this.hasClass('down')){
									novoCountBox = new Number(novoCountBox);
								if(heightTextScroll>((novoCountBox+0.3)*boxBio.find('.scroll').height())+(boxBio.find('.scroll').height()-100)){
									novoCountBox = countBox+0.3;
									countBox = countBox+0.3;
									novoCountBox = Math.round(novoCountBox*100)/100;
									textScroll.animate({top:'-'+(countBox*boxBio.find('.scroll').height())+'px'},400, 'easeInOutQuart');
									ativaBts(countBox,heightTextScroll);
								}
							} else {
								novoCountBox = new Number(novoCountBox);
								if(novoCountBox>0){
									novoCountBox = countBox-0.3;
									countBox = countBox-0.3;
									novoCountBox = Math.round(novoCountBox*100)/100;
									textScroll.animate({top:'-'+(novoCountBox*boxBio.find('.scroll').height())+'px'},400, 'easeInOutQuart');
									ativaBts(novoCountBox,heightTextScroll);
								}
							}

						});
					}

					var zindex = 40, offsetY = 0, numElementos = $('.modeloSingle .boxContent').length, alturaJanela = $(window).height(), heightOffset = parseInt(0);
					
					$('.modeloSingle .boxContent').each(function(){
						$(this).css('z-index',zindex);
						
						if(offsetY==1){
							heightOffset = heightOffset;
						}
						
						$(this).attr('data-offsetY', heightOffset);
						heightOffset = heightOffset + alturaJanela;
						
						$(this).width(controller._window);
						zindex--;
						offsetY++;
					});
					
					$('.modeloSingle .boxFull').each(function(){
						$(this).find('.image').children('.imgFull').width(controller._window);
						$(this).find('.image').height($(window).height()/*-100*/);
						$(this).height($(window).height()/*-100*/);
					});
					
					$('.modeloSingle .info .navModelo li').each(function(){
						$(this).append('<span></span>');
						$(this).find('span').width($(this).width()-20);
						$(this).find('span').css('margin-left','-'+(($(this).width()/2)-9)+'px');
					});
					
					var numBoxMedium = $('.modeloSingle .boxMedium').length;
					
					if(numBoxMedium){
						$('.modeloSingle .boxMedium').each(function(){
							$(this).height($(window).height());
						});
					}
					
					
					
					/* 
					 * info (fixed) - navModelo 
					 */
					$('.modeloSingle .navModelo ul li:last').css({'background':'none'});
					var tamNavModelo = 0, indice = 0;
					$('.modeloSingle .navModelo ul li').each(function(){
						tamNavModelo = $(this).width() /*+ 37*/ + tamNavModelo;
						$(this).attr('data-indice',indice);
						indice++;
					});
					$('.modeloSingle .navModelo ul').css({'width':(tamNavModelo)+'px', 'margin-left':'-'+(tamNavModelo/2)+'px'});
					
					// verifica qual a hash, coloca active no button
					var hash = controller._hash;
					hash = hash.replace('#!/','');
					hash = hash.split('/');
					if(hash[1] == null || hash[1] == undefined || hash[1] == '' || hash[1] == ' '){
						setTimeout(function(){ pages.scrollModeloSingle('capa'); }, 3000);
					} else {setTimeout(function(){ pages.scrollModeloSingle(hash[1]); }, 3000);}
					
					
					
					pages.modeloSingleTrueFalse = true;
					
					$('div.top a').live('click', function(){
						pages.modeloSingleTrueFalse = false;
					});
					
					
					/*
					 * click menu .navModelo
					 * */
					if(numBoxMedium){
							
						$('.boxMedium .boxSlider').each(function(){
							var tam = $(this).find('ul li').length;
							if(tam==1){
								$(this).html('<div class="slider" data-pos="0"> '+$(this).html()+ ' </div>');
							} else {
								$(this).html('<div class="slider" data-pos="0"> '+$(this).html()+ ' </div>');
								$(this).prepend('<p class="next"><a href="#" rel="self" data-type="next">Next</a> <span class="numSlider"></span></p> <p class="prev"><a href="#" rel="self" data-type="prev">Prev</a> <span class="numSlider"></span></p>');
							}
						});
						$('.boxMedium').each(function(){
							var tam = $(this).find('ul li').length;
							$(this).find('.slider ul').width(tam*990);
							// show number of images
							if(tam==1){} else {
								$(this).find('.numSlider').html('<strong>1</strong> / '+$(this).find('.slider li').length);
							}
						});
						
						if($(window).height() < 400){
							$('.boxNoticias').height(280).css('margin-top','-'+(280/2)-50+'px');
						} else if($(window).height() > 400 && $(window).height() < 730){ 
							$('.boxNoticias').height(380).css('margin-top','-'+(380/2)-30+'px');
						} else if($(window).height() > 730){ 
							$('.boxNoticias').height(500).css('margin-top','-'+(500/2)-50+'px');
						}
						
						$(window).bind('resize', function(){
							
							if($(window).height() < 400){
								$('.boxNoticias').height(280).css('margin-top','-'+(280/2)+'px');
							} else if($(window).height() > 400 && $(window).height() < 700){ 
								$('.boxNoticias').height(380).css('margin-top','-'+(380/2)+'px');
							} else if($(window).height() > 700){ 
								$('.boxNoticias').height(480).css('margin-top','-'+(480/2)+'px');
							}
							
						});

					} // end is numBoxMedium
					
					
					/* 
					 * call function resize 
					 * */
					controller.resizeImageSingle();
					


					var novoHash = location.hash.split('/');
					if(novoHash[novoHash.length-1]=='capa'){
						$('.infoModelo').find('h2').animate({'top':'10px'});
						$('.infoModelo').find('p').animate({'bottom':'15px'});
					} else {
						$('.infoModelo').find('h3').fadeIn();
						$('.infoModelo').find('h2').animate({'top':'15px'});
						$('.infoModelo').find('p').animate({'bottom':'10px'});
					}


					/*
					 * addCasting
					 * hover, out and click
					 * */
					if(pages.countModeloSingle==0){
						
						/*
						 * overOutComposite
						 * */
						$('.boxComposite').live('mouseenter mouseleave', function(e){
							if (e.type == 'mouseenter'){
								if (jQuery.browser.msie) {
									$(this).find('a.btDownComposite').slideDown();
								}else {
									$(this).find('a.btDownComposite').fadeIn();
								}
							} else if (e.type == 'mouseleave'){
								if (jQuery.browser.msie) {
									$(this).find('a.btDownComposite').slideUp();
								}else {
									$(this).find('a.btDownComposite').fadeOut();
								}
							}
						});
						
						$('.slider li').live('mouseenter mouseleave', function(e){
							if (e.type == 'mouseenter'){
								if (jQuery.browser.msie) {
									$(this).children('a.addCasting').slideDown();
								} else {
									$(this).children('a.addCasting').fadeIn();
								}
							} else if (e.type == 'mouseleave'){
								if (jQuery.browser.msie) {
									$(this).children('a.addCasting').slideUp();
								} else {
									$(this).children('a.addCasting').fadeOut();
								}
							}
						});
						$('.slider li a.addCasting').live('click', function(e){
							if($(this).attr('data-status') == 'enabled'){
								pages.castingEffect($(this).attr('data-id'), 'add');
								$(this).attr('data-status','disabled');
								$(this).removeClass('add').addClass('added');
								$(this).text('Remove From Casting [ - ]');
							} else {
								pages.castingEffect($(this).attr('data-id'), 'del');
								$(this).attr('data-status','enabled');
								$(this).removeClass('add').addClass('remove');
								$(this).text('Add my to Casting [ + ]');
							}
						});
						
						/*
						 * click menu .navModelo
						 * */
						$('.modeloSingle .navModelo li a').live('click', function(){
							
							clearTimeout(pages.timeInfoModelo);
							var $this = $('.modeloSingle .navModelo a.btShowHidden'), $infoModelo = $('.modeloSingle .infoModelo');
							$this.attr('data-status','active');
							$this.parents('.navModelo').find('h3').fadeOut();
							$this.find('span').animate({'backgroundPosition':'10px -57px'},200);
							$infoModelo.find('span.border').fadeOut(200, function(){
								$infoModelo.animate({bottom:'70px'}, 300, function(){
									$infoModelo.find('h2, p').fadeIn();
									pages.timeInfoModelo = setTimeout(function(){ pages.downInfoModelo(); }, 2000);
								});
							});
							
							var href = $(this).attr('href');
							var novoHref = href.split('/');
							
							if(novoHref[novoHref.length-1]=='capa'){
								$infoModelo.find('h2').animate({'top':'10px'});
								$infoModelo.find('p').animate({'bottom':'15px'});
							} else {
								$infoModelo.find('h3').fadeIn();
								$infoModelo.find('h2').animate({'top':'15px'});
								$infoModelo.find('p').animate({'bottom':'10px'});
							}

							href = href.replace(controller._urlSite(),'');
							location.hash = '#!/'+href;
						});
						
					
						$('.navModelo .topPost a').live('click', function(e){
							pages.scrollModeloSingle('capa');
						});
						
					} // end if countModeloSingle 0
					
					pages.countModeloSingle=1;
					
				}, // end modeloSingle
			
			/*
			 * if TRUE estou na pagina modeloSingle
			 * */
			modeloSingleTrueFalse : false,
				
			/*
			 * CastingEffect
			 * */
			castingEffect : function(id, action){
				
				$.ajax({
					
					url: controller._urlSite()+'casting/mycasting/'+action,
					type: 'POST',
					data: 'idImagem='+id,
					success: function(data){
						$('div.top .numCasting').text(data);
						$('div.top .colorEffect').fadeIn(500, function(){
							$('div.top .colorEffect').fadeOut(400, function(){});
						});
					}
					
				}); // end ajax
				
			},	// end castingEffect
			
			
			
			
			
			
			scrollModeloSingle : function(hash, nextPost, url){
				
				if(nextPost){
					var href = url;
					href = href.replace(controller._urlSite(),'');
					location.hash = '#!/'+href;					
				}
				var resetVideos = function(){
					// reseta iframe videos, stop videos
					var tamSliderVideo = $('#videos').length;
					if(tamSliderVideo>0){
						var sliderAtual = $('#videos').find('.slider').attr('data-pos');
						var html = $('#videos').find('.slider ul li:eq('+sliderAtual+')').html();
						$('#videos').find('.slider ul li:eq('+sliderAtual+')').html(' ');
						$('#videos').find('.slider ul li:eq('+sliderAtual+')').html(html);
					}
				}
				if(hash==='capa' || hash==$('.navModelo li.btCapa').attr('data-indice')){
					$('.navModelo .topPost').fadeOut(); $('.navModelo .nextPost').delay(1000).fadeIn();
					$('.navModelo li.btCapa').addClass('active').find('span').fadeIn(); $('.navModelo li').not('.btCapa').removeClass('active').find('span').fadeOut();
					if ($('a.btShowHidden').attr('data-status') == 'active') { $('.infoModelo h3').fadeOut(); }
					$('.infoModelo h2 span').fadeOut(200, function(){
						$('.infoModelo h2 span').text($('.infoModelo h3').text()).fadeIn();
					});
					$('.modeloSingle').attr('data-status',$('.navModelo li.btCapa').attr('data-indice'));
					resetVideos();
					
				} else if(hash==='book' || hash==$('.navModelo li.btBook').attr('data-indice')){
					$('.navModelo .topPost').fadeOut(); $('.navModelo .nextPost').fadeIn();
					$('.navModelo li:.btBook').addClass('active').find('span').fadeIn(); $('.navModelo li').not('.btBook').removeClass('active').find('span').fadeOut();
					$('.infoModelo h3').fadeIn();
					$('.infoModelo h2 span').fadeOut(200, function(){
						$('.infoModelo h2 span').text('Book').fadeIn();
					});
					$('.modeloSingle').attr('data-status',$('.navModelo li.btBook').attr('data-indice'));
					resetVideos();
				} else if(hash==='videos' || hash==$('.navModelo li.btVideos').attr('data-indice')){
					$('.navModelo .topPost').fadeOut(); $('.navModelo .nextPost').fadeIn();
					$('.navModelo li..btVideos').addClass('active').find('span').fadeIn(); $('.navModelo li').not('.btVideos').removeClass('active').find('span').fadeOut();
					$('.infoModelo h3').fadeIn();
					$('.infoModelo h2 span').fadeOut(200, function(){
						$('.infoModelo h2 span').text('Vídeos').fadeIn();
					});
					$('.modeloSingle').attr('data-status',$('.navModelo li.btVideos').attr('data-indice'));
				} else if(hash==='polaroids' || hash==$('.navModelo li.btPolaroids').attr('data-indice')){
					$('.navModelo .topPost').fadeOut(); $('.navModelo .nextPost').fadeIn();
					$('.navModelo li.btPolaroids').addClass('active').find('span').fadeIn(); $('.navModelo li').not('.btPolaroids').removeClass('active').find('span').fadeOut();
					$('.infoModelo h3').fadeIn();
					$('.infoModelo h2 span').fadeOut(200, function(){
						$('.infoModelo h2 span').text('Polaroids').fadeIn();
					});
					$('.modeloSingle').attr('data-status',$('.navModelo li.btPolaroids').attr('data-indice'));
					resetVideos();
				} else if(hash==='composite' || hash==$('.navModelo li.btComposite').attr('data-indice')){
					$('.navModelo .topPost').fadeOut(); $('.navModelo .nextPost').fadeIn();
					$('.navModelo li.btComposite').addClass('active').find('span').fadeIn(); $('.navModelo li').not('.btComposite').removeClass('active').find('span').fadeOut();
					$('.infoModelo h3').fadeIn();
					$('.infoModelo h2 span').fadeOut(200, function(){
						$('.infoModelo h2 span').text('Composite').fadeIn();
					});
					$('.modeloSingle').attr('data-status',$('.navModelo li.btComposite').attr('data-indice'));
					resetVideos();
				} else if(hash==='bio' || hash==$('.navModelo li.btBio').attr('data-indice')){
					$('.navModelo .topPost').fadeOut(); $('.navModelo .nextPost').fadeIn();
					$('.navModelo li.btBio').addClass('active').find('span').fadeIn(); $('.navModelo li').not('.btBio').removeClass('active').find('span').fadeOut();
					$('.infoModelo h3').fadeIn();
					$('.infoModelo h2 span').fadeOut(200, function(){
						$('.infoModelo h2 span').text('Bio').fadeIn();
					});
					$('.modeloSingle').attr('data-status',$('.navModelo li.btBio').attr('data-indice'));
					resetVideos();
				} else if(hash==='noticias' || hash==$('.navModelo li.btNoticias').attr('data-indice')){
					$('.navModelo .topPost').fadeIn(); $('.navModelo .nextPost').fadeOut();
					$('.navModelo li.btNoticias').addClass('active').find('span').fadeIn(); $('.navModelo li').not('.btNoticias').removeClass('active').find('span').fadeOut();
					$('.infoModelo h3').fadeIn();
					$('.infoModelo h2 span').fadeOut(200, function(){
						$('.infoModelo h2 span').text('Notícias').fadeIn();
					});
					$('.modeloSingle').attr('data-status',$('.navModelo li.btNoticias').attr('data-indice'));
					resetVideos();
				}
				
				$('html, body').animate({scrollTop:parseInt($('.modeloSingle .boxContent:eq('+$('.modeloSingle').attr('data-status')+')').attr('data-offsety'))}, 800);
			
			},
			
			
			slider : {
				
				controls : {
					
					slideOld : null,
					next : function(){

						//click next
						$('.next a').live('click mouseenter mouseleave', function(e){
							
							if(e.type == 'mouseenter'){
								if (jQuery.browser.msie) {$(this).parent('p').find('span').slideDown();} 
								else {$(this).parent('p').find('span').fadeIn();}
							} else if(e.type == 'mouseleave'){
								if (jQuery.browser.msie) {$(this).parent('p').find('span').slideUp();} else {$(this).parent('p').find('span').fadeOut();}								
							} else if(e.type == 'click'){
							
								var nextSlide, laguraSlider, totalElementos=0;
								
								// get total elements
								totalElementos = $(this).parents('.boxSlider').find('div.slider li').length;
								
								// get number position active
								nextSlide = $(this).parents('.boxSlider').find('div.slider').attr('data-pos');
								pages.slider.controls.slideOld = nextSlide; /*reset li, stop video */
								nextSlide = parseInt(nextSlide)+1;
	
								if(totalElementos==nextSlide){
									/*
									nextSlide = 0;
									$(this).parents('.boxSlider').find('div.slider').attr('data-pos', nextSlide);
									$(this).parents('.boxSlider').find('div.slider ul').animate({left:'0px'}, 1000);
									$(this).parents('.boxSlider').find('.numSlider').html('<strong>1</strong> / '+totalElementos);
									*/
								} else {
	
									larguraSlider = $(this).parents('.boxSlider').find('div.slider').width();
	
									// change numActive
									$(this).parents('.boxSlider').find('div.slider').attr('data-pos', nextSlide);
									
									// animation next slider
									$(this).parents('.boxSlider').find('div.slider ul').animate({left:'-'+(nextSlide*larguraSlider)+'px'}, 1000, function(){
										//reset li, stop video
										var html = $(this).parents('.boxSlider').find('div.slider ul li:eq('+pages.slider.controls.slideOld+')').html();
										$(this).parents('.boxSlider').find('div.slider ul li:eq('+pages.slider.controls.slideOld+')').html('');
										$(this).parents('.boxSlider').find('div.slider ul li:eq('+pages.slider.controls.slideOld+')').html(html);
									});
									
									// update info numSlider
									$(this).parents('.boxSlider').find('.numSlider').html('<strong>'+(nextSlide+1)+'</strong> / '+totalElementos);
									
								}
							
							} // end click
							
						});
						
					},
					
					prev : function(){
						
						//
						$('.prev a').live('click mouseenter mouseleave', function(e){
							
							if(e.type == 'mouseenter'){
								if (jQuery.browser.msie) {$(this).parent('p').find('span').slideDown();} 
								else {$(this).parent('p').find('span').fadeIn();}
							} else if(e.type == 'mouseleave'){
								if (jQuery.browser.msie) {$(this).parent('p').find('span').slideUp();} 
								else {$(this).parent('p').find('span').fadeOut();}
							} else if(e.type == 'click'){
								
							
								var prevSlide, laguraSlider, totalElementos=0;
								
								// get total elements
								totalElementos = $(this).parents('.boxSlider').find('div.slider li').length;
								
								// get number position active
								prevSlide = $(this).parents('.boxSlider').find('div.slider').attr('data-pos');
								pages.slider.controls.slideOld = prevSlide; /*reset li, stop video */
								prevSlide = parseInt(prevSlide)-1;
	
								if(prevSlide==-1){
									//reset
								} else {
									larguraSlider = $(this).parents('.boxSlider').find('div.slider').width();
	
									// change numActive
									$(this).parents('.boxSlider').find('div.slider').attr('data-pos', prevSlide);
									
									// animation next slider
									$(this).parents('.boxSlider').find('div.slider ul').animate({left:'-'+(prevSlide*larguraSlider)+'px'}, 1000, function(){
										//reset li, stop video
										var html = $(this).parents('.boxSlider').find('div.slider ul li:eq('+pages.slider.controls.slideOld+')').html();
										$(this).parents('.boxSlider').find('div.slider ul li:eq('+pages.slider.controls.slideOld+')').html('');
										$(this).parents('.boxSlider').find('div.slider ul li:eq('+pages.slider.controls.slideOld+')').html(html);
									});
									
									// update info numSlider
									$(this).parents('.boxSlider').find('.numSlider').html('<strong>'+(prevSlide+1)+'</strong> / '+totalElementos);
									
								}
							
							} // end click
							
						});
						
					}
					
				},
				
				init : function(){
					
					pages.slider.controls.next();
					pages.slider.controls.prev();
					
				}
				
				
				
			}, // sliderModelo
			
			
				
				
				
			sejaUmModelo : function(numberActive){	

				pages.includePage(numberActive);
				
				$('.sejaUmModelo').delay(200).fadeIn(400);
				pages.slideAnimation(numberActive, 'seja-um-modelo');
				
				controller.resizePage();
				
				
				
				/* fileInputs */
				var SITE = SITE || {};
				//var myFSO = new ActiveXObject("Scripting.FileSystemObject");
				SITE.fileInputs = function() {  
					var $this = $(this),      
					$val = $this.val(),   
					valArray = $val.split('\\'),      
					newVal = valArray[valArray.length-1],      
					$button = $this.siblings('.button'),      
					$fakeFile = $this.siblings('.file-holder');  
					
					var nomeArquivo = newVal.split('.');
					
					if(newVal.length>2) {    
						$button.text('Escolher Arquivo');
						if(nomeArquivo[1]==='jpg' || nomeArquivo[1]==='JPG'){
							if($fakeFile.length === 0) {
								$button.after('<span class="file-holder">' + newVal + '</span>');
							} else {
								$fakeFile.text(newVal);
							}  
						}
					}
				};
				
				$("#telefone").mask("(99) 9999-9999");
				$("#celular").mask("(99) 9999-9999");

				$('.file-wrapper input[type=file]').bind('change focus click', SITE.fileInputs);
				
				/* formSejaUmModelo */
				$('#formSejaUmModelo').live('submit', function(){
					
					var count = 0,
						$nome = $(this).find('#nome'),
						$email = $(this).find('#email'),
						$idade = $(this).find('#idade'),
						$altura = $(this).find('#altura'),
						$peso = $(this).find('#peso'),
						$bustoTorax = $(this).find('#bustoTorax'),
						$cintura = $(this).find('#cintura'),
						$quadril = $(this).find('#quadril'),
						$sexo = $(this).find('#sexo'),
						$telefone = $(this).find('#telefone'),
						lang = $('#container').attr('data-lang');
					
					
					if($nome.val().length < 3){
						$nome.addClass('inputError'); $nome.focus();
						if(lang=='en'){ $('#formSejaUmModelo .erro').text('Please fill in the field name correctly!'); } else {
							$('#formSejaUmModelo .erro').text('Campo Nome preenchido incorretamente!');	
						}
						return false;
					} else if($email.val().length < 5 || $email.val().indexOf('@')==-1 || $email.val().indexOf('.')==-1){
						$('#formSejaUmModelo').find('#nome').removeClass('inputError');
						$email.addClass('inputError'); $email.focus();	
						if(lang=='en'){ $('#formSejaUmModelo .erro').text('Please fill in the field email address correctly!'); } else {
							$('#formSejaUmModelo .erro').text('Campo Email preenchido incorretamente!');	
						}
						return false;
					} else if($sexo.val().length < 2){
						$('#formSejaUmModelo').find('#nome, #email').removeClass('inputError');
						if(lang=='en'){ $('#formSejaUmModelo .erro').text('Please fill in the field gender correctly!'); } else {
							$('#formSejaUmModelo .erro').text('Selecione seu sexo!');	
						}
						return false;
					} else if($telefone.val().length < 2){
						$('#formSejaUmModelo').find('#nome, #email').removeClass('inputError');
						$telefone.addClass('inputError'); $telefone.focus();	
						if(lang=='en'){ $('#formSejaUmModelo .erro').text('Please fill in the field phone number correctly!'); } else {
							$('#formSejaUmModelo .erro').text('Campo Telefone preenchido incorretamente!');	
						}
						return false;
					} else if($(this).find('.photo:eq(0)').val() == ""){ 
						$('#formSejaUmModelo').find('#nome, #email, #telefone').removeClass('inputError');
						if(lang=='en'){ $('#formSejaUmModelo .erro').text('Please fill in the field picture 1 correctly!'); } else {
							$('#formSejaUmModelo .erro').text('Campo foto 1 é obrigatório!');
						}	
						return false;
					} else if($(this).find('.photo:eq(1)').val() == ""){ 
						$('#formSejaUmModelo').find('#nome, #email, #telefone').removeClass('inputError');
						if(lang=='en'){ $('#formSejaUmModelo .erro').text('Please fill in the field picture 2 correctly!'); } else {
							$('#formSejaUmModelo .erro').text('Campo foto 2 é obrigatório!');
						}
						return false;
					} else {
						
						if(count==0){
							//$('#formSejaUmModelo').find('#enviar').fadeOut(200);
							$('#formSejaUmModelo').find('#nome, #email, #telefone').removeClass('inputError');
							$('#formSejaUmModelo .erro').text(' ');
							/*$('.loader').fadeIn();
							var dadosForm = $(this).serialize();
							$.ajax({
								url: controller._urlSite()+'seja-um-modelo/enviar',
								enctype: 'multipart/form-data',
								type: 'POST',
								data: dadosForm,
								success: function(data){
									$('.loader').fadeOut();
									$('p.success').delay(300).fadeIn();
								}
							}); // end ajax
							count++;
							return false;
							*/
							return true;
						}
					}
				});
				
				/* change sexo */
				$('.sejaUmModelo .sexo a').live('click', function(){
					$(this).parents('ul').find('li a').removeClass('active'); 
					$(this).addClass('active');
					$(this).parents('.colM').find('#sexo').val($(this).text());
				});
					
			}, // seja um modelo
			
			
			
			
			casting : function(numberActive){
					
				pages.includePage(numberActive);
				
				$('.topModelo').each(function(){
					var qtdNome = $(this).find('h3').text().length;
					if(qtdNome>17){
						$(this).find('h3').css({'margin':'50px 0 15px 0'});
					}
				});

				$('.casting').delay(200).fadeIn(400);
				pages.slideAnimation(numberActive, 'casting');
				
				controller.resizePage();
				
				$("a.photo").fancybox({
					'titleShow'     : false,
					'transitionIn'	: 'elastic',
					'transitionOut'	: 'elastic',
					'easingIn'      : 'easeOutBack',
					'easingOut'     : 'easeInBack'
				});
				
				$("a.video").fancybox({
					'width'				: 720,
					'height'			: 470,
			        'autoScale'     	: false,
			        'transitionIn'		: 'elastic',
					'transitionOut'		: 'elastic',
					'type'				: 'iframe'
				});
				$('a.video').live('click', function(e){
					//$('#fancybox-wrap').css({'left':'50% !important', 'top':'50% !important','margin':'-235px 0 0 -360px'});
					$('#fancybox-close').css({'margin-left':'-30px'});
				});
				var qtdThumbGeral = $('.casting .thumb').length;
				$('.casting .thumb .remove').live('click', function(e){
					pages.castingEffect($(this).parents('.thumb').attr('data-id'), 'del');
					$(this).parents('.thumb').attr('data-status','inactive');
					$(this).parents('.thumb').fadeOut();
					
					var qtd = $(this).parents('.box').find('.thumb[data-status=active]').length;
					if(qtd==0){
						$(this).parents('.box').fadeOut();
					}
					
					qtdThumbGeral--;
					if(qtdThumbGeral==0){
						$('.boxForm').fadeOut(300, function(){	
							$('.boxForm').delay(300).html('<p>Navegue pelo site, e selecione vídeos e imagens que deseja encaminhar.</p><p>Sua seleção ficara armazenada na aba MY CASTING durante sua navegação, e poderá através desta ser encaminhada para o(s) email(s) que desejar.</p>');
							$('.boxForm').delay(400).fadeIn();
						});
					}
					
				});
				
				
				
				var count = 0;
				
				$('#formCasting').live('submit', function(){
					
					var $nomeCasting = $('#formCasting').find('#nomeCasting');
					var $comentarios = $(this).find('#comentarios');
					var $nomeDest = $(this).find('#nomeDestinatario');
					var $emailDest = $(this).find('#emailDestinatario');
					var $nome = $(this).find('#nome');
					var $email = $(this).find('#email');
				
					if($nomeCasting.val().length < 3){
						
						$nomeCasting.addClass('inputError');	
						$nomeCasting.focus();	
						$('#formCasting .erro').text('Campo Nome do Casting preenchido incorretamente!');	
						return false;
						
					} else if($nomeDest.val().length < 3){
						
						$('#formCasting').find('#nomeCasting, #emailDestinatario, #nome, #email').removeClass('inputError');
						
						$nomeDest.addClass('inputError');	
						$nomeDest.focus();	
						$('#formCasting .erro').text('Campo Nome do Destinatário preenchido incorretamente!');	
						return false;
						
					} else if($emailDest.val().length < 5 || $emailDest.val().indexOf('@')==-1 || $emailDest.val().indexOf('.')==-1){
						
						$('#formCasting').find('#nomeCasting, #nomeDestinatario, #nome, #email').removeClass('inputError');
						
						$emailDest.addClass('inputError');	
						$emailDest.focus();	
						$('#formCasting .erro').text('Campo Email do Destinatário preenchido incorretamente!');	
						return false;
					
					} else if($nome.val().length < 3){
						
						$('#formCasting').find('#nomeCasting, #nomeDestinatario, #emailDestinatario, #email').removeClass('inputError');
						
						$nome.addClass('inputError');	
						$nome.focus();	
						$('#formCasting .erro').text('Campo Nome preenchido incorretamente!');	
						return false;
					
					} else if($email.val().length < 5 || $email.val().indexOf('@')==-1 || $email.val().indexOf('.')==-1){
						
						$('#formCasting').find('#nomeCasting, #nomeDestinatario, #emailDestinatario, #nome').removeClass('inputError');
						
						$email.addClass('inputError');	
						$email.focus();
						$('#formCasting .erro').text('Campo Email do Destinatário preenchido incorretamente!');	
						return false;
						
					} else {
						
						if(count==0){
							$('#formCasting').find('.block').fadeIn(0);
							$('#formCasting').find('#nomeCasting, #nomeDestinatario, #emailDestinatario, #nome, #email').removeClass('inputError');
							$('#formCasting .erro').text(' ');
							$('.loader').fadeIn();
							var dadosForm = $(this).serialize();
							if(count==0){
								$.ajax({
									url: controller._urlSite()+'casting/inserir',
									type: 'POST',
									data: dadosForm,
									success: function(data){
										$('.boxSucesso').delay(500).fadeIn(500);
										$('.loader').fadeOut();
										$('.casting .box').fadeOut();
										$('div.top .numCasting').text('0');
									}
								}); // end ajax
							}
							count++;
							return false;
						}
					}
					
				});
					
				
				
				$('.casting .thumb').live('mouseenter mouseleave', function(e){
					
					if (e.type == 'mouseenter'){
						if (jQuery.browser.msie) {$(this).children('span').slideDown(150);} else {$(this).children('span').fadeIn(150);}
					} else if(e.type == 'mouseleave'){
						if (jQuery.browser.msie) {$(this).children('span').slideUp(200);} else {$(this).children('span').fadeOut(200);}
					}
					
				});
				
			}, // end casting
			
			
			
			quemSomos : function(numberActive){
				
				pages.includePage(numberActive);
				
				$('.quemsomos').delay(200).fadeIn(400);
				pages.slideAnimation(numberActive, 'quem-somos');

				controller.resizePage();

			}, // end staff
			
			staff : function(numberActive){
					
				pages.includePage(numberActive);
				
				$('.staff').delay(200).fadeIn(400);
				pages.slideAnimation(numberActive, 'staff');
				
				controller.resizePage();
				
			}, // end staff
			
			
			contato : function(numberActive){
				
				pages.includePage(numberActive);

				$('.contato').delay(200).fadeIn(400);
				pages.slideAnimation(numberActive, 'contato');

				controller.resizePage();
				
				var counter = 0;
				$('#formContato').live('submit', function(){
					
					if($nomeCasting.val().length < 3){
						
						$nomeCasting.addClass('inputError');	
						$nomeCasting.focus();	
						$('#formContato .erro').text('Preencha o campo mensagem novamente');	
						return false;
						
					} else {
						
						// ajax submit
						
					}
						
				});
					
			} // end contato
			
	}; // end pages
	
	
	
	
	
	$(document).ready(function(){

		$('#content').attr('data-pos','-1');
		$('#content').width(controller._window).html('<div class="pos"></div>');
		$('#content .pos').width($(window).width());
		pages.posActive = -1;
		
		controller._hash = location.hash;
		if(controller._hash==="" || controller._hash.length==0 || controller._hash.search('#!/')==-1 || controller._hash==="#" || controller._hash==="#!" || controller._hash==="#/"){
			var url = 'home';
			controller._hashController(url);
		} else {
			var hash = controller._hash.replace('#!/', '');
			pages._control(hash);
		}

		// init
		controller._init();
		
		// nav
		var navOver = function(){$(this).children('ul').slideDown(100);}
		var navOut = function(){$(this).children('ul').slideUp(200);}
		var config = {over: navOver, timeout: 250, out: navOut};
		$("div.top ul li").hoverIntent(config);
		
				
		// init slider
		pages.slider.init();
		
		
		/*
		 * Show/Hidden infoModelo
		 * */
		$('.modeloSingle .navModelo a.btShowHidden').live('click', function(){
			var $this = $(this), $infoModelo = $('.modeloSingle .infoModelo');
			
			if($this.attr('data-status') == 'active'){
				$this.attr('data-status','inactive');
				$('.navModelo div.block').fadeIn();
				$this.find('span').animate({'backgroundPosition':'-14px -57px'},200);
				$infoModelo.find('h2, p').fadeOut(200, function(){
					$infoModelo.find('h2, p, h3').fadeOut();
					$infoModelo.animate({bottom:'-70px'}, 300, function(){
						$infoModelo.find('h2, p').fadeOut();
						$('.navModelo div.block').fadeOut();
						$('.navModelo').find('h3').fadeIn();
					});
				});
				
			} else {				
				
				$this.attr('data-status','active');
				$('.navModelo').find('h3').fadeOut();
				$this.find('span').animate({'backgroundPosition':'10px -57px'},200);
				$infoModelo.find('span.border').fadeOut(200, function(){
					$infoModelo.animate({bottom:'70px'}, 300, function(){
						$infoModelo.find('h2, p').fadeIn();
						pages.timeInfoModelo = setTimeout(function(){ pages.downInfoModelo(); }, 2000);
					});
				});

				var novoHash = location.hash.split('/');
				if(novoHash[novoHash.length-1]=='capa'){
					$('.infoModelo').find('h2').animate({'top':'10px'});
					$('.infoModelo').find('p').animate({'bottom':'15px'});
				} else {
					$('.infoModelo').find('h3').fadeIn();
					$('.infoModelo').find('h2').animate({'top':'15px'});
					$('.infoModelo').find('p').animate({'bottom':'10px'});
				}
				
			}
			
		}); // end show/hidden infoModelo
		
		
		
	});
	
})(jQuery);
