jQuery.noConflict();







jQuery(document).ready(function(){




	//hack para mudar o menu
//	jQuery(".nacional #submenu a:contains('Phoenix 290 Platinum')").text("Phoenix 290 Platinum LANÇAMENTO").css("color","yellow") 
//	jQuery(".nacional #submenu a:contains('Phoenix 360 Platinum')").text("Phoenix 360 Platinum LANÇAMENTO").css("color","yellow") 
//	jQuery(".nacional #submenu a:contains('Phoenix 275 Platinum')").text("Phoenix 275 Platinum LANÇAMENTO").css("color","yellow") 
//	//jQuery(".nacional #submenu a:contains('Phoenix 195 Platinum')").text("Phoenix 195 Platinum LANÇAMENTO").css("color","yellow") 
//	

jQuery(".nacional #submenu a:contains('Phoenix 290 Platinum Open')").text("Phoenix 290 Platinum Open LANÇAMENTO").css("color","yellow") 

jQuery(".nacional .contentheading_embarcacoes:contains('Phoenix 290 Platinum Open')").text("290 Platinum Open")

//	//hack para mudar o menu
//	jQuery(".internacional #submenu a:contains('Phoenix 290 Platinum')").text("Phoenix 290 Platinum NEW").css("color","yellow") 
//	jQuery(".internacional #submenu a:contains('Phoenix 360 Platinum')").text("Phoenix 360 Platinum NEW").css("color","yellow")


	jQuery('a:contains("Factory installed Accessories")').text('Factory Accessories')

	
	jQuery(".nacional h2:contains('Phoenix 195 Platinum Faixa Luxo')").text("Phoenix 195 Platinum")
	jQuery(".nacional h2:contains('Phoenix 235 Platinum Faixa Luxo')").text("Phoenix 195 Platinum")

	//adiciona a lingua atual ao body
//  var lingua = window.document.location.href;
//  
//  patt=/lang=pt/g;
//  result=patt.test(lingua);
//  if(result)
//  {
//  
//  
//  	jQuery('#wrap').addClass('nacional');
//  	
//  
//  } else {
//  
//  	reg=/.*lang=(..)/;
//  	
//  	ling = lingua.match(reg);
//  	
//  	alert(ling)
//  
//  	jQuery('#wrap').addClass('internacional');
//  	
//  	//alert(li[1])
//  	
//  	lin = ling[1];
//  	
//  	jQuery('#wrap').addClass(lin);
//  	
//  	
//  }


	//desabilita as marcaras
	jQuery("#jflanguageselection a").each(function(){
		
		//jQuery(this).attr('href','javascript:void(0)');
		//	jQuery(this).fadeTo('fast', 0.5)
	})
	
	
	
	
	jQuery('#menu .item3 a').attr('href','javascript:void(0)');	

	var newImg = jQuery('#imgborda>img').clone().appendTo('#imgborda');
	newImg.attr({'id':'temporario'});
	
	//mudança de cores
	jQuery("#cores img[src$='amarelo.png']").click(function(){
		barcoCor("amarelo")
	})
	
	//mudança de cores
	jQuery("#cores img[src$='verde.png']").click(function(){
		barcoCor("verde")
	})
	
	//mudança de cores
	jQuery("#cores img[src$='azul.png']").click(function(){
		barcoCor("azul")
	})
	
	//mudança de cores
	jQuery("#cores img[src$='vermelho.png']").click(function(){
		barcoCor("vermelho")
	})
	
	//mudança de cores
	jQuery("#cores img[src$='branco.png']").click(function(){
		barcoCor("branco")
	})
	
	
	
	//mudança de cores
	jQuery("#cores img[src$='preto.png']").click(function(){
		barcoCor("preto")
	})
	


	jQuery("#mask").fadeTo('slow', 0.0, function(){ jQuery(this).hide();});


	jQuery("#tabs").tabs() //.tabs('equalize');
	




		jQuery("#submenu").hide();
		
	//	jQuery("._embarcacoes #submenu").show();	
		
		
		jQuery("#menu ul li a").hover(function() {
				//	jQuery("#submenu").hide('fast');
				submenuintv = setTimeout('mostrasubmenu(false)',0)
		
		
			}, function() {
			//	jQuery("#submenu").toggle('fast');
			}); 
		
		
		
		
		jQuery("#menu ul li a:eq(2)").unbind();
		
		jQuery("._embarcacoes #menu ul li a").hover(function() {
						//
				}, function() {
				//	jQuery("#submenu").toggle('fast');
				});
		
		jQuery("#menu ul li a:eq(2)").hover(function() {
			
			//	submenuintv = setTimeout('mostrasubmenu(true)',100)
			
				mostrando=jQuery("#submenu").css('display')
				
				if(mostrando!='block'){
					jQuery("#submenu").show('fast');
				}else{
						clearInterval(submenuintv)
				}
				
		}, function() {
		//	jQuery("#submenu").toggle('fast');
		}); 


		










		jQuery("#submenu").hover(function() {
			//	jQuery("#submenu").show('fast');
		}, function() {
			//jQuery("#submenu").hide('fast')
				submenuintv = setTimeout('mostrasubmenu(false)',500)
		});


	//	jQuery("._embarcacoes #menu ul li a").unbind();
	

})


