function showFullDetails(fullDetails){
	if(fullDetails==null){ return false }
    $(".welcomeText").hide();
    $("#moreInfo")
	.find("h2.moreInfo_title_text").text(fullDetails.bottomTabs.Title).end()
	.find(".moreInfo_title_icon").addClass("moreInfoicon_"+fullDetails.bottomTabs.SubCatId).end()
    .show();
    //console.log("id = " + fullDetails.MoreInfoId);
    //console.log(fullDetails);
	$("#mx_tabs")
		.attr('class','grid_12 '+fullDetails.bottomTabs.Colour)
		.empty()
		.append("<ul></ul");
    
	$.each(fullDetails.bottomTabs.Tabs, function(index, tab){ 
		$("#mx_tabs ul").append("<li><a href=\"#" + tab.Href + "\">"+tab.Title+"</a></li>");
		$("#tab_content").append("<div id=\""+tab.Href+"\"></div>");
		//get temp gray
		//console.log("link colour = "+$("#mx_tabs ul li a[href=\"#" + tab.Href + "\"]").css('color'));
		$("#mx_tabs ul li a[href=\"#" + tab.Href + "\"]").addClass("temp_colour");
        		
		$("#"+tab.Href).load(tab.Url,function(){
			//once loaded put temp gray colour here...
            $("#mx_tabs ul li a[href=\"#" + tab.Href + "\"]").removeClass("temp_colour");
            //console.log("link colour = "+$("#mx_tabs ul li a[href=\"#" + tab.Href + "\"]").css('color'));
		});
	});
	make_tabs();
    return false;
}
function showSlideshow(Images){
	var popupIMGs = $("<div class='slideshow_sml'></div>");
	var slideshow_nav = $('<ul id="slideshow_nav" class="jcarousel-skin-matrix10sml"></ul>');
	var slideshow_controls = $('<div class="slideshow_controls_sml"><div><a href="#" id="pause_slideshow">PAUSE</a> <a href="#" id="hide_captions">HIDE CAPTIONS</a></div></div>');
    
	$.each(Images, function(index, img){
		image = '<div class="image"> \
		<div class="caption"> \
			<div class="caption_text">'+img.title+' <span class="copyright">'+img.copyright+'</span></div> \
			<div class="caption_background"></div> \
		</div> \
		<img src="'+img.url+'" border="0" alt="'+img.title+' '+img.copyright+'" title="'+img.title+' '+img.copyright+'" >';
		popupIMGs.append(image);
	
		//var thumb_url = img.url.replace("images\/points\/", "images\/points\/thumbs\/").replace(/\.jpg$/, "_thumb.jpg");
		slideshow_nav.append('<li style="float:left"><a href="#"><img src="'+img.url+'" width="70" height="50" /></a></li>');
    });
	
	$("#photo_overlay").remove();
	popupIMGs.prependTo("body").wrap("<div id='photo_overlay'></div>;");
	$("#photo_overlay").append(slideshow_nav);
	$("#photo_overlay").append(slideshow_controls);

	$( "#photo_overlay" ).dialog({
		title: null,
		modal: true,
		resizable: false,
		width: 625,
		height: 570,
		zIndex: 2500,
		dialogClass:'no_border'
	}).css({overflow:"hidden"});
	$(".ui-dialog-titlebar").hide();
	$(".ui-dialog .ui-dialog-content").css({padding:"10px"});

	var x = $('#slideshow_nav').jcarousel({
		scroll:6,
		initCallback: jcarousel_init
	});
	 
	$('.slideshow_sml').cycle({
		speed: 3000,
		timeout: 1,
		cleartype: false,
		pager: "#slideshow_nav", 
		pagerAnchorBuilder: function(idx, slide) { 
		//	return selector string for existing anchor 
			return '#slideshow_nav li:eq(' + idx + ') a';
		},
		before:function(){
		//	$(".activeSlide").parent("li").next().find("a").click();
			if($(".activeSlide").length>0){
				if($("#slideshow_nav li:last").find("a.activeSlide").length>0){
					carousel_selected = 1;
				}else{
					carousel_selected = Number($(".activeSlide").parent("li").attr("jcarouselindex"))+1;
				}
				if(carousel_selected>c.last || carousel_selected == 1){c.scroll($.jcarousel.intval(carousel_selected));}
				//	console.log(carousel_selected);
			}
		},
		speedIn: 4000,  // speed of the "in" transition 
		speedOut: 4000  // speed of the "out" transition
	});
	
	$(".slideshow_sml .image .caption .caption_background").css("opacity",.8);

	$("#hide_captions").toggle(function(){
		// $('.caption_text,.caption_background').hide("slide", { direction: "down" }, 1000);
		$('.caption_text,.caption_background').animate({opacity: 0}, 900 );
		$(this).text("SHOW CAPTIONS");
	},function(){
		//$('.caption_text,.caption_background').animate({height: "40px",top:"-=40px"}, 900 );
		$('.caption_text,.caption_background').animate({opacity: .8}, 900 );
		$(this).text("HIDE CAPTIONS");
	})

	$("#pause_slideshow").toggle(function(){
		$('.slideshow_sml').cycle('pause');
		$(this).text("PLAY");
	},function(){
		$('.slideshow_sml').cycle('resume');
		$(this).text("PAUSE");
	});

	var close_box = $("<a href='#' id='close_overlay' style='width:34px;height:34px;position:absolute;z-index:5000;display:block;'><img src='/images/close.png' /></a>").prependTo("#photo_overlay");
	var offset = close_box.offset();
	close_box.offset({top:offset.top+7, left:offset.left+589}).hide();
	
	$("#photo_overlay .image, #close_overlay").live("mouseover",function(){
		$("#close_overlay").stop(true, true).fadeIn('fast');
	})
	
	$("#photo_overlay .image, #close_overlay").live("mouseout",function(){
		$("#close_overlay").stop(true, true).fadeOut('slow')
	})
	
	$(".ui-widget-overlay, #close_overlay").live("click",function(){
		$(".slideshow_sml").cycle("destroy");
    	$("#photo_overlay").dialog("destroy");
	});
	
	return false;
}

	//wether dropdown code...
	var dropdown_showing = false;
	var dropdown_mousehover = false;
	var timer;

	function hide_dropdown(){
		if(dropdown_mousehover==false){
			$(".metcheck a#dropdown").click();
		}else{
			timer = setTimeout("hide_dropdown()",7500);
		}
	}

