//var web_root="http://www.sampatti.com/Myshow/";
var web_root="http://www.myshow.com.au/";


function getSitePath()

{

	var windowLocation = window.location;

	windowLocation = windowLocation.toString();

	var last_slash = windowLocation.lastIndexOf('/'); 

	var site_path = windowLocation.substr(0,last_slash);

	return site_path;							

}

/*

function CommentsForCommentsAdmin2(querystring,videoid,section,statussa)

{

	if(confirm('Are you sure you want to delete this comments ....'))

	{

	var url = getSitePath()+'/frontdeletecomments.php?querystring=';

	var parameters = querystring+'&comments='+videoid+'&sectionname='+section+'&statuss='+statussa;

	http_request 	=	false;	

	if(window.XMLHttpRequest) 

		{		// branch for native XMLHttpRequest object

			try 

			{

				http_request = new XMLHttpRequest();

			} catch(e) 

			{

				http_request = false;

			}

		}

		else if(window.ActiveXObject) 

		{		// branch for IE/Windows ActiveX version

			try 

			{

				http_request = new ActiveXObject("Msxml2.XMLHTTP");

			}

			catch(e) 

			{

				try 

				{

					http_request = new ActiveXObject("Microsoft.XMLHTTP");

				} 

				catch(e) 

				{

					http_request = false;

				}

			}

		}

		

		if(http_request)

		{			

			http_request.onreadystatechange = checkdata2;

			http_request.open("GET", url + parameters, true);

			http_request.send("");

		}	

	}  

}

function checkdata2()

{

	if(http_request.readyState	==	4)	

	{

	 if (http_request.status == 200) 

	 {  

	 	var popup	=	http_request.responseText;	

		alert(popup);

		if(popup=="sucess")

		{

		var p_strVideoId = document.getElementById('vid').value;

					var page2 = 0;

			popULateComments_inner(p_strVideoId, page);

		}

	 	

	 }

	 else

	{

		alert('There was an error with the request');

		return false;

	}

	}

}



*/





function ChangestatusOfvideosAdmin(querystring,videoid,section,statussa)

{	

	if(confirm('Are you sure you want to proceed ....'))

	{

	var url = getSitePath()+'/frontchangevideostatus.php?querystring=';

	var parameters = querystring+'&videoid='+videoid+'&sectionname='+section+'&statuss='+statussa;

	http_request 	=	false;	

	if(window.XMLHttpRequest) 

		{		// branch for native XMLHttpRequest object

			try 

			{

				http_request = new XMLHttpRequest();

			} catch(e) 

			{

				http_request = false;

			}

		}

		else if(window.ActiveXObject) 

		{		// branch for IE/Windows ActiveX version

			try 

			{

				http_request = new ActiveXObject("Msxml2.XMLHTTP");

			}

			catch(e) 

			{

				try 

				{

					http_request = new ActiveXObject("Microsoft.XMLHTTP");

				} 

				catch(e) 

				{

					http_request = false;

				}

			}

		}

		

		if(http_request)

		{		

			

			http_request.onreadystatechange = checkdata;

			http_request.open("GET", url + parameters, true);

			http_request.send("");

		}	

	}  

	

}



function checkdata()

{

	if(http_request.readyState	==	4)	

	{

	 if (http_request.status == 200) 

	 {  

	 	var popup	=	http_request.responseText.split('#$#$%%$#@');		 	 	

	 	if(eval(popup[0]) > eval(0))

	 	{

	 		window.location.reload();

	 	}

	 }

	 else

	{

		alert('There was an error with the request');

		return false;

	}

	}

}

function Change_Status(ID,type,page,valObj)

{

	

	if(type==2){

		

		var rvar = confirm("Are you sure!! Do you want to delete videos and its related data(Posted comment,Rating...)");

	    if(rvar==false)

	    {

	    	valObj.checked = false;

	    	return false;

	    }

	    else

	    {

	    	

	    }

	

	}

	

	document.write('<html>');

	document.write('<body>');

	document.write('<form name="frm" method="POST">');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="video_id" value='+ID+'>');

	document.write('</td>');

	document.write('</tr>');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="status_type" value='+type+'>');

	document.write('</td>');

	document.write('</tr>');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="page_number" value='+page+'>');

	document.write('</td>');

	document.write('</tr>');	

	document.write('</form>');

	document.write('</body>');

	document.write('</html>');	

	document.frm.action='Change_Video_status.php';

	document.frm.submit();

}

