
$(document).ready(function() {
prod_id='0';
	
	loadHeaderContent();
	
	switch($('.content').attr('rel')){
	case 'cocktail':
		animateShoes();
		animateHandbags();
		animateJewelry();
		setActiveCallout($('.dress-callout'),"dresses_bg.png");
		set_header_text();
		fill_content("?category=9&process=5&prod_id=3&NAV=",1);
		break;
	case 'prom-dresses':
		animateShoes();
		animateHandbags();
		animateJewelry();
		setActiveCallout($('.dress-callout'),"dresses_bg.png");
		fill_content("?category=8&process=5&prod_id=3&NAV=",1);
		set_header_text();
		
		break;
	case 'prom-dresses-shoes':
		animateHandbags();
		animateDresses();
		animateJewelry();
		setActiveCallout($('.shoe-callout'),"shoes_bg.png");
		set_header_text();
		fill_content("?category=8&process=5&prod_id=3&NAV=",1);
		break;
	case 'prom-shoes':
		animateHandbags();
		animateDresses();
		animateJewelry();
		setActiveCallout($('.shoe-callout'),"shoes_bg.png");
		set_header_text();
		fill_content("?category=2&process=5&prod_id=1&NAV=",1);
		prom_shoe_shopBy();
		break;
	case 'gold-prom-shoes':
		animateHandbags();
		animateDresses();
		animateJewelry();
		setActiveCallout($('.shoe-callout'),"shoes_bg.png");
		set_header_text();
		fill_content("?category=2&process=5&prod_id=1&colorselect=gold&NAV=",1);
		prom_shoe_shopBy();
		break;
	case 'silver-prom-shoes':
		animateHandbags();
		animateDresses();
		animateJewelry();
		setActiveCallout($('.shoe-callout'),"shoes_bg.png");
		set_header_text();
		fill_content("?category=2&process=5&prod_id=1&colorselect=silver&NAV=",1);
		prom_shoe_shopBy();
		break;
	case 'wedding-shoes':
		animateHandbags();
		animateDresses();
		animateJewelry();
		setActiveCallout($('.shoe-callout'),"shoes_bg.png");
		set_header_text();
		fill_content("?category=1&process=5&prod_id=1&NAV=",1);
		wedding_shoe_shopBy();
		break;	
	case undefined :
		break;
	}
	
	
	$('.dress-callout').click( function(){
		animateShoes();
		animateHandbags();
		animateJewelry();
		setActiveCallout($(this),"dresses_bg.png");
		dress_shopBy();
			
	});
	$('.jewelry-callout').click( function(){
		animateShoes();
		animateHandbags();
		animateDresses();
		setActiveCallout($(this),"jewelry_bg.png");
		jewelry_shopBy();
	});
	$('.handbag-callout').click( function(){
		animateShoes();
		animateJewelry();
		animateDresses();
		setActiveCallout($(this),"handbags_bg.png");
		handbag_shopBy();
	});
	$('.shoe-callout').click( function(){
		animateHandbags();
		animateJewelry();
		animateDresses();
		setActiveCallout($(this),"shoes_bg.png");
		shoe_shopBy();
	});
	
	$('.product-callouts').find('.start-over').click(function(){
		startOver();
	});
	
	$('.product-callouts').find('.step-back').click(function(){
		stepBack();
	});
	
	
	
});
function loadHeaderContent(){
	journey=$('.template').find('.shopping-journey-content').clone();
 	$('.shopping-journey').html(journey);

}
function animateDresses(){
	$('.dress-callout').animate({  
		left: '1000px'
		}, 2000);  
	
}

function animateShoes(){
	$('.shoe-callout').animate({  
		left: '1000px'
		}, 2000);  

}

function animateHandbags(){
	$('.handbag-callout').animate({  
		left: '1000px'
		}, 2000);  

}

function animateJewelry(){
	$('.jewelry-callout').animate({  
		left: '1000px'
		}, 2000);  
}

