// JavaScript Document
function menu(i){
						     if(($("#hedd"+i+ " img").attr('src'))=="imagenes/hedd"+i+"-1.gif"){
								 for(var j=1; j<7;j++){
								  $("#hedd"+j +" img").attr('src',"imagenes/hedd"+j+"-1.gif");
								  }
								  $("#hedd"+i+ " img").attr('src',"imagenes/hedd"+i+"-2.gif");
								  $("#sub_productos").hide(500);
								  $("#sub_idea").hide(500);}
							  
							  else if(($("#hedd"+i+ " img").attr('src'))=="imagenes/hedd"+i+"-2.gif"){
								  $("#hedd"+i+ " img").attr('src',"imagenes/hedd"+i+"-1.gif");
								  }
							  }

function submenu(h,i){ $("#hedd"+h+i).attr('class','current');//$("#hedd11").attr('class','new');
													for(var j=1;j<4;j++){
														
															for(k=1;k<3;k++){
																if(j!=i||k!=h){$("#hedd"+k+j).attr('class','new');}
																		}
															}
													}
							
						    
							 
$(document).ready(function(){
						    //$("#texto_p").load('texto_p.php?id=desc');
						   $("#sub_idea").hide(0);
							 $("#sub_productos").hide(0);
							 
						   $("#blocker").fadeOut(0);
						   $(".lightbox").fadeOut(0);
						   //$("#blocker").hide(0);
						   $("#inu").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeTo(500,.5);
													 $("#inufib").fadeTo(500,1);})
						     				
							$("#inu1").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeTo(500,.5);
													 $("#inufib1").fadeTo(500,1);})

							$("#inu2").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeTo(500,.5);
													 $("#inufib2").fadeTo(500,1);})
													 										
						   $("#jas").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeTo(500,.5);
													 $("#japon").fadeTo(500,1);})
						   
						   $("#usda").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeTo(500,.5);
													 $("#estadosUnidos").fadeTo(500,1);})
						   
						   $("#ue").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeTo(500,.5);
													 $("#unionEuropea").fadeTo(500,1);})
						   
						   $("#naturland").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeTo(500,.5);
													 $("#corea").fadeTo(500,1);})
						   
						   $("#blocker").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeOut(500);
													 $(".lightbox").fadeOut(500)})
						   $(".cerrar").click(function(){
													 //$("#blocker").show(0);
													 $("#blocker").fadeOut(500);
													 $(".lightbox").fadeOut(500)})
						   $("#container").click(function(){
													 if($("#blocker").css("opacity")==.5){
													 $("#blocker").fadeOut(500);
													 $(".lightbox").fadeOut(500)}})
													   
													   
						for(var i=1; i<7;i++){
						  $("#fl"+i+" img").fadeOut(0);}
						    $("#sub_idea").hide(0);
							 $("#sub_productos").hide(0);
						   
						   
$("#hedd1").click(function(){
							  if(($("#hedd1 img").attr('src'))=="imagenes/hedd1-1.gif"){
								  for(var i=1; i<7;i++){
								  $("#hedd"+i +" img").attr('src',"imagenes/hedd"+i+"-1.gif");
								  }
								   $("#hedd1 img").attr('src',"imagenes/hedd1-2.gif");
								  $("#sub_idea").show(500);
								  $("#sub_productos").hide(500);
								  }
								  		
							  else if(($("#hedd1 img").attr('src'))=="imagenes/hedd1-2.gif"){
								  $("#hedd1 img").attr('src',"imagenes/hedd1-1.gif");
								  $("#sub_idea").hide(500);}
							  })

if(($("#hedd1 img").attr('src'))=="imagenes/hedd1-2.gif"){
	$("#sub_idea").show(500);
	$("#fl1 img").fadeIn(1000);
	$("#fl1 img").attr('src',"imagenes/flecha2.gif");
													}


$("#hedd2").click(function(){
							  if(($("#hedd2 img").attr('src'))=="imagenes/hedd2-1.gif"){
								  for(var i=1; i<7;i++){
								  $("#hedd"+i +" img").attr('src',"imagenes/hedd"+i+"-1.gif");
								  }
								  $("#hedd2 img").attr('src',"imagenes/hedd2-2.gif");
								  $("#sub_productos").show(500);
								  $("#sub_idea").hide(500);}
							  
							  else if(($("#hedd2 img").attr('src'))=="imagenes/hedd2-2.gif"){
								  $("#hedd2 img").attr('src',"imagenes/hedd2-1.gif");
								  $("#sub_productos").hide(500);}
							  })

if(($("#hedd2 img").attr('src'))=="imagenes/hedd2-2.gif"){
	$("#sub_productos").show(500);
	$("#fl2 img").fadeIn(1000);
	$("#fl2 img").attr('src',"imagenes/flecha2.gif");
													}

$("#idea_footer").click(function(){
							  if(($("#hedd1 img").attr('src'))=="imagenes/hedd1-1.gif"){
								  for(var i=1; i<7;i++){
								  $("#hedd"+i +" img").attr('src',"imagenes/hedd"+i+"-1.gif");
								  }
								   $("#hedd1 img").attr('src',"imagenes/hedd1-2.gif");
								  $("#sub_idea").show(500);
								  $("#sub_productos").hide(500);
								  for(var i=1; i<7;i++){ if (i!=1){$("#fl"+i+" img").fadeOut(1000);}}
								   $("#fl1 img").fadeIn(1000);
														$("#fl1 img").attr('src',"imagenes/flecha2.gif");}
								  		
							  else if(($("#hedd1 img").attr('src'))=="imagenes/hedd1-2.gif"){
								  $("#hedd1 img").attr('src',"imagenes/hedd1-1.gif");
								  $("#sub_idea").hide(500);
								  $("#fl1 img").fadeOut(1000);}
							  })