function ChangeMeta(ID,type,page)

{
	 
	document.write('<html>');

	document.write('<body>');

	document.write('<form name="frm" method="POST">');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="video_id" value='+ID+'>');

	document.write('</td>');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="page_number" value='+page+'>');

	document.write('</td>');

	document.write('</tr>');	

	document.write('</form>');

	document.write('</body>');

	document.write('</html>');	

	document.frm.action='manage_meta.php';

	document.frm.submit();
	
}	

function Change_featured(ID,type,page)

{

	if(type){

		var featured=1;

	}

	else{

		featured=0;

	}

	document.write('<html>');

	document.write('<body>');

	document.write('<form name="frm" method="POST">');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="video_id" value='+ID+'>');

	document.write('</td>');

	document.write('</tr>');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="featured" value='+featured+'>');

	document.write('</td>');

	document.write('</tr>');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="page_number" value='+page+'>');

	document.write('</td>');

	document.write('</tr>');	

	document.write('</form>');

	document.write('</body>');

	document.write('</html>');	

	document.frm.action='Change_Video_feature.php';

	document.frm.submit();

}



function Change_adult(ID,type,page)

{

	if(type){

		var featured=1;

	}

	else{

		featured=0;

	}

	

	

	document.write('<html>');

	document.write('<body>');

	document.write('<form name="frm" method="POST">');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="video_id" value='+ID+'>');

	document.write('</td>');

	document.write('</tr>');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="featured" value='+featured+'>');

	document.write('</td>');

	document.write('</tr>');

	document.write('<tr>');

	document.write('<td>');

	document.write('<input type="hidden" name="page_number" value='+page+'>');

	document.write('</td>');

	document.write('</tr>');	

	document.write('</form>');

	document.write('</body>');

	document.write('</html>');	

	document.frm.action='Change_Video_adult.php';

	document.frm.submit();

}



function Change_video_position(ID,type,page,flag,eobj)

{

	if(type)

	{

		var featured=1;

	}

	else

	{

		featured=0;

	}

	

	document.write('<html>');

	document.write('<body>');

	document.write('<form name="frm" method="POST">');

	document.write('<input type="hidden" name="video_id" value='+ID+'>');	

	document.write('<input type="hidden" name="featured" value='+featured+'>');	

	document.write('<input type="hidden" name="page_number" value='+page+'>');

	document.write('<input type="hidden" name="flag" value='+flag+'>');

	document.write('</form>');

	document.write('</body>');

	document.write('</html>');	

	document.frm.action='Change_Video_position.php';

	document.frm.submit();

}



function get_video(Video,site_name)

{

	window.open(site_name+'admin_middleFlash.php?type=9&video_id='+Video,'','height=550,width=850,scrollbar=yes, menubar=no,status = 0, resizable = 1');

}



function get_video_front(Video,site_name)

{

	window.open(site_name+'display_video.php?video_id='+Video,'','height=300,width=350,scrollbar=yes, menubar=no,status = 0, resizable = 1');

}



function comment(video_id,redirectPage){

 var userid = document.getElementById('iduser').value;

 var success;

  if(userid==""){	

    alert("You are not logged in user.Please login first to view the comment.\nIf you are not existing user click on New User link displaying on top of the page.");

  	success=1;

  }

  else{

  	location.href=web_root +"comment/" +video_id;

  }

  if(success=='1'){

  	location.href=web_root +"front/login.php?redirect="+redirectPage;

  }

}



function abusecomment(video_id,redirectPage){

 var userid = document.getElementById('iduser').value;

 var success;

  if(userid==""){	

	alert("You are not logged in user.Please login first to report abuse.\nIf you are not existing user click on New User link displaying on top of the page.");

	success=1;

  }

  else{

  //	location.href="comments.php?video_id=" +video_id;

	location.href=web_root + "comment/abuse/"+video_id;

  }

  if(success=='1'){

	location.href=web_root + "front/login.php?redirect="+redirectPage;

  }

}



/*

function bookmark_video(page,video_id,catid,redirectPage,queryString)

{

	var userid = document.getElementById('iduser').value;

	var success;

	if(userid=="")

	{	

		alert("You are not logged in user.Please login first to bookmark the video.\nIf you are not existing user click on New User link displaying on top of the page.");

		success=1;

	}

	else

	{

		var url = "bookmark_videos.php"+"?"+queryString+"&bookmark=yes&video_id=" +video_id +"&catid="+catid;

		 var targetFrame = "mywindow";

		mywindow = window.open (url,"","menubar=0,toolbar=0,location=0,status=0,titlebar=0,scrollbars=1,resizable=0,width=305,height=70,left=350,top=150");

	}

	

	if(success=='1')

	{

		location.href="login.php?redirect="+redirectPage;

	}

}

*/



