var pre=-1;
 var i=5;
  var t;
  function add()
  {
   document.getElementById("tabdisplay").style.height=i.toString()+"px"
   if(i>=190) 
   {
    return;
   }     
   i=i+5;
    t= setTimeout("add()",500);
  }
  
  function test4()
  {
	  alert("test");
  }
  
function getvideodetails()
{
	alert("test")
    document.getElementById('tabdisplay').style.display="inline";
    document.getElementById('addvideo').style.display="none";
	
   
}
function showVideo(id,vfile)
{    
        if(pre!=-1)
            document.getElementById('playvideo'+pre).style.display='none';
         document.getElementById('playvideo'+id).style.display='inline';
        var s1 = new SWFObject("http://blog.stutalk.com/javascripts/mediaplayer.swf","mediaplayer","450","400","8");
	s1.addParam("allowfullscreen","true");						
	s1.addVariable("width","450");
	s1.addVariable("height","400");
	s1.addVariable("file",vfile);
	s1.addVariable("backcolor","0x000000");
	s1.addVariable("frontcolor","0xCCCCCC");					
	s1.addVariable("autostart","true");
	s1.addVariable("repeat","list");					
	s1.addVariable("bufferlength","8");
	s1.addVariable("showdownload",'false');
	s1.addVariable('displayheight','380');
	s1.addVariable("rotatetime", "10");	
	s1.write("playvideo"+id);	
        pre=id;
}
function validate(td,add,dis)
{
    if(document.getElementById(add).value==null || document.getElementById(add).value==0)
    {
        document.getElementById(td).style.color="#ff0000";
        document.getElementById(dis).style.display="inline";
        return 0;
    }        
    else
    {
        document.getElementById(td).style.color="#000000";
        document.getElementById(dis).style.display="none";
        return 1;
    }
}
function addvideodetails()
{
    var title,desc,url;
    title=validate('td1','add1','dis1');
    desc=validate('td3','add3','dis3')
    url=validate('td2','add2','dis2');    
    if(title==0 || url==0 || desc==0)
        return false;
}
function cancel()
{
    document.getElementById('tabdisplay').style.display="none";
    document.getElementById('addvideo').style.display="inline";
    var i;
    for(i=1;i<=3;i++)
    {
     document.getElementById('td'+i).style.color="#000000";
     document.getElementById('add'+i).value="";
     document.getElementById('dis'+i).style.display="none";
   }
}

function addVideoComments(postedby,videoid)
{
    var description = document.getElementById('comments').value;
    var url="http://www.stutalk.com/video/addpost?postedby="+postedby+"&videoid="+videoid+"&description="+description;
    if(description!=0)
        {
    ajaxFunction("tt",url);
     getComments(videoid)
        }
document.getElementById('comments').value="";
}

function getComments(id)
{
    var url="http://www.stutalk.com/video/getcomments?id="+id;
    ajaxFunction(document.getElementById('getComments'),url);
}

function deletecomment(id,videoid)
{
    var url="http://www.stutalk.com/video/deletecomment?id="+id;
    ajaxFunction("tt",url);
    getComments(videoid)
}

// Function for Add comments for photo
function getAlbumComments(id)
{
    var url="http://www.stutalk.com/photo/getalbumcomments?id="+id;
    ajaxFunction(document.getElementById('getComments'),url);
}

function addAlbumComments(postedby,albumid)
{
    var description = document.getElementById('comments').value;
    var url="http://www.stutalk.com/photo/addalbumpost?postedby="+postedby+"&albumid="+albumid+"&description="+description;
    if(description!=0)
        {
    ajaxFunction("tt",url);
   getAlbumComments(albumid);
        }
document.getElementById('comments').value="";
}

function getAlbumComments(id)
{
    var url="http://www.stutalk.com/photo/getalbumcomments?id="+id;
    ajaxFunction(document.getElementById('getComments'),url);
}

function deleteAlbumComment(id,albumid)
{
    var url="http://www.stutalk.com/photo/deletealbumcomment?id="+id;
    ajaxFunction("tt",url);
    getAlbumComments(albumid);
}
