//For the Category Play Video
function category_plyavideo(VideoID)
{
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="video";
	var Option="GetPlayVideo";
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&VideoID="+VideoID, Option);	
}
//For close Window and delte the playlist data
function set_myplalist(File_Path1,Option)
{
	fetch_remote_page(File_Path1+"?Option="+Option, Option);	
}
//For The Schedule Mode
function schedulemode(VideoID)
{
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="video";
	var Option="GetScheduleMode";
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&VideoID="+VideoID, Option);	
}
//For The Open window
function OpenWindow(VideoID)
{	
	var FileName="moredescription.php?VideoID="+VideoID;
	window.open(FileName,"","location=0,menubar=0,titlebar=0,toolbar=0,resizable=0,status=0,height=700,width=600,top=0,left=0");
}
//For The Open window For Tv Mode
function OpenTvWindow(VideoTitle)
{	//onclick=window.open("tvmode.php?VideoTitle='+VideoData[0]+'",
	var FileName="tvmode.php?VideoTitle="+VideoTitle;
	window.open(FileName,"","location=0,menubar=0,titlebar=0,toolbar=0,resizable=0,status=0,height=700,width=1024,top=0,left=0"); 
}
//For The Information Mode
function informationmode(VideoID)
{
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="video";
	var Option="GetInformationMode";
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&VideoID="+VideoID, Option);	
}
//For the change the css
function changecss(val)
{
	if(val==01)
		document.getElementById('ShareVideo').className='used_text_white_link_hover';
	else if(val==00)
		document.getElementById('ShareVideo').className='used_text_white_link';
	if(val==11)
		document.getElementById('TVMode').className='used_text_white_link_hover';
	else if(val==10)
		document.getElementById('TVMode').className='used_text_white_link';
	if(val==21)
		document.getElementById('ScheduleMode').className='used_text_white_link_hover';
	else if(val==20)
		document.getElementById('ScheduleMode').className='used_text_white_link';
	if(val==31)
		document.getElementById('InformationMode').className='used_text_white_link_hover';
	else if(val==30)
		document.getElementById('InformationMode').className='used_text_white_link';
}
//For the Share the Video
function ShareVideo()
{
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="video";
	var Option="GetShareVideo";
	var From;
	var To;
	var Subject;
	var Message;
	From=document.getElementById('From').value;
	To=document.getElementById('To').value;
	Subject=document.getElementById('Subject').value;
	Message=document.getElementById('Message').value;
	
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&From="+From+"&To="+To+"&Subject="+Subject+"&Message="+Message, Option);	
}
//For the Searching
function Search_Keyword()
{
	if(document.getElementById('SearchKeyword').value=="SEARCH" || document.getElementById('SearchKeyword').value=="") 
		alert('Please Enter Keyword For The Search');
	else
	{
		var URL=location.hostname;	
		var File_Path1;
		if(URL=="192.168.0.1" || URL=="121.247.164.98")
			File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
		else if(URL=="www.mygospelworkers.org")
			File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
		var TableName="video";
		var Option="GetSearchResult";
		var SearchKeyword=document.getElementById('SearchKeyword').value;
		fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&SearchKeyword="+SearchKeyword, Option);	
	}
}

//For the get category video data
function getcategoryvideo(CategoryID)
{
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="video";
	var Option="GetCategoryVideo";
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&CategoryID="+CategoryID, Option);	
}
//For the Play video
function plyavideo(VideoID,Option1)
{
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="video";
	var Option="GetPlayVideo";

	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&VideoID="+VideoID+"&Option1="+Option1, Option);	
}
//For the Fetch The Nowplaying data
function nowplaying(File_Path1,TableName,Option,VideoID)
{
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&VideoID="+VideoID, Option);	
}

