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

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

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

	$('a.modal').click(function (e) {
		$('#modal').modal({position: ["10%"]});
		e.preventDefault();
	});

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

/* Window Popup
--------------------------------------------------------------------------------------- */
var newWin = null;
function popUp(strURL, strType, strHeight, strWidth, strCustom) {
  if (newWin != null && !newWin.closed) newWin.close();
  var strOptions="";
  if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
  if (strType=="fixed") strOptions="height="+strHeight+",width="+strWidth;
  if (strType=="elastic") strOptions="scrollbars,"+"resizable,height="+strHeight+",width="+strWidth;
  if (strType=="custom") strOptions="height="+strHeight+",width="+strWidth+","+strCustom;
  newWin = window.open(strURL, 'newWin', strOptions);
  newWin.focus();
}

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