function setActiveCallout(objRef, color){
	objRef.animate({  
		left: '0px'
		}, 2000);
	bgUrl="url(img/" + color + ")";
	$('.product-callouts').css('backgroundImage',bgUrl); 
	prod_id=objRef.find('.learn-more').attr('rel');
	objRef.find('.learn-more').hide(0);
	$('.product-callouts').find('.start-over').show(1000);
	
}

function startOver(){
	$('.product-callouts').css('backgroundImage',''); 
	$('.dress-callout').animate({  
	left: '1px'
	}, 2000);
	$('.jewelry-callout').animate({  
	left: '196px'
	}, 2000);
	$('.handbag-callout').animate({  
	left: '392px'
	}, 2000);
	$('.shoe-callout').animate({  
	left: '588px'
	}, 2000);
	$('.product-callouts').find('.start-over').hide(0);
	$('.dress-callout').find('.learn-more').show(0);
	$('.jewelry-callout').find('.learn-more').show(0);
	$('.handbag-callout').find('.learn-more').show(0);
	$('.shoe-callout').find('.learn-more').show(0);
	$('.product-callouts').find('.shop-by').remove();
	$('.product-callouts').find('.special-event-dress').remove();
	$('.product-callouts').find('.budget-dress').remove();
	$('.product-callouts').find('.size-buttons').remove();
	$('.product-callouts').find('.brand-names').remove();
	$('.product-callouts').find('.dress-colors').remove();
	$('.product-callouts').find('.step-back').hide(0);
	$('.product-callouts').find('.jewelry-main').remove();
	$('.product-callouts').find('.jewelry-colors').remove();
	$('.product-callouts').find('.handbag-main').remove();
	$('.product-callouts').find('.handbag-colors').remove();
	$('.product-callouts').find('.handbag-collections').remove();
	$('.product-callouts').find('.shoes-main').remove();
	$('.product-callouts').find('.shoe-colors').remove();
	$('.product-callouts').find('.shoe-collections').remove();
	$('.product-callouts').find('.heel-heights').remove();
	$('.product-callouts').find('.header-content').remove();
}
 function dress_shopBy(){
 	$('.product-callouts').find('.step-back').hide(0);
 	shopBy=$('.template').find('.shop-by').clone();
 	shopBy.appendTo('.product-callouts');
 	$('.product-callouts').find(shopBy).animate({left:'210px'},2000);
 		$('.product-callouts').find(shopBy).find('.special-event').click(function(){
 			dress_specialEvent();
 			$('.product-callouts').find('.step-back').show(1000);
 			
		});
		
		$('.product-callouts').find(shopBy).find('.short-dress').click(function(){
			fill_content("?process=5&silhselect=8&prod_id=3&NAV=",1);
			setCheckbox($(this));
		});
		
		$('.product-callouts').find(shopBy).find('.by-size').click(function(){
			dress_sizeOptions();
			$('.product-callouts').find('.step-back').show(1000);
		});
		
		$('.product-callouts').find(shopBy).find('.by-color').click(function(){
			dress_colors();
			$('.product-callouts').find('.step-back').show(1000);
		});
		
		$('.product-callouts').find(shopBy).find('.by-budget').click(function(){
			dress_budget();
			$('.product-callouts').find('.step-back').show(1000);
		});
		$('.product-callouts').find(shopBy).find('.by-brand').click(function(){
			dress_brandOptions();
			$('.product-callouts').find('.step-back').show(1000);
		});
		
		$('.product-callouts').find('.shop-by').find('.browse-all').click(function(){
		window.location.href='dresses.asp?prod_id=3';
		});
 }
 
 function dress_specialEvent(){
 	specialEvent=$('.template').find('.special-event-dress').clone();
  	specialEvent.appendTo('.product-callouts');
 	$('.product-callouts').find('.shop-by').animate({left:'1000px'},2000);
	$('.product-callouts').find(specialEvent).animate({left:'210px'},2000);
		$('.product-callouts').find(specialEvent).find('.mob-dress').click(function(){
			fill_content("?category=6&process=5&prod_id=3&NAV=",1);
			setCheckbox($(this));
		});
		
		$('.product-callouts').find(specialEvent).find('.prom-dress').click(function(){
			fill_content("?category=8&process=5&prod_id=3&NAV=",1);
			setCheckbox($(this));
		});
		
		$('.product-callouts').find(specialEvent).find('.wedding-dress').click(function(){
			fill_content("?category=1&process=5&prod_id=3&NAV=",1);
			setCheckbox($(this));
		});
		$('.product-callouts').find(specialEvent).find('.cocktail-dress').click(function(){
			fill_content("?category=9&process=5&prod_id=3&NAV=",1);
			setCheckbox($(this));
		});
		$('.product-callouts').find(specialEvent).find('.hc-dress').click(function(){
			fill_content("?category=8&process=5&prod_id=3&NAV=",1);
			setCheckbox($(this));
		});
		$('.product-callouts').find(specialEvent).find('.quince-dress').click(function(){
			fill_content("?category=15&process=5&prod_id=3&NAV=",1);
			setCheckbox($(this));
		});
	
 }
 
 function set_header_text(){
	headerContent=$('.template').find('.header-content').clone();
  	headerContent.appendTo('.product-callouts');
  	$('.product-callouts').find(headerContent).animate({left:'210px'},2000);
 }
 function dress_budget(){
  	budget=$('.template').find('.budget-dress').clone();
   	budget.appendTo('.product-callouts');
  	$('.product-callouts').find('.shop-by').animate({left:'1000px'},2000);
 	$('.product-callouts').find(budget).animate({left:'210px'},2000);
 		
 		
 		$('.product-callouts').find(budget).find('.price-under200').click(function(){
 			fill_content("?price_max=200&price_min=100&process=2&prod_id=3&NAV=",1);
 			setCheckbox($(this));
 		});
 		
 		$('.product-callouts').find(budget).find('.price-under300').click(function(){
 			fill_content("?price_max=300&price_min=200&process=2&prod_id=3&NAV=",1);
 			setCheckbox($(this));
 		});
 		$('.product-callouts').find(budget).find('.price-under400').click(function(){
 			fill_content("?price_max=400&price_min=300&process=2&prod_id=3&NAV=",1);
 			setCheckbox($(this));
 		});
 		$('.product-callouts').find(budget).find('.price-under500').click(function(){
 			fill_content("?price_max=500&price_min=400&process=2&prod_id=3&NAV=",1);
 			setCheckbox($(this));
 		});
 		$('.product-callouts').find(budget).find('.price-over500').click(function(){
 			fill_content("?price_max=9999&price_min=500&process=2&prod_id=3&NAV=",1);
 			setCheckbox($(this));
 		});
 	
 }
 