$("#productos_footer").click(function(){
							  if(($("#hedd2 img").attr('src'))=="imagenes/hedd2-1.gif"){
								  for(var i=1; i<7;i++){
								  $("#hedd"+i +" img").attr('src',"imagenes/hedd"+i+"-1.gif");
								  }
								  $("#hedd2 img").attr('src',"imagenes/hedd2-2.gif");
								  $("#sub_productos").show(500);
								  $("#sub_idea").hide(500);
								  for(var i=1; i<7;i++){ if (i!=2){$("#fl"+i+" img").fadeOut(1000);}}
								  $("#fl2 img").fadeIn(1000);
														$("#fl2 img").attr('src',"imagenes/flecha2.gif");}
							  
							  else if(($("#hedd2 img").attr('src'))=="imagenes/hedd2-2.gif"){
								  $("#hedd2 img").attr('src',"imagenes/hedd2-1.gif");
								  $("#sub_productos").hide(500);
								  $("#fl2 img").fadeOut(1000);}
							  })

if(($("#hedd0 img").attr('src'))=="imagenes/hedd0-2.gif"){
	$("#fl0 img").fadeIn(1000);
	$("#fl0 img").attr('src',"imagenes/flecha2.gif");
													}

for(var i=3;i<7;i++){
if(($("#hedd"+i+" img").attr('src'))=="imagenes/hedd"+i+"-2.gif"){
	$("#fl"+i+" img").fadeIn(1000);
	$("#fl"+i+" img").attr('src',"imagenes/flecha2.gif");
													}
}
$("#hedd3").click(function(){menu (3)})
$("#hedd4").click(function(){menu (4)})
$("#hedd5").click(function(){menu (5)})
$("#hedd6").click(function(){menu (6)})


$("#hedd11").mouseenter(function(){ submenu(1,1)})
$("#hedd12").mouseenter(function(){ submenu(1,2)})
$("#hedd13").mouseenter(function(){ submenu(1,3)})
$("#hedd21").mouseenter(function(){ submenu(2,1)})
$("#hedd22").mouseenter(function(){ submenu(2,2)})
$("#hedd23").mouseenter(function(){ submenu(2,3)})

$("#hedd11").mouseleave(function(){$("#hedd11").attr('class','new')})
$("#hedd12").mouseleave(function(){$("#hedd12").attr('class','new')})
$("#hedd13").mouseleave(function(){$("#hedd13").attr('class','new')})
$("#hedd21").mouseleave(function(){$("#hedd21").attr('class','new')})
$("#hedd22").mouseleave(function(){$("#hedd22").attr('class','new')})
$("#hedd23").mouseleave(function(){$("#hedd23").attr('class','new')})


$("#header_menu").click(function(){
								 for(var i=1; i<7;i++){
										if(($("#hedd"+i+" img").attr('src'))=="imagenes/hedd"+i+"-2.gif"){
														$("#fl"+i+" img").fadeIn(1000);
														$("#fl"+i+" img").attr('src',"imagenes/flecha2.gif");}
																		else{$("#fl"+i+" img").fadeOut(1000);
																			//$("#fl"+i+" img").attr('src',"imagenes/flecha1.gif");
																			}
								 }

})

$('#send').click(function(){	
					    
					
						
						
                        var valido = '';
                        var msg = 'The fields in red are required.';
						
						var destino=$("#destiny").val();
                        var name = $("#enviar_nombre").val();
						var phone = $("#enviar_telefono").val();
						var country = $("#enviar_pais").val();
                        var email = $("#enviar_mail").val();
			            var comentario = $("#enviar_comentario").val();
						
						/*	$("#respuesta").html(destino);*/
						
			            if (name.length<1 || comentario.length<1 || email.length<1|| destino<1) { valido = msg; }
						
                        if (name.length<1) { $('#nombre').addClass('error'); } else{ $('#nombre').removeClass('error'); }
                        if (email.length<1) { $('#mail').addClass('error'); } else{ $('#mail').removeClass('error'); }
			            if (comentario.length<1) { $('#comentario').addClass('error'); } else{ $('#comentario').removeClass('error'); }
						if (destino<1) { $('#destiny').addClass('error'); } else{ $('#destiny').removeClass('error'); }
						
                        if (valido!='') {
                        $("#respuesta").html(valido);
                        } else {
							
							if(destino==1){var to="iideaeurope@iidea.com.mx";}
							if(destino==2){var to="iideanorthamerica@iidea.com.mx";}
							if(destino==3){var to="iidealatam@iidea.com.mx";}
							if(destino==4){var to="iideaasia@iidea.com.mx";}
							if(destino==5){var to="contact@iidea.com.mx";}
							if(destino==6){var to="iideaemployment@iidea.com.mx";}
							
                        var datastr ='name=' + name + '&email='+ email +'&comentario=' + comentario + '&to=' + to +'&phone=' + phone + '&country=' + country;
                        $.ajax({
                                type: "POST",
                                url: "mail.php",
                                data: datastr,
                                cache: false,
                                success: function(){
								 $("#respuesta").html("Your message has been sent");
                                }
                               });
                        }
                        return false;
                });



$("#mexico").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=mexicoen');
})

$("#usa").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=usaen');
})

$("#holanda").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=holandaen');
})

$("#alemania").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=alemaniaen');
})

$("#polonia").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=poloniaen');
})

$("#turquia").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=turquiaen');
})

$("#rusia").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=rusiaen');
})

$("#korea").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=koreaen');
})

$("#japon").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=japonen');
})

$("#italia").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=italiaen');
})

$("#espana").click(function(){
  $("#texto_p").fadeIn('slow');
  $("#texto_p").load('texto_p.php?id=espanaen');
})
					   


  


 })
