/** ZOYUN - JS **/

$(document).ready(function(){

/** Simple browser version checks and alert. */
var ua = $.browser.name;
var uav = $.browser.versionNumber;
if (ua == 'firefox' && uav < 5){
  $('#browser').html('<div class="msgbox">Version of your browser (<strong>'+ua+' '+uav+'</strong>) not-to-date! Please <a href="http://www.mozilla.com/firefox/" target="_blank">update</a>!</div>');
}
if (ua == 'msie' && uav < 8){
  $('#browser').html('<div class="msgbox">Version of your browser (<strong>'+ua+', '+uav+'</strong>) not-to-date! Please <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home" target="_blank">update</a>!</div>');
}
if (ua == 'opera' && uav < 9){
  $('#browser').html('<div class="msgbox">Version of your browser (<strong>'+ua+', '+uav+'</strong>) not-to-date! Please <a href="http://www.opera.com/download/" target="_blank">update</a>!</div>');
}
if ($.layout.name == 'webkit' && $.layout.versionX < 5){
  $('#browser').html('<div class="msgbox">Version of your browser (<strong>'+ua+', '+uav+'</strong>) not-to-date! Please <a href="http://www.apple.com/safari/" target="_blank">update</a>!</div>');
}

/** Fixed firefox bug for the disabled input's title attribute. **/
if (ua == 'firefox') {
  $(function() {
    $('input[disabled][title]').removeAttr('disabled').addClass('disabled').click(function() {
      return false
    })
  })
}

// Pop-up
$('#feedBurner').click(function() {
	window.open( 'http://feedburner.google.com/fb/a/mailverify?uri=fungamesws&amp;loc=en_US', 'popupwindow', 'scrollbars=yes,width=600,height=600');
	return false;
});

}); // jQuery

/** Simple rating */
function saveVote(id,vote){
  $('#like').removeAttr('onclick').addClass('disabled').click(function(){
    return false;
  });
  $('#dislike').removeAttr('onclick').addClass('disabled').click(function(){
    return false;
  });
  $("#loading").show();
  $.ajax({
    type:"POST",
    cache:false,
    data:"id="+id+"&vote="+vote,
    success:function(msg){
      $("#loading").hide();
      $('#voted').html('Thank you for vote!');
      var hl_up=parseInt($('#game_hl_up').html().replace(',',''));
      var hl_down=parseInt($('#game_hl_down').html().replace(',',''));
      if(vote=='like'){
        hl_up++;
        $('#game_hl_up').html(hl_up);
      }else if(vote=='dislike'){
        hl_down++;$('#game_hl_down').html(hl_down);
      }
    }
  });
  return false;
}

// END
