/* ---------------------------------------------------------------------------------------
Site: 			websitename.com
Author: 		Chris Satterthwaite
Updated: 		January.24.2010
Updated By: 	Chris Donalds
--------------------------------------------------------------------------------------- */
$(document).ready(function(){

  $('#dialog').jqm();

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

/* Cycle Script
--------------------------------------------------------------------------------------- */
	$('.fade').cycle({ 
	    fx:    'fade', 
	    speed:  1800 
	});

/* 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);
	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 ul li a[href*="' + url + '"]').addClass('selected');
	} else {
		$('.home a').addClass('selected');
	}
});

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

$(function(){
  $('a[rel*="gallery"]').lightBox({
	fixedNavigation: true,							  
  	overlayBgColor:	'#000000',
	overlayOpacity:	0.9,
	imageLoading:	'inc/js/lightbox/lightbox-ico-loading.gif',
	imageBtnClose:	'inc/js/lightbox/lightbox-btn-close.gif',
	imageBtnPrev:	'inc/js/lightbox/lightbox-btn-prev.gif',
	imageBtnNext:	'inc/js/lightbox/lightbox-btn-next.gif',
	imageBlank:		'inc/js/lightbox/lightbox-blank.gif',
	containerResizeSpeed: 200,
	txtImage:	'Photo',
	txtOf:		'of',
	keyToClose:	'c',
	keyToPrev:	'p',
	keyToNext:	'n'
   });
});

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

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