var submenuintv

function mostrasubmenu(qual){
	
	clearInterval(submenuintv)
	
	if(qual){
		jQuery("#submenu").show('fast')
		
	}else{
	
		jQuery("#submenu").hide('fast')
		
	}
	
}








//jQuery.extend(jQuery.ui.tabs.prototype, { 
//    equalize: function() { 
//        var heights = this.jQuerypanels.map(function() { 
//            return jQuery(this).height(); 
//        }) 
//        .get() 
//        .sort(function(a, b) { 
//            return b - a; 
//        }); 
//        // set all panels to highest height 
//        this.jQuerypanels.css('height', heights[0]); 
//    } 
//}); 



function viewVideo(video){
	//alert(video);
	




	var lingua = window.document.location.href;
	
	 closevar = "fechar"
	
	if(lingua.match(/lang=en/)) closevar = "close";






	html = "<div id='fade' style='display:none;background-color:black;position:absolute; top:0; left:0;right:0;bottom:0;z-index:9999999'></div><div  id='cortina' style='position:absolute; top:0; left:0;right:0;bottom:0;z-index:999999999'><table height='100%' width='100%'><tr height='100%'><td height='100%' valign='middle' align='center'><div id='flashplayer' style='	border: 10px solid #000;width:513px;height:341px'></div><a style='display:block; width:533px; height:50px;background-color:black;text-align:center;font-weight: bold;line-height:50px;text-decoration: none;' id='fechar' href='javascript:closeVideo()'>"+closevar+"<a></tr></td></table></div>";



	jQuery("body").prepend(html)
	
	jQuery('#fade').fadeTo('fast', 0.0, function(){
		
		jQuery('#fade').fadeTo('slow', 0.7).show();
	});
	
	
//	jQuery.fn.media.defaults.flvPlayer = '/mediaplayer/player-viral.swf';


	//jQuery('#flashplayer').flash({swf:video, width:513, height:341});
	
	
//	jQuery('#flashplayer').midia({swf:video, width:513, height:341});
	
	
   //    jQuery('#flashplayer').media({ 
   //        width:     513, 
   //        height:    341, 
   //        autoplay:  true, 
   //        src:       video, 
   //     //   attrs:     { attr1:  'attrValue1',  attr2:  'attrValue2' },  // object/embed attrs 
   //       // params:    { param1: 'paramValue1', param2: 'paramValue2' }, // object params/embed attrs 
   //        caption:   false // supress caption text 
   //    });
	
	videoFLV = video.replace(/\....$/,"")
	
		videoFLV = 'http://phoenixboats.com.br/'+ videoFLV;
	
	
	jQuery('#flashplayer').flowplayer("/flowplayer/flowplayer-3.1.5.swf",(videoFLV+".flv"));
		
}







function view360(video){
	//alert(video);
	
		videoFLV = 'http://phoenixboats.com.br/'+	video;
	
//	var myWindow = window.open("foo.html","windowName","resizable=yes");
	var myWindow = open(videoFLV, 'new', 'width=415,height=345,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no')
	
	
	
	return true;
	
	
	
	
	
	var lingua = window.document.location.href;
	
	 closevar = "fechar"
	
	if(lingua.match(/lang=en/)) closevar = "close";


	html = "<div id='fade'  style='display:none;background-color:black;position:absolute; top:0; left:0;right:0;bottom:0;z-index:9999999'></div><div  id='cortina' style='position:absolute; top:0; left:0;right:0;bottom:0;z-index:999999999'><table height='100%' width='100%'><tr height='100%'><td height='100%' valign='middle' align='center'><div id='flashplayer' style='	border: 10px solid #000;width:513px;height:341px'></div><a style='display:block; width:533px; height:50px;background-color:black;text-align:center;font-weight: bold;line-height:50px;text-decoration: none;' id='fechar' href='javascript:closeVideo()'>"+closevar+"<a></tr></td></table></div>";



	jQuery("body").prepend(html)
	
	jQuery('#fade').fadeTo('fast', 0.0, function(){
		
		jQuery('#fade').fadeTo('slow', 0.7).show();
	});
	
	
//	jQuery.fn.media.defaults.flvPlayer = '/mediaplayer/player-viral.swf';

	videoFLV = 'http://phoenixboats.com.br/'+	video;
	jQuery('#flashplayer').flash({swf:videoFLV, width:513, height:341});
	










	
//	jQuery('#flashplayer').midia({swf:video, width:513, height:341});
	
	
   //    jQuery('#flashplayer').media({ 
   //        width:     513, 
   //        height:    341, 
   //        autoplay:  true, 
   //        src:       video, 
   //     //   attrs:     { attr1:  'attrValue1',  attr2:  'attrValue2' },  // object/embed attrs 
   //       // params:    { param1: 'paramValue1', param2: 'paramValue2' }, // object params/embed attrs 
   //        caption:   false // supress caption text 
   //    });
	
	//videoFLV = video.replace(/\....$/,"")
	
	//videoFLV = 'http://phoenixboats.com.br/'+	videoFLV;
	
	
	//jQuery('#flashplayer').flowplayer("/flowplayer/flowplayer-3.1.5.swf",(videoFLV+".flv"));
		
}









