(function () {
mod_navFrame_ext = typeof mod_navFrame_ext === "undefined" ? 10 : mod_navFrame_ext;
HTML;
echo "var html = '" . str_replace("\n", "\\n", $html) . "';";
?>
$("#" + mod_navFrame_id).html(html).children("div").css("cursor", "pointer").hover(
function () {
$(this).addClass("ui-state-hover");
},
function () {
$(this).removeClass("ui-state-hover");
}
);
eventInit.register(function () {
var directionArray = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
for (var i in directionArray) {
(function () {
var currentDirection = directionArray[i];
$("#mb"+currentDirection+"_"+mod_navFrame_id).click(function () {
// $("#arrow_"+currentDirection.toLowerCase()+"_"+mod_navFrame_id).click(function () {
mod_navFrame(currentDirection);
});
}());
}
});
eventAfterMapRequest.register(function () {
mod_navFrame_arrange();
});
function mod_navFrame_arrange(){
var el = document.getElementById(mod_navFrame_target).style;
var ext = mod_navFrame_ext;
var myLeft = parseInt(el.left, 10);
var myTop = parseInt(el.top, 10);
var myWidth = parseInt(el.width, 10);
var myHeight = parseInt(el.height, 10);
//left,top,width,height
mod_navFrame_pos("mbN_"+mod_navFrame_id,(myLeft),(myTop - ext),(myWidth),(ext));
document.getElementById("arrow_n_"+mod_navFrame_id).style.left = (myWidth/2 - parseInt(document.getElementById("arrow_n_"+mod_navFrame_id).width, 10)/2) + "px";
mod_navFrame_pos("mbNE_"+mod_navFrame_id,(myLeft + myWidth),(myTop - ext),(ext),(ext));
mod_navFrame_pos("mbE_"+mod_navFrame_id,(myLeft + myWidth),(myTop),(ext),(myHeight));
document.getElementById("arrow_e_"+mod_navFrame_id).style.top = (myHeight/2 - parseInt(document.getElementById("arrow_n_"+mod_navFrame_id).height, 10)/2) + "px";
mod_navFrame_pos("mbSE_"+mod_navFrame_id,(myLeft + myWidth),(myTop + myHeight),(ext),(ext));
mod_navFrame_pos("mbS_"+mod_navFrame_id,(myLeft),(myTop + myHeight),(myWidth),(ext));
document.getElementById("arrow_s_"+mod_navFrame_id).style.left = (myWidth/2 - parseInt(document.getElementById("arrow_s_"+mod_navFrame_id).width, 10)/2) + "px";
mod_navFrame_pos("mbSW_"+mod_navFrame_id,(myLeft - ext),(myTop + myHeight),(ext),(ext));
mod_navFrame_pos("mbW_"+mod_navFrame_id,(myLeft - ext),(myTop),(ext),(myHeight));
document.getElementById("arrow_w_"+mod_navFrame_id).style.top = (myHeight/2 - parseInt(document.getElementById("arrow_w_"+mod_navFrame_id).height, 10)/2) + "px";
mod_navFrame_pos("mbNW_"+mod_navFrame_id,(myLeft - ext),(myTop -ext),(ext),(ext));
}
function mod_navFrame(val){
mb_panMap(mod_navFrame_target,val);
}
function mod_navFrame_pos(el,left,top,width,height){
document.getElementById(el).style.left = left + "px";
document.getElementById(el).style.top = top + "px";
document.getElementById(el).style.width = width + "px";
document.getElementById(el).style.height = height + "px";
}
}());