	var http2 = false;
		
		if(navigator.appName == "Microsoft Internet Explorer") {
		  http2 = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
		  http2 = new XMLHttpRequest();
		}
		
	var http = false;		
		
		if(navigator.appName == "Microsoft Internet Explorer") {
		  http = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
		  http = new XMLHttpRequest();
		}
		
	var http3 = false;		
		
		if(navigator.appName == "Microsoft Internet Explorer") {
		  http3 = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
		  http3 = new XMLHttpRequest();
		}		
		
	var http4 = false;		
		
		if(navigator.appName == "Microsoft Internet Explorer") {
		  http4 = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
		  http4 = new XMLHttpRequest();
		}			
		

	
	function thisMovie(movieName) {
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName]
		}
		else {
			return document[movieName]
		}
	};
	
	// Functiom to reaload ajax		
	function ajax_reload(site, container, loadingbar, kanal){
			
		  if ( loadingbar == 1 ){	
		  document.getElementById(''+container+'').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';		
		  }
		  if ( loadingbar == 2 ){	
		  document.getElementById(''+container+'').innerHTML = '<div style="margin-left: 420px; margin-top: 180px"><img src=http://woho.tv/img/ajax-loader-green.gif></div>';		
		  }		  
		  
		  if ( kanal == 1 ){
			  http2.open("POST", ''+site+'', true);			
			  http2.onreadystatechange=function() {
			  if(http2.readyState == 4) {
				  document.getElementById(''+container+'').innerHTML = http2.responseText;				  
				}
			  }
			  http2.send(null);	
		  }
		  if ( kanal == 2 ){
			  http.open("POST", ''+site+'', true);			
			  http.onreadystatechange=function() {
			  if(http.readyState == 4) {
				  document.getElementById(''+container+'').innerHTML = http.responseText;				  
				}
			  }
			  http.send(null);	
		  }		
		  if ( kanal == 3 ){
			  http3.open("POST", ''+site+'', true);			
			  http3.onreadystatechange=function() {
			  if(http3.readyState == 4) {
				  document.getElementById(''+container+'').innerHTML = http3.responseText;				  
				}
			  }
			  http3.send(null);	
		  }			  
		  
	};

	// Connection between HTML env and Swf
	function info(id, id2, time, duration, title, desc, date, thumb, video, nextId2, prevId2, buffor){		
	
		
		var o = document.getElementById("opis");
		
		if ( document.getElementById('play').innerHTML == '' && time != 0 ){ 
			ajax_reload("site/ajax_data/tv_controlbox.php",'controlico','1',2);			
		}
		
		if (o){
	
		var dur = duration;	
		if ( time == 0 ){			
			var dupa = 'Buffering';	 			
		}
		else
		{
			var dupa = Math.round(dur*100)/100+"s";				
			document.getElementById("time").innerHTML = "Time: "+Math.round(time*100)/100+"s / "+dupa;
			document.getElementById('play').innerHTML = id;	
		if ( time < 2 ){			
			document.getElementById("opis").innerHTML = desc.substr(0,40)+"...";	
			document.getElementById('vote').innerHTML = ''					
			ajax_reload("site/ajax/tv_info.php?id="+id+"&mode=1",'vote','1',1);															
		}
 	  }	
	}
	};

	// Jumping to  entry in swf playlist
	function gotoXVideo(val){ thisMovie("player").gotoXVideoJS(val); }
	
	// -----------------------------------//

	// Favourite tv.php, addtofavorite.php from player
	function favorite(channel,typ,user){

	GB_showCenter("Add to playlist", "http://channel.woho.tv/site/ajax/tv_playlist_add.php?id="+document.getElementById('play').innerHTML+"&channel="+channel,400,500);		

			return false;			
	};
	
	function tvoptions(id, channel, par){

		if ( id == 10 ){ par = document.getElementById('email').value; }
		
		var playitem = document.getElementById('play').innerHTML;	
		ajax_reload("site/ajax/tv_infobox.php?id="+id+"&channel="+channel+"&playitem="+playitem+"&par="+par,'messokdwa',1,2);
		
		$("#messokdwa").show("fast");	
		setTimeout('$("#messokdwa").hide("fast");',30000);		
	
	  
		
	};
	
		
	
	// Favourite tv.php, addtofavorite.php from list
	function addfavorite(channel,typ,id, user){
		
		if ( user == '' || user == 0 ){
			
		logon_redirect(1,1)	
			
			
		}
		else
		{
			
			http2.open("POST", "site/ajax/addtofavorite.php?id="+id+"&channel="+channel+"&typ="+typ, true);		
	
			  http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				  if ( http2.responseText == 0 ){

						document.getElementById('video'+id).innerHTML = '<img src=img/playlist.png  style="margin-left: 5px; position:relative; top: 4px" />';							  
						
				  }
				}
			  }
			  
			  http2.send(null);		

			  setTimeout("loadplaylist('1','"+user+"','2')",200);
			  	  
		}
			  return false;			
	};	

	// Play function for swf player. All envs
	function play(){ 

		thisMovie("player").playJS(); 
		
	};
	
	function prev() { thisMovie("player").prevJS(); };
	
	function next() { thisMovie("player").nextJS(); };	
	
	// show function youtube
	
	function show_youtube(idshow,tag,x){
		
	if ( tag == 1 ){ 
	var tagi = document.getElementById('searchtagshow').value;
	ajax_reload("site/youtube_search_show.php?show="+idshow+"&tag="+tagi+"&x="+x,'user_profile','1',1);	
	
	}
	else
	{
		
	ajax_reload("site/youtube_search_show.php?show="+idshow+"&tag="+tag+"&x="+x,'user_profile','1',1);	
	
	}
	
		
	};
	
	// Playlist youtube
	
	function playlist_youtube(idshow,tag,x){
		
	if ( tag == 1 ){ 
	var tagi = document.getElementById('searchtagshow').value;
	ajax_reload("site/playlist_search_show.php?show="+idshow+"&tag="+tagi+"&x="+x,'user_profile','1',1);	
	
	}
	else
	{
		
	ajax_reload("site/playlist_search_show.php?show="+idshow+"&tag="+tag+"&x="+x,'user_profile','1',1);	
	
	}
	
		
	};
	
	// playlist youtube go back to normal
	function goback_playlist(id){
				ajax_reload("site/user_playlist_details.php?playlist="+id,'user_profile','1',1);					
		
	};


	// user_profile.php changing Ajax user env
	function user_profile(id){
		
 		    document.getElementById('user_profile').innerHTML = '<img src=img/loader3.gif> Loading...</div>';			
			
			if ( id == 1 ){  http2.open("POST", "site/user_profile_down.php", true); }
			if ( id == 2 ){  http2.open("POST", "site/user_password.php", true); }
			if ( id == 3 ){  http2.open("POST", "site/user_details.php", true); }		
			if ( id == 4 ){  http2.open("POST", "site/user_messages.php", true); }	
			if ( id == 5 ){  http2.open("POST", "site/user_website.php", true); }	
			if ( id == 6 ){  http2.open("POST", "site/user_show_control.php", true); }				
			if ( id == 7 ){  http2.open("POST", "site/user_playlist.php", true); }			
			if ( id == 8 ){  http2.open("POST", "site/publish.php", true); }	
			if ( id == 9 ){  http2.open("POST", "site/user_bookmarked.php", true); }		
			if ( id == 10 ){  http2.open("POST", "site/user_show_mixbox.php", true); }		
			if ( id == 15 ){  http2.open("POST", "site/user_adverts.php", true); }		
			if ( id == 16 ){  http2.open("POST", "site/user_jingles.php", true); }	
			if ( id == 17 ){  http2.open("POST", "site/user_channels.php", true); }	
			if ( id == 18 ){  http2.open("POST", "site/youtube_search_show.php", true); }			
			if ( id == 19 ){  http2.open("POST", "site/flickr/flickr_search.php", true); }		
			if ( id == 20 ){  http2.open("POST", "site/user_profile_avatar.php", true); }				
	
			  http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				  document.getElementById('user_profile').innerHTML = http2.responseText;
				  
				  if ( id == 7 	|| id == 10 ){
					  
					
						list = document.getElementById("playlista");
						DragDrop.makeListContainer( list, 'g100' );
						list.onDragOver = function() { this.style["background"] = "#EEF"; };
						list.onDragOut = function() {this.style["background"] = "none"; };
						list.onDragDrop = function() {onDropshowmain('g100',0); };					
					  
				  }
				  
				  tooltip();
				  
				  
				}
			  }			  
			  http2.send(null);					  
			  return false;		
	};


	// reload playlist user_playlist.php
	function playlist(id,view){	
		document.getElementById('view').innerHTML = view;	
		ajax_reload("site/ajax/user_playlist.php?x="+id+"&view="+view,'page','1',1);		
		return false;		
	};


	// Removing item from playlist user_playlist.php
	function removeitem(id,id2){
		
		var dupa = confirm("Are your sure? ");		
		if (dupa){				
		$(document).ready(function() {									   
			$("#item"+id2).hide("slow"); 			 			
			ajax_reload("site/ajax/playlist_remove.php?id="+id,'debug','1',2);		 		  		  				  
			});				
		}
	};
	
	// Removing item from playlist user_playlist.php
	function removeitemshow(id,id2){
		
		var dupa = confirm("Are your sure? ");		
		if (dupa){				
		$(document).ready(function() {									   
			$("#item"+id2).hide("slow"); 			 			
			ajax_reload("site/ajax/user_show_remove_item.php?id="+id,'debug','1',2);		 		  		  				  
			});				
		}
	};	
	
	// Removing bookmarked user_bookmark.php
	function removechannel(id,id2){
		
		var dupa = confirm("Are your sure? ");
		
		if (dupa){		
		
		$(document).ready(function() {									   
			$("#item"+id2).hide("slow"); 			 			
			ajax_reload("site/ajax/bookmark_remove.php?id="+id,'debug','1',2);			 		  		  				  
			});				
		}
	};
	
	// Removing bookmarked user_bookmark.php
	function removeadvert(id,id2){
		
		var dupa = confirm("Are your sure? ");
		
		if (dupa){		
		
		$(document).ready(function() {									   
			$("#item"+id2).hide("slow"); 			 			
			ajax_reload("site/ajax/advert_remove.php?id="+id,'debug','1',2);			 		  		  				  
			});				
		}
	};		
	
	// Removing show
	function removeplaylist(id,id2){
		
		var dupa = confirm("Are your sure? ");
		
		if (dupa){		
		
		$(document).ready(function() {									   
			$("#itema"+id2).hide("slow"); 			 			
			ajax_reload("site/ajax/show_remove.php?id="+id,'debug','1',2);			 		  		  				  
			});				
		}
	};		

	// View plailist ay user_playslit.php
	function viewplaylist(){
			if ( document.getElementById('view').innerHTML == 1 ){ 
				var view = 2;  
				document.getElementById('view').innerHTML = "2";		
			}
			else
			{ 		
				var view = 1; 
				document.getElementById('view').innerHTML = "1";  		
			}			
			ajax_reload("site/ajax/user_playlist.php?x=1&view="+view,'page','1',1);				
		    return false;		
	};

	// Showing message to user user_message.php
	function showmessage(id, img){
	
		if ( document.getElementById(''+img+'').src == 'http://woho.tv/img/triangle1.gif' ){
			document.getElementById(''+img+'').src = 'img/triangle2.gif';	
		}
		else
		{		
			document.getElementById(''+img+'').src = 'img/triangle1.gif';				
		}
	
		$(document).ready(function() {

				$("#"+id).toggle("slow"); 
		});
	
	};
	
	
	// Remove user message user_message.php
	function removemessage(id, identry){		
		var check = confirm("Do you really want to delete this message");		
		if (check){				
			$(document).ready(function() {									   
				$("#"+identry).hide("slow"); 	
				ajax_reload("site/ajax/message_remove.php?id="+id,'debug','1',1);			  
				return false;						
	  	    });								  
		}					
	};

		
	
	function channel_close_search(){

		document.getElementById('menu4').className = 'menu_closed';
		document.getElementById('menu4b').style.display = 'none';
		document.getElementById('ico4').src = 'img/triangle1.gif';
		document.getElementById('menu5').className = 'menu_closed';
		document.getElementById('menu5b').style.display = 'none';
		document.getElementById('ico5').src = 'img/triangle1.gif';
		
		
	};

	// Main page channel change tv.php
	function channel_page(id,view,searchtags){	

	
		if ( searchtags != 'mem' ){ document.getElementById('searchtags').innerHTML = ''+searchtags+'';	}		
		if ( view == 0 ){					
			view = document.getElementById('view').innerHTML;				
			document.getElementById('viewnow').innerHTML = view;				
			if ( view == 1 ){ document.getElementById('view').innerHTML = 2; }
			if ( view == 2 ){ document.getElementById('view').innerHTML = 3; }			
			if ( view == 3 ){ document.getElementById('view').innerHTML = 4; }					
			if ( view == 4 ){ document.getElementById('view').innerHTML = 1; }						
		}		  
		if (  searchtags  == 'mem' ){ searchtags = document.getElementById('searchtags').innerHTML; }
		if (  view  == 'mem' ){ view = document.getElementById('viewnow').innerHTML; }		
		

		
	     ajax_reload("site/ajax/channel_page.php?x="+id+"&view="+view+'&search='+searchtags,'page','1',1);			  

		 
		 channel_close_search();				 
		 return false;							  

	};
	
	// Main page channel change tv.php
	function youtube_page(id, tag, channel){	
	
			var add = document.getElementById('add').innerHTML;
			
		if ( add == '' ){


		 ajax_reload("site/ajax/youtube_page.php?x="+id+"&tag="+tag+"&channel="+channel,'page','1',1);			  


		 
		}
		else
		{
			alert("You're importing a file. Please wait until task is completed");	
		}
			
	
		
	};	
	
	function search_page(x,tag){
	
		 ajax_reload("site/search_page.php?x="+x+"&tag="+tag,'content','1',1);			
		
	};
	
	function addfromyoutube(channel, code, url){
		
		var add = document.getElementById('add').innerHTML;
		

		
		if ( add == '' ){

	      document.getElementById('add').innerHTML = code;
		  document.getElementById(''+code+'').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Importing... Wait</div>';		  
				
			http2.open("POST", "site/ajax/youtube_add.php?channel="+channel+"&code="+code+"&url="+url, true); 
				http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				  	
					document.getElementById(''+code+'').innerHTML = http2.responseText;
					document.getElementById('add').innerHTML = '';
				  				  
				}
			  }			  
			  http2.send(null);					  
			  return false;					
			

		 
		}
		else
		{
			alert("Sorry you can add only one item per time. Wait a second and try again");	
		}
		
	};
	
	function addfromyoutubeshow(channel, code, url){
		
		var add = document.getElementById('add').innerHTML;
		
		if ( add == '' ){

	      document.getElementById('add').innerHTML = code;
		  document.getElementById(''+code+'').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Importing... Wait</div>';				
			http2.open("POST", "site/ajax/youtube_add_show.php?show="+channel+"&code="+code+"&url="+url, true); 
				http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				  	
					document.getElementById(''+code+'').innerHTML = http2.responseText;
					document.getElementById('add').innerHTML = '';
				  				  
				}
			  }			  
			  http2.send(null);					  
			  return false;					
			

		 
		}
		else
		{
			alert("Sorry you can add only one item per time. Wait a second and try again");	
		}
		
	};	
	
	function addfromyoutubeplaylist(channel, code, url){
		
		var add = document.getElementById('add').innerHTML;
		
		if ( add == '' ){

	      document.getElementById('add').innerHTML = code;
		  document.getElementById(''+code+'').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Importing... Wait</div>';				
			http2.open("POST", "site/ajax/youtube_add_playlist.php?show="+channel+"&code="+code+"&url="+url, true); 
				http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				  	
					document.getElementById(''+code+'').innerHTML = http2.responseText;
					document.getElementById('add').innerHTML = '';
				  				  
				}
			  }			  
			  http2.send(null);					  
			  return false;					
			

		 
		}
		else
		{
			alert("Sorry you can add only one item per time. Wait a second and try again");	
		}
		
	};		
	
	
	// Main page channel change tv.php
	function playlist_page(id,view,searchtags){	
		
		if ( searchtags != 'mem' ){ document.getElementById('searchtags').innerHTML = ''+searchtags+'';	}		
		if ( view == 0 ){					
			view = document.getElementById('view').innerHTML;				
			document.getElementById('viewnow').innerHTML = view;				
			if ( view == 1 ){ document.getElementById('view').innerHTML = 2; }
			if ( view == 2 ){ document.getElementById('view').innerHTML = 3; }			
			if ( view == 3 ){ document.getElementById('view').innerHTML = 4; }						
			if ( view == 4 ){ document.getElementById('view').innerHTML = 1; }									
		}		  
		if (  searchtags  == 'mem' ){ searchtags = document.getElementById('searchtags').innerHTML; }
		if (  view  == 'mem' ){ view = document.getElementById('viewnow').innerHTML; }		
		
		 ajax_reload("site/ajax/playlist_page.php?x="+id+"&view="+view+'&search='+searchtags,'page','1',1);			  
		  	  
		 channel_close_search();
		  
		
	};	
	
	function user_channel_page(user,channel, par){
		
		 ajax_reload("site/ajax/user_channel_page.php?id="+channel+"&user="+user,'page','1',1);		
		 ajax_reload("site/ajax/user_channel_page_controlbox.php?id="+channel+"&user="+user,'optionschannel','1',3);			 		 
		 document.getElementById('menu_text2').innerHTML = document.getElementById('item'+par).innerHTML;	
		 document.getElementById('menu1').className = 'menu_closed';
		 document.getElementById('menu1b').style.display = 'none';
		 document.getElementById('menu_text').style.color = 'black';			
		
		
	};
	
	
	function fadetoshow(){
	
			jQuery(".DOdisabled").fadeTo("fast", 0.4); // This should set the opacity to 100% on hover
			jQuery(".DOdisabled").attr("disabled","disabled");	
		
	}
	
	
	// Main page channel change tv.php
	function shows_page(id,view,searchtags){	
	
		if ( searchtags != 'mem' ){ document.getElementById('searchtags').innerHTML = ''+searchtags+'';	}		
		if ( view == 0 ){					
			view = document.getElementById('view').innerHTML;				
			document.getElementById('viewnow').innerHTML = view;				
			if ( view == 1 ){ document.getElementById('view').innerHTML = 2; }
			if ( view == 2 ){ document.getElementById('view').innerHTML = 3; }			
			if ( view == 3 ){ document.getElementById('view').innerHTML = 4; }						
			if ( view == 4 ){ document.getElementById('view').innerHTML = 1; }									
		}		  
		if (  searchtags  == 'mem' ){ searchtags = document.getElementById('searchtags').innerHTML; }
		if (  view  == 'mem' ){ view = document.getElementById('viewnow').innerHTML; }		
		
		 ajax_reload("site/ajax/shows_page.php?x="+id+"&view="+view+'&search='+searchtags,'page','1',1);
			
		setTimeout("fadetoshow()",500);
		  	  
		 channel_close_search();
		  
		  return false;			
	};		
	

	// show page
	function show_page(id){		

		  ajax_reload("site/ajax/show_page.php?x="+id,'page','1',1);			  	
		  return false;
	};	

	// Resizing procedure tv.php
	function resizeplayer(channel, mode){
		
		
		if ( mode == 1 ){
			
			document.getElementById('control_container').style.width = '955px';
			document.getElementById('playerwejscie').style.width = '956px';		
			document.getElementById('controlico').style.width = '480px';			
			document.getElementById('kanal').style.display = 'none';				
			document.getElementById('controlico').style.top = '-115px';					
			document.getElementById('playersrodek').innerHTML = '<img src=img/loader3.gif> Loading...';			
			document.getElementById('headbox_load').style.display = 'none'
//			document.getElementById('compact').style.display = 'none'			;	
			ajax_reload("site/ajax/tv_player.php?mode=1&channel="+channel,'playersrodek','0',1);				  						
			$("#headbox_in").slideDown("slow"); 		  
		
		}
			else
		{
			
			document.getElementById('control_container').style.width = '604px';
			document.getElementById('playerwejscie').style.width = '604px';		
			document.getElementById('controlico').style.width = '210px';			
			document.getElementById('kanal').style.display = 'block';		
			document.getElementById('controlico').style.top = '-115px';					
			document.getElementById('headbox_load').style.display = 'none';	
//			document.getElementById('compact').style.display = 'inline'			;							
			
			ajax_reload("site/ajax/tv_player.php?mode=2&channel="+channel,'playersrodek','0',1);					  						
			$("#headbox_in").slideDown("slow"); 		  			
			
			
		}				  
	};


	// Function changing main player view from single to full mode tv.php
	function playerview(channel){		

			var player = document.getElementById('session').innerHTML;
	
			if( navigator.appName == "Microsoft Internet Explorer" ) {				
					var kak = 'yeee';											
			}
			else
			{	
				if ( player == '' || player == 1 ){	
					// View mode 1;						
					$("#headbox_in").slideUp("slow"); 
					document.getElementById('session').innerHTML = 2;
					setTimeout("document.getElementById('headbox_load').style.display = 'block';",1000);	
					setTimeout("resizeplayer("+channel+",1)",2000);	
					document.getElementById('channel_compact_icon').style.display = 'none';
				}
				else
				{					
					// View mode 2
					$("#headbox_in").slideUp("slow"); 					
					document.getElementById('session').innerHTML = 1;					
					setTimeout("document.getElementById('headbox_load').style.display = 'block';",1000);	
					setTimeout("resizeplayer("+channel+",2)",2000);		
					document.getElementById('channel_compact_icon').style.display = 'block	';					
				}
			}
	};
	
	// Resizing procedure tv.php
	function resizeplayercompact(channel, mode){
		
		
		if ( mode == 1 ){

	
			document.getElementById('kupa').style.display = 'block';		
			document.getElementById('playerwejscie').style.top = '25px';		
			document.getElementById('playersrodek').style.top = '40px';						
			document.getElementById('controlico').style.top = '-70px';						
			document.getElementById('headbox_load').style.display = 'none';	
			ajax_reload("site/ajax/tv_player_compact.php?mode=1&channel="+channel,'playersrodek','0',1);				  						
			$("#playercontainer").slideDown("slow"); 			  
		
		}
			else
		{
			
			document.getElementById('kupa').style.display = 'none';		
			document.getElementById('playerwejscie').style.top = '0px';		
			document.getElementById('playersrodek').style.top = '0px';						
			document.getElementById('controlico').style.top = '-110px';								
			document.getElementById('headbox_load').style.display = 'none';	
			ajax_reload("site/ajax/tv_player_compact.php?mode=2&channel="+channel,'playersrodek','0',1);				  						
			$("#playercontainer").slideDown("slow"); 						  						
			
		}				  
	};	
	
	// Function changing main player view from single to full mode tv.php
	function playerviewcompact(channel){		

			var player = document.getElementById('session').innerHTML;
			
			if( navigator.appName == "Microsoft Internet Explorer" ) {				
					var kak = 'yeee';											
			}
			else
			{	
	
				if ( player == '' || player == 1 ){	
					// View mode 1;						
					$("#playercontainer").slideUp("slow"); 
					document.getElementById('session').innerHTML = 2;
					setTimeout("document.getElementById('headbox_load').style.display = 'block';",1000);	
					setTimeout("resizeplayercompact("+channel+",1)",2000);						
				}
				else
				{					
					// View mode 2
					$("#playercontainer").slideUp("slow"); 	
					document.getElementById('session').innerHTML = 1;					
					setTimeout("document.getElementById('headbox_load').style.display = 'block';",1000);	
					setTimeout("resizeplayercompact("+channel+",2)",2000);											
				}
			}

	};	
	
	// tv.php change list view on main list
	function lista(numer, channel){
	  	 	  ajax_reload("site/ajax_lista.php?channel="+channel,'lista','1',1);				  
			  return false; 			
	};	
	
	// tv.php change list view on main list tags
	function menu_tags(channel, tag){			
			ajax_reload("site/ajax/tv_menu_tags.php?channel="+channel+"&tags="+tag,'lista','1',1);					  
			return false; 			
	};		
	
	// swfg play
	function zapusc(id, channel){
		
	if ( document.getElementById('playlist').innerHTML != '' ){						
		load_xml_list(2, channel);				
		setTimeout("gotoXVideo("+id+")",1000);			
	}
	else
	{		
		 gotoXVideo(id);
	     return false; 	  		 
	}
//		document.getElementById('channel_name').style.display = 'block';
//		document.getElementById('channel_name_new').style.display = 'none';				 
	};	
	
		// swfg play
	function zapuscTV(id,id2){
		
		 gotoXVideo(id);
	  	
		 var olditem = document.getElementById('podswietlenie').innerHTML;
		 
		 document.getElementById('image'+id2).style.border = '3px solid brown';
		 if ( olditem != 0 ){
		 document.getElementById('image'+olditem).style.border = '1px solid Silver';		 
		 }
		 
		 document.getElementById('podswietlenie').innerHTML = id2;
	     return false; 		 
		 
	};	
	
	
	
	// KLoad xml list
	function load_xml_list(mode, par){	
	if ( mode == 1 ){		
		ajax_reload("site/ajax/playlist_swf.php?user="+par,'playersrodek','1',1);		
		document.getElementById('playlist').innerHTML = par;								
	}			
	if ( mode == 2 ){							
//		document.getElementById('controlico').style.top = '-115px';		
		ajax_reload("site/ajax/tv_player.php?mode=2&channel="+par,'playersrodek','1',1);						  		
		document.getElementById('playlist').innerHTML 	= '';						
	}				
	};
	
	
	// personal playlist
	function playpersonal(id,user){
		
	if ( user != '' && user != 0 ){				
	if ( document.getElementById('playlist').innerHTML != user ){			
		load_xml_list(1, user);
		setTimeout("gotoXVideo("+id+")",1200);	
		document.getElementById('controlico').style.top = '-115px';			
	}
	else
	{		
		gotoXVideo(id)
	}			 
	     return false; 	  		 
	}	 
	};		
	
	// personal playlist user page
	function playuser(id){ gotoXVideo(id); };
	
	// Infoboxright tv.php load all movies and pages
	function loadpage(id,channel,x){								
			if ( id == 1 ){ ajax_reload("site/ajax/tv_videos.php?channel="+channel+"&x="+x,'options',1,1);	 }
			if ( id == 7 ){ ajax_reload("site/ajax/tv_videos_overlay.php?channel="+channel+"&x="+x,'options',1,1);	 }			
			if ( id == 2 ){ ajax_reload("site/ajax/tv_about.php?channel="+channel,'options',1,1);	 }	
			if ( id == 3 ){ ajax_reload("site/ajax/tv_tags.php?channel="+channel,'options',1,1);	 }		
			if ( id == 4 ){ ajax_reload("site/ajax/tv_channels.php?channel="+channel,'options',1,1);	 }					
			if ( id == 5 ){ ajax_reload("site/ajax/tv_comments.php?channel="+channel+"&x="+x,'options',1,1);	 }					
			if ( id == 6 ){ ajax_reload("site/ajax/tv_comments_add.php?channel="+channel+"&x="+x,'options',1,1);	 }	
	};
	
	function ramka(ktr,co){
		
		if ( co == 1){ document.getElementById(''+ktr+'').style.background = '#a6cfff';}
		if ( co == 2){ document.getElementById(''+ktr+'').style.background = 'white'; }
		
	};	

	// unblock
	function odblokuj(ktory){
	
		if ( document.getElementById(''+ktory+'').style.display == 'none' ){		
			document.getElementById(''+ktory+'').style.display = 'block';
		}
			else
		{
			document.getElementById(''+ktory+'').style.display = 'none';
		}
	};	
	
	function vote(id,score,typ, where){
		
		ajax_reload("site/ajax/tv_vote.php?id="+id+"&score="+score,where,0,1);								
	}
	
	function showvote(id,score,typ, where){
		
		ajax_reload("site/ajax/show_vote.php?id="+id+"&score="+score+"&typ="+typ,''+where+'',1,3);								
	};
	
	
