	<!-- Adobe recommends that developers use SWFObject2 for Flash Player detection. -->
	<!-- For more information see the SWFObject page at Google code (http://code.google.com/p/swfobject/). -->
	<!-- Information is also available on the Adobe Developer Connection Under "Detecting Flash Player versions and embedding SWF files with SWFObject 2" -->
	<!-- Set to minimum required Flash Player version or 0 for no version detection -->
	var swfVersionStr = "9.0.124";
	<!-- xiSwfUrlStr can be used to define an express installer SWF. -->
	var xiSwfUrlStr = "";
	var flashvars = {};
	var params = {};
	params.quality = "high";
		
	params.bgcolor = "#999999";
	params.play = "true";
	params.loop = "true";
	params.wmode = "transparent";
	params.menu = "false";
	params.devicefont = "false";
	params.salign = "";
	params.allowscriptaccess = "sameDomain";
	var attributes = {};
	attributes.id = "animation";
	attributes.name = "animation";
	attributes.align = "middle";
	
	
/* 	********************** */
	
		
	var SWF_HEIGHT = 950;
	var SWF_WIDTH = 1345;
	var OFFSET_TOP_BOTTLE = 285;
	var OFFSET_BOX_TOP = 129;
	var OFFSET_BOX_LEFT = 27;

	function showDetaiBox(color){
	
		browserWindowSize();
		//IE fadeIn Bugfix
		$('#'+color).css('display', 'inline-block');
		$('#'+color).fadeIn(400, function () {
           //end fade
         });       
	}
	
	function hideDetaiBox(color){

		
		$('.detailBox').hide();         
         
	}
	
	function intBottlesJS(){
		$('.bottleHover').hide();
		
		$('#whiteBottleDetail').hide();
		$('#whiteBottle').css('visibility', 'visible');
		
		$('#blackBottleDetail').hide();
		$('#blackBottle').css('visibility', 'visible');
		
		$('#greenBottleDetail').hide();
		$('#greenBottle').css('visibility', 'visible');
		
		$('#pinkBottleDetail').hide();
		$('#pinkBottle').css('visibility', 'visible');
		
		$('#redBottleDetail').hide();
		$('#redBottle').css('visibility', 'visible');
		
		$('#orangeBottleDetail').hide();
		$('#orangeBottle').css('visibility', 'visible');
		
		$('#purpleBottleDetail').hide();
		$('#purpleBottle').css('visibility', 'visible');
	}
	
	
	$( function() {

         $('.closeDetail').click(function(e) {
         	 e.preventDefault();
             $('.detailBox').hide();
             //if there is a swf
             if($('#animation').length){
             	SendDataToFlashMovie("");
             }else{
             	intBottlesJS();
             }
             
             
         });
			
			
		$('.bottleDetail').click(function() {
             $('.detailBox').hide();
             intBottlesJS();             
             
         });
         
        			//$('#whiteBottleHover').trigger('click'); 
    	$('#whiteBottle').live('touchend', function(e) {
    		$('#whiteBottle').trigger('mouseover');
		});
    	$('#blackBottle').live('touchend', function(e) {
    		$('#blackBottle').trigger('mouseover');
		});
    	$('#greenBottle').live('touchend', function(e) {
    		$('#greenBottle').trigger('mouseover');
		});
    	$('#pinkBottle').live('touchend', function(e) {
    		$('#pinkBottle').trigger('mouseover');
		});
    	$('#redBottle').live('touchend', function(e) {
    		$('#redBottle').trigger('mouseover');
		});
    	$('#orangeBottle').live('touchend', function(e) {
    		$('#orangeBottle').trigger('mouseover');
		});	
    	$('#purpleBottle').live('touchend', function(e) {
    		$('#purpleBottle').trigger('mouseover');
		});		
									               
         $('#whiteBottle').mouseover(function() {
              $(this).css('visibility', 'hidden');
              $('#whiteBottleHover').show();
         });
         $('#blackBottle').mouseover(function() {
              $(this).css('visibility', 'hidden');
              $('#blackBottleHover').show();
         });
         $('#greenBottle').mouseover(function() {
             $(this).css('visibility', 'hidden');
             $('#greenBottleHover').show();
         }); 		          
         $('#pinkBottle').mouseover(function() {
              $(this).css('visibility', 'hidden');
              $('#pinkBottleHover').show();
         });         
         $('#redBottle').mouseover(function() {
              $(this).css('visibility', 'hidden');
              $('#redBottleHover').show();
         });         
         $('#orangeBottle').mouseover(function() {
              $(this).css('visibility', 'hidden');
              $('#orangeBottleHover').show();
         });         
         $('#purpleBottle').mouseover(function() {
              $(this).css('visibility', 'hidden');
              $('#purpleBottleHover').show();
         });
                 
         
         
         
          $('.bottleHover').mouseout(function() {
          		var initBoolean=true;
          		$(".bottleDetail").each(function(i){
				
					if($(this).css('display') == 'block'){
						initBoolean=false
					}
				});
				if(initBoolean){
					intBottlesJS();
				}				
          });
          	$('#whiteBottleHover').click(function() {
          		 $(this).hide();
                 $('#whiteBottle').css('visibility', 'hidden');
                 $('#whiteBottleDetail').show();
                 $('#white').css('display', 'inline-block');
                 $('#white').fadeIn(400, function () {
          		 //end fade
         		})
			});
          	$('#blackBottleHover').click(function() {
          		 $(this).hide();
                 $('#blackBottle').css('visibility', 'hidden');
                 $('#blackBottleDetail').show();
                  $('#black').css('display', 'inline-block');
                 $('#black').fadeIn(400, function () {
          		 //end fade
         		})
			});         
          	$('#greenBottleHover').click(function() {
          		 $(this).hide();
                 $('#greenBottle').css('visibility', 'hidden');
                 $('#greenBottleDetail').show();
                  $('#green').css('display', 'inline-block');
                 $('#green').fadeIn(400, function () {
          		 //end fade
         		})
			});        
          	$('#pinkBottleHover').click(function() {
          		 $(this).hide();
                 $('#pinkBottle').css('visibility', 'hidden');
                 $('#pinkBottleDetail').show();
                 $('#pink').css('display', 'inline-block');
                 $('#pink').fadeIn(400, function () {
          		 //end fade
         		})
			});
          	$('#redBottleHover').click(function() {
          		 $(this).hide();
                 $('#redBottle').css('visibility', 'hidden');
                 $('#redBottleDetail').show();
                 $('#red').css('display', 'inline-block');
                 $('#red').fadeIn(400, function () {
          		 //end fade
         		})
			});	
          	$('#orangeBottleHover').click(function() {
          		 $(this).hide();
                 $('#orangeBottle').css('visibility', 'hidden');
                 $('#orangeBottleDetail').show();
                 //IE fadeIn Bugfix
				 $('#orange').css('display', 'inline-block');
                 $('#orange').fadeIn(400, function () {
          		 //end fade
         		})
			});
          	$('#purpleBottleHover').click(function() {
          		 $(this).hide();
                 $('#purpleBottle').css('visibility', 'hidden');
                 $('#purpleBottleDetail').show();
                 //IE fadeIn Bugfix
				 $('#purple').css('display', 'inline-block');
                 $('#purple').fadeIn(400, function () {
          		 //end fade
         		})
			});
			
			
		$('.quick-change-link').mouseover(function() {
            $(this).find('.quick-change-image').css("opacity", "0.8");
			 $(this).find('.quick-change-image').css("-ms-filter:", "'progid:DXImageTransform.Microsoft.Alpha(opacity=80)'");
			 $(this).find('.quick-change-image').css("filter", "alpha(opacity=80)");
			
         });
                 
         
          $('.quick-change-link').mouseout(function() {
             $(this).find('.quick-change-image').css("opacity", "1");
			 $(this).find('.quick-change-image').css("-ms-filter:", "'progid:DXImageTransform.Microsoft.Alpha(opacity=100)'");
			 $(this).find('.quick-change-image').css("filter", "alpha(opacity=100)");	
          });
          $('.quick-change-link').click(function(e) {
          		e.preventDefault();
          		$('.closeDetail').trigger("click");
          		if($('#animation').length){
             		SendDataToFlashMovie($(this).attr('href'));
            	}else{
          			$('#'+$(this).attr('href')+'Bottle').trigger('mouseover');
          			$('#'+$(this).attr('href')+'BottleHover').trigger("click");
          		}
          });
         
        
								         
	});
	
	
/* ************************* */

	
function getFlashMovieObject(movieName){
	if (window.document[movieName]){
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		/*
if (document.embeds &amp;&amp; document.embeds[movieName])
			return document.embeds[movieName];
*/
	}
	else{
		return document.getElementById(movieName);
	}
}


function SendDataToFlashMovie(newPage){
	var flashMovie=getFlashMovieObject("animation");
	flashMovie.sendParameterToFlash(newPage);
}

function browserWindowSize() {
	
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	
	if (typeof window.innerWidth != 'undefined') {
	
	  viewportwidth = window.innerWidth;
	  viewportheight = window.innerHeight;
	}
	
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	
	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
	
	   viewportwidth = document.documentElement.clientWidth;
	   viewportheight = document.documentElement.clientHeight;
	}

	//if the proportion of the width to the height of the SWF is bigger or the same like in the the original the vertical offcet can be calculated directely 
	if(parseInt($('#animation').height())/parseInt($('#animation').width()) <= SWF_HEIGHT/SWF_WIDTH){
		$('.detailBox').css('top', parseInt($('#animation').height())*OFFSET_TOP_BOTTLE/SWF_HEIGHT-OFFSET_BOX_TOP+'px');
	//if the proportion of the width to the height of the SWF is smaler like in the the original the vertical offcet has to be calculated with the rescaled hight of the SWF
	}else{
		//calculate resized SWF_HEIGHT
		var new_SWF_HEIGHT= SWF_HEIGHT*parseInt($('#animation').width())/SWF_WIDTH;
		//calculate resized OFFSET_TOP_BOTTLE
		var new_OFFSET_TOP_BOTTLE= OFFSET_TOP_BOTTLE*parseInt($('#animation').width())/SWF_WIDTH;
		
		$('.detailBox').css('top', (parseInt($('#animation').height())-new_SWF_HEIGHT)/2+new_OFFSET_TOP_BOTTLE-OFFSET_BOX_TOP+'px');
	}
	$('.detailBox').css('left', parseInt($('#animation').width())/2-OFFSET_BOX_LEFT+'px');
	
	
	var MIN_WIDTH = 0;
	
	if($('#animation').length) {
		MIN_WIDTH = 1100;
	} else {
		MIN_WIDTH = 1310;
	}

/*
	var headerHeight = $('#header').height();
	var headerBorderSize = parseInt($('#header').css("border-bottom-width"));
*/
	var fbActivityFeedHeight = $('#fbActivityFeed').height();
	var fbActivityFeedTop = parseInt($('#fbActivityFeed').css("top"));
	var ltIE7 = false;
	
	// If IE6 or lower
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		
		ltIE7 = true;
	} 
	
	// Set wrapper height
	$('#wrapper').css("height", viewportheight - headerHeight - headerBorderSize);
		
	// Hide Facebook Activity Feed when under minum width or height (or ie < 7), show otherwise
	if (viewportwidth < MIN_WIDTH || viewportheight <= (fbActivityFeedHeight + fbActivityFeedTop + 20) || ltIE7) {
	
		$('#fbActivityFeed').hide();
		$('#main').css('padding-right', '0px');
		$('#aligner').css('padding-right', '0px');
		
	} else {
			
		$('#main').css('padding-right', '260px');
		$('#aligner').css('padding-right', '260px');
		$('#fbActivityFeed').show();
	}
		
	if (viewportwidth < MIN_WIDTH) {
		//if there is a swf
		if($('#animation').length){
           $('.detailBox').css('margin-left', '-5px');
        }else{
        	$('.detailBox').css('margin-left', '-35px');
        }
		
	} else {
		//if there is a swf
		if($('#animation').length){
           $('.detailBox').css('margin-left', '-5px');
        }else{
        	$('.detailBox').css('margin-left', '-165px');
        }
	}
	
	if (viewportheight < 720) {
	
		$('#mediumRectangle1').hide();
		
	} else {
	
		$('#mediumRectangle1').show();
	}
	
}
