$(document).ready(function() {

	var h = $(window).height();
	var w = $(window).width();
	var offset = $("#footer").offset();
	var windowH = h-150;
	var scrollH = offset.top;
	if(windowH>scrollH){pageH=windowH;}else{pageH=scrollH;}
	$('body').css("min-height",pageH);
	$('#designer-fix').css("width",w);
	$('#designer-fix').css("height",1100);

	if (IE7 == true || 
	navigator.userAgent.match(/Android/i) ||
	navigator.userAgent.match(/webOS/i) ||
	navigator.userAgent.match(/iPhone/i) ||
	navigator.userAgent.match(/iPod/i)
	){
		//do nothing
	} else {
		
   	$(function() {  
     $().jSnow({  
       flakes : 100,  
       flakeCode : [ 
         "i/snow/S/lg_02.png",  
         "i/snow/S/lg_02.png", 
         "i/snow/S/lg_02.png", 
         "i/snow/XXS/med_08.png",
         "i/snow/XXS/med_08.png",
         "i/snow/XXS/med_08.png",
         "i/snow/XXS/med_08.png"
       ],  
       fallingSpeedMax : 1,  
       fallingSpeedMin : 0,  
       zIndex : -1,  
       interval : 1  
     });  
   	}); 
   	}
	
	//get page
	var page = $('.content').attr("id");
	
	//homepage
	if(page=="contentindex"||page=="contentmen"||page=="contentwomen"){
		if (IE8 == false){
			$(function () {$('.grid img').hide();});
		}
		$(window).bind("load", function() {$('.grid img:hidden').fadeIn(500);});
	
		$('#grid1 div').each(function(i){
			i++;
			$(this).mouseover(function(){
				$(this).fadeTo("fast", 0);
			});
			$(this).mouseout(function(){
				$(this).fadeTo("fast", 1);
			});
		});
		$("#various1").fancybox();
		setTimeout( function() {$('.splash').fadeOut('medium', function() {});}, 3000);
	}
	
	// event photos
	$('#scroller-small li').each(function(index) {
		index++;
    	$(this).click(function() {
			dir = $(this).attr('class');
			img = $(this).attr('id');
    		$('#display-photo').html('<img src="../events/'+dir+'/'+img+'">');
		});
	});
	$('.scroll-left').click(function() {
		curpos = $("#scroller-small ul").position().left;
		if(curpos<300){
			newpos = curpos + 540;
			$('#scroller-small ul').animate({left: newpos}, 500);
		}
	});
	$('.scroll-right').click(function() {
		curpos = $('#scroller-small ul').position().left;
		var stripW1 = $('#scroller-small ul').width()-600;
		var stripW2 = "-"+stripW1;
		if(curpos>stripW2){
			newpos = curpos - 540;
			$('#scroller-small ul').animate({left: newpos}, 500);
		}
	});
	
	// winter sale
	$("a#sale").fancybox();
	$("a[rel=group]").fancybox();
	$("a[rel=group2]").fancybox();
	
});