function stepBack(){
//alert(prod_id);
	switch(prod_id){
		case '3':
			$('.product-callouts').find('.step-back').hide(1000);
			$('.product-callouts').find('.shop-by').animate({left:'210px'},2000);
			$('.product-callouts').find('.special-event-dress').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.budget-dress').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.size-buttons').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.brand-names').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.dress-colors').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.special-event-dress').remove();
			$('.product-callouts').find('.budget-dress').remove();
			$('.product-callouts').find('.size-buttons').remove();
			$('.product-callouts').find('.brand-names').remove();
			$('.product-callouts').find('.dress-colors').remove();
			$('.product-callouts').find('.header-content').remove();
			break;
		case '4':
			$('.product-callouts').find('.step-back').hide(1000);
			$('.product-callouts').find('.jewelry-main').animate({left:'210px'},2000);
			$('.product-callouts').find('.jewelry-colors').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.jewelry-colors').remove();
			break;
		case '2':
			$('.product-callouts').find('.step-back').hide(1000);
			$('.product-callouts').find('.handbag-main').animate({left:'210px'},2000);
			$('.product-callouts').find('.handbag-colors').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.handbag-colors').remove();
			$('.product-callouts').find('.handbag-collections').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.handbag-collections').remove();
		case '1':
			$('.product-callouts').find('.step-back').hide(1000);
			$('.product-callouts').find('.shoes-main').animate({left:'210px'},2000);
			$('.product-callouts').find('.shoe-colors').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.shoe-colors').remove();
			$('.product-callouts').find('.shoe-collections').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.shoe-collections').remove();
			$('.product-callouts').find('.heel-heights').animate({left:'1000px',opacity:'0'},2000);
			$('.product-callouts').find('.heel-heights').remove();			
	}
	
  }
  
  function dress_sizeOptions(){
  	sizeOptions=$('.template').find('.size-buttons').clone();
     	sizeOptions.appendTo('.product-callouts');
    	$('.product-callouts').find('.shop-by').animate({left:'1000px'},2000);
 	$('.product-callouts').find(sizeOptions).animate({left:'210px'},2000);
 	$('.product-callouts').find(sizeOptions).find('.size_option').click(function(){
 		fill_content("?process=6&sizeselect=" + $(this).attr('rel') + "&prod_id=3&NAV=",1);
 		setSizeButton($(this));
 	});
  }
  
  function dress_brandOptions(){
    	brand=$('.template').find('.brand-names').clone();
       	brand.appendTo('.product-callouts');
      	$('.product-callouts').find('.shop-by').animate({left:'1000px'},2000);
   	$('.product-callouts').find(brand).animate({left:'210px'},2000);
   	$('.product-callouts').find(brand).find('.dress-brands').click(function(){
   		fill_content("?collection=" + $(this).attr('rel') + "&process=3&prod_id=3&NAV=",1);
   		setCheckbox($(this));
   		
   	});
  }
  
  function dress_colors(){
    	colors=$('.template').find('.dress-colors').clone();
     	colors.appendTo('.product-callouts');
    	$('.product-callouts').find('.shop-by').animate({left:'1000px'},2000);
   	$('.product-callouts').find(colors).animate({left:'210px'},2000);
   		
   		
   		$('.product-callouts').find(colors).find('.color-option').click(function(){
   			fill_content("?colorselect=" + $(this).attr('rel') +"&process=1&prod_id=3&NAV=",1);
   			setCheckbox($(this));
   		});
   		$('.color-option-other').find('#txtColor').focus(function(){
   			$(this).val('');
   		});
   		$('.product-callouts').find(colors).find('.color-option-other').find('.sm_button').click(function(){
			otherColor=$(this).parent('.color-option-other').find('#txtColor').val();
			
			fill_content("?colorselect=" + otherColor +"&process=1&prod_id=3&NAV=",1);
			setCheckbox($(this).parent('.color-option-other'));
   		});
   		
   		
   	
 }
  function fill_content(qryString,navpage){
  loadImg="<img src='img/loading.gif'/>";
  $('.content').html("LOADING..."+ loadImg);
 //alert(qryString);
  navString=qryString + navpage;
  jqxhr = $.post('stylesearch_index.asp' + navString, function(data){
  	$('.content').html(data);
  	
  	})
  	
  	.success(function() {  
		$('.content').slideDown(2000);
		$('.content').find('.next-page').click(function(){
			nextpage=$(this).attr('rel');
			fill_content(qryString,nextpage);
		});
		
		$('.content').find('.prev-page').click(function(){
			prevpage=$(this).attr('rel');
			fill_content(qryString,prevpage);
		});
		
		$('.content').find('.page-navigate').click(function(){
			curpage=$(this).attr('rel');
			fill_content(qryString,curpage);
		});
		$('.content').find('.detail-image').click(function(){
			curpage=$(this).attr('rel');
			fill_detail(curpage,qryString,navpage);
		});
		
				
	})
	
	.error(function() { 
	$('.content').html(navString);
	
	})
	
	.complete(function() { 

	});
  }
  
   function fill_detail(qryString,lastPage,navpage){
    loadImg="<img src='img/loading.gif'/>";
    $('.content').html("LOADING..."+ loadImg);
   //alert(qryString);
    navString=qryString;
    jqxhr = $.post('details_inner.asp' + navString, function(data){
    	$('.content').html(data);
    	
    	})
    	.success(function() {  
  		$('.content').show(0);
  		$('.content').find('#addItem').val("Loading...");
 // Change Google +1 meta tags
  //$('meta[itemprop=name]').attr("content")=;
  //$('meta[itemprop=description]').attr("content")=;
  //$('meta[itemprop=image]').attr("content")=;
		$('.content').find('#addItem').attr("disabled", true);
		show_cart();
			
		$('.content').find('#addItem').click( function(){
			if(validate()){
				add_item();
			}
		});
		
		$('.content').find('.next-detail').click( function(){
		fill_detail($(this).attr('rel'),lastPage,navpage);
  		});
  		
  		$('.content').find('.prev-detail').click( function(){
		fill_detail($(this).attr('rel'),lastPage,navpage);
  		});
  		
  		$('.content').find('.detail-back').click( function(){
		fill_content(lastPage,navpage);
  		});
  	})
  	
  	.error(function() { 
  	$('.content').html(qryString);
  	
  	})
  	
  	.complete(function() { 
  	//alert("load complete");
  	});
  }
  
  function jewelry_shopBy(){
   	$('.product-callouts').find('.step-back').hide(0);
   	shopBy=$('.template').find('.jewelry-main').clone();
   	shopBy.appendTo('.product-callouts');
   	$('.product-callouts').find(shopBy).animate({left:'210px'},2000);
   		$('.product-callouts').find(shopBy).find('.select-color').click(function(){
   			jewelry_colors();
   			$('.product-callouts').find('.step-back').show(1000);
   			
  		});
  		
  		$('.product-callouts').find(shopBy).find('.necklace-sets').click(function(){
  			fill_content("?category=12&process=5&prod_id=4&NAV=",1);
  			setCheckbox($(this));
  		});
  		
  		$('.product-callouts').find(shopBy).find('.earrings').click(function(){
  			fill_content("?category=10&process=5&prod_id=4&NAV=",1);
  			setCheckbox($(this));
  		});
  		
  		$('.product-callouts').find(shopBy).find('.bracelets').click(function(){
  			fill_content("?category=11&process=5&prod_id=4&NAV=",1);
  			setCheckbox($(this));
  		});
  		
  		
  		$('.product-callouts').find(shopBy).find('.browse-jewelry').click(function(){
  			fill_content("?collection=22&process=3&prod_id=4&NAV=",1);
  			setCheckbox($(this));
  		});
 }
  
  function jewelry_colors(){
      	colors=$('.template').find('.jewelry-colors').clone();
       	colors.appendTo('.product-callouts');
      	$('.product-callouts').find('.jewelry-main').animate({left:'1000px'},2000);
     	$('.product-callouts').find(colors).animate({left:'210px'},2000);
     		
     		
     		$('.product-callouts').find(colors).find('.color-option').click(function(){
     			fill_content("?colorselect=" + $(this).attr('rel') +"&process=1&prod_id=4&NAV=",1);
     			setCheckbox($(this));
     		});
     		$('.product-callouts').find(colors).find('.color-option-other').find('.sm_button').click(function(){
			otherColor=$(this).parent('.color-option-other').find('#txtColor').val();
			fill_content("?colorselect=" + otherColor +"&process=1&prod_id=4&NAV=",1);
			setCheckbox($(this).parent('.color-option-other'));
   		});
     		
     	
 }
 function handbag_shopBy(){
    	$('.product-callouts').find('.step-back').hide(0);
    	shopBy=$('.template').find('.handbag-main').clone();
    	shopBy.appendTo('.product-callouts');
    	$('.product-callouts').find(shopBy).animate({left:'210px'},2000);
    		$('.product-callouts').find(shopBy).find('.handbag-color').click(function(){
    			handbag_colors();
    			$('.product-callouts').find('.step-back').show(1000);
    			
   		});
   		
   		$('.product-callouts').find(shopBy).find('.casual-bags').click(function(){
   			fill_content("?category=3&process=5&prod_id=2&NAV=",1);
   			setCheckbox($(this));
   		});
   		
   		$('.product-callouts').find(shopBy).find('.formal-bags').click(function(){
   			fill_content("?category=14&process=5&prod_id=2&NAV=",1);
   			setCheckbox($(this));
   		});
   		$('.product-callouts').find(shopBy).find('.wedding-bags').click(function(){
			fill_content("?category=13&process=5&prod_id=2&NAV=",1);
			setCheckbox($(this));
   		});
   		
   		$('.product-callouts').find(shopBy).find('.bag-designers').click(function(){
   			handbag_collections();
    			$('.product-callouts').find('.step-back').show(1000);
   		});
   		
   		
   		$('.product-callouts').find(shopBy).find('.browse-handbags').click(function(){
   			window.location.href='handbags.asp?prod_id=2';
   		});
  }
   
   function handbag_colors(){
       	colors=$('.template').find('.handbag-colors').clone();
        	colors.appendTo('.product-callouts');
       	$('.product-callouts').find('.handbag-main').animate({left:'1000px'},2000);
      	$('.product-callouts').find(colors).animate({left:'210px'},2000);
      		
      		
      		$('.product-callouts').find(colors).find('.color-option').click(function(){
      			fill_content("?colorselect=" + $(this).attr('rel') +"&process=1&prod_id=2&NAV=",1);
      			setCheckbox($(this));
      		});
      		$('.product-callouts').find(colors).find('.color-option-other').find('.sm_button').click(function(){
			otherColor=$(this).parent('.color-option-other').find('#txtColor').val();
			fill_content("?colorselect=" + otherColor +"&process=1&prod_id=2&NAV=",1);
			setCheckbox($(this).parent('.color-option-other'));
   		});
      	
 }
 function handbag_collections(){
        	collections=$('.template').find('.handbag-collections').clone();
         	collections.appendTo('.product-callouts');
        	$('.product-callouts').find('.handbag-main').animate({left:'1000px'},2000);
       	$('.product-callouts').find(collections).animate({left:'210px'},2000);
       		
       		
       		$('.product-callouts').find(collections).find('.collection-option').click(function(){
       			fill_content("?collection=" + $(this).attr('rel') + "&process=3&prod_id=2&NAV=",1);
       			setCheckbox($(this));
       		});
       		
       		
       	
 }
 
 function shoe_shopBy(){
     	$('.product-callouts').find('.step-back').hide(0);
     	shopBy=$('.template').find('.shoes-main').clone();
     	shopBy.appendTo('.product-callouts');
     	$('.product-callouts').find(shopBy).animate({left:'210px'},2000);
     		$('.product-callouts').find(shopBy).find('.shoe-color').click(function(){
     			shoe_colors();
     			$('.product-callouts').find('.step-back').show(1000);
     			
    		});
    		
    		$('.product-callouts').find(shopBy).find('.casual-shoes').click(function(){
    			fill_content("?category=3&process=5&prod_id=1&NAV=",1);
    			setCheckbox($(this));
    		});
    		
    		$('.product-callouts').find(shopBy).find('.formal-shoes').click(function(){
    			fill_content("?category=2&process=5&prod_id=1&NAV=",1);
    			setCheckbox($(this));
    		});
    		$('.product-callouts').find(shopBy).find('.wedding-shoes').click(function(){
 			fill_content("?category=1&process=5&prod_id=1&NAV=",1);
 			setCheckbox($(this));
    		});
    		
    		$('.product-callouts').find(shopBy).find('.shoe-designers').click(function(){
    			shoe_collections();
     			$('.product-callouts').find('.step-back').show(1000);
    		});
    		$('.product-callouts').find(shopBy).find('.casual-boots').click(function(){
			fill_content("?category=3&shoeTypeSelect=14&process=4&prod_id=1&NAV=",1);
 			setCheckbox($(this));
    		});
    		$('.product-callouts').find(shopBy).find('.heel-height').click(function(){
			heel_heights();
			$('.product-callouts').find('.step-back').show(1000);
    		});
    		$('.product-callouts').find(shopBy).find('.whats-new').click(function(){
			fill_content("?process=6&prod_id=1&NAV=",1);
			setCheckbox($(this));
    		});
    		$('.product-callouts').find(shopBy).find('.whats-hot').click(function(){
			fill_content("?category=13&process=5&prod_id=1&NAV=",1);
			setCheckbox($(this));
    		});
    		
    		$('.product-callouts').find('.shop-by').find('.browse-shoes').click(function(){
    			window.location.href='shoes.asp?prod_id=1';
    		});
   }
