/* YAHOO.namespace("example.video_container1");
function initVideoPopup() {
	// Instantiate the Dialog

	YAHOO.example.video_container1.video_dialog1 = new YAHOO.widget.Dialog("video_dialog1", 
									       { width : "50em",
										 context:["popup_context","tl","bl"],
										 visible : false,
										 modal:true
									       });

	YAHOO.example.video_container1.video_dialog2 = new YAHOO.widget.Dialog("video_dialog2", 
									       { width : "50em",
										 context:["popup_context","tl","bl"],
										 visible : false,
										 modal:true
									       });

	YAHOO.example.video_container1.video_dialog3 = new YAHOO.widget.Dialog("video_dialog3", 
									       { width : "50em",
										 context:["popup_context","tl","bl"],
										 visible : false,
										 modal:true
										 });

	YAHOO.example.video_container1.video_dialog4 = new YAHOO.widget.Dialog("video_dialog4",
										 { width : "50em",
										   context:["popup_context","tl","bl"],
										   visible : false,
										   modal:true
										 });
	


	YAHOO.example.video_container1.video_dialog1.render();
	YAHOO.example.video_container1.video_dialog1.hide();
	
	YAHOO.example.video_container1.video_dialog2.render();
	YAHOO.example.video_container1.video_dialog2.hide();

	YAHOO.example.video_container1.video_dialog3.render();
	YAHOO.example.video_container1.video_dialog3.hide();

	YAHOO.example.video_container1.video_dialog4.render();
	YAHOO.example.video_container1.video_dialog4.hide();
	
	YAHOO.example.video_container1.manager = new YAHOO.widget.OverlayManager();
	YAHOO.example.video_container1.manager.register([
						   YAHOO.example.video_container1.video_dialog1,
						   YAHOO.example.video_container1.video_dialog2,
						   YAHOO.example.video_container1.video_dialog3,
						   YAHOO.example.video_container1.video_dialog4]);

}

//call on dom ready - during window load
YAHOO.util.Event.onDOMReady(initVideoPopup);
//YAHOO.util.Event.addListener(window, "load", initVideoPopup);	
*/
function showVideoPopup()
{

  var login_user_id = document.getElementById('logged_in_user_id').value;

  if(login_user_id == '' || isNaN(login_user_id) )
    {
      displayErrorMessage('error_video_comments',ERROR_LOGIN_REQUIRED);
      return false;
    }

  document.getElementById('mymedia').style.display='none';
  document.getElementById('video_dialog1').style.display='block';
  YAHOO.example.video_container1.video_dialog1.show();
}
function hideVideoPopup()
{
  document.getElementById('video_dialog1').style.display='none';
  document.getElementById('mymedia').style.display='block';
  YAHOO.example.video_container1.video_dialog1.hide();
  
}
function showAddToPlaylistPopup()
{
  
  var login_user_id = document.getElementById('logged_in_user_id').value;
  
  if(login_user_id == '' || isNaN(login_user_id) )
    {
      displayErrorMessage('error_video_comments',ERROR_LOGIN_REQUIRED);
      return false;
    }

  document.getElementById('mymedia').style.display='none';
  document.getElementById('video_dialog3').style.display='block';
  YAHOO.example.video_container1.video_dialog3.show();
}
function hideAddToPlaylistPopup()
{
  document.getElementById('mymedia').style.display='block';
  document.getElementById('video_dialog3').style.display='none';
  YAHOO.example.video_container1.video_dialog3.hide();
}

function showVideoCommentsPopup(comment_id,login_user_id,comment_user_id)
{
 
  if(login_user_id == '' || isNaN(login_user_id) )
    {
      displayErrorMessage('error_video_comments',ERROR_LOGIN_REQUIRED);
      return false;
    }
  else if(login_user_id == comment_user_id)
    {
      displayErrorMessage('error_video_comments',ERROR_REPORT_ABUSE_SAME_USER);
      return false;
    }
  
  document.getElementById('mymedia').style.display='none'; 
  document.getElementById('video_dialog2').style.display='block';
  YAHOO.example.video_container1.video_dialog2.show();

  document.getElementById('abuse_id').value = comment_id; 
  document.getElementById('abuse_user_id').value = comment_user_id;
  document.getElementById('login_user_id').value = login_user_id;

}

function hideVideoCommentsPopup()
{
  document.getElementById('mymedia').style.display='block';
  document.getElementById('video_dialog2').style.display='none';
  YAHOO.example.video_container1.video_dialog2.hide();
}

/* share module overly issue resolved*/
function videoShare()
{
  document.getElementById('mymedia').style.display='none';
  share();
}

