		$.randomImage = {
			defaults: {
				//you can change these defaults to your own preferences.
				path: '', //change this to the path of your images
				//
				myImages: ['http://icelanticboards.com/images/banners/2012_Animal-Banner-FLAT_1.jpg','http://icelanticboards.com/images/banners/2012_main_banner.jpg','http://icelanticboards.com/images/banners/2012_Ben-Carve-FLAT.jpg','http://icelanticboards.com/images/banners/2012_cordorouy-banner-FLAT.jpg','http://icelanticboards.com/images/banners/2012_Gypsy-Pow.jpg','http://icelanticboards.com/images/banners/2012_Mark-Morris-Banner-FLAT.jpg','http://icelanticboards.com/images/banners/2012_Morris-X-FLAT.jpg','http://icelanticboards.com/images/banners/2012_One-Degree-Sculpture-FLAT.jpg','http://icelanticboards.com/images/banners/2012_US-AnimalsFLAT_1.jpg','http://icelanticboards.com/images/banners/2012_Turner-Tele-FLAT.jpg','http://icelanticboards.com/images/banners/2012_Zila-POW-FLAT.jpg', ]
			}			
		}
		$.fn.extend({
				randomImage:function(config) {
					var config = $.extend({}, $.randomImage.defaults, config); 				
					 return this.each(function() {					
							var imageNames = config.myImages;					
							//get size of array, randomize a number from this
							// use this number as the array index
							var imageNamesSize = imageNames.length;
							var lotteryNumber = Math.floor(Math.random()*imageNamesSize);
							var winnerImage = imageNames[lotteryNumber];
							var fullPath = config.path + winnerImage;								
							//put this image into DOM at class of randomImage
							// alt tag will be image filename.
							$(this).attr( {
											src: fullPath,
											alt: winnerImage
										});		
					});	
				}		
		});
		
		function pagerFactory(idx, slide) {
			 
			if (idx < 9)
			  {
				var s = idx > 2 ? ' style="display:none"' : '';
				return '<a href="#">0'+(idx+1)+'</a>';
			  }
			else
			  {
				var s = idx > 2 ? ' style="display:none"' : '';
				return '<a href="#">'+(idx+1)+'</a>';
			  }
			
		
		 };
		
		$(document).ready(function(){

			$('#mycarousel').jcarousel({
				scroll: 1,
				itemFallbackDimension: 700
			});   

			$.fn.supersized.options = {  
				vertical_center: 1,
				slideshow: 0,
				navigation: 0,
				transition: 0 //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left				
			};
		    $('#supersize').supersized();

			$("ul.sf-menu").superfish();

			$('a.video_link').live('click', function() {									
				$('.youtubebox').load($(this).attr('rel'));
				return false;	
			});
			
			$('.shuffle').randomImage();
			
						

			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
					
				
			
			
			$('#calendar').fullCalendar({
				editable: false,
				events: [{"id":"591","title":"Icelantic's Winter on the Rocks - come be apart of history as we throw the 1st Ever Winter Concert at Red Rocks during SIA!!!","start":"2012-01-27"},{"id":"587","title":"Free Demos at Kirkwood!  ","start":"2012-01-02"},{"id":"586","title":"Snowbasin Demo","start":"2011-12-18"},{"id":"585","title":"Powder Mountain Demo","start":"2011-12-17"},{"id":"584","title":"Aspen Ajax Demo","start":"2011-12-19"},{"id":"581","title":"Aspen Highlands Opening Day Demo","start":"2011-12-10"},{"id":"575","title":"Bent Gate Loveland Demo","start":"2011-12-04"},{"id":"574","title":"Mt. Hood Meadows Demo","start":"2012-03-18"},{"id":"572","title":"Mt. Baker Banked Slalom Demo","start":"2012-02-11"},{"id":"573","title":"Mt. Baker Banked Slalom Demo","start":"2012-02-12"},{"id":"571","title":"Mt. Baker Banked Slalom Demo","start":"2012-02-10"},{"id":"570","title":"Mt. Hood Meadows Demo","start":"2011-12-18"},{"id":"568","title":"Crystal Mountain Demo","start":"2011-12-11"},{"id":"569","title":"Mt. Bachelor Demo","start":"2011-12-17"},{"id":"567","title":"Mt.Baker Demo","start":"2011-12-03"},{"id":"565","title":"Colorado Ski and golf demo at Loveland!","start":"2011-11-19"},{"id":"545","title":"First Friday Party @ Battery 621","start":"2011-11-04"},{"id":"551","title":"First Friday Party @ Battery 621","start":"2012-05-04"},{"id":"550","title":"First Friday Party @ Battery 621","start":"2012-04-06"},{"id":"549","title":"First Friday Party @ Battery 621","start":"2012-03-02"},{"id":"548","title":"First Friday Party @ Battery 621","start":"2012-02-03"},{"id":"547","title":"First Friday Party @ Battery 621","start":"2012-01-06"},{"id":"546","title":"First Friday Party @ Battery 621","start":"2011-12-02"},{"id":"520","title":"Loveland Ski Area Christy Sports Demo","start":"2011-11-12"},{"id":"539","title":"Durango Mountain Demo","start":"2012-01-15"},{"id":"522","title":"Loveland, Shop Employee Demo","start":"2011-11-17"},{"id":"544","title":"Dodge Ridge Demo","start":"2012-03-25"},{"id":"542","title":"Mt. Baker Demo","start":"2012-02-12"},{"id":"543","title":"Mt. Hood Meadows Demo","start":"2012-03-18"},{"id":"540","title":"Boyne Mountain Demo","start":"2012-02-25"},{"id":"541","title":"Mt. Baker Demo","start":"2012-02-11"},{"id":"538","title":"Durango Mountain Demo","start":"2012-01-14"},{"id":"537","title":"Brundage Mountain Demo","start":"2012-01-05"},{"id":"536","title":"Brundage Mountain Demo","start":"2012-01-04"},{"id":"534","title":"Durango Mountain Demo","start":"2011-12-18"},{"id":"535","title":"Mt. Hood Meadows Demo","start":"2011-12-18"},{"id":"533","title":"Breckenridge Demo @ Mountain Wave","start":"2011-12-17"},{"id":"531","title":"Durango Mountain Demo","start":"2011-12-17"},{"id":"528","title":"Alta Demo","start":"2011-12-11"},{"id":"526","title":"Brighton Demo","start":"2011-12-10"},{"id":"527","title":"Vail Demo @ Buzz's\/Double Diamond","start":"2011-12-10"},{"id":"525","title":"Winterpark Demo","start":"2011-12-03"},{"id":"523","title":"Copper Demo","start":"2011-11-19"},{"id":"524","title":"Copper Demo","start":"2011-11-20"},{"id":"521","title":"Loveland, Shop Employee Demo","start":"2011-11-16"},{"id":"392","title":"Icelantic 1st Friday at Battery 621!  Featuring Fresh Jefferson, 621 Kalamath St. Denver","start":"2011-10-07"},{"id":"513","title":"The Gallery at Ben Lomond Suites, Ogden UT.  6pm-9pm, Icelantic skis will debut their 2011-2012 artist inspired skis both in Denver, Colorado and Ogden, Utah during each cities first Friday art stroll. ","start":"2011-10-07"},{"id":"395","title":"Mazot Fest 2011, 10am to 3pm, Mt. Hood Meadows, MHM Mazot Eatery: A fun race and event with proceeds going to the MHM Canine Avalanche Program.","start":"2011-04-23"},{"id":"391","title":"Copper Demo, USASA Skier Nationals","start":"2011-04-12"},{"id":"390","title":"Copper Demo, USASA Skier Nationals","start":"2011-04-11"},{"id":"389","title":"Copper Demo, USASA Skier Nationals","start":"2011-04-10"},{"id":"388","title":"Crested Butte Demo at FestEvol","start":"2011-03-27"},{"id":"387","title":"Crested Butte Demo at FestEvol","start":"2011-03-26"},{"id":"386","title":"Come try out the 2011-2012 line at Mt. Hood Meadows!!","start":"2011-03-20"},{"id":"384","title":"Icelantic Presents-Zion I and The Grouch w. Abstract Rude, The Shotgun Wedding Quintet, Ray Bones, and Jazz Mafia!!","start":"2011-04-02"},{"id":"366","title":"Icelantic Demo @ Vail - Outside of Buzz's Board Shop","start":"2011-01-16"},{"id":"365","title":"Icelantic Demo @ Vail - Outside of Buzz's Board Shop","start":"2011-01-15"},{"id":"359","title":"Demo day at Monarch Mtn. with Blindside","start":"2010-12-22"},{"id":"350","title":"Icelantic Demo @ Northside Pizza, Breckenridge","start":"2010-12-18"},{"id":"357","title":"Icelantic Demo @ Snowbasin","start":"2011-03-12"},{"id":"352","title":"Icelantic Demo @ Bear Valley","start":"2011-01-06"},{"id":"351","title":"Icelantic Demo @ Mt Bachelor","start":"2010-12-18"},{"id":"349","title":"Icelantic Demo @ Breckenridge","start":"2010-12-17"},{"id":"348","title":"Icelantic Demo @ Alta","start":"2011-01-08"},{"id":"346","title":"Icelantic Demo @ Alpine Meadows","start":"2011-03-06"},{"id":"345","title":"Icelantic Demo @ Dodge Ridge ","start":"2010-12-18"},{"id":"344","title":"Icelantic Demo @ Copper","start":"2010-12-20"},{"id":"343","title":"Icelantic Demo @ Copper","start":"2010-12-19"},{"id":"342","title":"Icelantic Demo @ Alyeska","start":"2011-02-26"},{"id":"341","title":"Icelantic Demo @ Alyeska","start":"2011-02-25"},{"id":"340","title":"Icelantic Demo @ Mission Ridge ","start":"2011-02-12"},{"id":"339","title":"Icelantic Demo @ Mission Ridge ","start":"2011-02-11"},{"id":"335","title":"Icelantic Demo @ Mt Hood Meadows ","start":"2010-12-19"},{"id":"328","title":"Icelantic Demo at Eagle Point","start":"2011-01-15"},{"id":"327","title":"Icelantic Demo at Powder Mountain","start":"2011-02-13"},{"id":"326","title":"Icelantic Demo at Powder Mountain","start":"2011-02-12"},{"id":"325","title":"Icelantic Demo at Crystal Mountain","start":"2010-12-11"},{"id":"313","title":"American Telemark Festival, Icelantic demo event at Mad River Glenn","start":"2011-03-12"},{"id":"323","title":"Junior Freeski Open, Grand Targhee. Top 3 win Icelantic Skis","start":"2011-03-19"},{"id":"324","title":"Junior Freeski Open, Grand Targhee. Top 3 win Icelantic Skis","start":"2011-03-20"},{"id":"322","title":"Junior Freeski Open, Grand Targhee. Top 3 win Icelantic Skis","start":"2010-12-18"},{"id":"321","title":"Icelantic Demo, NATO Tele Fest, Saddleback ME","start":"2011-03-19"},{"id":"320","title":"Icelantic EMS Demo at Wildcat","start":"2011-03-05"},{"id":"319","title":"Icelantic Demo at Loon","start":"2010-12-18"},{"id":"318","title":"Icelantic Demo at Jay Peak","start":"2010-12-13"},{"id":"317","title":"Icelantic Demo at Okemo, Day 3","start":"2010-12-12"},{"id":"316","title":"Icelantic Demo at Okemo, day 2","start":"2010-12-11"},{"id":"315","title":"Icelantic Demo at Okemo, day 1","start":"2010-12-10"},{"id":"314","title":"American Telemark Festival, Icelantic demo eevent at Mad River Glenn, day 2","start":"2011-03-13"},{"id":"312","title":"Icelantic Demo, Sierra at Tahoe","start":"2011-03-27"},{"id":"311","title":"Icelantic Demo, Sierra at Tahoe","start":"2011-03-26"},{"id":"310","title":"Icelantic Demo, Dodge Ridge","start":"2011-03-13"},{"id":"309","title":"First Friday at the NEW Icelantic Gallery, Battery 621","start":"2011-01-07"},{"id":"308","title":"Icelantic - Powder 7.com demo at Loveland","start":"2011-01-09"},{"id":"307","title":"Icelantic Demo behind teton Village Sports in Jackson Hole","start":"2011-01-02"},{"id":"306","title":"Icelantic Demo at Stratton","start":"2010-12-19"},{"id":"305","title":"Vail Pro Night","start":"2010-12-18"},{"id":"302","title":"Icelantic X-MAS Sweater Party @ Stoney's Bar and Grill","start":"2010-12-07"},{"id":"301","title":"Icelantic Demo at Teton Village Sports in Jackson Hole","start":"2011-01-01"},{"id":"300","title":"Poor Booyz Productions Icelantic party at North Side Pizza in Breckenridge","start":"2010-11-16"}]			});
			
			$('#slideshow').cycle({
				fx: 'scrollHorz',
				timeout: 0,
				prev: '#prev',
				next: '#next',
				pager: '#nav',
				pagerAnchorBuilder: pagerFactory
			});
			
			$('a.buy_now').live('click', function() {
				if($('#art_buy').val() != '') {window.open($('#art_buy').val());} else {
					alert('Please select a Topsheet');
				}
				return false;
			});
			
			$('#store_buy').change(function()  {
				$('.productimgs').attr('src',$('#store_buy option:selected').attr('rel'));				
				return false;
			});
			
			$('.storemaindropdown').change(function()  {
				if($('.storemaindropdown').val() != '') {window.location.replace($('.storemaindropdown').val());} else {
					
				}
				return false;
			});
			
			$('a.buy_store').live('click', function() {
				if($('#store_buy').val() != '') {window.open($('#store_buy').val());} else {
					alert('Please select a Item');
				}
				return false;
			});
			
			var default_product_img;
			
			$('img.product_thumb').hover(
				function() {
					default_product_img = $('.productimgs').attr('src');
					$('.productimgs').attr('src', $(this).attr('rel'));
				}, 
				function() {
					$('.productimgs').attr('src', default_product_img);
				}
			);
			
			$('#field10').hide();
			$('#selectfieldother').change(function(){
				var val = [];
				$('#selectfieldother').each(function(i){
				  if($(this).val() == 'Other'){$("#field10").fadeIn();}else{$("#field10").fadeOut();}
				});
			});			

			
			$.metadata.setType("attr", "validate"); 
				// validate the comment form when it is submitted
				$("#form1").validate({
					rules: {
						
						name: {
							required: true,
							minlength: 2
						},
						zipcode: {
							required: true,
							maxlength: 5
						},
						field4: {
							digits: true,
							maxlength: 7,
							minlength:3
						},

						Email1: {
							required: true,
							email: true
						},
						
						agree: "required"
					},
					messages: {
						field2: "Please enter your age.",
						Name: "Please enter your name.",
						Email1: "Please enter a valid email address.",
						field8: "Please select ski size.",
						field9: "Please select ski model.",
						field4: "Please enter ski seiral #.",
						field7: "Please enter your home mountain",
						field3: "Please enter where you purchased",
						City: "Please enter home town.",
						field6: "Please enter why you choose Icelantic",
						field5: "Please enter which pair of Icelantics"
					},
					submitHandler: function(form) {
						if ($('#simpleCaptcha_0').val() == $('#register').attr('class')) {
							//alert('success!');
							form.submit();
						} else {
							alert('You must click on the correct image to submit this form.');
						}
					}

				});
				
				$('#captcha1').bind('loaded.simpleCaptcha', function() {
					  introText: '<p>Please click on the <strong class="captchaText"></strong></p>'
				  }).simpleCaptcha();

		});
