Hello, I'm Rafael, I live in Brazil and I have a big doubt JS.
I'm new to JS and my problem is:
I'm doing a page containing 3 images, clicking on an image a YOUTUBE VIDEO OF LOADED is, if you click on another image in the video running to be closed and the new video uploaded.

The solution:
oa declare each ifame div as display: none;,
when the User clicks on the image a javascript function is triggered by modifying the div display: block;.

The problem:
The div appears and hides normally, but the video continues its execution actually the audio video continues running.

Follow the code test


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Galeria de video</title>
<script type="text/javascript">
function movie_1(id){
document.getElementById("test_1").style.display='block';
document.getElementById("test_3").style.display='none';
document.getElementById("test_2").style.display='none';
}
function movie_2(id){
document.getElementById("test_2").style.display='block';
document.getElementById("test_1").style.display='none';
document.getElementById("test_3").style.display='none';
}
function movie_3(id){
document.getElementById("test_3").style.display='block';
document.getElementById("test_1").style.display='none';
document.getElementById("test_2").style.display='none';
}
</script>

<style type="text/css">
#test_1, #test_2, #test_3{
display: none;}
#movies{
width:500px;
height:300px;
margin-left:auto;
margin-right:auto;}
#conteudo{
width:900px;
height:700px;
margin-left:auto;
margin-right:auto;}
</style>
</head>

<body>
<div id="conteudo">

<div id="movies">

<a href="javascript: ;" onclick="movie_1(test_1);">Video 1</a>
<a href="javascript: ;" onclick="movie_2(test_2);">Video 2</a>
<a href="javascript: ;" onclick="movie_3(test_3);">Video 3</a>


<div id="test_1"><iframe width="420" height="315" src="http://www.youtube.com/embed/NK0U5lOP_-k" frameborder="0" allowfullscreen></iframe></div>


<div id="test_2"><iframe width="420" height="315" src="http://www.youtube.com/embed/LQuA7jjeNKw" frameborder="0" allowfullscreen></iframe></div>
<div id="test_3"><iframe width="420" height="315" src="http://www.youtube.com/embed/T8RzkST12bs" frameborder="0" allowfullscreen></iframe></div>

</div>
</div>


</body>
</html>