// JavaScript Document
var map = null;
Cufon.replace('h1', { fontFamily: 'boldcond',hover: false });
Cufon.replace('.brand a', { fontFamily: 'helvcond',hover: true});
Cufon.replace('h2', { fontFamily: 'helvcond',hover: false });
Cufon.replace('#header span', { fontFamily: 'helvcond',hover: false });
Cufon.replace('.panel_title', { fontFamily: 'helvcond',hover: false });
Cufon.replace('ul.navigation a', { fontFamily: 'helvcond',hover: true });
Cufon.replace('.sidebar_container .title', { fontFamily: 'helvcond',hover: false });
Cufon.replace('.main_title h3', { fontFamily: 'boldcond',hover: false });
$(document).ready(function() {
	if(typeof($.fn.nivoSlider)!='undefined'){
		$('#slider').nivoSlider({
			effect:'boxRandom', // Specify sets like: 'fold,fade,sliceDown'
			slices:15, // For slice animations
			boxCols: 8, // For box animations
			boxRows: 4, // For box animations
			animSpeed:1000, // Slide transition speed
			pauseTime:5000, // How long each slide will show
			startSlide:0, // Set starting Slide (0 index)
			directionNav:false, // Next & Prev navigation
			directionNavHide:false, // Only show on hover
			controlNav:false, // 1,2,3... navigation
			controlNavThumbs:false, // Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, // Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', // Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
			keyboardNav:true, // Use left & right arrows
			pauseOnHover:false, // Stop animation while hovering
			manualAdvance:false, // Force manual transitions
			captionOpacity:0.8, // Universal caption opacity
			prevText: 'Prev', // Prev directionNav text
			nextText: 'Next', // Next directionNav text
			beforeChange: function(){}, // Triggers before a slide transition
			afterChange: function(){}, // Triggers after a slide transition
			slideshowEnd: function(){}, // Triggers after all slides have been shown
			lastSlide: function(){}, // Triggers when last slide is shown
			afterLoad: function(){} // Triggers when slider has loaded
		});
	}
	$('.jqmWindow').jqm({modal: true,
						 toTop:true,
						 overlay:60,
						 onHide: function(hash){
							hash.w.fadeOut(800,function(){$('#map').remove();});
							hash.o.fadeOut(800,function(){$(this).remove();});			 
						 }
					});
});
function loadLocation(lat,lng){
	$('.jqmWindow').jqmShow();
	$('#jqmContainer').empty().append('<div id="map"></div>');
	var latlng = new google.maps.LatLng(lat,lng);
	var myOptions = {
		zoom: 16,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		scrollwheel: false
	}
	map = new google.maps.Map(document.getElementById("map"),myOptions);
	var marker =new google.maps.Marker({
		position: latlng,
		map: map,
		icon: root+'images/site/markerbig.png'
	});
}
function mailpop(type){
	$('#jqmContainer').empty().load(root+'index.php/site/mailform/',
									{type: type},
									function(){
										Cufon.replace('.main_title h3', { fontFamily: 'boldcond',hover: false });
										if($('.dp').length){
											$('.dp').datepicker({dateFormat: 'd M yy'});
										}	
										$('#popcontact').jvalidate({dir: 'left',scrollerror: false});
									});
	$('.jqmWindow').jqmShow();
}
function closeModal(){
	$('.jqmWindow').jqmHide();
}
function loadServices(p){
	$('#specials').load(root+'index.php/site/loadservices/page/'+p);	
}
function loadParts(p){
	$('#parts').load(root+'index.php/site/loadparts/page/'+p);	
}
