$(document).ready(function(){ 
    $(".blueBox").css("color", "#ffffff");
    $(".blueBox").css("padding", "0px 9px");
    var w = parseInt($(".blueBox").css("width"));
    if (w) {
        var p = parseInt($(".blueBox").css("padding-left"));
        p += parseInt($(".blueBox").css("padding-right"));
        p *= 2.4;
        w -= Math.round(p);
    } else {
        w = '';
    }
    $(".blueBox").wrap('<div class="blueBoxHolder">'+ 
    '<div style="background:transparent url(/images/screen4/events-menu-1.0_r9_c4.jpg) repeat top left;">'+
    '<div style="background:transparent url(/images/screen4/events-menu-1.0_r9_c2.jpg) repeat-y top left;">'+
    '<div style="background:transparent url(/images/screen4/events-menu-1.0_r9_c5.jpg) repeat-y top right;padding:1px 0px;">'+
    '</div>'+ 
    '</div>'+ 
    '</div>'+ 
    '</div>');
    //$(".blueBoxHolder").css("width", w);
    $(".blueBox").css("width", "auto");
    $('.blueBoxHolder').prepend('<div style="height:9px;background:transparent url(/images/screen4/events-menu-1.0_r7_c4.jpg) repeat-x top left;">'+
    '<div style="height:9px;background:transparent url(/images/screen4/events-menu-1.0_r7_c2.jpg) no-repeat top left;">'+
    '<div style="height:9px;background:transparent url(/images/screen4/events-menu-1.0_r7_c5.jpg) no-repeat top right;">'+
    '</div>'+
    '</div>'+
    '</div>')
    .append('<div style="height:16px;background:transparent url(/images/screen4/events-menu-1.0_r10_c3.jpg) repeat-x bottom left;">'+
    '<div style="height:16px;background:transparent url(/images/screen4/events-menu-1.0_r10_c2.jpg) no-repeat bottom left;">'+
    '<div style="height:16px;background:transparent url(/images/screen4/events-menu-1.0_r10_c6.jpg) no-repeat bottom right;"> </div>'+
    '</div></div>');

    $(".greyBox").css("padding", "6px");
    $(".greyBox").wrap('<div class="greyBoxHolder" style="border:#c6c6c6 0px solid;padding:0px;">'+ 
    '<div class="greyBoxInner" style="border:#00a4f2 1px solid;padding:0px 0px 0px 0px;">'+
    '</div>'+ 
    '</div>');
    //$(".greyBoxHolderX").css("width", $(".greyBox").css("width"));
    $('.greyBoxHolder').append('<div style="height:16px;background:transparent url(/images/screen4/events-menu-1.0_r10_c3.jpg) repeat-x bottom left;">'+
    '<div style="height:16px;background:transparent url(/images/screen4/events-menu-1.0_r10_c2.jpg) no-repeat bottom left;">'+
    '<div style="height:16px;background:transparent url(/images/screen4/events-menu-1.0_r10_c6.jpg) no-repeat bottom right;"> </div>'+
    '</div></div>');
});
$(document).ready(function(){ 
    if($(".userContent .shadow")) {
        $(".userContent img.shadow").css("border", "#000000 0px solid");
        $(".userContent img.shadow").css("padding", "0px");
        $(".userContent .shadow").css("margin", "0px");
        $(".userContent .shadow").wrap('<table border="0"><tr><td style="padding:0; margin:0;">'+ 
        '<div class="imgBoxInner" style="border:#00a4f2 0px solid;padding:0; margin:0;">'+
        '</div>'+ 
        '</td></tr></table>');
        $('.userContent img.shadow').parent(".imgBoxInner").prepend('<div class="section_corr"> </div><div class="section_corl"> </div>')
        $(".userContent img.shadow").parent(".imgBoxInner").addClass('pic');
        $(".userContent #farnhomeloop").parent(".imgBoxInner").addClass('loop');
        $('.imgBoxInner').append('<div class="imgFooter" style="margin-top:0px;"><div style="height:8px;background:transparent url(/images/screen4/events-menu-1.0_r5_c4.jpg) repeat-x bottom left;">'+
        '<div style="height:8px;background:transparent url(/images/screen4/events-menu-1.0_r5_c2.jpg) no-repeat bottom left;">'+
        '<div style="height:8px;background:transparent url(/images/screen4/events-menu-1.0_r5_c5.jpg) no-repeat bottom right;"> </div>'+
        '</div></div></div>');
        if ($.browser.msie) {
            $(".imgFooter").css("margin-top", "-3px");
        } else {
        $(".pic .imgFooter").css("margin-top", "-3px");
        $(".loop .imgFooter").css("margin-top", "-4px");
        }
    }
});

$(document).ready(function(){ 
	var textmode = getCookie('textmode');
	if($(".RelatedLinks") && textmode <= 0) {
		$(".RelatedLinks span").mouseover(function() {
			$(this).addClass("hover");
		});
		$(".RelatedLinks span").mouseout(function() {
			$(this).removeClass("hover");
		}); 
	}
});

$(function() {
    if ($.browser.msie) {
	    var zIndexNumber = 1000;
	    $('div').each(function() {
		    $(this).css('zIndex', zIndexNumber);
		    zIndexNumber -= 10;
	    });
	}
});

$(document).ready(function(){ 
if($("ul.sf-menu").length>=1){
    $("ul.sf-menu").superfish({delay:600,autoArrows: false,dropShadows: true,animation: {height:'show'},speed: 'fast'}); 
}
}); 

/********************** callable functions *************************************/
var tag = [];
var lastI ;
var map;

function call_map(items){
			var myOptions = {
				zoom: 6,
				//center: new google.maps.LatLng(51.8982465, -2.0751915),
				center: new google.maps.LatLng(53.75656, -2.075192),
				mapTypeControl: true,
				navigationControl: true,
				navigationControlOptions: {
					style: google.maps.NavigationControlStyle.ZOOM_PAN
				  },
				streetViewControl: true,
				scaleControl: true,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			}
	
			map = new google.maps.Map(document.getElementById("map"), myOptions);
			var image = '/images/map_icon.png';
			var shadow = '/images/shadow.png'

			for(i in items)
			{
				tag[i] = new Object;

				var myLatLng = new google.maps.LatLng(items[i][0], items[i][1]);

				var marker = new google.maps.Marker({
					position: myLatLng,
					map: map,
					icon: image,
					shadow: shadow
				});
	
				tag[i].marker = marker;
				tag[i].html = items[i][2];
	
				tag[i].infoWindow = new google.maps.InfoWindow({
					content: tag[i].html
				});

				tag[i].listener = makeClosure(i, tag[i].marker) ;
			}
};

function makeClosure(x, marker)
{
	var listener = google.maps.event.addListener(marker, 'click', function() {
		openInfoWindow(x) ;		// <-- this is the key to making it work
	});
	return listener ;	
}

function openInfoWindow(i)
{
	if (lastI)
	{
		tag[lastI].infoWindow.close() ;
	}
	lastI = i ;    
	tag[i].infoWindow.open(map,tag[i].marker) ;    
}