function bookmark_video(video_id,catid,redirectPage,redirectFlag)

{

	var userid = document.getElementById('iduser').value;

	var success;

	if(userid=="")

	{	

		alert("You are not logged in user.Please login first to bookmark the video.\nIf you are not existing user click on New User link displaying on top of the page.");

		success=1;

	}

	else

	{

		var url = web_root + "front/bookmark_videos.php"+"?bookmark=yes&video_id=" +video_id +"&catid="+catid+"&redirectFlag="+redirectFlag+"&redirectPage="+redirectPage;

		var targetFrame = "mywindow";

		mywindow = window.open (url,"","menubar=0,toolbar=0,location=0,status=0,titlebar=0,scrollbars=1,resizable=0,width=305,height=70,left=350,top=150");

	}

	

	if(success=='1')

	{

		location.href=web_root + "front/login.php?redirect="+redirectPage;

	}

}


function bookmark_videoHome(video_id,catid,redirectPage,redirectFlag)

{

bookmark_video(video_id,catid,redirectPage,redirectFlag);

}


function chkVideo(module) {



  if(document.getElementById('vname').value==""){

  	alert("Please enter video display name.");

  	document.getElementById('vname').focus();

  	return false;

  }

 if(module=='') { 

  if(document.getElementById('upvideo').value==""){

  	alert("Please upload video.");

  	document.getElementById('upvideo').focus();

  	return false;

  }	

 }

 /*if(document.getElementById('upvideo').value!=""){

 	var ext = getfileextension('upvideo'); 

 	alert(ext);

	 if( ext != "wmv" ) {

	 	alert("Videos with wmv or mpeg extention can be uploaded.");

	 	return false;

	 }

  } 	*/

}



function getfileextension(inputId) 

{ 

	 var fileinput = document.getElementById(inputId); 

	 if(!fileinput ) return ""; 

	 var filename = fileinput.value; 

	 if( filename.length == 0 ) return ""; 

	 var dot = filename.lastIndexOf("."); 

	 if( dot == -1 ) return ""; 

	 var extension = filename.substr(dot,filename.length); 

	 return extension; 

} 



function rankToMe(video_id,type,adult,redirectPage,check_rate,webroot)

{

	//alert(redirectPage);

	 var userid = document.getElementById('iduser').value;

	 var success;

    if(userid=="")

    {	

      alert("You are not logged in user.Please login first to rate the video.\nExisting user can only rate the video.");

  	  success=1;

    }

	

 	if(success=='1')

 	{

    	location.href = webroot+"front/login.php?redirect="+redirectPage;

    }

    else

    {

    	if(check_rate==0) 

    	{



         if(adult=='1')

         {	

    	   location.href= webroot+"front/categoryConfirm.php?redirect="+redirectPage+"&video_id="+video_id+"&type="+type+"&adult="+adult+"&flag=rate&check_rate="+check_rate;

    	 		

    	 }

    	else

    	{	

			document.write('<html>');

			document.write('<body>');

			document.write('<form name="frm" method="POST">');

			document.write('<tr>');

			document.write('<td>');

			document.write('<input type="hidden" name="video_id" value='+video_id+'>');

			document.write('</td>');

			document.write('</tr>');

			document.write('<tr>');

			document.write('<td>');

			document.write('<input type="hidden" name="type" value='+type+'>');

			document.write('</td>');

			document.write('</tr>');

			document.write('<tr>');

			document.write('<td>');

			document.write('<input type="hidden" name="adult" value='+adult+'>');

			document.write('</td>');

			document.write('</tr>');			

			document.write('</form>');

			document.write('</body>');

			document.write('</html>');	

		

			document.frm.action=webroot+'front/rating.php?redirect='+redirectPage;

			document.frm.submit();

    	  }

    	}

    	else{

    		alert("You have already rate this video.");

    		return false;

    		

    	}

    }

}