/*	function menu_view(){
		
		$("#playmenu").toggle("fast"); 			
	
		if ( document.getElementById('menu_view_icon').innerHTML == '+' ){
			document.getElementById('menu_view_icon').innerHTML	= '-';
		}
		else
		{
			document.getElementById('menu_view_icon').innerHTML	= '+';
		}
	
	}
*/

	function str_replace (search, replace, subject)
	{
	  var result = "";
	  var  oldi = 0;
	  for (i = subject.indexOf (search)
		 ; i > -1
		 ; i = subject.indexOf (search, i))
	  {
		result += subject.substring (oldi, i);
		result += replace;
		i += search.length;
		oldi = i;
	  }
	  return result + subject.substring (oldi, subject.length);
	};	
	
	function addcomment(channel){
		
	
		if ( document.getElementById('comment').value == '' ){		
			$(document).ready(function() {
			document.getElementById('mess').innerHTML = 'Please leave a message ;)';
			$("#mess").show("slow"); 
			});					
		}
		else
		{			
		var comment = document.getElementById('comment').value;
		comment = str_replace(' ','%20',comment);
			
		http2.open("POST", "site/ajax/tv_comments_save.php?channel="+channel+"&value="+comment, true); 		
		  http2.onreadystatechange=function() {
			if(http2.readyState == 4) {
			loadpage(5,channel,1);
			}
		  }		  
		  http2.send(null);										
		}				
	};
	
	function addcommentuser(channel){
	
		if ( document.getElementById('comment').value == '' ){		
			$(document).ready(function() {
			document.getElementById('mess').innerHTML = 'Please leave a message ;)';
			$("#mess").show("slow"); 
			});					
		}
		else
		{			
		var comment = document.getElementById('comment').value;
		comment = str_replace(' ','%20',comment);
			
		http4.open("POST", "site/ajax/user_comments_save.php?channel="+channel+"&value="+comment, true); 		
		  http4.onreadystatechange=function() {
			if(http4.readyState == 4) {
			loadpagepersonal(5,channel,1)
			}
		  }		  
		  http4.send(null);										
		}				
	};	
	
	function addcommentshow(channel){
	
		if ( document.getElementById('comment').value == '' ){		
			$(document).ready(function() {
			document.getElementById('mess').innerHTML = 'Please leave a message ;)';
			$("#mess").show("slow"); 
			});					
		}
		else
		{			
		var comment = document.getElementById('comment').value;
		comment = str_replace(' ','%20',comment);
			
		http4.open("POST", "site/ajax/user_comments_save.php?channel="+channel+"&value="+comment, true); 		
		  http4.onreadystatechange=function() {
			if(http4.readyState == 4) {
			loadpageshow(5,channel,1)
			}
		  }		  
		  http4.send(null);										
		}				
	};	
	
	function loadplaylist(mainframe,user, mode){

		rozwin_menu(1,1,800);						
		ajax_reload("site/ajax/myplaylist.php?mainframe="+mainframe+"&user="+user,'lista',1,1);			

	};
	
	function loadintroduction(channel){
			ajax_reload('site/ajax/user_player_introduction.php?channel='+channel,'player_container',1,2);				
	};
	
	function logon_redirect(mode, alertuser){	
		// small window at tv.php
		if ( mode == 1 ){			
			rozwin_menu(1,1,800);			
			ajax_reload("site/ajax/loginsmall.php?alert="+alertuser,'lista',0,1);				
		}
		if ( mode == 2){
			document.getElementById('mess').innerHTML = 'You need to be woho member to do that. <a href=http://woho.tv/pl/?go=5>Click here</a> to register.';
			$("#mess").show("fast");	
			setTimeout('$("#mess").hide("fast");',15000);
		}		
	};
	
	function bookmark(channel,user){	

			if ( user == '' || user == 0 ){			
				logon_redirect(1,1)				
			}
			else
			{

		   http4.open("POST", "site/ajax/tv_bookmark.php?channel="+channel, true); 							
			  http4.onreadystatechange=function() {
				if(http4.readyState == 4) {
			if ( http4.responseText == 0 ){
						
				$(document).ready(function() {
					document.getElementById('messok').innerHTML = 'Added';
					$("#mess").show("slow"); 
					});							
												
					}
					else
					{
						
				$(document).ready(function() {
					document.getElementById('mess').innerHTML = 'You bookmarked this channel before';
					$("#mess").show("slow"); 
					});							
												
					}	
					
				}
			  }			  
			http4.send(null);	
			
			}
	
	};	
	
					
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------user_show.php			
	

	function user_player(id,user,showid){		
			document.getElementById('player_container').innerHTML = '<br><br><br><br><img src=http://woho.tv/img/loaderbig.gif style="padding-left: 240px"></div>';									
			ajax_reload('site/ajax/user_player.php?mode='+id+'&userid='+user+"&showid="+showid,'player_container',1,2);							
	};
	
	function loadpagepersonal(page,inter,par){
		   document.getElementById('info').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';			
		   	if ( page == 1){  http2.open("POST", "site/ajax/userpage_about.php?user="+inter+"&par="+par, true); }
		   	if ( page == 2){  http2.open("POST", "site/ajax/userpage_episodes.php?user="+inter+"&par="+par, true); }
		   	if ( page == 3){  http2.open("POST", "site/ajax/userpage_playlist.php?user="+inter+"&par="+par, true); }
		   	if ( page == 4){  http2.open("POST", "site/ajax/userpage_forum.php?user="+inter+"&par="+par, true); }
		   	if ( page == 5){  http2.open("POST", "site/ajax/userpage_comments.php?user="+inter+"&par="+par, true); }
		   	if ( page == 6){  http2.open("POST", "site/ajax/userpage_community.php?user="+inter+"&par="+par, true); }
		   	if ( page == 7){  http2.open("POST", "site/ajax/userpage_shows.php?user="+inter+"&par="+par, true); }	
		   	if ( page == 10){  http2.open("POST", "site/ajax/userpage_community.php?user="+inter+"&par="+par, true); }				
		   	if ( page == 11){  http2.open("POST", "site/ajax/userpage_community_insert.php?user="+inter+"&par="+par, true); }							
			  http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				  document.getElementById('info').innerHTML = http2.responseText;
				  
				}
			  }
			http2.send(null);				
	};
	
	function loadpageshow(page,inter,par){
		   document.getElementById('info').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';			
		   	if ( page == 1){  http2.open("POST", "site/ajax/userpage_show_about.php?user="+inter+"&par="+par, true); }
		   	if ( page == 2){  http2.open("POST", "site/ajax/userpage_show_episodes.php?user="+inter+"&par="+par, true); }
		   	if ( page == 5){  http2.open("POST", "site/ajax/userpage_show_comments.php?user="+inter+"&par="+par, true); }
		   	if ( page == 6){  http2.open("POST", "site/ajax/userpage_community.php?user="+inter+"&par="+par, true); }
		   	if ( page == 7){  http2.open("POST", "site/ajax/userpage_show_shows.php?user="+inter+"&par="+par, true); }	
		   	if ( page == 10){  http2.open("POST", "site/ajax/userpage_show_community.php?user="+inter+"&par="+par, true); }				
		   	if ( page == 12){  http2.open("POST", "site/ajax/userpage_show_info.php?user="+inter+"&par="+par, true); }							
		   	if ( page == 11){  http2.open("POST", "site/ajax/userpage_show_community_insert.php?user="+inter+"&par="+par, true); }							
			  http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				  document.getElementById('info').innerHTML = http2.responseText;
				  
				}
			  }
			http2.send(null);				
	};	

	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------user_playlist.php		
	
	function add_playlist(){
	
	GB_showCenter("Add new playlist", "http://woho.tv/site/ajax/user_playlist_add.php",270,500);	
	
	};
	
	
	function playlist_drop_change(x, view){
	var value = document.getElementById('playlist_dropdown').options[document.getElementById('playlist_dropdown').selectedIndex].value;
	if ( value == '' ){
		GB_showCenter("Add new playlist", "http://woho.tv/site/ajax/user_playlist_add.php",270,500);
	}
	else
	{
			document.getElementById('user_profile').innerHTML = '<img src=img/loader3.gif> Loading...</div>';
		   	http2.open("POST", "site/ajax/user_playlist_view.php?playlist="+value+"&x="+x+"&view="+view, true); 	
			  http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
				       // Ajax env and dragdropjquery plugin holds data ll teh time we eed to find uniqeue numbver 
 					    var unik = Math.floor(Math.random()*2993);						 					
				 		document.getElementById('user_profile').innerHTML = http2.responseText;				  
						list[''+unik+''] = document.getElementById("playlista");
						DragDrop.makeListContainer( list[''+unik+''], 'g'+unik );
						list[''+unik+''].onDragOver = function() { this.style["background"] = "#EEF"; };
						list[''+unik+''].onDragOut = function() {this.style["background"] = "none"; };
						list[''+unik+''].onDragDrop = function() {onDrop('g'+unik,value,50); };	

				}
			  }
			http2.send(null);				
	}				
	};
	

	function playlist_admin_page(x,view,playlist,items){		
		document.getElementById('user_profile').innerHTML = '<img src=img/loader3.gif> Loading...</div>';					
	   	http4.open("POST", "site/ajax/user_playlist_view.php?playlist="+playlist+"&x="+x+"&view="+view+"&items="+items, true); 	
			  http4.onreadystatechange=function() {
				if(http4.readyState == 4) {					
			 		    // Ajax env and dragdropjquery plugin holds data ll teh time we eed to find uniqeue numbver				
				        var unik = Math.floor(Math.random()*2993);						 					
				        document.getElementById('user_profile').innerHTML = http4.responseText;
						list[''+unik+''] = document.getElementById("playlista");
						DragDrop.makeListContainer( list[''+unik+''], 'g'+unik );
						list[''+unik+''].onDragOver = function() { this.style["background"] = "#EEF"; };
						list[''+unik+''].onDragOut = function() {this.style["background"] = "none"; };
						list[''+unik+''].onDragDrop = function() {onDrop('g'+unik,playlist,items); };					  
				}
			  }
			http4.send(null);		
	};
	

	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------record_show.php		
	
	function user_show_add(id){	
		if ( id == null  ){			
			GB_showCenter("Add new show", "http://woho.tv/site/ajax/user_show_add.php",620,650); 			
		}
		else
		{
			if ( id == 1 ){
			GB_showCenter("Add new show", "http://woho.tv/site/ajax/user_show_add.php?back=1",620,650); 					
			rozwin_menu(1,0,800);				
			}
			
			if ( id == 2 ){
			GB_showCenter("Add new show", "http://woho.tv/site/ajax/user_show_add.php?back=2",620,650); 									
			}
			
			if ( id == 3 ){
			GB_showCenter("Add new show", "http://woho.tv/site/ajax/user_show_add.php?back=3",620,650); 									
			}			
			
		}				
	};		
	
	function informuj(id){ ajax_reload('site/ajax_data/playlist_dropdown.php?id='+id,'informuj',0,1); };	
	function change_text(name,na){ document.getElementById(''+name+'').innerHTML = na;	};			


	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------user_show_control.php			

	function user_show_dropdown(id){ ajax_reload('site/ajax_data/shows_dropdown.php?id='+id,'showdropdown',1,1); };			

	function user_show_select(id){ ajax_reload('site/ajax_data/shows_select.php?id='+id,'showdropdown',1,1); };			
	function user_show_select_record(id){ ajax_reload('site/ajax_data/shows_select_record.php?id='+id,'showdropdown',1,1); };				

	function user_channel_select(id){ ajax_reload('site/ajax_data/channel_select.php?id='+id,'channels',1,2);};		

	// ChanGE page
	function user_show_control_page(page, par){		
	
		ajax_reload('site/ajax/user_show_controlbox.php?mode='+page+'&id='+par,'pagecontrol',1,3);			
	
	if ( page == 1 ){		
	
	
 		    document.getElementById('showcontainer').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';		
			http2.open("POST", "site/ajax/user_show_list.php?id="+par, true);			
			http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
 				        document.getElementById('showcontainer').innerHTML = http2.responseText;	
				}
			  }
			http2.send(null);	
			

			
	}		
	// useer_show_control.php option 2 = go back to main page with list of all shows
	if ( page == 2 ){		
 		    document.getElementById('showcontainer').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';		
			http2.open("POST", "site/ajax/user_show_list_main.php", true);			
			http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
 				        document.getElementById('showcontainer').innerHTML = http2.responseText;	
				}
			  }
			http2.send(null);		
			
	
	 
	}		
	if ( page == 3 ){				 
			var value = document.getElementById('playlist_dropdown').options[document.getElementById('playlist_dropdown').selectedIndex].value;		 			
			if ( value == '' ){				
	 		 GB_showCenter("Add new show", "http://woho.tv/site/ajax/user_show_add.php?back=1",400,550);												
			}
			else
			{		
		     document.getElementById('showcontainer').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';			
			 http2.open("POST", "site/ajax/user_show_list.php?id="+value, true);			
			 http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
		 			    document.getElementById('showcontainer').innerHTML = http2.responseText;				  		  
				}
			  }
			http2.send(null);					
			}				
	}		
		rozwin_menu(1,0,par);		
		
		
	};
	
	function preview(show, user){
	
		 GB_showCenter("Preview show", "http://woho.tv/site/ajax/user_show_preview.php?id="+show+"&userid="+user,440,630);		
		
	};
	
	function preview_playlist(show, user){
	
		 GB_showCenter("Preview show", "http://woho.tv/site/ajax/user_playlist_preview.php?id="+show+"&userid="+user,440,630);		
		
	};	
	
	function preview_normal(show){
	
	user_profile(6);
	setTimeout('user_show_control_page(1,'+show+')',1000);
		
	};	

	
	function show_video_add(show){
		
		 GB_showCenter("Upload file", "http://woho.tv/site/ajax/user_show_upload.php?id="+show,600,600);					
		
	};
	
	function advert_video_add(show){
		
		 GB_showCenter("Upload advertisment file", "http://woho.tv/site/ajax/user_advert_upload.php?id="+show,600,600);					
		
	};
	
	function rozwin_menu(id, mode, par){		
	if ( document.getElementById('menu'+id).className == 'menu_closed' && mode != 0 ){	
		document.getElementById('menu'+id).className = 'menu_expand';
		document.getElementById('menu'+id+'b').style.display = 'block';
		document.getElementById('menu_text').style.color = 'black';		
		document.getElementById('ico2'+id).src = 'img/triangle2.gif';		
	}
	else
	{
		// 800 maximum number of items in list
		if ( par != 800 ){ document.getElementById('menu_text').innerHTML = document.getElementById('item'+par).innerHTML; }
		document.getElementById('menu'+id).className = 'menu_closed';
		document.getElementById('menu'+id+'b').style.display = 'none';
		document.getElementById('menu_text').style.color = 'white';	
		document.getElementById('ico2'+id).src = 'img/triangle1.gif';					
	}		
	};
	
	function menu_universal(id, mode){		

	if ( document.getElementById('menu'+id).className == 'menu_closed' && mode != 0 ){	
		document.getElementById('menu'+id).className = 'menu_expand';
		document.getElementById('menu'+id+'b').style.display = 'block';
		document.getElementById('menu_text').style.color = 'black';		
		document.getElementById('ico'+id).src = 'img/triangle2.gif';		
	}
	else
	{
		// 800 maximum number of items in list
		document.getElementById('menu'+id).className = 'menu_closed';
		document.getElementById('menu'+id+'b').style.display = 'none';
		document.getElementById('menu_text').style.color = 'white';	
		document.getElementById('ico'+id).src = 'img/triangle1.gif';					
	}		
	
	};	
	
	function rozwin_menu_main(mode){	
	
	if ( document.getElementById('menumainini').className == 'menu_closed' && mode != 0){	
		document.getElementById('menumainini').className = 'menu_expand';
		document.getElementById('menu1bmain').style.display = 'block';
	//	document.getElementById('menu_text_main').style.color = 'black';		
	}
	else
	{
		document.getElementById('menumainini').className = 'menu_closed';
		document.getElementById('menu1bmain').style.display = 'none';
		document.getElementById('menu_text_main').style.color = 'white';	
	}		
	};	
	
	
	function remove_show(id,shownumber){	
		var confirmmess = confirm("Are you sure you want to do that. All items from that show will be moved to reository");
		if (confirmmess){ 
			ajax_reload('site/ajax/user_show_remove.php?id='+id+"&shownumber="+shownumber,'debug',0,1); 
			ajax_reload('site/ajax_data/shows_dropdown.php','menu1b',0,2); 			
			$("#show"+id).slideUp("slow"); 		
		}
	};
	
	function edit_show(id){ GB_showCenter("Edit show", "http://woho.tv/site/ajax/user_show_edit.php?id="+id,400,550); };	
	
	function change_show_status(id,status) { 				
 		 ajax_reload('site/ajax/user_show_status.php?id='+id+'&status='+status,'status'+id,0,1); 	
	};	
	function change_show_status_list(id,status) { 				
		 ajax_reload('site/ajax/user_show_status_list.php?id='+id+'&status='+status,'status'+id,0,1); 	
	};		
	function change_movie_status_list(id,status) { 				
		 ajax_reload('site/ajax/user_movie_status_list.php?id='+id+'&status='+status,'status'+id,0,1); 	
	};	
	function moveshow(id){	
		 GB_showCenter("Move item", "http://woho.tv/site/ajax/user_show_move.php?id="+id,400,520);				
	};	
	function movevideo(id){	
		 GB_showCenter("Move item", "http://woho.tv/site/ajax/user_playlist_move_save.php?id="+id,400,520);				
	};		
	function mixtable(id) { 	
	
		     document.getElementById('user_profile').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';			
			 http2.open("POST", "site/user_show_mixbox.php?id="+id, true);			
			 http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
		 			    document.getElementById('user_profile').innerHTML = http2.responseText;				  		 						
				}
			  }
			http2.send(null);					
	};
	function dropmenu(id, show, ext){

		$("#drop"+id).toggle("fast"); 	
		if ( id == 1 ){ ajax_reload('site/ajax_data/repository.php?id='+show,'drop'+id,1,1); }
		if ( id == 2 ){ ajax_reload('site/ajax_data/playlist.php?id='+show+'&idplaylist='+ext,'drop'+id,1,1); }		
		if ( id == 3 ){ ajax_reload('site/ajax_data/adverts.php?id='+show,'drop'+id,1,1); }				
		
	};
	
	function dropmenusearch(id){

		$("#drop"+id).toggle("fast"); 	
		if ( id == 1 ){ ajax_reload('site/ajax_data/languages.php','drop'+id,1,1); }
		if ( id == 2 ){ ajax_reload('site/ajax_data/genre.php','drop'+id,1,1); }		
		if ( id == 3 ){ ajax_reload('site/ajax_data/last.php','drop'+id,1,1); }				
		
	};	
	
	function dropmenusearchchannels(id){

		$("#drop"+id).toggle("fast"); 	
		if ( id == 1 ){ ajax_reload('site/ajax_data/languages_channels.php','drop'+id,1,1); }
		if ( id == 2 ){ ajax_reload('site/ajax_data/genre_channels.php','drop'+id,1,1); }		
		if ( id == 3 ){ ajax_reload('site/ajax_data/last.php','drop'+id,1,1); }				
		
	};		
	
	function dropmenusearchshows(id){

		$("#drop"+id).toggle("fast"); 	
		if ( id == 1 ){ ajax_reload('site/ajax_data/languages_shows.php','drop'+id,1,1); }
		if ( id == 2 ){ ajax_reload('site/ajax_data/genre_shows.php','drop'+id,1,1); }		
		if ( id == 3 ){ ajax_reload('site/ajax_data/last.php','drop'+id,1,1); }				
		
	};		
	
	function addtoshow(id, show, typ){

//		$("#itemrep"+id).toggle("slow"); 	
//		 ajax_reload('site/ajax/php?id='+show,'debug',0,1); 	

		     document.getElementById('showtable').innerHTML = '<img src=http://woho.tv/img/loader3.gif> Loading...</div>';			
			 http2.open("POST", 'site/ajax/user_mixtable.php?add='+id+'&show='+show+'&type='+typ, true);		
			 
			 http2.onreadystatechange=function() {
				if(http2.readyState == 4) {
		 		
					document.getElementById('showtable').innerHTML = http2.responseText;	
					
					var dragsort = ToolMan.dragsort()
					var junkdrawer = ToolMan.junkdrawer()										
					junkdrawer.restoreListOrder("boxes");
					dragsort.makeListSortable(document.getElementById("boxes"), saveOrder);			
					
												
						
					}					
						
				}
			http2.send(null);					
	
					
	};	
	
	
	function user_show_www(id, mode, info,channel){
		

		ajax_reload('site/ajax_data/showinfo.php?id='+id+"&mode="+mode+"&info="+info+"&channel="+channel,'intro2',1,3);
		document.getElementById('menu1').className = 'menu_closed';		
		document.getElementById('menu1b').style.display = 'none';		
		document.getElementById('menu_text').style.color = 'white';			
		document.getElementById('ico21').src = 'img/triangle1.gif';			
//		document.getElementById('menu_text').innerHTML = document.getElementById('item'+id).innerHTML; 	

	};
	
	function user_profile_show(channel, mode){
		
		ajax_reload('site/ajax_data/user_info.php?id='+mode+"&channel="+channel,'intro2',1,3);
		document.getElementById('menu1').className = 'menu_closed';		
		document.getElementById('menu1b').style.display = 'none';		
		document.getElementById('menu_text').style.color = 'white';			
		document.getElementById('ico21').src = 'img/triangle1.gif';				
		
	};
	
	
	// -------------------------------------------------------------------f----------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------				
	
	
	function main(){
		
		var mode = document.getElementById('view').innerHTML;
		
		if ( mode == 1 ){
		ajax_reload('site/ajax_data/showlist.php','page',1,1);
		document.getElementById('view').innerHTML =  '2';
		document.getElementById('name').innerHTML =  'User shows';		
		}
		else
		{
		ajax_reload('site/ajax_data/channellist.php','page',1,1);			
		document.getElementById('view').innerHTML =  '1';		
		document.getElementById('name').innerHTML =  'User channels';			
		}
	
	};
	
	
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// -----------------------------------------------------------------------------------------
	// --------------------------------------------------------------------user_show.php
		
	// windownr - 1 user_show , typ -1 show -2 playlist
	function playshowitem(movie_id,movie_position,show_id,user_id,typ,windownr,base_show_id,info){	
	
	// hold if it's a playlist or showlist
	var view = document.getElementById('viewdebug').innerHTML;	
	// hod current show or playlist number
	var internal = document.getElementById('internaldebug').innerHTML;
			
	// typ = 2 - playlsit / typ = 1 - show typ = 3 load just playlist and play
	if ( typ == 3 ){		
	
			ajax_reload('site/ajax/user_player.php?mode=1&showid='+show_id+'&userid='+user_id+'&autostart=1','player_container',1,2);
			document.getElementById('viewdebug').innerHTML = '1';
			document.getElementById('internaldebug').innerHTML = ''+show_id+''	
			user_show_www(base_show_id,typ,info,user_id);			
			loadpagepersonal(2,user_id,show_id);			
	}
	else
	{
			if ( internal == show_id && typ == view ){		

				gotoXVideo(movie_position);				
			}
			else
			{		
				document.getElementById('viewdebug').innerHTML = ''+typ+'';
				document.getElementById('internaldebug').innerHTML = ''+show_id+'';	
				ajax_reload('site/ajax/user_player.php?mode='+typ+'&showid='+show_id+'&userid='+user_id,'player_container',1,2);	
				setTimeout('gotoXVideo('+movie_position+')',1000);				
				user_show_www(base_show_id,typ,info,user_id);

				
			}
	}
	
	};
	
	// Loading both playlist and playlist list mode = 1 playlist 2 show
	function loadlist(mode,user_id,item_id){
	
	if (  mode == 1 ){
		
		document.getElementById('viewdebug').innerHTML = '2';
		document.getElementById('internaldebug').innerHTML = ''+item_id+'';		
		
		loadpagepersonal(3,user_id,item_id);
		user_player(2,user_id,item_id);			
//		user_show_www(item_id,2,2,user_id);			
	
	
	}
	if ( mode == 2 ){
		loadpagepersonal(2,user_id,item_id);		
	}
		
	};
	
	function joincommunity(id){ 
		ajax_reload('site/ajax/user_community_join.php?id='+id,'community',1,2);	
		loadpagepersonal(1,id,1);
	};		
	
	function joincommunityshow(id){ 
		ajax_reload('site/ajax/user_community_join.php?id='+id,'community',1,2);	
		loadpageshow(10,id,1)
	};		
	
	
	
	function record_introduction(){
		GB_showCenter("Record Introduction", "http://woho.tv/site/ajax/record_introduction.php",330,350); 		
	};
	
	function upload_introduction(){
		GB_showCenter("Upload Introduction", "http://woho.tv/site/ajax/upload_introduction.php",130,350); 		
	};
	
	// bacl tell you to go back to add file list. Empty back means go directly to list
	function channel_add(id){
		GB_showCenter("Add new channel", "http://woho.tv/site/ajax/channel_add_new.php?back="+id,580,650); 		
	};	
	
	// bacl tell you to go back to add file list. Empty back means go directly to list
	function channel_add_file(id){
		GB_showCenter("Add new channel", "http://woho.tv/site/ajax/channel_add_file.php?back="+id,580,650); 		
	};		
	
	function channel_edit(id){
		GB_showCenter("Edit channel details", "http://woho.tv/site/ajax/channel_edit.php?id="+id,420,460); 				
	};
		
	
	
	// open mychannels window
	function mychannels(){
		GB_showCenter("My channels", "http://woho.tv/site/ajax/mychannels.php",450,450); 		
	};		
	

	function user_mychannel_add(channel){
		ajax_reload('site/ajax/user_mychannel_add.php?channel='+channel,'debug',1,2);	
		ajax_reload("site/ajax/tv_infobox.php?id=15",'infotv',1,3);		
		document.getElementById('mychannel').innerHTML = 'On your favorite list';
	};
		

	$(document).ready(function(){ // This sets the opacity of the thumbs to fade down to 60% when the page loads
	
	$(".fade").hover(function(){
	$(this).fadeTo("fast", 0.8); // This should set the opacity to 100% on hover
	},function(){
	$(this).fadeTo("fast", 1.0); // This should set the opacity back to 60% on mouseout
	});
	
	});	
	
	jQuery(document).ready(function(){ // This sets the opacity of the thumbs to fade down to 60% when the page loads
		jQuery(".DOdisabled").fadeTo("fast", 0.4); // This should set the opacity to 100% on hover
		jQuery(".DOdisabled").attr("disabled","disabled");
	});		
	
		
	function searchtag(){
		
		searchtagvalue = document.getElementById('searchtag').value;
		window.location="http://woho.tv/search_"+searchtagvalue+".html";
		
		
	};
	
	function searchtag_dwa(){
		
		searchtagvalue = document.getElementById('searchtagdwa').value;
		window.location="http://woho.tv/search_"+searchtagvalue+".html";
		
		
	};	
	
	function searchtag_trzy(){
		
		searchtagvalue = document.getElementById('searchtagtrzy').value;
		window.location="http://woho.tv/search_"+searchtagvalue+".html";
		
		
	};		
	
	function tooltip(){
	
		$(document).ready(JT_init);
		
		function JT_init(){
				   $("a.jTip")
				   .hover(function(){JT_show(this.href,this.id,this.name)},function(){$('#JT').remove()})
				   .click(function(){return false});	   
		}
			
			
	};
	
	function playlist_add(id, channel){
		
		GB_showCenter("Add to playlist", "http://channel.woho.tv/site/ajax/tv_playlist_add.php?id="+id+"&channel="+channel,400,500);			
		
		
	};
	
	function sendinv(par){

		var email = document.getElementById('inviteemail').value;
		
		if ( email == '' || email == 'Enter email' ){
			alert("Enter email first");
		}
		else
		{
		ajax_reload('site/ajax/user_inv.php?email='+email+"&par="+par,'inv1',1,2);			
		}
		
	};
	
	function sendinv2(par,email_in,div){

		if ( email_in == 0 ){
			
		var email = document.getElementById('inviteemail2').value;
		
		}
		else
		{
		var email = email_in;	
		}
		
		if ( email == '' || email == 'Enter email' ){
			alert("Enter email first");
		}
		else
		{
		ajax_reload('site/ajax/user_inv.php?email='+email+"&par="+par,div,1,2);			
		}
		
	};	
	
	function help(id){
	
		 GB_showCenter("Help window", "http://woho.tv/site/ajax/help.php?id="+id,300,300);		
		
	};

	function show_movie(id){
	
		 GB_showCenter("Show movie", "http://woho.tv/site/ajax/user_website_show_movie.php?id="+id,425,622);		
		
	};
	
	function about(id){
		ajax_reload('site/ajax_data/about_info.php?id='+id,'about',1,2);	
	};
	
	function flickrsearch(mode,page,tag){
		
		if ( mode == 1 ){
		 var tags = document.getElementById('flickr').value;	
		}
		else
		{
		 var tags = tag.replace(' ','%20');
		}
		
		ajax_reload('site/flickr/flickr_page.php?page='+page+'&tag='+tags,'flickrpage',1,2);			
	};
	
	function flickrsave(www){
	
			ajax_reload('site/flickr/flickr_save.php?wwww='+wwww,'debug',1,2);	
		
	};
	
	function changeicon(id,na, komunikat){
		
				document.getElementById("infocontrol").innerHTML = komunikat;	
				document.getElementById(''+id+'').src = 'img/control_shade/'+na+'.png';
	};
	
	function report_bug(www){
		
		GB_showCenter("Report a bug", "http://woho.tv/site/ajax/report_bug.php?www="+www,580,650); 				
		
	};
	
	function playlist_select(id){

		
		var id2 = document.getElementById('playlistname').options[document.getElementById('playlistname').selectedIndex].value;
	
	
		ajax_reload('site/ajax_data/playlist.php?id='+id+'&idplaylist='+id2,'drop2',1,1);
		
	};
	
	function channel_tag(){
	
		ajax_reload('site/ajax_data/channels_tags.php','page',1,1);
		
	}
	
	function export_show(id){
		GB_showCenter("Export show", "http://woho.tv/site/ajax/show_export.php?id="+id,580,650); 				
	}
	
	
	function export_channel(id){
		GB_showCenter("Export channel", "http://woho.tv/site/ajax/channel_export.php?id="+id,580,650); 				
	}	
	
	function export_playlist(id,user){
		GB_showCenter("Export playlist", "http://woho.tv/site/ajax/playlist_export.php?id="+id+"&channel="+user,580,650); 				
	}		
	
	function import_playlist(id,user){
		GB_showCenter("Import playlist", "http://woho.tv/site/ajax/playlist_import.php?id="+id+"&user="+user,580,650); 						
	}
	
	
	function import_playlist_itunes(id,user){	
		GB_showCenter("Import playlist", "http://woho.tv/site/ajax/playlist_import_itunes.php?id="+id+"&user="+user,580,650); 						
	}	
	
	function set_thb(ktore){
		ajax_reload('site/ajax/user_profile_step2.php?id='+ktore,'user_profile',1,1);		
	}
	
	function menuitemtv(id,ktore, channel){
	if ( id == 1 ){	ajax_reload('site/ajax/tv_community.php?id='+ktore+'&channel='+channel,'la2',1,1); }
	if ( id == 2 ){	ajax_reload('site/ajax/tv_dashboard.php?id='+ktore+'&channel='+channel,'la3',1,2); }	
	
	}
	
	function addcommentchannel(channel,user){
		
	
		if ( document.getElementById('commentid').value == '' ){		
			alert("Please enter text first");				
		}
		else
		{			
		var comment = document.getElementById('commentid').value;
		comment = str_replace(' ','%20',comment);
			
		http2.open("POST", "site/ajax/tv_dashboard.php?channel="+channel+"&iduser="+user+"&value="+comment, true); 		
		  http2.onreadystatechange=function() {
			if(http2.readyState == 4) {
			document.getElementById('la3').innerHTML = http2.responseText;	
			}
		  }		  
		  http2.send(null);										
		}				
	};	
	
	function operation_show(id, show){
		
		if ( id == 1 ){ $("#operationarea1").toggle("slow"); }
		if ( id == 2 ){ $("#operationarea2").toggle("slow"); }				
		if ( id == 3 ){ ajax_reload('site/ajax/userpage_show_one_comments.php?show='+show,'operationarea3',1,1);}		
		if ( id == 4 ){ GB_showCenter("Embed show", "http://woho.tv/site/ajax/userpage_show_one_embed.php?show="+show,580,650); }				
		
		
	};
	
function addcommentshowone(channel){
		
	
		if ( document.getElementById('comment').value == '' ){		
			$(document).ready(function() {
			document.getElementById('mess').innerHTML = 'Please leave a message ;)';
			$("#mess").show("slow"); 
			});					
		}
		else
		{			
		var comment = document.getElementById('comment').value;
		comment = str_replace(' ','%20',comment);
			
		http2.open("POST", "site/ajax/userpage_show_one_comment_save.php?show="+channel+"&value="+comment, true); 		
		  http2.onreadystatechange=function() {
			if(http2.readyState == 4) {
			 ajax_reload('site/ajax/userpage_show_one_comments_view.php?show='+channel,'operationarea3',1,1);
			}
		  }		  
		  http2.send(null);										
		}				
	};		