function closeVideo(){
	jQuery('#flashplayer').html('&emsp;');

	jQuery('#cortina').remove();

	jQuery("#fade").fadeTo('slow', 0.0, function(){ jQuery(this).hide();});
}


function barcoCor(cor){
	
	var imgBase = jQuery('#imgborda img:first').attr('src');
	imgBase = imgBase.match(/[^\/]*$/);
	imgBase = imgBase[0].replace(/....$/,"");
	
	
//	alert(newImg)
	novaImagem = "/images/stories/barcos/cores/"+imgBase+"_"+cor+".jpg"



//	var newImg2 = jQuery('#temporario').clone().appendTo('#imgborda');
//	newImg2.attr({'id':'temporario2'});
//	newImg2.fadeTo('fast', 0.0)
	jQuery('#temporario2').remove();
	
	var img = new Image();

	  // wrap our new image in jQuery, then:
	  jQuery(img)
	    // once the image has loaded, execute this code
	    .load(function () {
	      // set the image hidden by default    
	      jQuery(this).hide();

	      // with the holding div #loader, apply:
	      jQuery('#imgborda')
	         // then insert our image
	        .append(this);

	      // fade our image in to create a nice effect
	      jQuery(this).fadeIn('slow', function() {
	      	jQuery('#temporario').attr('src', novaImagem);
	      });
	      
	    })

	    // if there was an error loading the image, react accordingly
	    .error(function () {
	      // notify the user that the image could not be loaded
	    })

	    // *finally*, set the src attribute of the new image to our image
	    .attr({'src': novaImagem,'id':'temporario2'});
	
	
	
	
//	jQuery("#temporario").attr('src', novaImagem);
//	jQuery('#imgborda img').hide();

	
	
}


function faixaluxo(arquivo){
	
	arqdest="";
	//se é a primeira vez, definias variaveis
	if(jQuery("#faixaluxo.inicio").length==0){
	//	alert('primeira vez');
		
		jQuery("#faixaluxo").addClass('inicio')
		
		var imgBase = jQuery('#imgborda img:first').attr('src');

		imgBase = imgBase.match(/[^\/]*$/);
		imgBase = imgBase[0] //.replace(/....$/,"");
		
		jQuery("#faixaluxo").attr('imgum',imgBase);
		jQuery("#faixaluxo").attr('imgdois',arquivo);
		jQuery("#faixaluxo").attr('atual',1);
		
	}
	
	
	//seleciona o proximo
	if( jQuery("#faixaluxo").attr('atual')==1){
		
			jQuery("#faixaluxo").attr('atual',2).text("Ver normal");
			
			arqdest = jQuery("#faixaluxo").attr('imgdois')			
		
			//mudança de cores
			jQuery("#cores img[src$='branco.png']").attr('src','/images/stories/preto.png').click(function(){
				barcoCor("preto")
			});
			
			jQuery("#cores").addClass('faixaluxo');
			
			//
		
	}else 	if( jQuery("#faixaluxo").attr('atual')==2){
	

					jQuery("#faixaluxo").attr('atual',1).text("Ver Faixa Luxo");;

					arqdest = jQuery("#faixaluxo").attr('imgum')			

					//mudança de cores
					jQuery("#cores img[src$='preto.png']").attr('src','/images/stories/branco.png').click(function(){
						barcoCor("branco")
					});
					
					
					
						jQuery("#cores").removeClass('faixaluxo');
		
		
		
	}
	
	
	
	

	novaImagem = "/images/stories/barcos/"+arqdest;
	
	jQuery('#temporario2').remove();
	
//	jQuery("a#faixaluxo").attr('onClick','faixaluxo('+imgBase+')')
	
	
	
	var img = new Image();

	  // wrap our new image in jQuery, then:
	  jQuery(img)
	    // once the image has loaded, execute this code
	    .load(function () {
	      // set the image hidden by default    
	      jQuery(this).hide();

	      // with the holding div #loader, apply:
	      jQuery('#imgborda')
	         // then insert our image
	        .append(this);

	      // fade our image in to create a nice effect
	      jQuery(this).fadeIn('slow', function() {
	      	jQuery('#temporario').attr('src', novaImagem);
	
		jQuery('#imgborda img:first').attr('src',novaImagem)
	
	      });
	      
	    })

	    // if there was an error loading the image, react accordingly
	    .error(function () {
	      // notify the user that the image could not be loaded
	    })

	    // *finally*, set the src attribute of the new image to our image
	    .attr({'src': novaImagem,'id':'temporario2'});
	
	

		
	
}