/*

function promote_video(video_id,catid,redirectPage,redirectFlag) 

{ 	

	var userid = document.getElementById('iduser').value; 	

	var success; 	

	if(userid=="") 	

	{

		alert("You are not logged in user.Please login first to promote the video.\nIf you are not existing user click on New User link displaying on top of the page.");

		success=1; 	

	} 	else 	

	{

		var url = "promote_videos.php"+"?promote=yes&video_id=" +video_id +"&catid="+catid+"&redirectFlag="+redirectFlag+"&redirectPage="+redirectPage;

		var targetFrame = "mywindow"; 		mywindow = window.open (url,"","menubar=0,toolbar=0,location=0,status=0,titlebar=0,scrollbars=1,resizable=0,width=305,height=70,left=350,top=150"); 		

		//mywindow.moveTo(350,50); 		  	

	} 	

	if(success=='1') 	

	{ 		

		location.href="login.php?redirect="+redirectPage; 	

	} 

}

*/

function promote_videoHome(video_id,catid,redirectPage,redirectFlag) 

{ 	

	var userid = document.getElementById('iduser').value; 	

	var success; 	

	if(userid=="") 	

	{

		alert("You are not logged in user.Please login first to promote the video.\nIf you are not existing user click on New User link displaying on top of the page.");

		success=1; 	

	} 	

	else 	

	{

		var url = web_root + "front/promote_videos.php"+"?promote=yes&video_id=" +video_id +"&catid="+catid+"&redirectFlag="+ 0 +"&redirectPage="+redirectPage;

		var targetFrame = "mywindow"; 		

		mywindow = window.open (url,"","menubar=0,toolbar=0,location=0,status=0,titlebar=0,scrollbars=1,resizable=0,width=305,height=70,left=350,top=150"); 		

		//mywindow.moveTo(350,50); 		  	

	} 	

	if(success=='1') 	

	{ 		

		location.href=web_root + "front/login.php?redirect="+redirectPage; 	

	} 

}


function promote_video(video_id,catid,redirectPage,redirectFlag) 

{ 	

  promote_videoHome(video_id,catid,redirectPage,redirectFlag) ;
}



function add_video_group(spanID,group_id,webroot)

{

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/add_videos_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';	

	str = "&myRand="+myRand+"&group_id="+group_id+"&spanID="+spanID;	

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

			modify_videoList(group_id,9,webroot);

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}





function add_video_group_now(group_id,spanID,form,webroot)

{

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/add_videos_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';

	str = draw_query_string(form);

	

	//alert(str);

	

	

	str += "&myRand="+myRand+"&spanID="+spanID+"&groupflag=addVideo";

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

			modify_videoList(group_id,9,webroot);			

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}







function modify_video_group(spanID,group_id,limit,mode,webroot)

{

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/modify_videos_group.php";	

	

	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';	

	str = "&myRand="+myRand+"&group_id="+group_id+"&spanID="+spanID+"&max_num="+limit+"&mode="+mode;	

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;			

			document.getElementById(spanID).innerHTML = objRes;			

			document.getElementById("msgSpan").innerHTML = "";

			modify_videoList(group_id,limit,webroot);

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}





function modify_video_group_now(group_id,spanID,form,limit,mode,webroot)

{

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/modify_videos_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';

	str = draw_query_string(form);

	str += "&myRand="+myRand+"&spanID="+spanID+"&max_num="+limit+"&mode="+mode+"&groupflag=modifyVideo";

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			

			//alert(objRes);

			

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

			modify_videoList(group_id,limit,webroot);

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}



function modify_members_group(spanID,group_id,limit,mode,webroot)

{

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/modify_members_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';	

	str = "&myRand="+myRand+"&group_id="+group_id+"&spanID="+spanID+"&max_num="+limit+"&mode="+mode;	

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}





function modify_members_group_now(group_id,spanID,form,limit,mode,videoFlag,webroot)

{

	var conf = true;

	if(videoFlag == 2 && form.modificationAction.value == "publisher")

	{

		conf = confirm("Only moderator will upload videos for group.You are violating the 'upload videos' rights of group,Please confirm!");

	}

	

	if(conf)

	{

		var xmlHttp = getHTTPObject();	

		var url = webroot+"front/modify_members_group.php";	

		myRand=parseInt(Math.random()*99999999);  // cache buster

		var str = '';

		str = draw_query_string(form);

		str += "&myRand="+myRand+"&spanID="+spanID+"&max_num="+limit+"&mode="+mode+"&groupflag=modifyMember";

		xmlHttp.onreadystatechange=function()

		{		

			if(xmlHttp.readyState==4)

			{

				objRes = xmlHttp.responseText;

				document.getElementById(spanID).innerHTML = objRes;

				document.getElementById("msgSpan").innerHTML = "";

				modify_memberList(group_id,limit,webroot);

			}

		}

		xmlHttp.open("POST",url,true);

		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

		xmlHttp.send(str);

	}

	

}



