function copyToClipboard(elementID) {
  object=document.getElementById(elementID);
  text2copy=object.value;
  if (window.clipboardData) {
    window.clipboardData.setData("Text",text2copy);
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="/js/_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
  alert('The code has been copied to clipboard');
}

function hidenshow(id, img) {
	var d = $('#'+id).css('display');		
	if (d == 'block') {
		$('#'+id).hide('slow');
		$('#'+img).attr({ src: "images/expand_icon.jpg", alt: "Expand" });		
	} else {
		$('#'+id).show('slow');
		$('#'+img).attr({ src: "images/collapse_icon.jpg", alt: "Collapse" });		
	}
}
function ClickMore() { $('#desc_more').css('display', 'inline'); $('#more_word').hide();  }
function ClickLess() { $('#more_word').css('display', 'inline'); $('#desc_more').hide(); }
function SaveContunious() { continuous = $('#continuous:checked').length; createCookie('continuous',continuous,1); }

function CommentRequest() { 
	username = $("#username").val();
	comment = $("#comment").val();
	vid =$("#vid").val();
	
	new Ajax.Request("/includes/comments.php", { method: 'post',  postBody: "username="+username+"&comment="+comment+"&vid="+vid,  onComplete: CommentResponse }); }
function CommentResponse(req) { document.getElementById("UserComments").innerHTML = req.responseText; }