/* Close Report abuse popups */
function closeVideoPopup()
{
    document.getElementById('video_dialog1').style.display = 'none';
    document.getElementById('video_dialog2').style.display = 'none';
    document.getElementById('video_dialog3').style.display = 'none';
    document.getElementById('video_dialog4').style.display = 'none';
    YAHOO.example.video_container1.video_dialog4.hide();
    hideVideoPopup();
    hideVideoCommentsPopup();
}



function showAddToPlaylistPopupJquery()
{
  
  var login_user_id = document.getElementById('logged_in_user_id').value;
  
  if(login_user_id == '' || isNaN(login_user_id) )
    {
      displayErrorMessage('error_video_comments',ERROR_LOGIN_REQUIRED);
      return false;
    }
  
  document.getElementById('mymedia').style.display='none';
  document.getElementById('video_dialog3').style.display='block';
  $("#video_dialog3").dialog('destroy');
  $(function() {
      		$("#video_dialog3").dialog({
		bgiframe: true,
                title:'Add To Playlist',
                width:600,
		modal: true,
                draggable: true,
                resizable:false
                });
            
             });  
}

function hideAddToPlaylistPopupJquery()
{
  document.getElementById('mymedia').style.display='block';
  document.getElementById('video_dialog3').style.display='none';
  $("#video_dialog3").dialog('destroy');
}


function showVideoPopupJquery()
{

  var login_user_id = document.getElementById('logged_in_user_id').value;

  if(login_user_id == '' || isNaN(login_user_id) )
    {
      displayErrorMessage('error_video_comments',ERROR_LOGIN_REQUIRED);
      return false;
    }
  document.getElementById('abuse_error_msg').style.display ="none";
  document.getElementById('mymedia').style.display='none';
  document.getElementById('video_dialog1').style.display='block';
  $("#video_dialog1").dialog('destroy');
  $(function() {
      		$("#video_dialog1").dialog({
		bgiframe: true,
                title:'Report Abuse',
                width:600,
		modal: true,
                draggable: true,
                resizable:false
                });
            
             });  
}

function hideVideoPopupJquery()
{
  document.getElementById('video_dialog1').style.display='none';
  document.getElementById('mymedia').style.display='block';
  $("#video_dialog1").dialog('destroy');
}



/* Close Report abuse popups througj jquery*/
function closeVideoPopupJquery()
{
    document.getElementById('video_dialog1').style.display = 'none';
    document.getElementById('video_dialog2').style.display = 'none';
    document.getElementById('video_dialog3').style.display = 'none';
    document.getElementById('video_dialog4').style.display = 'none';
    $("#video_dialog4").dialog('destroy');
    hideVideoPopupJquery();
}

function showVideoCommentsPopupJquery(comment_id,login_user_id,comment_user_id)
{
  document.getElementById('abuse_comments_error_msg').style.display = "none";
  if(login_user_id == '' || isNaN(login_user_id) )
    {
      displayErrorMessage('error_video_comments',ERROR_LOGIN_REQUIRED);
      return false;
    }
  else if(login_user_id == comment_user_id)
    {
      displayErrorMessage('error_video_comments',ERROR_REPORT_ABUSE_SAME_USER);
      return false;
    }
  
  document.getElementById('mymedia').style.display='none'; 
  document.getElementById('video_dialog2').style.display='block';
 
  $("#video_dialog2").dialog('destroy');
$(function() {
      		$("#video_dialog2").dialog({
		bgiframe: true,
                title:'Report Abuse',
                width:600,
		modal: true,
                draggable: true,
                resizable:false
                });
            
             });

  document.getElementById('abuse_id').value = comment_id; 
  document.getElementById('abuse_user_id').value = comment_user_id;
  document.getElementById('login_user_id').value = login_user_id;

}

function hideVideoCommentsPopupJquery()
{
  document.getElementById('mymedia').style.display='block';
  document.getElementById('video_dialog2').style.display='none';
  $("#video_dialog2").dialog('destroy');
}

/* share module overly issue resolved through jquery*/ 
function videoShareJquery()
{
  if(document.getElementById('error'))
    {
      document.getElementById('error').style.display='none';
    }
  document.getElementById('mymedia').style.display='none';
  //share();
  //$("#share_popup").dialog('destroy');
  $(function() {
      		$("#share_popup").dialog({
		bgiframe: true,
                title:'Share Video',
                width:600,
		modal: true,
                draggable: true,
		resizable:false,
		position:top
                });
            
             });
 shareVideo();

}

function closeSharePopUpJquery()
{
 document.getElementById('mymedia').style.display = "block";
 $("#share_popup").dialog('destroy');
}

function closePlaylistJquery()
{
 document.getElementById('mymedia').style.display = "block";
 $("#video_dialog3").dialog('destroy');
}

