openlayers change Map div

HTML

<script src="http://openlayers.org/api/OpenLayers.js"></script>
<body onload="init()">openlayers change Map div 
    <div>
    <input type="button" value="move map" onclick="movemap()" />
    
    </div>
    <div id="map" style="width: 200px; height: 200px; border: 1px solid black"></div>
    <div id="map2" style="width: 200px; height: 200px; border: 1px solid green"></div>
</body>

JavaScript

var map;

function init() {
    map = new OpenLayers.Map({
        div: "map",
        center: new OpenLayers.LonLat(0, 0),
        minResolution: "auto",
        maxResolution: 1000,
        layers: [
        new OpenLayers.Layer.OSM()]
    });

}


function movemap() {
    if (map.div.id == "map") {
        map.render("map2");
        console.log(map.div);
    } else {
        map.render("map");
        console.log(map.div);
    }
}