function modify_memberList(group_id,limit,webroot)

{

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/modify_groupDetails.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';

	//str = draw_query_string(form);

	str = "&myRand="+myRand+"&group_id="+group_id+"&groupflag=memberList";

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;			

			document.getElementById("memberlistSpan").innerHTML = '<a href="JavaScript:modify_members_group(\'group_action_span\','+group_id+','+limit+',\'display\')" class="normal_link_u">Members '+objRes+'</a>';

			

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}



function modify_videoList(group_id,limit,webroot)

{

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/modify_groupDetails.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';

	//str = draw_query_string(form);

	str = "&myRand="+myRand+"&group_id="+group_id+"&groupflag=videoList";

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById("videolistSpan").innerHTML = '<a href="JavaScript:modify_video_group(\'group_action_span\','+group_id+','+limit+',\'display\',\''+webroot+'\')" class="normal_link_u">Videos '+objRes+'</a>';			

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}



function add_comment_group(spanID,group_id,webroot)

{

	X	=	new String(window.location);

	var takeWindowLoca	=	X.toString();	

	if(takeWindowLoca.search("#") == -1)

	{

		window.location = window.location + "#groupcomment";

	}

	

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/add_comment_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';	

	str = "&myRand="+myRand+"&group_id="+group_id+"&spanID="+spanID;	

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}



function edit_comment_group(spanID,group_id,comment_id,webroot)

{

	X	=	new String(window.location);

	var takeWindowLoca	=	X.toString();	

	if(takeWindowLoca.search("#") == -1)

	{

		window.location = window.location + "#groupcomment";

	}

	

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/add_comment_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';	

	str = "&myRand="+myRand+"&group_id="+group_id+"&spanID="+spanID+"&mode=Edit&comment_id="+comment_id;	

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}





function add_comment_group_now(group_id,spanID,form,webroot)

{

	X	=	new String(window.location);

	var takeWindowLoca	=	X.toString();	

	if(takeWindowLoca.search("#") == -1)

	{

		window.location = window.location + "#groupcomment";

	}

	

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/add_comment_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';

	str = draw_query_string(form);	

	str += "&myRand="+myRand+"&spanID="+spanID+"&groupflag=addComment";

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}







function modify_comment_group(spanID,group_id,limit,mode,webroot)

{

	

	X	=	new String(window.location);

	var takeWindowLoca	=	X.toString();	

	if(takeWindowLoca.search("#") == -1)

	{

		window.location = window.location + "#groupcomment";

	}

	

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/modify_comment_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';	

	str = "&myRand="+myRand+"&group_id="+group_id+"&spanID="+spanID+"&max_num="+limit+"&mode="+mode;	

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}





function modify_comment_group_now(group_id,spanID,form,limit,mode,webroot)

{

	X	=	new String(window.location);	

	var takeWindowLoca	=	X.toString();	

	if(takeWindowLoca.search("#") == -1)

	{

		window.location = window.location + "#groupcomment";

	}

	

	var xmlHttp = getHTTPObject();	

	var url = webroot+"front/modify_comment_group.php";	

	myRand=parseInt(Math.random()*99999999);  // cache buster

	var str = '';

	str = draw_query_string(form);

	str += "&myRand="+myRand+"&spanID="+spanID+"&max_num="+limit+"&mode="+mode+"&groupflag=modifyComment";

	xmlHttp.onreadystatechange=function()

	{		

		if(xmlHttp.readyState==4)

		{

			objRes = xmlHttp.responseText;

			document.getElementById(spanID).innerHTML = objRes;

			document.getElementById("msgSpan").innerHTML = "";

		}

	}

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

	xmlHttp.send(str);

}



function chkUserForPlaylist(redirectPage){
	

	 var userid = document.getElementById('iduser').value;

	 var success;

    if(userid=="")

    {	

      alert("You are not logged in user.Please login first to Add this video to playlist.\nExisting user can only Add video to Playlist.");

  	  success=1;

    }

	

 	if(success=='1')

 	{

    	location.href = web_root+"front/login.php?redirect="+redirectPage;

    }

    

  }
	
	
 