/* jquery vibration plugin for form validation */
jQuery.fn.vibrate = function(conf) {
        var config = jQuery.extend({
                speed: 30, 
                duration: 1000, 
                frequency: 7000, 
                spread: 3
        }, conf);

        return this.each(function() {
                var t = jQuery(this);

                var vibrate = function() {
                        var topPos = Math.floor(Math.random() * config.spread) - ((config.spread - 1) / 2);
                        var leftPos = Math.floor(Math.random() * config.spread) - ((config.spread - 1) / 2);
                        var rotate = Math.floor(Math.random() * config.spread - (config.spread - 1) / 2); // cheers to erik@birdy.nu for the rotation-idea
                        t.css({position: 'relative', left: leftPos +'px', top: topPos +'px', WebkitTransform: 'rotate(' +rotate +'deg)'});
                };

                var doVibration = function () {
                        
						var vibrationInterval = setInterval(vibrate, config.speed);

                        var stopVibration = function() {
                                clearInterval(vibrationInterval);
                                t.css({position: 'static'});
                        };

                        setTimeout(stopVibration, config.duration);
                };
				
				/* 
					Mofication by Kishore - I am commenting out the following line as it calls the vibration function repeatedly.
				 	We need to call it only once. So, instead I make a call to doVibration() directly.
				*/
				
                //setInterval(doVibration, config.frequency);
				doVibration();
        });
};

// force the cursor to go to end of textfield

(function($)
{
    jQuery.fn.putCursorAtEnd = function()
    {
    return this.each(function()
    {
        $(this).focus()

        // If this function exists...
        if (this.setSelectionRange)
        {
        // ... then use it
        // (Doesn't work in IE)

        // Double the length because Opera is inconsistent about whether a carriage return is one character or two. Sigh.
        var len = $(this).val().length * 2;
        this.setSelectionRange(len, len);
        }
        else
        {
        // ... otherwise replace the contents with itself
        // (Doesn't work in Google Chrome)
        $(this).val($(this).val());
        }

        // Scroll to the bottom, in case we're in a tall textarea
        // (Necessary for Firefox and Google Chrome)
        this.scrollTop = 999999;
    });
    };
})(jQuery);

/* jquery.hover.captions.js */
 
 $(document).ready(function() {
 
	//move the image in pixel
	var move = -15;
	
	//zoom percentage, 1.2 =120%
	var zoom = 1.1;
 
	//On mouse over those thumbnail
	$('.productitem').hover(function() {
		
		//Set the width and height according to the zoom percentage
		width = $('.productitem').width() * zoom;
		height = $('.productitem').height() * zoom;
		
		//Move and zoom the image
		$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
		
		//Display the productcaption
		$(this).find('div.productcaption').stop(false,true).fadeIn(200);
	},
	function() {
		//Reset the image
		$(this).find('img').stop(false,true).animate({'width':$('.productitem').width(), 'height':$('.productitem').height(), 'top':'0', 'left':'0'}, {duration:100});	
 
		//Hide the productcaption
		$(this).find('div.productcaption').stop(false,true).fadeOut(200);
	});
 
 });
 
 /* Favorites */
	$(document).ready(function() {
		// Load in the hidden content
		$('.favorited.not_saved').append('<a class="Favorites_Save Favorites_Trigger" style="display:none;" href="{permalink="includes/favorite-add/"}">save</a>');
		$('.favorited.not_saved').append('<a class="Favorites_Delete Favorites_Trigger" style="display:none;" href="{permalink="includes/favorite-add/delete/"}">delete</a>');
		$('.favorited.saved').append('<a class="Favorites_Save Favorites_Trigger" style="display:none;" href="{permalink="includes/favorite-add/"}">save</a>');
		
		// Apply the event handlers
		$('a.Favorites_Save') .click (function() {
			var link = $(this).attr('href')
			$('.Favorites_Status').load(link, function() {
					$('.Favorites_Delete').show();
				});
			$(this).hide();
			return false;
		});
		$('a.Favorites_Save_Full') .click (function() {
			var link = $(this).attr('href')
			$('.Favorites_Status').load(link, function() {
					$('.Favorites_Delete').show();
				});
			$(this).hide();
			return false;
		});
		
		$('a.Favorites_Delete') .click (function() {
			var link = $(this).attr('href')
			$('.Favorites_Status').load(link, function() {
					$('.Favorites_Save').show();
				});
			$(this).hide();
			return false;
		});
	});
		


// Define: Linkify plugin
(function($){
  var url1 = /(^|&lt;|\s)(www\..+?\..+?)(\s|&gt;|$)/g,
      url2 = /(^|&lt;|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|&gt;|$)/g,

      linkifyThis = function () {
        var childNodes = this.childNodes,
            i = childNodes.length;
        while(i--)
        {
          var n = childNodes[i];
          if (n.nodeType == 3) {
            var html = $.trim(n.nodeValue);
            if (html)
            {
              html = html.replace(/&/g, '&amp;')
                         .replace(/</g, '&lt;')
                         .replace(/>/g, '&gt;')
                         .replace(url1, '$1<a href="http://$2">$2</a>$3')
                         .replace(url2, '$1<a href="$2">$2</a>$5');
              $(n).after(html).remove();
            }
          }
          else if (n.nodeType == 1  &&  !/^(a|button|textarea)$/i.test(n.tagName)) {
            linkifyThis.call(n);
          }
        }
      };

  $.fn.linkify = function () {
    return this.each(linkifyThis);
  };
})(jQuery);

/* aswitcher.js */

$(document).ready(function(){
	
	jQuery("#archives").hide();
	jQuery("#page-show").replaceWith($('.pagination')); //This line: not part of original aswitcher. Added cuz EE's pagination is retarded.
	jQuery("input[type='text']").addClass('clear-input'); //Not aswitcher. Clears input text for search box w/ /js/jquery.clearinput.js
	jQuery("#aswitcher").click(function(){
		jQuery("#archives").slideToggle();
		return false;
	});

	jQuery("ul.blog-listing a").each(function(i, el){
		var img = jQuery(el).find("img.blog_image")[0];
		if (img)
		{
			el.img = img;
		}
	});
	jQuery("ul.blog-listing a").hover(function() {
		if (this.img)
		{
			if (!this.img._src){
				this.img._src = this.img.src;
			}
			this.img.src = "http://12ozprophet.com/images/transparent.gif";
			jQuery(this.img).css({'background-position': '0 0'});
		}
	}, function() {
		if (this.img && this.img._src)
		{
			this.img.src=this.img._src;
		}
	});
	
	//initTabs();
});

