/* Streaming Video Player Amazon */

  $(document).ready(function(){ Player.init() });
  
  var Player = {
    streamer: "rtmp://sty0pvhc8c3ak.cloudfront.net/cfx/st",
    provider: 'rtmp',
    bucket: "http://d2q89eqwwy7vi1.cloudfront.net/",
 
    init: function(start){
			if(document.location.hash != '' && document.location.hash.match(/recipe_\d/)){
        this.get_params("recipe_"+document.location.hash.match(/\d/)[0]+"_thumb");
      } else {
        this.get_params('player');
      }
      
      this.mobile =  (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1) ||
        (navigator.platform.indexOf("iPad") != -1);
      
      if(this.mobile){
        this.streamer = null;
        this.provider = null;
      }
 
			this.play();
    }, 
 
		play: function(){
      var file = this.mobile ? this.bucket + this.url : this.url;
 
			jwplayer("player").remove();
 
      jwplayer("player").setup({
    	  streamer: this.streamer, 
    	  provider: this.provider,
    	  file: file,
    	  image: this.image,
    	  playerready: "Player.ready",
        width: 480,
        height: 270,
        autostart: true,
        players: [
          {type:'html5', config: {
    autostart: "false"
  }}, {type:'flash', src:'/jw/player.swf'}
        ]
      });
		},
    
    get_params:function(id){
      this.url = $('#'+id).attr('data-video');
      this.image = $('#'+id).attr('data-image');
    },
    
    load: function(id){
			id = parseInt(id);
      this.get_params("recipe_"+id+"_thumb");
      
      this.play();
      
      // show recipe
      $('.recipe_link').removeClass('current');
      $('#recipe_'+id+'_link').addClass('current');
    },
    
    ready: function(obj){
      this.player = document.getElementById(obj.id);
 
    }
  }





    $(document).ready(function(){
        $("#country").change(function(){

            if ($(this).val() == "CA" || $(this).val() == "US" ) {

                $("#hide1").slideDown("fast"); //Slide Down Effect
                $("#hide2").slideUp("fast");    //Slide Up Effect

            } else {

                $("#hide1").slideUp("fast");    //Slide Up Effect
                $("#hide2").slideDown("fast"); //Slide Down Effect
            }
        });

        
    });


