$(document).ready(function(){
	$('input.text').click(function() {
			if (this.value == this.defaultValue) {
				this.value = '';
			}
	});
	$('input.text').blur(function() {
			if (this.value == '') {
				this.value = this.defaultValue;
			}
	});
	$('textarea').click(function() {
			if ($(this).val() == $(this).attr('rel')) {
				$(this).val('');
			}
	});
	$('textarea').blur(function() {
		if ($(this).val() == '') {
			$(this).val($(this).attr('rel'));
		}
	});
	$('body.page-20 #flash').flash({
		'src':'/images/stories/flash/blastrite_blasting_systems_30082010_852.swf',
		'width':'700',
		'height':'500',
		'allowfullscreen':'false',
		'allowscriptaccess':'always',
		'wmode':'transparent',
		'quality':'high'
	});
	$('body.page-21 #flash').flash({
		'src':'/images/stories/flash/blastrite_painting_systems_31082010_843.swf',
		'width':'700',
		'height':'500',
		'allowfullscreen':'false',
		'allowscriptaccess':'always',
		'wmode':'transparent',
		'quality':'high'
	});
	// <a href="#" rel="map" class="map" lat="-34.397" lng="150.644">directions</a>
	$('a[rel*=maplink]').click(function() {
		var link = $(this).attr('href');
		$.facebox.settings.opacity = 0.75;
		$.facebox('<div id="fbmap"></div>');
		$('#fbmap').append('<iframe id="map" width="800" height="600" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"/>');
		$('#map').attr('src', link);
		return false;
 	});
	$('a[rel*=map]').click(function() {
		var lat = $(this).attr('lat');
		var lng = $(this).attr('lng');
		$.facebox.settings.opacity = 0.75;
		$.facebox('<div id="fbmap"></div>');
		var latlng = new google.maps.LatLng(lat,lng);
	  var mapOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
		var map = new google.maps.Map(document.getElementById("fbmap"), mapOptions);
		var marker = new google.maps.Marker({
			position: latlng,
			title:"Blastrite"
		});
		marker.setMap(map);
		return false;
 	});
});