//For the Fetch The playlist data
function myplyalist(File_Path1,TableName,Option)
{
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option, Option);	
}
//For When add in play list that time feach the data for play list.
function myplyalist_insert()
{
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="playlist";
	var Option="GetMyPlayList";
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option, Option);	

}
//Insert Into Play List
function insertplaylist(VideoID){
	var URL=location.hostname;	
	var File_Path1;
	if(URL=="192.168.0.1" || URL=="121.247.164.98")
		File_Path1='http://'+URL+'/general/mychapeltv/ajax_dynamic_myplaylist.php';
	else if(URL=="www.mygospelworkers.org")
		File_Path1='http://'+URL+'/mychapeltv/ajax_dynamic_myplaylist.php';
	var TableName="playlist";
	var Option="AddtoPlayList";
	fetch_remote_page(File_Path1+"?Table="+TableName+"&Option="+Option+"&VideoID="+VideoID, Option);	
	
}

//-------- Previous category
function prev(File_Path,TableName,Option,TotalCategory){
	fetch_remote_page(File_Path+"?Table="+TableName+"&Option="+Option+"&TotalCategory="+TotalCategory, Option);	
	
}
//-------- Next category
function next(File_Path,TableName,Option,TotalCategory,FlagNext){
	fetch_remote_page(File_Path+"?Table="+TableName+"&Option="+Option+"&TotalCategory="+TotalCategory, Option);		
}
//On Load Category
function onLoad(File_Path,TableName,Option)
{
	fetch_remote_page(File_Path+"?Table="+TableName+"&Option="+Option, Option);	
}
// JavaScript Document
// -----Chage The Status-------
function chagestatus(formname,file,id,val)
{
	document.getElementById(formname.name).Process.value="STATUS";
	document.getElementById(formname.name).ID.value=id;
	document.getElementById(formname.name).action  = file+".php?val="+val;
	document.getElementById(formname.name).submit();
}

// -----Chage Admin Type For Admin-------
function chagestatus_type(formname,file,id,statusvalue,val)
{
	document.getElementById(formname.name).Process.value=statusvalue;
	document.getElementById(formname.name).type_status.value=val;
	document.getElementById(formname.name).ID.value=id;
	document.getElementById(formname.name).action  = file+".php";
	document.getElementById(formname.name).submit();
}
//--- Go Back To File -----
function goback()
{
	history.go(-1);
}
//--- Sorting The Record -----
function sortdata(file,OrderBy,OrderType,Keyword,Type,FieldName,Page,PerPageLimit)
{
	window.location="index.php?p="+file+"&OrderBy="+OrderBy+"&OrderType="+OrderType+"&Keyword="+Keyword+"&FieldName="+FieldName+"&Type="+Type+"&Page="+Page+"&PerPageLimit="+PerPageLimit;
}
//--- Add Page For The Record -----
function add(file,PerPageLimit,Page)
{
		window.location="index.php?p="+file+"&var="+PerPageLimit+"&Page="+Page+"&MODE=ADD";
}
//--- Edit Page for The  Record -----
function edit(file,id)
{
	window.location="index.php?p="+file+"&ID="+id+"&MODE=UPDATE";
}
//-----Detail of the page-------
function detail(file,id)
{
	window.location="index.php?p="+file+"&ID="+id;
}
//--- Search For The Show All Record -----
function searchshowall(file,PerPageLimit,RefferenceID)
{
	window.location="index.php?p="+file+"&PerPageLimit="+PerPageLimit+"&ProductID="+RefferenceID;
}
//--- Search For The Record For Go Button-----
function searchgo(formname,file)
{
	document.getElementById(formname.name).action  = "index.php?p="+file;
	document.getElementById(formname.name).submit();
}
//---------------  Change Per Page limit ----------------
function changeperPage(PerPageLimit,formname,file)
{
		document.getElementById(formname.name).action  = "index.php?p="+file+"&PerPageLimit="+PerPageLimit;
		document.getElementById(formname.name).submit();
}
//------------------  Change Display Page -----------------------
function changeDisplayPage(PageNo,formname,file)
{	
	document.getElementById(formname.name).Page.value=PageNo;
	document.getElementById(formname.name).action  = "index.php?p="+file;
	document.getElementById(formname.name).submit();
}
// --------------- Confirm Delete alert Message ------------------
function confirmDel(formname,ID,Process,managefile)
{
	if(Process=="DELETE")
		{
			if(confirm("Do you really want to delete?"))
			{
				document.getElementById(formname.name).Process.value=Process;
				document.getElementById(formname.name).ID.value=ID;
				document.getElementById(formname.name).action  = managefile+".php";
				document.getElementById(formname.name).submit();
				return true;
			}
			else
				return false;
		}
		else
		{
			var ellen=document.getElementById(formname.name).elements.length;
			var count=0;
			for(var i=1;i<ellen;i++)
			{
				if(document.getElementById(formname.name).elements[i].name=="del[]")
				{
					 if(document.getElementById(formname.name).elements[i].checked==true)
						count=count+1;
				}
			}
				if(count==0)
				{
					alert("Please Select Record To Delete");
					return false;
				}
				else
				{
					if(confirm("Do you really want to delete?"))
					{
					document.getElementById(formname.name).Process.value=Process;
					document.getElementById(formname.name).ID.value=ID;
					document.getElementById(formname.name).action  = managefile+".php";
					document.getElementById(formname.name).submit();
						return true;
					}
					else
						return false;
				}
	}
}
function confirmDelSimple(formname,Process,managefile)
{
	var ellen=document.getElementById(formname).elements.length;
	var count=0;
	for(var i=0;i<ellen;i++)
	{
		if(document.getElementById(formname).elements[i].name=="del[]")
		{	
			 if(document.getElementById(formname).elements[i].checked==true)
			 {
				count=count+1;
			 }
		}
	}
		if(count==0)
		{
			alert("Please Select Record To Delete");
			return false;
		}
		else
		{
			if(confirm("Do you really want to delete?"))
			{
				
			document.getElementById(formname).Process.value=Process;
			document.getElementById(formname).action  = managefile+".php";
			document.getElementById(formname).submit();
				return true;
			}
			else
				return false;
		}
}