function prom_shoe_shopBy(){
     	
     		$('.product-callouts').find('.header-content').find('.shoe-color').click(function(){
     			shoe_colors();
     			$('.product-callouts').find('.step-back').show(1000);
     			
    		});
    		
    		
    		$('.product-callouts').find('.header-content').find('.heel-height').click(function(){
			heel_heights();
			$('.product-callouts').find('.step-back').show(1000);
    		});
    		
   }
 function wedding_shoe_shopBy(){
      	
      		$('.product-callouts').find('.header-content').find('.shoe-color').click(function(){
      			shoe_colors();
      			$('.product-callouts').find('.step-back').show(1000);
      			
     		});
     		
     		
     		$('.product-callouts').find('.header-content').find('.heel-height').click(function(){
 			wedding_heights();
 			$('.product-callouts').find('.step-back').show(1000);
     		});
     		
   }
    
function shoe_colors(){
        	colors=$('.template').find('.shoe-colors').clone();
         	colors.appendTo('.product-callouts');
        	$('.product-callouts').find('.shoes-main').animate({left:'1000px'},2000);
        	$('.product-callouts').find('.header-content').animate({left:'1000px'},2000);
        	//$('.product-callouts').find(heights).animate({left:'1000px'},2000);
       		$('.product-callouts').find(colors).animate({left:'210px'},2000);
       		
       		
       		$('.product-callouts').find(colors).find('.color-option').click(function(){
       			fill_content("?colorselect=" + $(this).attr('rel') +"&process=1&prod_id=1&NAV=",1);
       			setCheckbox($(this));
       		});
      		$('.product-callouts').find(colors).find('.color-option-other').find('.sm_button').click(function(){
			otherColor=$(this).parent('.color-option-other').find('#txtColor').val();
			fill_content("?colorselect=" + otherColor +"&process=1&prod_id=1&NAV=",1);
			setCheckbox($(this).parent('.color-option-other'));
   		});       		
       		
       	
  }
  function shoe_collections(){
         	collections=$('.template').find('.shoe-collections').clone();
          	collections.appendTo('.product-callouts');
         	$('.product-callouts').find('.shoes-main').animate({left:'1000px'},2000);
        	$('.product-callouts').find(collections).animate({left:'210px'},2000);
        		
        		
        		$('.product-callouts').find(collections).find('.collection-option').click(function(){
        			fill_content("?collection=" + $(this).attr('rel') + "&process=3&prod_id=1&NAV=",1);
        			setCheckbox($(this));
        		});
        		
        		
        	
 }
 function heel_heights(){
         	heights=$('.template').find('.heel-heights').clone();
          	heights.appendTo('.product-callouts');
         	$('.product-callouts').find('.shoes-main').animate({left:'1000px'},2000);
         	$('.product-callouts').find('.header-content').animate({left:'1000px'},2000);
         	//$('.product-callouts').find(colors).animate({left:'1000px'},2000);
        		$('.product-callouts').find(heights).animate({left:'210px'},2000);
        		
        		
        		$('.product-callouts').find(heights).find('.heel-option').click(function(){
        			fill_content("?heelselect=" + $(this).attr('rel') +"&process=1&prod_id=1&NAV=",1);
        			setCheckbox($(this));
        		});
        		
        		
        	
  }
  function wedding_heights(){
           	heights=$('.template').find('.heel-heights').clone();
            	heights.appendTo('.product-callouts');
           	$('.product-callouts').find('.shoes-main').animate({left:'1000px'},2000);
           	$('.product-callouts').find('.header-content').animate({left:'1000px'},2000);
           	//$('.product-callouts').find(colors).animate({left:'1000px'},2000);
          		$('.product-callouts').find(heights).animate({left:'210px'},2000);
          		
          		
          		$('.product-callouts').find(heights).find('.heel-option').click(function(){
          			fill_content("?heelselect=" + $(this).attr('rel') +"&category=1&process=1&prod_id=1&NAV=",1);
          			setCheckbox($(this));
          		});
          		
          		
          	
  }
  function setCheckbox(objRef){
  	mainDiv=objRef.parent();
  	mainDiv.find('.dress-option').css('background-image','url(img/dress-chechbox.png)');
  	mainDiv.find('.heel-option').css('background-image','url(img/dress-chechbox.png)');
  	mainDiv.find('.shoe-option').css('background-image','url(img/dress-chechbox.png)');
  	objRef.css('background-image','url(img/dress-chechbox_over.png)');
  }
  function setSizeButton(objRef){
    	mainDiv=objRef.parent();
    	mainDiv.find('.size-option').css('background-image','url(http://www.myshoeconnection.com/images/size_button.gif)');
     	objRef.css('background-image','url(http://www.myshoeconnection.com/images/size_button_0.gif)');
  }
  
  function show_cart(){
  
  	$.get('cart_preview.asp', function(data) {
  	
  	  $('.shopping-cart').html(data);
  	  
  	});
  	$('.shopping-cart').slideDown(900);
  	$('#addItem').removeAttr("disabled");
  	$('#addItem').val("Add to Cart");
  	
  }
  function hide_cart(){
  $('.shopping-cart').hide(0);
  }
  
  function add_item(){
  dataString  = 'collection_id=' + $('#collection_id').val() + '&';
  dataString += 'mfr_id=' + $('#mfr_id').val() + '&';
  dataString += 'prod_id=' + $('#prod_id').val() + '&';
  dataString += 'handbag_id=' + $('#handbag_id').val() + '&';
  dataString += 'hbcollection_id=' + $('#hbcollection_id').val() + '&';
  dataString += 'size_selected=' + $('#size_selected').val() + '&';
  dataString += 'width_selected=' + $('#width_selected').val() + '&';
  dataString += 'stock_id_selected=' + $('#stock_id_selected').val() + '&';
  if($('#defcolor').val()!=undefined){
  dataString += 'defcolor=' + $('#defcolor').val() + '&';
  }
  if($('#defoptioncolor').val()!=undefined){
  dataString += 'defoptioncolor=' + $('#defoptioncolor').val() + '&';
  }
  if($('#optionID').val()!=undefined){
  dataString += 'optionID=' + $('#optionID').val() + '&';
  }
  if($('#optioncolor').val()!=undefined){
  dataString += 'optioncolor=' + $('#optioncolor').val() + '&';
  }
  dataString += 'color_select=' + $("input[name='color_select']:checked").val() + '&';
  dataString += 'units=' + $('#units').val();
  
  //alert(dataString);
  
  	$.ajax({  
  	  type: "POST",  
  	  url: "ajax_addToCart.asp",  
  	  data: dataString,  
  		  success: function() {  
  			hide_cart();
  			show_cart();
  
  		  },
  		 error:function(){
  		 alert("error");
  		 }
  	}); 
  	return false;
  }
  function validate(){
  
  //alert($("input[name='color_select']:checked").val());
   if ($("input[name='color_select']:checked").val()==undefined){
   	alert("Please select a color");
   	return false;
   }
   if ($('#units').val()==""){
    	alert("Please select a quantity");
    	return false;
   }
  if($('#prod_id').val()!=4 && $('#prod_id').val()!=2){
  	 if ($('#size_selected').val()==""){
  		alert("Please select a size");
  		return false;
  	 }
  }
   return true;
}
