(function ($) {
	$.studioforty9 = {
		filterable: function(options) {
			options = $.extend({
				useHash: true,
				animationSpeed: 1000,
				show: { width: 'show', opacity: 'show' },
				hide: { width: 'hide', opacity: 'hide' },
				useTags: true,
				tagSelector: '#portfolio-filter a',
				portfolioSelector: '#portfolio-list',
				selectedTagClass: 'current',
				allTag: 'all'
			}, options);
			
			return $(options.portfolioSelector).each(function() {
			
				/* FILTER: select a tag and filter */
				$(this).bind("filter", function( e, tagToShow ) {
					if (options.useTags) {
						$(options.tagSelector).removeClass(options.selectedTagClass);
						$(options.tagSelector + '[href=' + tagToShow + ']').addClass(options.selectedTagClass);
					}
					$(this).trigger("filterportfolio", [ tagToShow.substr(1) ]);
				});
			
				/* FILTERPORTFOLIO: pass in a class to show, all others will be hidden */
				$(this).bind("filterportfolio", function( e, classToShow ) {
					if (classToShow == options.allTag) {
						$(this).trigger("show");
					} else {
						$(this).trigger("show", [ '.' + classToShow ] );
						$(this).trigger("hide", [ ':not(.' + classToShow + ')' ] );
					}
					if (options.useHash) {
						location.hash = '#' + classToShow;
					}
				});
				
				/* SHOW: show a single class*/
				$(this).bind("show", function(e, selectorToShow) {
					$(this).children(selectorToShow).animate(options.show, options.animationSpeed);
				});
				
				/* SHOW: hide a single class*/
				$(this).bind("hide", function(e, selectorToHide) {
					$(this).children(selectorToHide).animate(options.hide, options.animationSpeed);	
				});
				
				if (options.useHash) {
					if(location.hash != '')
						$(this).trigger("filter", [ location.hash ]);
					else
						$(this).trigger("filter", [ '#' + options.allTag ]);
				}
				
				if (options.useTags) {
					$(options.tagSelector).click(function() {
						$('#portfolio-list').trigger("filter", [ $(this).attr('href') ]);
						$(options.tagSelector).removeClass('current');
						$(this).addClass('current');
					});
				}
			});
		},
		slider: function(options){
			var defaults = {
				selector:		'.slider',		
				prevId: 		'prevBtn',
				prevText: 		'Previous',
				nextId: 		'nextBtn',	
				nextText: 		'Next',
				controlsShow:	true,
				controlsBefore:	'',
				controlsAfter:	'',	
				controlsFade:	true,
				firstId: 		'firstBtn',
				firstText: 		'First',
				firstShow:		false,
				lastId: 		'lastBtn',	
				lastText: 		'Last',
				lastShow:		false,				
				vertical:		false,
				speed: 			1000,
				auto:			false,
				pause:			15000,
				continuous:		false, 
				numeric: 		false,
				numericId: 		'controls'
			}; 
			
			var options = $.extend(defaults, options);  
					
			$(options.selector).each(function() {  
				var obj = $(this); 				
				var s = $("li", obj).length;
				var w = $("li", obj).width(); 
				var h = $("li", obj).height(); 
				var clickable = true;
				obj.width(w); 
				obj.height(h); 
				obj.css("overflow","hidden");
				var ts = s-1;
				var t = 0;
				$("ul", obj).css('width',s*w);			
				
				if(options.continuous){
					$("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
					$("ul", obj).append($("ul li:nth-child(2)", obj).clone());
					$("ul", obj).css('width',(s+1)*w);
				};				
				
				if(!options.vertical) $("li", obj).css('float','left');
									
				if(options.controlsShow){
					var html = options.controlsBefore;				
					if(options.numeric){
						html += '<ol class="'+ options.numericId +'"></ol>';
					} else {
						if(options.firstShow) html += '<span class="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
						html += ' <span class="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
						html += ' <span class="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
						if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';				
					};
					
					html += options.controlsAfter;						
					$(obj).after(html);										
				};
				
				if(options.numeric){									
					for(var i=0;i<s;i++){						
						$(document.createElement("li"))
							.attr('class', options.numericId + (i+1))
							.html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
							.appendTo($("."+ options.numericId))
							.click(function(){							
								animate($("a",$(this)).attr('rel'),true);
							}); 												
					};							
				} else {
					$("a","."+options.nextId).click(function(){		
						animate("next",true);
					});
					$("a","."+options.prevId).click(function(){		
						animate("prev",true);				
					});	
					$("a","."+options.firstId).click(function(){		
						animate("first",true);
					});				
					$("a","."+options.lastId).click(function(){		
						animate("last",true);				
					});				
				};
				
				function setCurrent(i){
					i = parseInt(i)+1;
					$("li", "." + options.numericId).removeClass("current");
					$("li." + options.numericId + i).addClass("current");
				};
				
				function adjust(){
					if(t>ts) t=0;		
					if(t<0) t=ts;	
					if(!options.vertical) {
						$("ul",obj).css("margin-left",(t*w*-1));
					} else {
						$("ul",obj).css("margin-left",(t*h*-1));
					}
					clickable = true;
					if(options.numeric) setCurrent(t);
				};
				
				function animate(dir,clicked){
					if (clickable){
						clickable = false;
						var ot = t;				
						switch(dir){
							case "next":
								t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1;						
								break; 
							case "prev":
								t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
								break; 
							case "first":
								t = 0;
								break; 
							case "last":
								t = ts;
								break; 
							default:
								t = dir;
								break; 
						};	
						var diff = Math.abs(ot-t);
						var speed = diff*options.speed;						
						if(!options.vertical) {
							p = (t*w*-1);
							$("ul",obj).animate(
								{ marginLeft: p }, 
								{ queue:false, duration:speed, complete:adjust }
							);				
						} else {
							p = (t*h*-1);
							$("ul",obj).animate(
								{ marginTop: p }, 
								{ queue:false, duration:speed, complete:adjust }
							);					
						};
						
						if(!options.continuous && options.controlsFade){					
							if(t==ts){
								$("a","."+options.nextId).addClass('inactive');
								$("a","."+options.lastId).addClass('inactive');
							} else {
								$("a","."+options.nextId).removeClass('inactive');
								$("a","."+options.lastId).removeClass('inactive');					
							};
							if(t==0){
								$("a","."+options.prevId).addClass('inactive');
								$("a","."+options.firstId).addClass('inactive');
							} else {
								$("a","."+options.prevId).removeClass('inactive');
								$("a","."+options.firstId).removeClass('inactive');
							};					
						};				
						
						if(clicked) clearTimeout(timeout);
						if(options.auto && dir=="next" && !clicked){;
							timeout = setTimeout(function(){
								animate("next",false);
							},diff*options.speed+options.pause);
						};
				
					};
					
				};
				// init
				var timeout;
				if(options.auto){;
					timeout = setTimeout(function(){
						animate("next",false);
					},options.pause);
				};		
				
				if(options.numeric) setCurrent(0);
			
				if(!options.continuous && options.controlsFade){					
					$("a","."+options.prevId).addClass('inactive');
					$("a","."+options.firstId).addClass('inactive');				
				};				
				
			});
		  
		},
		dragndrop: function (options) {
			var defaults = {
				selector: '.draggable'
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).each(function () {
				alert('draggable');
			})
		},
		navigation: function (options) {
			var defaults = {
				selector: '#nav li',
				className: 'over'
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).each(function () {
				$(this).hover(function () {
					$('ul:first', this).fadeIn(100);
					$(this).addClass(options.className)
				},
				function () {
					$('ul', this).hide();
					$(this).removeClass(options.className)
				})
			})
		},
		tooltip: function (options) {
			var defaults = {
				selector: '.tooltip',
				xOffset: 10,
				yOffset: 25,
				clickRemove: false,
				id: 'jssp_tooltip',
				content: '',
				useElement: ''
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			var content;
			return $(options.selector).each(function () {
				var title = $(this).attr('title');
				$(this).hover(function (e) {
					content = (options.content != '') ? options.content: title;
					content = (options.useElement != '') ? $('#' + options.useElement).html() : content;
					$(this).attr('title', '');
					if (content != '' && content != undefined) {
						$('body').append('<div id="' + options.id + '">' + content + '</div>');
						$('#' + options.id).css({
							'position': 'absolute',
							'display': 'none'
						}).css('top', (e.pageY - options.yOffset) + 'px').css('left', (e.pageX + options.xOffset) + 'px').fadeIn('fast')
					}
				},
				function () {
					$('#' + options.id).remove();
					$(this).attr('title', title)
				});
				$(this).mousemove(function (e) {
					var x = ((e.pageX + options.xOffset + $(this).width()) < $(window).width()) ? (e.pageX + options.xOffset) : (e.pageX - options.xOffset - $(this).width() - 16);
					$('#' + options.id).css('top', (e.pageY - options.yOffset) + 'px').css('left', (x + 'px'))
				});
				if (options.clickRemove) {
					$(this).mousedown(function (e) {
						$('#' + options.id).remove();
						$(this).attr('title', title)
					})
				}
			})
		},
		popup: function (options) {
			var defaults = {
				selector: '.popup',
				popupId: 'jssp_popup',
				preloadText: 'Loading...',
				errorText: 'There has been a problem with your request, please click outside this window to close it.',
				closeText: 'Close',
				prevText: '&laquo; Previous',
				nextText: 'Next &raquo;'
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).each(function (i) {
				if ($(this).hasClass('gallery')) {
					var classNames = $(this).attr('class');
					classNames = classNames.split(' ').join('');
					$.data(this, 'gallery', classNames);
					eval('if((typeof ' + classNames + '_arr == "undefined")) ' + classNames + '_arr= new Array()');
					eval(classNames + '_arr').push($(this));
					$.data(this, 'index', eval(classNames + '_arr').length - 1)
				};
				$(this).bind('click', function (e) {
					e.preventDefault();
					if ($.browser.opera) $.support.opacity = true;
					var ie6 = $.browser.msie && $.browser.version.substr(0, 1) < 7;
					var opera95 = $.browser.opera && $.browser.version <= 9.5;
					var w = $(window).width();
					var h = $(document).height();
					var w2 = $(window).width() / 2;
					var h2 = $(window).height() / 2;
					show = function () {
						$('#' + options.popupId + 'preloader').remove();
						if (cw != 0) $('#' + options.popupId + 'content').css('width', cw + 'px');
						if (ch != 0) $('#' + options.popupId + 'content').css('height', ch + 'px');
						set($('#' + options.popupId + 'content'));
						$('#' + options.popupId + 'content').css('visibility', 'visible')
					};
					set = function (obj) {
						$(obj).css({
							'padding': '10px',
							'background': '#fff',
							'color': '#333',
							'text-align': 'left',
							'float': 'left',
							'position': 'fixed',
							'z-index': '10001',
							'visible': 'hidden'
						});
						var left = w2 - $(obj).width() / 2;
						var top = h2 - $(obj).height() / 2;
						$(obj).css({
							'left': left,
							'top': top,
							'display': 'none'
						}).fadeIn('1000');
						if (ie6) $(obj).css({
							'position': 'absolute',
							'top': (top + $(window).scrollTop()) + 'px'
						});
						if (opera95) $(obj).css({
							'position': 'absolute',
							'top': (document.body['clientHeight'] / 2 - $(obj).height() / 2 + $(window).scrollTop()) + 'px'
						});
						$('.caption', obj).css({
							'width': $(obj).width() + 'px',
							'display': 'block'
						})
					};
					if (ie6) $('embed, object, select').css('visibility', 'hidden');
					error = function () {
						$('#' + options.popupId + 'content').text(options.errorText);
						show()
					};
					remove = function () {
						$('#' + options.popupId).remove();
						$('#' + options.popupId + 'content').remove();
						$('#' + options.popupId + 'preloader').remove();
						if (ie6) $('embed, object, select').css('visibility', 'visible')
					};
					if ($('#' + options.popupId).length == 0) {
						$('<div id="' + options.popupId + '"></div>').appendTo('body').css({
							'width': w,
							'height': h,
							'background': '#000',
							'position': 'absolute',
							'top': '0',
							'left': '0',
							'z-index': '10000',
							'opacity': .7
						}).click(function () {
							remove()
						})
					};
					var href = $(this).attr('href');
					var extension = href.substr(href.lastIndexOf('.')).toLowerCase();
					var content;
					var cw = 0;
					var ch = 0;
					var showOk = false;
					$('<div id="' + options.popupId + 'preloader">' + options.preloadText + '</div>').appendTo('body');
					set($('#' + options.popupId + 'preloader'));
					$('<div id="' + options.popupId + 'content"></div>').appendTo('body');
					$('#' + options.popupId + 'content').css({
						'visibility': 'hidden',
						'position': 'absolute',
						'top': '-10000px',
						'left': '-10000px'
					});
					if ($(this).hasClass('flash')) {
						var flash = '<object width="100%" height="100%"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="' + href + '" /><embed src="' + href + '" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%"></embed></object>';
						$(flash).appendTo('#' + options.popupId + 'content');
						cw = 600;
						ch = 400;
						showOk = true
					} else {
						if (extension == '.jpg' || extension == '.jpeg' || extension == '.gif' || extension == '.png' || extension == '.bmp') {
							var img = new Image();
							$(img).error(function () {
								error()
							}).appendTo('#' + options.popupId + 'content');
							img.onload = function () {
								show();
								img.onload = function () {}
							};
							img.src = href + '?' + (new Date()).getTime() + ' =' + (new Date()).getTime()
						} else if (href.charAt(0) == '#') {
							$(href).clone().removeClass('hidden').appendTo('#' + options.popupId + 'content').show();
							$.jssp.forms('#' + options.popupId + 'content form');
							showOk = true
						} else {
							$('<iframe frameborder="0" scrolling="auto" style="width:100%;height:100%" src="' + href + '" />').appendTo('#' + options.popupId + 'content');
							cw = 900;
							ch = 500;
							showOk = true
						}
					};
					var rel = $(this).attr('rel').split(';');
					$.each(rel, function (i) {
						if (rel[i].indexOf('width') != -1) cw = rel[i].split(':')[1];
						if (rel[i].indexOf('height') != -1) ch = rel[i].split(':')[1]
					});
					if ($(this).attr('title') != '') {
						$('<span class="caption">' + $(this).attr('title') + '</span>').appendTo('#' + options.popupId + 'content').css({
							'display': 'none',
							'padding': '10px 0 0 0'
						})
					};
					if (showOk) show();
					$('<small>' + options.closeText + '</small>').appendTo('#' + options.popupId + 'content').css({
						'position': 'absolute',
						'float': 'left',
						'left': '0',
						'top': '-24px',
						'color': '#fff',
						'cursor': 'pointer'
					}).click(function () {
						remove()
					});
					if ($(this).hasClass('gallery')) {
						var arr = $.data(this, 'gallery');
						arr = eval(arr + '_arr');
						var index = $.data(this, 'index');
						if (arr.length > 1) {
							$('<small>' + (index + 1) + '/' + arr.length + '</small>').appendTo('#' + options.popupId + 'content').css({
								'position': 'absolute',
								'float': 'right',
								'right': '0',
								'bottom': '-24px',
								'color': '#fff',
								'cursor': 'pointer'
							});
							$('<small id="' + options.popupId + 'gallery"></small>').appendTo('#' + options.popupId + 'content').css({
								'position': 'absolute',
								'float': 'left',
								'left': '0',
								'bottom': '-24px',
								'color': '#fff',
								'cursor': 'pointer'
							});
							if (index != 0) {
								$('<span>' + options.prevText + '</span>').css('margin-right', '5px').appendTo('#' + options.popupId + 'gallery').click(function () {
									$('#' + options.popupId + 'content').remove();
									var obj = arr[index - 1];
									$(obj).trigger('click')
								})
							}
							if (index < arr.length - 1) {
								$('<span>' + options.nextText + '</span>').appendTo('#' + options.popupId + 'gallery').click(function () {
									$('#' + options.popupId + 'content').remove();
									var obj = arr[index + 1];
									$(obj).trigger('click')
								})
							}
						}
					}
				})
			})
		},
		external: function (options) {
			var defaults = {
				selector: 'a'
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			var hostname = window.location.hostname;
			hostname = hostname.replace('www.', '').toLowerCase();
			return $(options.selector).each(function () {
				if ( $(this).attr('href') != undefined) {
					var href = $(this).attr('href').toLowerCase();
					if (href.indexOf('http://') != -1 && href.indexOf(hostname) == -1) {
						$(this).attr('target', '_blank');
						$(this).addClass('external');
					}
				}
			})
		},
		rotate: function (options) {
			var defaults = {
				selector: '.rotate',
				initPause: 0,
				pause: 5000,
				randomize: false
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).each(function () {
				var obj = $(this);
				var length = $(obj).children().length;
				var temp = 0;
				function getRan() {
					var ran = Math.floor(Math.random() * length) + 1;
					return ran
				};
				function show() {
					if (options.randomize) {
						var ran = getRan();
						while (ran == temp) {
							ran = getRan()
						};
						temp = ran
					} else {
						temp = (temp == length) ? 1 : temp + 1
					};
					$(obj).children().hide();
					$(':nth-child(' + temp + ')', obj).fadeIn('slow')
				};
				function init() {
					show();
					setInterval(show, options.pause)
				};
				setTimeout(init, options.initPause)
			})
		},
		cycle: function (options) {
			var defaults = {
				selector: '.cycle',
				effect: 'fade',
				initPause: 0,
				pause: 5000
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).each(function () {
				var obj = $(this);
				var length = $(obj).children().length;
				var temp = 0;
				var prev = -1;
				var z = 1;
				var h = $(':nth-child(1)', obj).height();
				$(obj).css('position', 'relative').height(h);
				$(obj).children().hide().css({
					'position': 'absolute',
					'top': '0',
					'left': '0'
				});
				function show() {
					temp = (temp == length) ? 1 : temp + 1;
					prev = (temp == 1) ? length: temp - 1;
					$(':nth-child(' + temp + ')', obj).css('z-index', z).fadeIn('slow', function () {
						$(':nth-child(' + prev + ')', obj).fadeOut('slow')
					});
					z++
				};
				function init() {
					show();
					setInterval(show, options.pause)
				};
				setTimeout(init, options.initPause)
			})
		},
		jump: function (options) {
			var defaults = {
				selector: 'a.jump',
				speed: 1000
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).click(function () {
				var target = $($(this).attr('href'));
				var offset = $(target).offset().top;
				$('html,body').animate({
					scrollTop: offset
				},
				1000, 'linear')
			})
		},
		showhide: function (options) {
			var defaults = {
				selector: '.toggle'
			};
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).each(function () {
				var target;
				if ($(this).hasClass('prev')) {
					target = $(this).prev().show()
				} else if ($(this).hasClass('id')) {
					target = $(this).attr('href');
					target = $(target).show()
				} else {
					target = $(this).next().show()
				};
				$(this).css('cursor', 'pointer');
				
				$(this).toggle(function () {
					$(this).removeClass('expanded');
					$(target).slideUp();
				},
				function () {
					$(this).addClass('expanded');
					$(target).slideDown();
				})
			})
		},
		forms: function (options) {
			var defaults = {
				selector: 'form',
				err: 'This is required',
				errEmail: 'A valid email address is required',
				errUrl: 'A valid URL is required',
				errPhone: 'A valid Phone number is required',
				errPhoneIE: 'A valid Irish Phone number is required',
				notValidClass: 'notvalid'
			};
			function check(obj) {
				if ($(obj).val() == '' || checkLabel(obj)) {
					var errormsg = ($(obj).attr('title') != '') ? $(obj).attr('title') : options.err;
					error(obj, errormsg)
				}
			};
			function checkRegEx(obj, type) {
				var regEx, err;
				switch (type) {
				case 'email':
					regEx = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
					err = options.errEmail;
					break;
				case 'url':
					regEx = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
					err = options.errUrl;
					break;
				case 'phone':
					var regEx = /^\s*\(?\s*\d{1,4}\s*\)?\s*[\d\s]{5,8}\s*$/;
					err = options.errPhone;
					break;					
				};
				var val = $(obj).val();
				val = $.trim(val);
				if (val.search(regEx) == -1 || checkLabel(obj)) {
					var errormsg = ($(obj).attr('title') != '') ? $(obj).attr('title') : err;
					error(obj, errormsg)
				}
			};
			function checkLabel(obj) {
				var text = $('label[for=' + $(obj).attr('id') + ']').text();
				return (text == $(obj).val())
			};
			function error(obj, errormsg) {
				var parent = $(obj).parent();
				parent.append('<span class="errors">' + errormsg + '</span>');
				$('span.errors', parent).hide().fadeIn('fast');
				$(obj).addClass(options.notValidClass);
				valid = false
			};
			$('input.label,textarea.label').each(function () {
				var text = $('label[for=' + $(this).attr('id') + ']').text();
				$('label[for=' + $(this).attr('id') + ']').css('display', 'none');
				$(this).val(text);
				$(this).focus(function () {
					if ($(this).val() == text) $(this).val('')
				});
				$(this).blur(function () {
					if ($(this).val() == '') $(this).val(text)
				})
			});
			if (typeof options == 'string') defaults.selector = options;
			var options = $.extend(defaults, options);
			return $(options.selector).each(function () {
				$(this).submit(function () {
					$('.errors', this).remove();
					$('.' + options.notValidClass, this).removeClass(options.notValidClass);
					valid = true;
					$(':text.required', this).each(function () {
						if ($(this).hasClass('email')) {
							checkRegEx(this, 'email')
						} else if ($(this).hasClass('url')) {
							checkRegEx(this, 'url')
						} else if ($(this).hasClass('phone')) {
							checkRegEx(this, 'phone')
						} else {
							check(this)
						}
					});
					$(':password.required', this).each(function () {
						check(this)
					});
					$('textarea.required', this).each(function () {
						check(this)
					});
					$(':checkbox.required', this).each(function () {
						if (!$(this).attr('checked')) {
							var errormsg = ($(this).attr('title') != '') ? $(this).attr('title') : options.err;
							error(this, errormsg)
						}
					});
					return valid
				})
			})
		}
	}
})(jQuery);


$(function(){
	$.studioforty9.slider({
		selector: '.banner .slider',
		auto: true,
		continuous: true,
		numeric: true
	});
	$.studioforty9.slider({
		selector: '#featured-work .slider',
		prevId: "work-prev",
		nextId: "work-next"

	});
	$.studioforty9.filterable({
		useHash: true,
		animationSpeed: 1000,
		show: { width: 'show', opacity: 'show' },
		hide: { width: 'hide', opacity: 'hide' },
		useTags: true,
		tagSelector: '#portfolio-filter a',
		selectedTagClass: 'current',
		allTag: 'all'
	});
	$.studioforty9.tooltip();
	$.studioforty9.popup();
	$.studioforty9.external();
	$.studioforty9.rotate();
	$.studioforty9.cycle();
	$.studioforty9.forms();
	$.studioforty9.showhide();
	$.studioforty9.jump();
})

Cufon.replace('.cufon', {
	fontFamily: 'Museo_Sans',
	textShadow: '1px 1px 1px rgba(255, 255, 255, 1)'
	});

Cufon.replace('.cufongreen', {
	fontFamily: 'Museo_Sans',
	textShadow: '1px 1px 1px rgba(0, 0, 0, 0.2)'
	});	
	
Cufon.replace('.body h1, .body h2, .body h3, .body h4', {
	fontFamily: 'Museo_Sans',
	textShadow: '1px 1px 1px rgba(255, 255, 255, 1)'
	});
	
Cufon.replace('.menu li a', {
	fontFamily: 'Museo_Sans',
	textShadow: '1px 1px 1px rgba(255, 255, 255, 1)'
	});
	
Cufon.replace('.menu li.current a', {
	fontFamily: 'Museo_Sans',
	textShadow: '1px 1px 1px rgba(0, 0, 0, 0.2)'
	});