// to send message to multiple person 
function confirmSendMessage(formname,Process,managefile)
{

	var ellen=document.getElementById(formname).elements.length;
	var count=0;
	for(var i=0;i<ellen;i++)
	{
		if(document.getElementById(formname).elements[i].name=="send[]")
		{	
			 if(document.getElementById(formname).elements[i].checked==true)
			 {
				count=count+1;
			 }
		}
	}
		if(count==0)
		{
			alert("Please Select Record To Send Message");
			return false;
		}
		else
		{
			document.getElementById(formname).Process.value=Process;
			document.getElementById(formname).action  ="index.php?p="+managefile;
			document.getElementById(formname).submit();
			return true;
		}
}


// ------------------- Check All and Uncheck All -----------------------
function check_all(Form_Obj,eventgiver){
		var ellen=Form_Obj.elements.length;
		if(eventgiver.checked==true){
			for(var i=1;i<ellen;i++){
				if(Form_Obj.elements[i].name=="del[]")
				Form_Obj.elements[i].checked=true;
			}
		}else if(eventgiver.checked==false){
			for(var i=1;i<ellen;i++){
				if(Form_Obj.elements[i].name=="del[]")
				Form_Obj.elements[i].checked=false;
			}
		}
}
//-----window open
function winpopup(url,width,height)
{

window.open(url,'','location=0,menubar=0,titlebar=0,toolbar=0,resizable=0,status=0,height='+height+',width='+width+',top=155,left=155');
}
//--- Fetching State of Country  Thourhg Ajax
//--- Showing and Hiding row
function show_hide_row(ID,TrID)
{

	if(ID=='other')
		document.getElementById(TrID).style.display="";
	else
		document.getElementById(TrID).style.display="none";
	
}
function submit_form(formname,file)
{
	document.getElementById(formname.name).action=file;
}
function showTbl(Style,ID){

	if(Style == 'show')
			document.getElementById(ID).style.display = '';
	else if(Style == 'hide')
			document.getElementById(ID).style.display = 'none';
}

//-- Selecting Accept Or Reject
function AcceptReject(formname,IDvalue,managefile)
{
	document.getElementById(formname).ID.value=IDvalue;
	document.getElementById(formname).action  = managefile+".php";
	document.getElementById(formname).submit();
}
function getAudioTitle(File_Path,ArticleAudio,Action)
{
	fetch_remote_page(File_Path+"?ArticleAudio="+ArticleAudio,Action);
}
