/** popups */
function popup_vote()
{
    window.open('/vote?id=' + global_id, 'Vote', 'width=650,height=490');
}

function popup_email()
{
    window.open('/email?id=' + global_id, 'Vote', 'width=650,height=500z');
}

/** share button */
is_open_share_btn = false;
function show_share()
{
  document.getElementById('shareButton').style.display="block";
  is_open_share_btn = true;
}

function hide_share()
{
  document.getElementById('shareButton').style.display="none";
  is_open_share_btn = false;
}

function switch_share()
{
  if(is_open_share_btn==false)
  {
    show_share();
  }
  else
  {
    hide_share();
  }
}

/** switch video */
function switch_video(video, id, name, submitted)
{
   //var url      = new String(window.location);
   //var pathname = window.location.pathname;
   //var realpath = url.replace(pathname, '');
 
  /** switch share id*/
  document.getElementById('delicious').href = "http://del.icio.us/post?url="+global_url+"?id=" + id + "&title=Jellystone Park Camp-Resort Video Contest";
  document.getElementById('digg').href = "http://digg.com/submit?phase=2&url="+global_url+"?id=" + id + "&title=Jellystone Park Camp-Resort Video Contest";
  document.getElementById('facebook').href = "http://www.facebook.com/share.php?u="+global_url+"?id=" + id + "&t=Jellystone Park Camp-Resort Video Contest";
  document.getElementById('myspace').href = "http://www.myspace.com/Modules/PostTo/Pages/?l=3&u="+global_url+"?id=" + id + "&t=Jellystone Park Camp-Resort Video Contest&c=%3Cp%3EPowered+by+%3Ca+href%3D%22http%3A%2F%2Fsharethis.com%22%3EShareThis%3C%2Fa%3E%3C%2Fp%3E";
  document.getElementById('reddit').href = "http://reddit.com/submit?url="+global_url+"?id=" + id + "&title=Jellystone Park Camp-Resort Video Contest";
  document.getElementById('stumbleupon').href = "http://www.stumbleupon.com/submit?url="+global_url+"?id=" + id + "&title=Jellystone Park Camp-Resort Video Contest";
  document.getElementById('twitter').href = "http://twitter.com/home?status="+global_url+"?id=" + id + "&title=Jellystone Park Camp-Resort Video Contest";

    document.getElementById('video_name').innerHTML = name;
    document.getElementById('video_submitted').innerHTML = "submitted by <span>" + submitted + "</span>";
    global_id = id;

   document.getElementById('player_wrapper').innerHTML = "";

  var isMSIE = /*@cc_on!@*/false;
  if (isMSIE) {
      var obj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="650" height="390" id="player" align="middle">';
      obj += '<param name="movie" value="/player.swf" />';
      obj += '<param name="quality" value="high" />';
      obj += '<param name="allowfullscreen" value="true" />';
      obj += '<param name="allowscriptaccess" value="always" />';
      obj += '<param name="play" value="true" />';
      obj += '<param name="flashvars" value="file='+video+'&amp;autostart=true" />';
      obj += '<param name="loop" value="false" />';
      obj += '</object>';
      document.getElementById('player_wrapper').innerHTML = obj;
      return;
    }
 
    var player_code = "" +
        "var player = new SWFObject('/player.swf','ply','650','390','9','#FFFFFF');" +
        "player.addParam('allowfullscreen','true');" +
        "player.addParam('allowscriptaccess','always');" +
        "player.addParam('flashvars ','file=" + video + "&amp;autostart=true');" +
        "player.write('player_wrapper'); ";
    eval(player_code);

}