/*jQuery Clear-Input plugin v1.0 Author: Aidan Feldman */
(function( $ ){
  // define the initialValue() function
  $.fn.initialValue = function(value) {
    if (value) {
      return this.attr('initial-value', value);
    } else {
      return this.attr('initial-value');
    }
  };
  
  $.fn.clearInput = function() {
    return this
      .focus(function(){
        if (this.value == $(this).initialValue()) {
          this.value = '';
        }
      })
      .blur(function(){
        if (this.value == '') {
          this.value = $(this).initialValue();
        }
      })
      .each(function(index, elt) {
        $(this).initialValue(this.value);
      });
  };

  // apply plugin to all inputs with class ".clear-input"
  $(function() {
    $('input.clear-input').clearInput();
  });
})( jQuery );

// scroll gallery plugin
jQuery.fn.scrollGallery = function(_options){
	var _options = jQuery.extend({
		sliderHolder: '.mask',
		slider:'>ul',
		slides: '>li',
		pagerLinks:'div.pager a',
		btnPrev:'.prev a',
		btnNext:'.next a',
		activeClass:'active',
		disabledClass:'disabled',
		generatePagination:'div.pg-holder',
		curNum:'em.scur-num',
		allNum:'em.sall-num',
		circleSlide:true,
		pauseClass:'gallery-paused',
		pauseButton:'none',
		pauseOnHover:true,
		autoRotation:false,
		stopAfterClick:false,
		switchTime:5000,
		duration:650,
		easing:'swing',
		event:'click',
		afterInit:false,
		vertical:false,
		step:false
	},_options);

	return this.each(function(){
		// gallery options
		var _this = jQuery(this);
		var _sliderHolder = jQuery(_options.sliderHolder, _this);
		var _slider = jQuery(_options.slider, _sliderHolder);
		var _slides = jQuery(_options.slides, _slider);
		var _btnPrev = jQuery(_options.btnPrev, _this);
		var _btnNext = jQuery(_options.btnNext, _this);
		var _pagerLinks = jQuery(_options.pagerLinks, _this);
		var _generatePagination = jQuery(_options.generatePagination, _this);
		var _curNum = jQuery(_options.curNum, _this);
		var _allNum = jQuery(_options.allNum, _this);
		var _pauseButton = jQuery(_options.pauseButton, _this);
		var _pauseOnHover = _options.pauseOnHover;
		var _pauseClass = _options.pauseClass;
		var _autoRotation = _options.autoRotation;
		var _activeClass = _options.activeClass;
		var _disabledClass = _options.disabledClass;
		var _easing = _options.easing;
		var _duration = _options.duration;
		var _switchTime = _options.switchTime;
		var _controlEvent = _options.event;
		var _step = _options.step;
		var _vertical = _options.vertical;
		var _circleSlide = _options.circleSlide;
		var _stopAfterClick = _options.stopAfterClick;
		var _afterInit = _options.afterInit;

		// gallery init
		if(!_slides.length) return;
		var _currentStep = 0;
		var _sumWidth = 0;
		var _sumHeight = 0;
		var _hover = false;
		var _stepWidth;
		var _stepHeight;
		var _stepCount;
		var _offset;
		var _timer;

		_slides.each(function(){
			_sumWidth+=$(this).outerWidth(true);
			_sumHeight+=$(this).outerHeight(true);
		});

		// calculate gallery offset
		function recalcOffsets() {
			if(_vertical) {
				if(_step) {
					_stepHeight = _slides.eq(_currentStep).outerHeight(true);
					_stepCount = Math.ceil((_sumHeight-_sliderHolder.height())/_stepHeight)+1;
					_offset = -_stepHeight*_currentStep;
				} else {
					_stepHeight = _sliderHolder.height();
					_stepCount = Math.ceil(_sumHeight/_stepHeight);
					_offset = -_stepHeight*_currentStep;
					if(_offset < _stepHeight-_sumHeight) _offset = _stepHeight-_sumHeight;
				}
			} else {
				if(_step) {
					_stepWidth = _slides.eq(_currentStep).outerWidth(true)*_step;
					_stepCount = Math.ceil((_sumWidth-_sliderHolder.width())/_stepWidth)+1;
					_offset = -_stepWidth*_currentStep;
					if(_offset < _sliderHolder.width()-_sumWidth) _offset = _sliderHolder.width()-_sumWidth;
				} else {
					_stepWidth = _sliderHolder.width();
					_stepCount = Math.ceil(_sumWidth/_stepWidth);
					_offset = -_stepWidth*_currentStep;
					if(_offset < _stepWidth-_sumWidth) _offset = _stepWidth-_sumWidth;
				}
			}
		}

		// gallery control
		if(_btnPrev.length) {
			_btnPrev.bind(_controlEvent,function(){
				if(_stopAfterClick) stopAutoSlide();
				prevSlide();
				return false;
			});
		}
		if(_btnNext.length) {
			_btnNext.bind(_controlEvent,function(){
				if(_stopAfterClick) stopAutoSlide();
				nextSlide();
				return false;
			});
		}
		if(_generatePagination.length) {
			_generatePagination.empty();
			recalcOffsets();
			var _list = $('<ul />');
			for(var i=0; i<_stepCount; i++) $('<li><a href="#">'+(i+1)+'</a></li>').appendTo(_list);
			_list.appendTo(_generatePagination);
			_pagerLinks = _list.children();
		}
		if(_pagerLinks.length) {
			_pagerLinks.each(function(_ind){
				jQuery(this).bind(_controlEvent,function(){
					if(_currentStep != _ind) {
						if(_stopAfterClick) stopAutoSlide();
						_currentStep = _ind;
						switchSlide();
					}
					return false;
				});
			});
		}

		// gallery animation
		function prevSlide() {
			recalcOffsets();
			if(_currentStep > 0) _currentStep--;
			else if(_circleSlide) _currentStep = _stepCount-1;
			switchSlide();
		}
		function nextSlide() {
			recalcOffsets();
			if(_currentStep < _stepCount-1) _currentStep++;
			else if(_circleSlide) _currentStep = 0;
			switchSlide();
		}
		function refreshStatus() {
			if(_pagerLinks.length) _pagerLinks.removeClass(_activeClass).eq(_currentStep).addClass(_activeClass);
			if(!_circleSlide) {
				_btnPrev.removeClass(_disabledClass);
				_btnNext.removeClass(_disabledClass);
				if(_currentStep == 0) _btnPrev.addClass(_disabledClass);
				if(_currentStep == _stepCount-1) _btnNext.addClass(_disabledClass);
			}
			if(_curNum.length) _curNum.text(_currentStep+1);
			if(_allNum.length) _allNum.text(_stepCount);
		}
		function switchSlide() {
			recalcOffsets();
			if(_vertical) _slider.animate({marginTop:_offset},{duration:_duration,queue:false,easing:_easing});
			else _slider.animate({marginLeft:_offset},{duration:_duration,queue:false,easing:_easing});
			refreshStatus();
			autoSlide();
		}

		// autoslide function
		function stopAutoSlide() {
			if(_timer) clearTimeout(_timer);
			_autoRotation = false;
		}
		function autoSlide() {
			if(!_autoRotation || _hover) return;
			if(_timer) clearTimeout(_timer);
			_timer = setTimeout(nextSlide,_switchTime+_duration);
		}
		if(_pauseOnHover) {
			_this.hover(function(){
				_hover = true;
				if(_timer) clearTimeout(_timer);
			},function(){
				_hover = false;
				autoSlide();
			});
		}
		recalcOffsets();
		refreshStatus();
		autoSlide();

		// pause buttton
		if(_pauseButton.length) {
			_pauseButton.click(function(){
				if(_this.hasClass(_pauseClass)) {
					_this.removeClass(_pauseClass);
					_autoRotation = true;
					autoSlide();
				} else {
					_this.addClass(_pauseClass);
					stopAutoSlide();
				}
				return false;
			});
		}

		if(_afterInit && typeof _afterInit === 'function') _afterInit(_this, _slides);
	});
}

