﻿function doPlay(obj)
{   
     file=jQuery(obj).attr("file");
     images=jQuery(obj).attr("images");
     
     /* Bo sung by Dat */     
     
     if(jQuery(obj).attr("topicid")!=null)
        topic_id=jQuery(obj).attr("topicid");
     else
        topic_id=jQuery.fn.getValuePage("topic_id");
        
     audio_id=jQuery(obj).attr("itemid");        
     
    
     $("#linksAjax").load("/Data/TopAudio.aspx?topic_id="+ topic_id + "&audio_id="+audio_id);
    /* Ket thuc */   
    
     jQuery.fn.play(file,images,"0","0","AudioDisplay",true);      
     jQuery("img[@group*=nghe]").attr("src","New%20Folder/nghe.gif");  
     jQuery(obj).attr("src","New%20Folder/dung.gif"); 
     return false;      
 
}
function autoPageHomeVideoPlay()
{
    var _location=jQuery.fn.getValuePage("location"); 
    _location = _location.replace(/_/g, '/');      
   
    var _name=jQuery.fn.getValuePage("name");     
    var _sContentVideo=jQuery.fn.getDataFileContent(_location+'/'+_name);
    
    var _file=jQuery.fn.getBlockContent(_sContentVideo, 'PATH_AUDIO_VIDEO'); 
    var _images=jQuery.fn.getBlockContent(_sContentVideo, 'IMAGE_AVATAR'); 
    _images='http://images.nhatbao.vn/'+ _images.substring(1,4)+ '_' + _images.substring(5,2)+ '_' + _images.substring(7,2) +'/'+_images; 
    width="399";
    height="310"; 
    play=true;
    jQuery.fn.play(_file,_images,"276","264","VideoDisplay",play);
    
    return false; 
}

function doVideoPlay(obj,play)
{
	
    file=jQuery(obj).attr("file");

    images=jQuery(obj).attr("images");   
	

    width=jQuery(obj).attr("w");
    height=jQuery(obj).attr("h");
    if(width == undefined)
        width="276";
    if(height==undefined)
        height="264";
    if(play==undefined)
        play=true;
 	
    jQuery.fn.play(file,images,width,height,"VideoDisplay",play); 
    return false;    
}
function doVideoPlayHH(obj,play)
{
    file=jQuery(obj).attr("file");
    images=jQuery(obj).attr("images");   
    width=jQuery(obj).attr("w");
    height=jQuery(obj).attr("h");
    if(width == undefined)
        width="336";
    if(height==undefined)
        height="278";
    if(play==undefined)
        play=true;
    /* Bo sung by Dat */
    
    var video_id=jQuery(obj).attr("itemid"); 
     $("#linksAjax").load("/Data/TopVideo.aspx?video_id="+ video_id);
    /* Ket thuc */
    jQuery.fn.play(file,images,width,height,"VideoDisplay",play); 
    return false;    
}
function doFirstVideo(obj)
{    
    file=jQuery(obj).parent().attr("file");
    images=jQuery(obj).parent().attr("images");    
    jQuery.fn.play(file,images,"399","315","VideoDisplay",false);  
    return false;    
}

       
function doDisplayPlaylistVideo()
{
    
    Switch(0);
    
}
(function(jQuery)
{    
   jQuery.fn.play = function(file,image,width,height,divWrite,autostart){
        if(image==null)
            image="/Audio/images/preview.jpg";        
        
        var s1 = new SWFObject("library/player.swf","ply",width,height,"9","#FFFFFF");
        s1.addParam("allowscriptaccess","always");
        s1.addParam("flashvars","file="+file+"&image="+image+"&autostart="+autostart);
        s1.write(divWrite);  
   }
   
   jQuery.fn.pause = function(width,height,divWrite){        
        var s1 = new SWFObject("library/player.swf","ply",width,height,"9","#FFFFFF");
        s1.addParam("state","PAUSED ");
        s1.write(divWrite);      
      
   }
   
   
   jQuery.fn.TahaMedia=function()
   {
        
            jQuery("img[@src*=nghe.gif]").each(function(){                
            jQuery(this).bind("click",function(){	
               
                 file=jQuery(this).attr("file");
                 images=jQuery(this).attr("images");
                                
                 if(player!=null)
                 {
                     jQuery.fn.pause();
                     jQuery(this).attr("src","New%20Folder/play.gif");
                     jQuery.fn.pause("0","0","AudioDisplay"); 
                 }
                 else
                 {
                     jQuery.fn.play(file,images,"0","0","AudioDisplay");      
                     jQuery("img[@group*=nghe]").attr("src","New%20Folder/nghe.gif");  
                     jQuery(this).attr("src","New%20Folder/dung.gif");   
                 }
//                 jQuery("img[@src*=dung.gif]").bind("click",function(){	
//                       jQuery(this).attr("src","New%20Folder/play.gif");
//                       jQuery.fn.pause("0","0","AudioDisplay"); 
//                   
//                       jQuery("img[@src*=play.gif]").bind("click",function(){	
//                               jQuery(this).attr("src","New%20Folder/dung.gif");                              
//                               jQuery.fn.play(file,images,"0","0","AudioDisplay"); 
//                       })
//                 })      
                
            })
            
         })   
      
   }
})(jQuery);

