﻿var areaTimeout = [];
$(document).ready(function() {
    $('a[rel*=lightbox]').lightBox({fixedNavigation:false});
    $('.lightBoxGallery a').lightBox({fixedNavigation:false});
			   
	// Use the each() method to gain access to each of the elements attributes
	$('area').each(function() {
	    var $this = this;
	    var name = $this.className.substr(3);
	    areaTimeout[name] = -1;
	    $(this).mouseover(function(){
	        if(areaTimeout[name]!= -1)
	        {
	            clearTimeout(areaTimeout[name]);
	            areaTimeout[name] = -1;
	        }
		    $('.districts' + name).show();
		});
		$(this).mouseout(function(){
		    areaTimeout[name]=setTimeout(function(){
		        var name = $this.className.substr(3);
		        $('.districts' + name).hide();
		    }, 300);
		});
    });
    $('.districts').each(function(){
        var $this = this;
	    $(this).mouseover(function(){
	        var name = $this.className.substr(19);
	        var area = $('.map' + name);
            if(areaTimeout[name]!= -1)
            {
                clearTimeout(areaTimeout[name]);
                areaTimeout[name] = -1;
            }
	        $(this).show();
		});
	    $(this).mouseout(function(){
		    var name = $this.className.substr(19);
		    areaTimeout[name]=setTimeout(function(){
		        $('.districts' + name).hide();
		    }, 300);
		});
    });
    
});

function toggleCity(obj)
{
    $(obj).next('ul:first').toggle();
}