/* 12oz JS Object */
/* do ya thing */
var twelve_ounce;
var deep_link_override = false;
twelve_ounce = twelve_ounce || {
	/*
     * @function:	init
     * @descrip:	main initialization function.  
     */
    init: function() {
		// add target attributes to open links in new windows
		$('a.target_blank').attr('target', '_blank');
		this.sfHover();
		this.share();
		this.clearFormFields({
			clearInputs: true,
			clearTextareas: true,
			passwordFieldText: false,
			addClassFocus: "focus",
			filterClass: "default"
		});
		jQuery('.shop-gallery', '.collections').scrollGallery();
    },
    /* 
      * @function: 	 ord
      * @descrip:	 generates random value used in ad serving.
    */
    ord: function(){
		return Math.random()*10000000000000000;     
    },
    /*
     *  @function:  teasers
     *  @descrip:   instantiates the nivoSlider object on the homepage
    */
    teasers:function(){
		$(window).load(function() {
			$('#teasers').nivoSlider(
				{ effect:'fade' }
			);
		});    
    },
    /*
     *  @function:   likee
     *  @descrip:    likee extension/add-on for expression engine.
    */
    likee:function(){ 
    	$(document).ready(function() {
			$("*[id^=likee_]").click(function(){
				var ids = $(this).attr("id").split("_");
				if (ids[1]=="c"){
					id=ids[2];
					c="c_";
					isCom="true";
				} else {
					id=ids[1];
					c="";
					isCom="false";
				}
				$.ajax({
					type: "POST",
					url: "/",
					data: "likee=true&entry_id="+id+"&isCom="+isCom,
					success: function(msg){
						//alert( "Data Saved: " + msg );
					}
				});
				
				$(this).replaceWith("<strong>"+$(this).html()+"</strong>");
				$("#dislikee_"+c+id).replaceWith("<span>"+$("#dislikee_"+c+id).html()+"</span>");
				$("#scoreeCount_"+c+id).html(parseInt($("#scoreeCount_"+c+id).html())+1);
				$("#likeeCount_"+c+id).html(parseInt($("#likeeCount_"+c+id).html())+1);
				$("#likeeReplace_"+c+id).replaceWith("");
				$("#likeeShow_"+c+id).replaceWith($("#likeeShow_"+c+id).html());
			});
			
			$("*[id^=dislikee_]").click(function(){
				var ids = $(this).attr("id").split("_");
				if (ids[1]=="c"){
					id=ids[2];
					c="c_";
					isCom="true";
				} else {
					id=ids[1];
					c="";
					isCom="false";
				}
				$.ajax({
					type: "POST",
					url: "/",
					data: "dislikee=true&entry_id="+id+"&isCom="+isCom,
					success: function(msg){
						//alert( "Data Saved: " + msg );
					}
				});
				
				$(this).replaceWith("<strong>"+$(this).html()+"</strong>");
				$("#likee_"+c+id).replaceWith("<span>"+$("#likee_"+c+id).html()+"</span>");
				$("#scoreeCount_"+c+id).html(parseInt($("#scoreeCount_"+c+id).html())-1);
				$("#dislikeeCount_"+c+id).html(parseInt($("#dislikeeCount_"+c+id).html())+1);
				$("#likeeReplace_"+c+id).replaceWith("");
				$("#likeeShow_"+c+id).replaceWith($("#likeeShow_"+c+id).html());
			});
		
		});	
	},
	
	/* 
	 * @function:  sfHover
     * @descrip:   adds special classes to nav elements on hover
    */
	sfHover:function() {
		//var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		var sfEls = $("ul#nav li");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	},
	
	/*
	 * @function:  	billingCountry
	 * @descrip:	change handler for the 'billing country' select box on account management pages
	**/
	billingCountry:function(){
		if(!$('#br_billing_state option:selected').length){ 
			this.setBillingCountry();
		} 
		$('#br_billing_country').change(twelve_ounce.setBillingCountry);
	},
	
	/*
	 * @function:	setBillingCountry
	 * @descrip:	enables/disables 'state' options on change of billing country select box
	*/
	setBillingCountry:function(){
		var zone_id = $('#br_billing_country option:selected').metadata().zone_id;
		$('#br_billing_state option').hide().attr("disabled","disabled");
		$('#br_billing_state option.zone_'+zone_id).show().removeAttr("disabled");
		$('#br_billing_state option:enabled').eq(0).attr('selected','selected');
	},

	/*
	 * @function:	recipientAutoComplete
	 * @descrip:	instantiates Autocomplete object on the Recipient Field, under private messaging.
	*/
	recipientAutoComplete:function(){
		var options, a, f;
		f = $('#friends_array');
		a = $('#query');

		options = { 
  			serviceUrl:'/index.php/messages/searchparam/',
			onSelect: function(value, data){ 
				f.append('<input type="hidden" name="friend[]" value="'+data+'" />');
			}
  		};
  		a.autocomplete(options);
	},
	createGroupAC:function(){
		// variable definitions
		var options, a, f;
		f = $('#friends_array');	// div that holds the hidden inputs for our friends to add to this group
		a = $('input.friend');		// jquery object that references all of the input fields 
		m = $('#add_another_friend');	// jquery object for the 'add another friend' button
		u = $('ul#friends_to_add_to_group'); // ul that holds all of the input fields for friends names.
		options = { 
  			serviceUrl:'/index.php/messages/searchparam/',
			onSelect: function(value, data){ 
				f.append('<input type="hidden" name="friends_member_id[]" value="'+data+'" />');
			}
  		};
		a.live('focusin', function(){
			$(this).autocomplete(options);
			return false;
		});
		
		
		// click handler for the add another friend button 
		m.unbind('click');
		
		m.bind('click', function(){
			var next = u.find('li').length;
			var to_append =  '<li><input type="text" name="friend_'+next+'" id="friend_'+next+'" class="field friend"  /></li>';
			u.append(to_append);
		});
		
	},
	/*
	 * @function:   productDetail
	 * @descrip:	handles 'main image' swapping on product detail page.
	 */
	productDetail:function(){
		var the_image = $('#product_image img:first');
		$('#product_thumbnails li').click(function(){
			var old_src = the_image.attr('src');
			var selected_img = $(this).find('img:first');			
			var new_src = selected_img.attr('rel');
			// change the line above to be .attr('rel');  and you should be good
			if(old_src != new_src){			
				the_image.animate({opacity: 0}, 750, function() {
					// Animation complete.
					the_image.attr('src', new_src);
					the_image.animate({opacity:1},750, function(){ /*complete*/ });
				});
			}
			return false;
		});	
	},
	/* 
	 * @function:	checkout page
	 * @descrip:    brilliant retail checkout page javascript
	*/
	checkout:function(shipping_action, total_action, theme ){
		/* Dynamic Options for Configurable Products */
		$(document).ready(function(){
			var dynamicOptionListCount=0;var dynamicOptionListObjects=new Array();function initDynamicOptionLists(){for(var i=0;i<dynamicOptionListObjects.length;i++){var dol=dynamicOptionListObjects[i];if(dol.formName!=null){dol.form=document.forms[dol.formName]}else if(dol.formIndex!=null){dol.form=document.forms[dol.formIndex]}else{var name=dol.fieldNames[0][0];for(var f=0;f<document.forms.length;f++){if(typeof(document.forms[f][name])!="undefined"){dol.form=document.forms[f];break}}if(dol.form==null){alert("ERROR: Couldn't find form element "+name+" in any form on the page! Init aborted");return}}for(var j=0;j<dol.fieldNames.length;j++){for(var k=0;k<dol.fieldNames[j].length-1;k++){var selObj=dol.form[dol.fieldNames[j][k]];if(typeof(selObj)=="undefined"){alert("Select box named "+dol.fieldNames[j][k]+" could not be found in the form. Init aborted");return}if(k==0){if(selObj.options!=null){for(l=0;l<selObj.options.length;l++){var sopt=selObj.options[l];var m=dol.findMatchingOptionInArray(dol.options,sopt.text,sopt.value,false);if(m!=null){var reselectForNN6=sopt.selected;var m2=new Option(sopt.text,sopt.value,sopt.defaultSelected,sopt.selected);m2.selected=sopt.selected;m2.defaultSelected=sopt.defaultSelected;m2.DOLOption=m;selObj.options[l]=m2;selObj.options[l].selected=reselectForNN6}}}}if(selObj.onchange==null){selObj.onchange=new Function("dynamicOptionListObjects["+dol.index+"].change(this)")}}}}resetDynamicOptionLists()}function resetDynamicOptionLists(theform){for(var i=0;i<dynamicOptionListObjects.length;i++){var dol=dynamicOptionListObjects[i];if(typeof(theform)=="undefined"||theform==null||theform==dol.form){for(var j=0;j<dol.fieldNames.length;j++){dol.change(dol.form[dol.fieldNames[j][0]],true)}}}}function DOLOption(text,value,defaultSelected,selected){this.text=text;this.value=value;this.defaultSelected=defaultSelected;this.selected=selected;this.options=new Array();return this}function DynamicOptionList(){this.form=null;this.options=new Array();this.longestString=new Array();this.numberOfOptions=new Array();this.currentNode=null;this.currentField=null;this.currentNodeDepth=0;this.fieldNames=new Array();this.formIndex=null;this.formName=null;this.fieldListIndexes=new Object();this.fieldIndexes=new Object();this.selectFirstOption=true;this.numberOfOptions=new Array();this.longestString=new Array();this.values=new Object();this.forValue=DOL_forValue;this.forText=DOL_forText;this.forField=DOL_forField;this.forX=DOL_forX;this.addOptions=DOL_addOptions;this.addOptionsTextValue=DOL_addOptionsTextValue;this.setDefaultOptions=DOL_setDefaultOptions;this.setValues=DOL_setValues;this.setValue=DOL_setValues;this.setFormIndex=DOL_setFormIndex;this.setFormName=DOL_setFormName;this.printOptions=DOL_printOptions;this.addDependentFields=DOL_addDependentFields;this.change=DOL_change;this.child=DOL_child;this.selectChildOptions=DOL_selectChildOptions;this.populateChild=DOL_populateChild;this.change=DOL_change;this.addNewOptionToList=DOL_addNewOptionToList;this.findMatchingOptionInArray=DOL_findMatchingOptionInArray;if(arguments.length>0){for(var i=0;i<arguments.length;i++){this.fieldListIndexes[arguments[i].toString()]=this.fieldNames.length;this.fieldIndexes[arguments[i].toString()]=i}this.fieldNames[this.fieldNames.length]=arguments}this.index=window.dynamicOptionListCount++;window["dynamicOptionListObjects"][this.index]=this}function DOL_findMatchingOptionInArray(a,text,value,exactMatchRequired){if(a==null||typeof(a)=="undefined"){return null}var value_match=null;var text_match=null;for(var i=0;i<a.length;i++){var opt=a[i];if(opt.value==value&&opt.text==text){return opt}if(!exactMatchRequired){if(value_match==null&&value!=null&&opt.value==value){value_match=opt}if(text_match==null&&text!=null&&opt.text==text){text_match=opt}}}return(value_match!=null)?value_match:text_match}function DOL_forX(s,type){if(this.currentNode==null){this.currentNodeDepth=0}var useNode=(this.currentNode==null)?this:this.currentNode;var o=this.findMatchingOptionInArray(useNode["options"],(type=="text")?s:null,(type=="value")?s:null,false);if(o==null){o=new DOLOption(null,null,false,false);o[type]=s;useNode.options[useNode.options.length]=o}this.currentNode=o;this.currentNodeDepth++;return this}function DOL_forValue(s){return this.forX(s,"value")}function DOL_forText(s){return this.forX(s,"text")}function DOL_forField(f){this.currentField=f;return this}function DOL_addNewOptionToList(a,text,value,defaultSelected){var o=new DOLOption(text,value,defaultSelected,false);if(a==null){a=new Array()}for(var i=0;i<a.length;i++){if(a[i].text==o.text&&a[i].value==o.value){if(o.selected){a[i].selected=true}if(o.defaultSelected){a[i].defaultSelected=true}return a}}a[a.length]=o}function DOL_addOptions(){if(this.currentNode==null){this.currentNode=this}if(this.currentNode["options"]==null){this.currentNode["options"]=new Array()}for(var i=0;i<arguments.length;i++){var text=arguments[i];this.addNewOptionToList(this.currentNode.options,text,text,false);if(typeof(this.numberOfOptions[this.currentNodeDepth])=="undefined"){this.numberOfOptions[this.currentNodeDepth]=0}if(this.currentNode.options.length>this.numberOfOptions[this.currentNodeDepth]){this.numberOfOptions[this.currentNodeDepth]=this.currentNode.options.length}if(typeof(this.longestString[this.currentNodeDepth])=="undefined"||(text.length>this.longestString[this.currentNodeDepth].length)){this.longestString[this.currentNodeDepth]=text}}this.currentNode=null;this.currentNodeDepth=0}function DOL_addOptionsTextValue(){if(this.currentNode==null){this.currentNode=this}if(this.currentNode["options"]==null){this.currentNode["options"]=new Array()}for(var i=0;i<arguments.length;i++){var text=arguments[i++];var value=arguments[i];this.addNewOptionToList(this.currentNode.options,text,value,false);if(typeof(this.numberOfOptions[this.currentNodeDepth])=="undefined"){this.numberOfOptions[this.currentNodeDepth]=0}if(this.currentNode.options.length>this.numberOfOptions[this.currentNodeDepth]){this.numberOfOptions[this.currentNodeDepth]=this.currentNode.options.length}if(typeof(this.longestString[this.currentNodeDepth])=="undefined"||(text.length>this.longestString[this.currentNodeDepth].length)){this.longestString[this.currentNodeDepth]=text}}this.currentNode=null;this.currentNodeDepth=0}function DOL_child(obj){var listIndex=this.fieldListIndexes[obj.name];var index=this.fieldIndexes[obj.name];if(index<(this.fieldNames[listIndex].length-1)){return this.form[this.fieldNames[listIndex][index+1]]}return null}function DOL_setDefaultOptions(){if(this.currentNode==null){this.currentNode=this}for(var i=0;i<arguments.length;i++){var o=this.findMatchingOptionInArray(this.currentNode.options,null,arguments[i],false);if(o!=null){o.defaultSelected=true}}this.currentNode=null}function DOL_setValues(){if(this.currentField==null){alert("Can't call setValues() without using forField() first!");return}if(typeof(this.values[this.currentField])=="undefined"){this.values[this.currentField]=new Object()}for(var i=0;i<arguments.length;i++){this.values[this.currentField][arguments[i]]=true}this.currentField=null}function DOL_setFormIndex(i){this.formIndex=i}function DOL_setFormName(n){this.formName=n}function DOL_printOptions(name){if((navigator.appName=='Netscape')&&(parseInt(navigator.appVersion)<=4)){var index=this.fieldIndexes[name];var ret="";if(typeof(this.numberOfOptions[index])!="undefined"){for(var i=0;i<this.numberOfOptions[index];i++){ret+="<OPTION>"}}ret+="<OPTION>";if(typeof(this.longestString[index])!="undefined"){for(var i=0;i<this.longestString[index].length;i++){ret+="_"}}document.writeln(ret)}}function DOL_addDependentFields(){for(var i=0;i<arguments.length;i++){this.fieldListIndexes[arguments[i].toString()]=this.fieldNames.length;this.fieldIndexes[arguments[i].toString()]=i}this.fieldNames[this.fieldNames.length]=arguments}function DOL_change(obj,usePreselected){if(usePreselected==null||typeof(usePreselected)=="undefined"){usePreselected=false}var changedListIndex=this.fieldListIndexes[obj.name];var changedIndex=this.fieldIndexes[obj.name];var child=this.child(obj);if(child==null){return}if(obj.type=="select-one"){if(child.options!=null){child.options.length=0}if(obj.options!=null&&obj.options.length>0&&obj.selectedIndex>=0){var o=obj.options[obj.selectedIndex];this.populateChild(o.DOLOption,child,usePreselected);this.selectChildOptions(child,usePreselected)}}else if(obj.type=="select-multiple"){var currentlySelectedOptions=new Array();if(!usePreselected){for(var i=0;i<child.options.length;i++){var co=child.options[i];if(co.selected){this.addNewOptionToList(currentlySelectedOptions,co.text,co.value,co.defaultSelected)}}}child.options.length=0;if(obj.options!=null){var obj_o=obj.options;for(var i=0;i<obj_o.length;i++){if(obj_o[i].selected){this.populateChild(obj_o[i].DOLOption,child,usePreselected)}}var atLeastOneSelected=false;if(!usePreselected){for(var i=0;i<child.options.length;i++){var m=this.findMatchingOptionInArray(currentlySelectedOptions,child.options[i].text,child.options[i].value,true);if(m!=null){child.options[i].selected=true;atLeastOneSelected=true}}}if(!atLeastOneSelected){this.selectChildOptions(child,usePreselected)}}}this.change(child,usePreselected)}function DOL_populateChild(dolOption,childSelectObj,usePreselected){if(dolOption!=null&&dolOption.options!=null){for(var j=0;j<dolOption.options.length;j++){var srcOpt=dolOption.options[j];if(childSelectObj.options==null){childSelectObj.options=new Array()}var duplicate=false;var preSelectedExists=false;for(var k=0;k<childSelectObj.options.length;k++){var csi=childSelectObj.options[k];if(csi.text==srcOpt.text&&csi.value==srcOpt.value){duplicate=true;break}}if(!duplicate){var newopt=new Option(srcOpt.text,srcOpt.value,false,false);newopt.selected=false;newopt.defaultSelected=false;newopt.DOLOption=srcOpt;childSelectObj.options[childSelectObj.options.length]=newopt}}}}function DOL_selectChildOptions(obj,usePreselected){var values=this.values[obj.name];var preselectedExists=false;if(usePreselected&&values!=null&&typeof(values)!="undefined"){for(var i=0;i<obj.options.length;i++){var v=obj.options[i].value;if(v!=null&&values[v]!=null&&typeof(values[v])!="undefined"){preselectedExists=true;break}}}var atLeastOneSelected=false;for(var i=0;i<obj.options.length;i++){var o=obj.options[i];if(preselectedExists&&o.value!=null&&values[o.value]!=null&&typeof(values[o.value])!="undefined"){o.selected=true;atLeastOneSelected=true}else if(!preselectedExists&&o.DOLOption!=null&&o.DOLOption.defaultSelected){o.selected=true;atLeastOneSelected=true}else{o.selected=false}}if(this.selectFirstOption&&!atLeastOneSelected&&obj.options.length>0){obj.options[0].selected=true}else if(!atLeastOneSelected&&obj.type=="select-one"){obj.selectedIndex=-1}}
		});
	},
    /* Sort By Asc/Desc */
	sortBy:function(){
		$(document).ready(function(){
			$("select#orderby").change(function(){
				var sortby = $("select#orderby option:selected").attr('value');
				var order  = $("input[@name='sort']:checked").attr('value');
				var order_string = sortby + '+' + order;
				$('input#order').attr('value', order_string);
			});
			
			$("input[@name='sort']").change(function(){
				var sortby = $("select#orderby option:selected").attr('value');
				var order  = $("input[@name='sort']:checked").attr('value');
				var order_string = sortby + '+' + order;
				$('input#order').attr('value', order_string);
			});
		});				
	},
	/* function that handles the slide up/down of the ajax login form */
	loginToggler:function(){
		$('a#login_link').click(function(){
			$('#a_login').slideToggle('slow', function() {
   				 // Animation complete.
 			 });
 			 
 			 return false;
		});	
	},
	/*  ajax login call back function */
	loginCallback:function(){
		$('#a_login').animate({opacity:.25}, 500, function(){}).slideUp();
		$('#login_li').empty().html('<a href="/index.php/account/">ACCOUNT</a>');
		$('#register_li').empty().html('<a href="/index.php?ACT=14">LOG OUT</a>');
	},
	/* Special functionality for comments (replying and quoting) */ 
	commentConversations:function(){
		$("a.c_reply").click(function() { 
			//Find author name in link
			
			//var author_el = $(this).parent().siblings('.author');
			
			var author_el = $(this).parents(".author")
			
			//alert($(this).parents(".comment-row").attr("rel"));
			
			//var author = author_el.html();
			var author = $(this).parents(".comment-row").attr("rel");
			
			//var authlink = $(this).parents(".comments-list").attr("id");
			var authlink = $(this).parents(".comment-row").attr("id");
			//alert('$(this).parents(".comment-row"): '+$(this).parents(".comment-row").attr("id"))			
			
			var textarea = $("textarea#comment");			
			//Get textarea value
			var text = textarea.attr('value');
			text = text.replace(/(\n\r|\n|\r|\t)/gm, ' ');
			text = text.replace(/(\t)/gm, ' ');
			var reply = " <a href='#"+authlink+"'>@"+author+"</a>\r\n\r\n";
			if(text === null || text === 'undefined'){
				//Add textarea value to include username and comment link
				textarea.val(reply).focus();
			} else {
				textarea.val(text+reply).focus();
			}
			
			$("textarea#comment").putCursorAtEnd();
			return false;
		});
		//Quote
		$("a.c_quote").click(function() {
			//var author_el = $(this).parent().siblings('li.author');
			//var author_el = $(this).parents(".author")
			//var author = author_el.html();
			
			var author = $(this).parents(".comment-row").attr("rel");
			//var authlink = $(this).parents(".comments-list").attr("id");
			
			var authlink = $(this).parents(".comment-row").attr("id");
			
			var textarea = $("textarea#comment");
			
			//Get textarea value
			var text = textarea.attr("value");
			text = text.replace(/(\n\r|\n|\r)/gm, '');
			//Get content of comment
			var quote = $(this).parents(".comment-row").find('.comment').find('p').text();
			quote = quote.replace(/(\n\r|\n|\r)/gm, ' ');
			quote = quote.replace(/(\t)/gm, ' ');
			quote = jQuery.trim(quote);
			//Get any highlighted text
			if (window.getSelection)
				var selection = window.getSelection();
			else if (document.getSelection)
				var selection = document.getSelection();
			else if (document.selection) {
				var selection = document.selection.createRange().text; }   
			//Use highlighted text if anything is highlighted instead of full comment
			
			if(selection!="") quote = selection;
			//Add quoted text, author, and comment link to textarea
			textarea.attr("value",text+"Quote - <a href='#"+authlink+"' class=\"quote\">"+author+"</a><code>"+quote+"</code>\r\n\r\n").focus();
		
			$("textarea#comment").putCursorAtEnd();
			
			return false;
		});
	},
	// for the profile section 
	// expand and collapse the tabs
	profileControls:function(){
		//hide the all of the element with class msg_body
		$(".profile_hidden").hide();
		//toggle the componenet with class msg_body
		$(".profile_onclick").click(function(){
			$(this).next(".profile_hidden").slideToggle(600);
		});
	  	this.groupAvatar();
	},
	/*
	 * @function: groupAvatar
	 * @descrip:  adds a tool tip to friends icons
	*/
	groupAvatar:function(){
		$(document).ready(function(){
			$(".avatar_wrap").tipTip();
		});
	},
	/*
	 * @function: Friends Pagination 
	 * @descrip:  adds some markup to the pagination set on the friends member pages.
	*/
	friendsPagination:function(){
		var friends = $('.friends_pagination');
		var active = friends.find('strong');
		var links = friends.find('a');
		friends.addClass('pagination');
		active.wrap('<li></li>');
		links.wrap('<li></li>');
		
		links.each(function(){
			var html = $(this).html();
			if(html === '&lt;'){ 
				$(this).parent('li').addClass('prev');
				$(this).empty().html('PREV');
			}
			if(html === '&gt;'){
				$(this).parent('li').addClass('next');
				$(this).empty().html('NEXT');
			}
		});
	},

	/*  @function:  sl_main -- shop landing main slider
		@descrip:	handler for the slider on the shop landing (sl) pager_wrapper
	*/
	sl_main:function(){
		var the_images = $('#sl_main');
		var collection_links = $('#sub_nav a');
		var p = $('.prev .text strong');
		var n = $('.next .text strong');
		var default_prev_caption = the_images.find('li:last .sl_caption').html();		
		var default_next_caption = the_images.find('li:eq(1) .sl_caption').html();	
		var subnav = $('nav.sub-nav');
		var collections = $('section.collections');

		the_images.animate({opacity:1}, 1500, function(){ /*ok*/}).cycle({ 
				activePagerClass: 'activeSlide', 
				after:         sl_afterChanger ,  
				delay:         3000,    
				easing:        'linear', 
				fx:            'fade',
				next:          '#next', 
				pause:         1,    
				prev:          '#prev',  
				speed:         1500,  
				timeout:       7000,  
		});
		
		p.html(default_prev_caption);
		currently_viewing = "";
		
		
		if(location.hash === '#home'){
			var ran = true;
		} else {
			var ran = false;		
		}
		
		n.html(default_next_caption);
		collection_links.click(function(){
			$(this).parent('li').siblings().each(function(){
				$(this).removeClass('active');
			});
			$(this).parent('li').addClass('active');
			
			if($(this).hasClass('home')){ 
				if(ran == true) return false;
				ran = true;
				homeBtnClick();
				//setTimeout('document.location.href = "/index.php/shop#";',800);	
				return false;
			}
			ran = false;
			if(collections.is(":hidden")){
				showCollections();
			}
			var url = $(this).attr('href'); 
			var value = url.substring(url.lastIndexOf('/') + 1);
			sl_catDetail(value);
			
			return false;
		});


		if(location.hash != '#home' && location.hash != ''){
			//collection_links.trigger('click');
			var h = location.hash;
			var temp = '';
			temp = h.replace('#', '');			
			if(collections.is(":hidden")){
				showCollections();
			}
			sl_catDetail(temp);
		}
		
		
		function sl_catDetail(hash){
			var target_url = 'http://'+document.domain+'/index.php/shop/collection/'+hash;
			collections.empty().load(target_url);			
			var current_url = document.location.href;
			var current_hash = location.hash;
			var new_url = current_hash == ""
							? document.location.href
							: current_url.replace(current_hash, "");
			new_url = new_url+"#"+hash;			
			document.location.href = new_url;
			currently_viewing = location.hash;		
		}
		

		/* handler that updates the prev/next captions after each change event */
		function sl_afterChanger(currSlideElement, nextSlideElement, options, forwardFlag){
			// prev button text container
			var p = $('.prev .text strong');
			// next button text container
			var n = $('.next .text strong');
			var prev_caption = $(currSlideElement).find('.sl_caption').html();
			var next_caption = $(nextSlideElement).next().find('.sl_caption').html();
			if (next_caption === null){
				next_caption = default_next_caption;	
			}
			p.html(prev_caption);
			n.html(next_caption);
		}  	
		/* */
		function showCollections(){
			$('nav.prev').hide(); $('nav.next').hide();
			the_images.cycle('pause').animate({opacity:.05}, 750, function(){ 
				subnav.animate({top:'10px'}, 750, function(){
						collections.show().animate({opacity:1}, 1000, function(){ /**/ });
				});						
			}); // pause the main slideshow.		
		}
		/* */
		function homeBtnClick(){
			if(location.hash === '#home'){
				return false;
			}
			if(collections.is(":hidden")){
				showCollections();
			} else {
				collections.animate({opacity:0}, 500, function(){
					subnav.animate({top:'603px'}, 500, function(){
						the_images.animate({opacity:1}, 750, function(){ 
							$('nav.prev').show(); $('nav.next').show();
						 }).cycle('start'); // play the main slideshow
					});						
				 }).hide();			
			}
			
			var new_url = 'http://'+document.domain+'/index.php/shop/';
			var data = '';
			window.history.pushState(data, "12ozProphet.com", new_url);

		}
	},
	// methods for contact page form validation
	contactUs:function(){
			var default_values = {};
			jQuery('input:text').each(function(i) {
				var index = jQuery(this).attr('name');
				var value = jQuery(this).val();
				default_values[index] = value;
			});
			jQuery('input:text').focus(function() {
				if(jQuery(this).val() === default_values[jQuery(this).attr('name')]) {
				  jQuery(this).val('');
				};
			});
			jQuery('input:text').blur(function() {
				if(jQuery(this).val() < 1) {
				  jQuery(this).val(default_values[jQuery(this).attr('name')]);
				};
			});
			$("#email").keyup(function(){
				var email = $("#email").val();		
				if(email != 0){
					if(twelve_ounce.isValidEmailAddress(email)){
						$("#email").css({"background-color": "#EFF"});
					} else {
						$("#email").css({"background-color": "#FEF"});
						$("#invalid").css({"display":"inline"});
						$("#invalid").css({"color":"red"});
					}
				} else {
					$("#email").css({"background-color":"#FFF"});				
				}		
			});
			$("#name").keyup(function(){
				var name = $(this).val();		
				if(name != 0){
					$(this).css({"background-color": "#EFF"});
				} else {
					$(this).css({"background-color":"#FFF"});			
				}		
			});
			$("#subject").keyup(function(){
				var subject = $(this).val();		
				if(subject != 0){
					$(this).css({"background-color": "#EFF"});
				} else {
					$(this).css({"background-color":"#FFF"});			
				}		
			});			
			$("#message").keyup(function(){
				var name = $(this).val();		
				if(name != 0){
					$(this).css({"background-color": "#EFF"});
				} else {
					$(this).css({"background-color":"#FFF"});			
				}		
			});			
			$('#submit').click(function(){
				twelve_ounce.handleSubmit();
				return false;
			});		
		},
		handleSubmit:function(){
				var email	=	$("#email").val();		
				var name  	=	$("#name").val();
				var subject  	=	$("#subject").val();
				var msg		=	$("#message").val();
				var cleared 	= 	true;
				if(email != 0){
					if(!twelve_ounce.isValidEmailAddress(email)){
						jQuery("#from").vibrate();
						jQuery("#from").parent('.cell').addClass('error');
						var cleared = false;
					} else {
						jQuery('#from').parent('.cell').removeClass('error');
					}
				} else {
					jQuery("#from").vibrate();
					jQuery("#from").parent('.cell').addClass('error');
					var cleared = false;
				}
				if(name !=0){ 
				} else {
					jQuery("#name").vibrate();
					jQuery("#name").parent('.cell').addClass('error');
					var cleared = false;
				}
				if(subject !=0){ 
				} else {
					jQuery("#subject").vibrate();
					jQuery("#subject").parent('.row').addClass('error');
					var cleared = false;
				}

				if(msg !=0){ 
				} else {
					jQuery("#message").vibrate();
					jQuery("#message").parent('.row').addClass('error');
					var cleared = false;
				}
				
				if(cleared){
					 document.forms["a"].submit();
				}
				return false;
		},
    	isValidEmailAddress:function (emailAddress) {
			var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
			return pattern.test(emailAddress);
		},
		
		activityFeedURLParse:function(){
			$('.comment-row .comment').linkify();
		},
		
		/* share button */
		share:function() {
			var _shareHolder = jQuery('.share');
			jQuery(_shareHolder).each(function() {
				var _this = $(this);
				var _shareBtn = _this.find('> a.btn');
				var _shareList = _this.find('> ul');
			
				if (_this.hasClass('opened')) {_shareList.show();}
				else {_shareList.hide();}
			
				_shareBtn.click(function() {
					if (_this.hasClass('opened')) {
						_shareList.stop().animate({opacity:0}, 700, function(){_shareList.css({display:'none'})});
						_this.removeClass('opened');
					}
					else {
						_shareList.css({display: 'block', opacity:0}).stop().animate({opacity:1}, 1000);
						_this.addClass('opened');
					}
					return false;
				});
			});
		}, // end share button jawn

	 // clears out the form fields.  
	 clearFormFields:function(o) {
		if (o.clearInputs == null) o.clearInputs = true;
		if (o.clearTextareas == null) o.clearTextareas = true;
		if (o.passwordFieldText == null) o.passwordFieldText = false;
		if (o.addClassFocus == null) o.addClassFocus = false;
		if (!o.filterClass) o.filterClass = "default";
		if(o.clearInputs) {
			var inputs = document.getElementsByTagName("input");
			for (var i = 0; i < inputs.length; i++ ) {
				if((inputs[i].type == "text" || inputs[i].type == "password") && inputs[i].className.indexOf(o.filterClass) == -1) {
					inputs[i].valueHtml = inputs[i].value;
					inputs[i].onfocus = function (){
						if(this.valueHtml == this.value) this.value = "";
						if(this.fake) {
							inputsSwap(this, this.previousSibling);
							this.previousSibling.focus();
						}
						if(o.addClassFocus && !this.fake) {
							this.className += " " + o.addClassFocus;
							this.parentNode.className += " parent-" + o.addClassFocus;
						}
					}
					inputs[i].onblur = function () {
						if(this.value == "") {
							this.value = this.valueHtml;
							if(o.passwordFieldText && this.type == "password") inputsSwap(this, this.nextSibling);
						}
						if(o.addClassFocus) {
							this.className = this.className.replace(o.addClassFocus, "");
							this.parentNode.className = this.parentNode.className.replace("parent-"+o.addClassFocus, "");
						}
					}
					if(o.passwordFieldText && inputs[i].type == "password") {
						var fakeInput = document.createElement("input");
						fakeInput.type = "text";
						fakeInput.value = inputs[i].value;
						fakeInput.className = inputs[i].className;
						fakeInput.fake = true;
						inputs[i].parentNode.insertBefore(fakeInput, inputs[i].nextSibling);
						inputsSwap(inputs[i], null);
					}
				}
			}
		}
		if(o.clearTextareas) {
			var textareas = document.getElementsByTagName("textarea");
			for(var i=0; i<textareas.length; i++) {
				if(textareas[i].className.indexOf(o.filterClass) == -1) {
					textareas[i].valueHtml = textareas[i].value;
					textareas[i].onfocus = function() {
						if(this.value == this.valueHtml) this.value = "";
						if(o.addClassFocus) {
							this.className += " " + o.addClassFocus;
							this.parentNode.className += " parent-" + o.addClassFocus;
						}
					}
					textareas[i].onblur = function() {
						if(this.value == "") this.value = this.valueHtml;
						if(o.addClassFocus) {
							this.className = this.className.replace(o.addClassFocus, "");
							this.parentNode.className = this.parentNode.className.replace("parent-"+o.addClassFocus, "");
						}
					}
				}
			}
		}
		function inputsSwap(el, el2) {
			if(el) el.style.display = "none";
			if(el2) el2.style.display = "inline";
		}
	},
	groupDescriptionField:function(){
		var ta = $('textarea#taMessage');
		var cc = $('span#remaining');
		var charLength = ta.val().length;
		cc.html((500-charLength) + ' characters remaining');
		ta.keyup(function() {
			var charLength = $(this).val().length;
			// Displays count
			cc.html((500-charLength) + ' characters remaining');
			// Alerts when 250 characters is reached
			if($(this).val().length > 500){
				cc.html('<strong>You may only have up to 500 characters.</strong>');
			}
		});
	}	
		
}  // end of object twelve_ounce




