/**
* --------------------------------------------------------------------------------------
* Scripts
* ----------------------------------------------------
* Modified April 08, 2009 by Chris
* @version 4.0.1
* @author Curtis <curtis@navigatormm.com>
* ----------------------------------------------------
*
* --------------------------------------------------------------------------------------
*/

$(document).ready(function()
{
	
/* Form Script
--------------------------------------------------------------------------------------- */
	$('#left input, #left textarea, #left select').focus(function(){
		$(this).parents('.right').addClass("over");
		}).blur(function(){
		$(this).parents('.right').removeClass("over");
	});


/* LightBox Script
--------------------------------------------------------------------------------------- */

$('.homeFade').cycle({ 
    fx:    'fade', 
    speed:  1800 
 });

$(function() {
  var host = window.location.hostname;
  if(host == 'stonehenge' || host == 'badger'){
  	var fpath = window.location.pathname;
	var parts = fpath.split('/');
	var path  = '/'+parts[1];
  }else{
  	path = '';
  }
  $('a[rel*="gallery"]').lightBox({
  	overlayBgColor:	'#000000',
	overlayOpacity:	0.8,
	imageLoading:	path+'/inc/js/lightbox/lightbox-ico-loading.gif',
	imageBtnClose:  path+'/inc/js/lightbox/lightbox-btn-close.gif',
	imageBtnPrev:	path+'/inc/js/lightbox/lightbox-btn-prev.gif',
	imageBtnNext:	path+'/inc/js/lightbox/lightbox-btn-next.gif',
	imageBlank:		path+'/inc/js/lightbox/lightbox-blank.gif',
	containerResizeSpeed: 500,
	txtImage:		'Photo',
	txtOf:			'of',
	keyToClose:		'c',
	keyToPrev:		'p',
	keyToNext:		'n',
 	fixedNavigation: true,
	showImageData: false
   });
});

$(document).ready(function(){
	$('.content input, .content textarea, .content select').focus(function(){
		$(this).parents('.right').addClass("over");
	}).blur(function(){
		$(this).parents('.right').removeClass("over");
	});
});

/* Modal Script
--------------------------------------------------------------------------------------- */

	$('.modal').click(function(){
			var id=$(this).parent().attr('id');
			$('#'+id+'-form').modal({position: ["10%"]});
	});

/* DETECT NAVIGATION ON STATE SCRIPT
--------------------------------------------------------------------------------------- */
	var url = location.pathname.substring(1);
	if (url.substr(-1, 1) == '/') url += 'index.php';
	var path = url.split("/");
	
	//path.shift();  /required only if its tested under a subfolder
	if(path.length>1){
		path.pop();
		path='/'+path.join('/')+'/';
	}
	else path=path[0];

	if (url) {
		$('#nav li a[href*="' + url + '"]').addClass('selected');
	}
});

/* Email Hide Script
--------------------------------------------------------------------------------------- */

function parse_email(user, server, domain, subject) {
	if(user && server && domain){
		emailto = "mailto:"+user+'@'+server+'.'+domain+"?subject="+subject;
		window.location = emailto;
	}
}

