html 5 overlay ad closing button

Hi, I have a html 5 overlay ad with youtube video embedded, ad is created with “google web designer” , I could ad a close button with java but the problem is if someone close the ad while video is playing it does not mute or pause the youtube video. pls suggest me any solution if you know.

this is my javacript code

<script language="javascript">
function myFunction() {

document.getElementById("cey-frame").height = "420";



document.getElementById("close-btn").style.display = "";
if(document.getElementById("close-btn").style.visibility = "hidden" ) {
document.getElementById("close-btn").style.visibility = "visible";


}
else {
document.getElementById("close-btn").style.visibility = "hidden";
}
}
</script>



<script language="javascript">
function myFunctionClose() {
document.getElementById("cey-frame").height = "0";
document.getElementById("close-btn").style.visibility = "hidden";

}
</script>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

</style>
</head>

<body>

<div style="width:990px; height:650px; margin:0 auto; background-image:url(990x650.jpg)">

<A HREF="#" onclick="myFunctionClose()"><img src="close.png" width="62" height="64" alt="Close" /></A>

<IFRAME id="cey-frame" style="position:absolute;" SRC="index.html" WIDTH=990 HEIGHT=650 allowtransparency="true" frameborder="0" scrolling="no">

</IFRAME>