can someone please help me, I am having trouble implementing this, i just want the map to center when the window is resized. But it wont eve load the map

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=utf-8" />
<title>Untitled Document</title>

<style>
#map {

    position:absolute; top:0; left:0; width:100%; height:100%;
}
</style>
<script
src="https://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script>
var myOptions = {
    center: new google.maps.LatLng(35.02, 111.02),
    zoom: 8,
    mapTypeId: google.maps.MapTypeId.ROADMAP
}

var map = new google.maps.Map(document.getElementById("map"), myOptions);

$(window).on('resize', function(){var currCenter = map.getCenter();google.maps.event.trigger(map, 'resize');map.setCenter(currCenter);
});

</script>
</head>

<body>
<div id="map"></div>
</body>
</html>