$(document).ready(function(){
	//$.each($(":input[type=hidden]"),function(i,item){
	//if(typeof console != undefined){console.log($(this).attr("id")+"="+$(this).val());}
	//})
	$.easing.def = "easeOutExpo"; 
	$("#moreInfo").hide();
	
    $.each($("#top_nav ul li a"), function(index, value) {
        //console.log("location.href = "+location.href+" AND value = "+value);
        if(value==location.href){$(this).addClass("selected");}
        if(location.href.search("/points")>-1){
            $("#top_nav ul li a:eq(1)").addClass("selected");
        }
	});

	if($(".category_list a.selected").length>0){
		var arrow_marker = $('.category_list a.selected').clone()
		var cat_id = 4;
		var arrow_marker_class = arrow_marker.attr("class");
		var class_parts = arrow_marker_class.split(" ");
		cat_id = class_parts[1];
		cat_id = cat_id.substr("bg_colour_".length);
	
		arrow_marker
		.css({
			border:"0px solid blue",
			position:"absolute",
			"background-color":"transparent",
			"margin-left":"260px",
			"margin-top":"1px",
			height:"24px",
			width:"7px"
		})
		.empty().html("<img border=\"0\" src=\"/images/arrow_"+cat_id+".gif\" />")
		.prependTo('.category_list a.selected');
	}
	
	try {
	$('#map_key').dialog({
		autoOpen: false,
		//show: 'fade',
		//hide: 'fade',
		zIndex: 4000,
		width:740,
		minWidth:740,
		height:140,
		resizable:false,
		minHeight:140,
		position:['center','top'],
		title:"Map Key:",
		dialogClass:'mapKeyDialogue',
		beforeclose: function(event, ui){/*console.log(this);*/},
		open: function(event, ui){
			$(this).prev(".ui-dialog-titlebar").css({
				"font-size":"0.7em",
				"line-height":"0.6em"
			})
			
			$('#map_key').dialog("widget").parent().css({
				"margin-left":"98px",
				"top":"438px"
			});
			$("#map_key ul li").css("font-size","10px");
		}
	})
	$("#closeKey").click(function(){$('#map_key').dialog("close");})
	$("#map_key").tabs({
		event: 'mouseover'
	});
	$(".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *") 
 		.removeClass("ui-corner-all ui-corner-top") 
  		.addClass("ui-corner-bottom");
	}catch(e){
	
	}
	$('#map_key_link').click(function() {
		if(!$('#map_key').dialog('isOpen')){$('#map_key').dialog('open')}else{$('#map_key').dialog('close')}
		//$('#map_key').css('margin-left','50px');
		return false;
	});

//weather dropdown
	if($(".xc_location").length>0){
	//bof if link exists.
		var location_of_last_slash = $(".xc_location").attr("href").lastIndexOf("/");
		var place_id = $(".xc_location").attr("href").substr(location_of_last_slash-1);
		var href_http = $(".xc_location").attr("href").substr(0,location_of_last_slash+1);

		var link = href_http+place_id;
		
		var list = $("<ul class=\"whole_list\"></ul>");
		list.appendTo($(".metcheck")).hide();
		$(".metcheck a#today")
		.append("<span class='background_image' style='background-color:white;display:block;height:48px;line-height:50px'><span class='top metcheck_image'></span><span class='bottom metcheck_image'></span></span>")
		.button()
		.click( function(e) {
			$(this).attr("href",link)
			e.stopPropagation(); // to prevent event from bubbling up
			//e.preventDefault(); // then cancel the event (if it's cancelable)
			//return false;
		})
		.css({padding:0});
		
		$(document).click(function(){
			if(dropdown_showing) hide_dropdown();
		})
		$(".metcheck").hover(function(){
			dropdown_mousehover = true;
		},function(){
			dropdown_mousehover = false;
		})
		$(".metcheck a#dropdown")
		.button({
			text: false,
			icons: {
				primary: "ui-icon-triangle-1-s"
			}
		})
		.click(function(e){
			if(dropdown_showing==false){
				$(".whole_list").show().slideDown('slow',function(){
					dropdown_showing = true;
				});
				e.stopPropagation(); // to prevent event from bubbling up
				e.preventDefault(); // then cancel the event (if it's cancelable)
				
				timer = setTimeout("hide_dropdown()",7500);
				//alert(e.relatedTarget);
			}else{
				$(".whole_list").slideUp('fast',function(){dropdown_showing=false;});
				e.stopPropagation(); // to prevent event from bubbling up
				e.preventDefault(); // then cancel the event (if it's cancelable)
				clearTimeout(timer);
			}
		})
		.parent()
		.buttonset();
			
		var w = 62; //width
		var g = 8; //gutter
		var x1 = 152;//first x,y (top left)
		var y1 = 102;
		var h1 = 19;//height  
		
		var x2 = 152;//second x,y (bottom - top left)
		var y2 = 250;
		var h2 = 23;//height
		
		for(i=1;i<7;i++){
			var top = "<a href=\""+link+"\" class='metcheck_image top' title='See Detailed Forcasts' style='background-position:-"+x1+"px -"+y1+"px'></a>";
			var bottom = "<a href=\""+link+"\" class='metcheck_image bottom' title='See Detailed Forcasts' style='background-position:-"+x2+"px -"+y2+"px'></a>";
			list.append("<li>"+top+bottom+"</li>");
			x1 = x1+w+g;
			x2 = x2+w+g;
		}
		/*
		$(".whole_list li").hover(function(){//$(this).clone().prependTo($(this)).addClass('highlight').css({height:(h1+h2)+"px"}).html('');
		},function(){//$(".highlight").remove();})
		*/
		$(".whole_list li").button();
		
		$(".whole_list li a").click(function(){
			
			//return false
		})
	}//eof if no link on page
})

