Hello Everyone,

Im here cause I am desperate.

I just can not find a solution to close this modal window with a video inside. It will .hide, but the video will keep running.

I tried .remove and .empty, they work, the video stops, but then I can not reopen my videos. So it does not work for what I want.

People sent me other jquerys ways and windows, but I do not know how to use them, and really just want this to close. I am new on programming. I tried like 5 different forums.

There must be a way. PLz help me

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>jQuery Modal Window</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('a[name=modal]').click(function(e) {
e.preventDefault();
var id = $(this).attr('href');
var maskHeight = $(document).height();
var maskWidth = $(window).width();
$('#mask').css({'width':1000,'height':580});
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(mask).height();
var winW = $(mask).width();
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/4);
$(id).fadeIn(2000);
});
$('.window .close').click(function (e) {
e.preventDefault();
$('#mask').hide();
$('.window').close();
$('.window').hide();
});
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
$('.window').close();
});
});
</script>
<style type="text/css">
body {
font-family:verdana;
font-size:15px;
}
a {color:#333; text-decoration:none}
a:hover {color:#ccc; text-decoration:none}
#mask {
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#000;
display:none;
}
#boxes .window {
position:fixed;
left:1000;
bottom:-100px;
width:440px;
height:200px;
display:none;
z-index:9999;
padding:20px;
}
#boxes #dialog {
width:820px;
height:520px;
padding:10px;
background-color:#ffffff;
}
#boxes #dialog1 {
width:820px;
height:520px;
padding:10px;
background-color:#ffffff;
}
#boxes #dialog2 {
width:820px;
height:520px;
padding:10px;
background-color:#ffffff;
}
#boxes #dialog3 {
width:820px;
height:520px;
padding:10px;
background-color:#ffffff;
}
.close{display:block; text-align:right;}
</style>
</head>
<body>
<ul>
<table border="0">
<tr>
<th><a href="#dialog" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" >
</a></th>
<th><a href="#dialog1" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></th>
<th><a href="#dialog2" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></th>
</tr>
<tr>
<td><a href="#dialog3" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></td>
<td><a href="#dialog1" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></td>
<td><a href="#dialog2" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></td>
</tr>
<tr>
<td><a href="#dialog" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></td>
<td><a href="#dialog" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></td>
<td><a href="#dialog" name="modal"><img height="180" width="300" src="http://imagens.kboing.com.br/papeldeparede/running_horse.jpg" ></a></td>
</tr>
</table>
</ul>
<div style="font-size:10px;color:#ccc" ></div>
<div id="boxes">
<div id="dialog" class="window" >
<a href="#" class="close" size"5">Fechar</a><br />
<iframe src="//www.youtube.com/embed/li_UAkm8yio" width="820" height="517" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen style="position:absolute;top:12px;bottom10px;">
</iframe>
</div>
<!-- Janela Modal com caixa de diálogo -->
<div id="dialog1" class="window">
<iframe id="youtube" width="820" height="517" src="//www.youtube.com/embed/li_UAkm8yio" frameborder= "0" allowfullscreen style="position:absolute;top:12px;bottom10px;"></iframe>
<a href="#" class="close">Fechar [X]</a><br />
</div>
<!-- Fim Janela Modal com caixa de diálogo -->
<!-- Janela Modal com Bloco de Nota -->
<div id="dialog2" class="window">
<a href="#" class="close">Fechar [X]</a><br />
<iframe id="youtube" width="820" height="517" src="//www.youtube.com/embed/li_UAkm8yio" frameborder= "0" allowfullscreen style="position:absolute;top:12px;bottom10px;"></iframe>
</div>
<!-- Fim Janela Modal com Bloco de Nota -->
<div id="dialog3" class="window">
<a href="#" class="close">Fechar [X]</a><br />
<iframe id="youtube" width="820" height="517" src="//www.youtube.com/embed/li_UAkm8yio" frameborder= "0" allowfullscreen style="position:absolute;top:12px;bottom10px;"></iframe>
</div>
<!-- Máscara para cobrir a tela -->
<div id="mask"></div>
</div>
</body>