	jQuery.noConflict();
			jQuery(document).ready(function($) {
				
			// main menu functions
			$(".dropmenu ul").css({display: "none"}); // Opera Fix
			$(".dropmenu li").hover(function(){
					$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn();
					},function(){
					$(this).find('ul:first').css({visibility: "hidden"});
					});
					
					
			$('a[data-rel]').each(function() {
				$(this).attr('rel', $(this).attr('data-rel')).removeAttr('data-rel');
			});	
			
			$('#style_switcher a[data-rel]').each(function() {
				$(this).attr('rel', $(this).attr('data-rel')).removeAttr('data-rel');
			});	

			// add 'search...' value to Search field
			// if focus on Search field - add 'search...' value
			$("input.search").val("search...").addClass("empty");
				$("input.search").focus(function(){
				if($(this).val() == "search...") {
					$(this).val("").removeClass("empty");		
				}
			});
			// else - value is removed
			$(".search").blur(function(){
				if($(this).val() == "") {
					$(this).val("search...").addClass("empty");
				}

			});

			
			// portfolio quicksand functions
			// Clone applications to get a second collection
			var $data = $(".portfolio_content").clone();
			
			//NOTE: Only filter on the main portfolio page, not on the subcategory pages
			$('.portfolio_categories li').click(function(e) {
				$(".filter li").removeClass("active");	
				// Use the last category class as the category to filter by. This means that multiple categories are not supported (yet)
				var filterClass=$(this).attr('class').split(' ').slice(-1)[0];
				
				if (filterClass == 'all-projects') {
					var $filteredData = $data.find('.portfolio_item');
				} else {
					var $filteredData = $data.find('.portfolio_item[data-type=' + filterClass + ']');
				}
				$(".portfolio_content").quicksand($filteredData, {
					duration: 800,
					easing: 'swing'
				}, function(){
						//callback function to re-apply hover effects on cloned elements
						setCaptions();
						Cufon.refresh();

					
				});
			
				$(this).addClass("active"); 			
				return false;
			});
			
						
			setCaptions=function(){
					$(".caption").hide();	
					$(".portfolio_item").hover(function(){$(this).find(".caption").slideDown("fast");},
						function(){$(this).find(".caption").slideUp("fast");}
					);
				};
			setCaptions();
			});
			
			(function($) {
		$.fn.email_sender = function(options) {
			var defaults = {
				sendMail:"php/email_sender.php",
				timer:4000,
				speedIn:400,
				speedOut:400
			};
		
			var settings = $.extend({}, defaults, options);
		
			return this.each(function () {
				var root = $(this);
				var button_send = $("input[type=submit]", root);
				var interval = undefined;
			
				function showResponse(message, type, timer) {

					if(interval) {
						clearInterval(interval);
						$(".form_message_sending", root).remove();
					}
					
					button_send.before('<div class="form_message_sending"><div class="box_content"></div></div>');
					$(".form_message_sending", root).css({"width":"358px", "margin-left":"60px"});
					(type == "error") ? $(".form_message_sending", root).addClass("error") : $(".form_message_sending", root).addClass("success");
					$(".box_content", root).html("<p style=\"color:red;\">" + message + "</p>");
					$(".form_message_sending", root).css({ "display" : "none"});
					$(".form_message_sending", root).fadeIn(settings.speedIn, function() {
						interval = setInterval(hideResponse, timer);
					});
				}
			
				function hideResponse() {

					clearInterval(interval);
					$(".form_message_sending", root).fadeOut(settings.speedOut, function() {
						$(".form_message_sending", root).remove();
					});

				}
			
				root.submit(function() {

					$.ajax({
						type: "POST",
						url: settings.sendMail,
						data: $(this).serialize(),
						success: function(output) {
							root.find(".form_success_message, .form_error_message").remove();
							root.append(output).children(".form_success_message, .form_error_message").hide();

							if($("p", root).attr('class') == 'form_success_message') {
								$("input[type=text], input[type=email], textarea", root).val('');
								showResponse($(".form_success_message green", root).text(), "success", settings.timer * 2);
							} else {
								showResponse($(".form_error_message", root).text(), "error", settings.timer);
							}
						}

					});

					return false;
				});
			});
		}
	})(jQuery);
