/*
* dhMenu.js
* damion hickman design 2009
* steve@damionhickman.com
*/
gDropDownMaxLines = 10;
function addHighlight(imgsrc) {
if (imgsrc.indexOf("-over.gif") == -1) {
return imgsrc.replace(".gif","-over.gif");
}
return imgsrc;
}
function closeAllMenuDropDowns() {
gHoverTimer = -1;
$(".dropDown").each(function (i) {
$(this).trigger("mouseenter");
$(this).trigger("mouseleave");
});
}
$.fn.outerHTML = function() {
var doc = this[0] ? this[0].ownerDocument : document;
return $('
', doc).append(this.eq(0).clone()).html();
};
var gHoverTimer = -1;
$(document).ready(function(){
if (jQuery.browser.msie && (jQuery.browser.version < 8)) {
ISIE = true;
} else {
ISIE = false;
}
$('#selectRegion').click(
function() {
var position = $(this).position();
var popup = $(".for-selectRegion");
//var left = Math.round(($(window).width() - popup.width()) / 2);
//var top = Math.round(($(window).height() - popup.height()) / 2);
var top = position.top - popup.height() - 75;
var left = position.left;
popup.css({'left':left,'top':top})
.slideDown("fast");
}
);
$('.dropmenuClose').click(
function () {
if (ISIE) {
$(this).closest(".dropmenu").hide();
} else {
$(this).closest(".dropmenu").fadeOut("fast")
}
}
);
$('.menuKill').mouseover(
function() {
closeAllMenuDropDowns();
}
);
$('.tab').mouseover(
function() {
var position = $(this).position();
var pnt = $(this).parent();
var outerpos = pnt.position();
var menu = ".for-" + $(this).attr('id');
$(".dropmenu")
.stop(true,true)
.each(function (i) { $(this).hide(); });
$('.tab').removeClass('on');
if ($(menu).length == 0) return;
$(this).addClass('on');
var theDropDown = $(menu);
var numCols = $('.linkcolumn',theDropDown).length;
var pl;
if (numCols == 0) {
pl = position.left;
} else {
pl = Math.round(($(window).width() - theDropDown.width()) / 2);
}
theDropDown.css('left', pl);
theDropDown.css('top', outerpos.top + pnt.height() + 7);
theDropDown.slideDown("fast").bind("mouseenter", function (e) {
$(this).bind("mouseleave", function (e) {
if (ISIE) {
$(this).hide();
} else {
$(this).fadeOut("fast")
}
$(this).unbind("mouseenter mouseleave");
$('.tab').removeClass('on');
});
});
}
);
});