
jQuery(function($){

$('#nav > li a').each(function(){

$(this).append('<span>' + $(this).attr('title') + '</span>');

});

$('a[rel=lightbox]').lightBox({overlayBgColor:'#483647'});

if($('.map_address').length>0)
{

$('.map_address').each(function()
{

var address = $(this).text();

if(address.length>0)
{

$(this).append('<div id="id' + Math.floor(Math.random()*5) + '" class="location_map"></div>');

var dat = encodeURIComponent(address);

$.ajax({

type: "POST",
url: "http://www.websterandwood.com.au/geo.php",
data: "loc=" + dat,
success: function(coord)
{

var coord_array = coord.split("::");

var latitude = coord_array[0];

var longitude = coord_array[1];

var latlon = [latitude,longitude];

    $('.location_map:last').jmap('init', {'mapType':'map','mapCenter':latlon,'mapZoom':16,'mapShowjMapsIcon':false});
	
	$('.location_map:last').jmap('AddMarker', {'pointLatLng':latlon},function(marker, options)
	{
	
	});

}

});

}

});


}

$('div.banner_container').slidecaption({tag: 'a.banner_slide'});

	$('#contactform').validate({tag:'.required',req_append: 'This Input is a Required Field', script:'ajax_save.php', http:'http://www.websterandwood.com.au/'});
	
	$(".slide-show-vars").each(function()
	{
	
	var slideshow = $(this);
	
	var contain_width = $(slideshow).width();
	
	var sid = $(slideshow).attr("rel");
	
	var slidespeed = $(slideshow).attr("speed");
	
	var caption_active = $(slideshow).attr("caption");
	
	if(slidespeed.length==0)
	{
	slidespeed = "6000";
	}
	
	$.ajax({
	type:"POST",
	url:"http://www.websterandwood.com.au/slideshow_select.php",
	data:"id="+sid+'&w='+contain_width,
	success:function(show)
	{
	
	$(slideshow).replaceWith(show);
	
	$('div.page-slide-show').slideshow({speed: slidespeed, caption: caption_active});
	
	}
	
	});
	
	});
	
	$("#nav").superfish({
		hoverClass	: "sfHover",
		delay		: 800,
		autoArrows	: false,
		animation	: {opacity:"show"},
		speed		: "normal",
		disableHI	: true
	})
	
});
