var box_id = 0;

//TAB MENU START
// TAB 1
$(document).ready(function(){
$('#tabs1 div').hide(); // Hide all divs
$('#tabs1 div:first').show(); // Show the first div
$('#tabs1 ul li:first').addClass('active'); // Set the class of the first link to active
$('#tabs1 ul li a').click(function(){ //When any link is clicked
$('#tabs1 ul li').removeClass('active'); // Remove active class from all links
$(this).parent().addClass('active'); //Set clicked link class to active
var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
$('#tabs1 div').hide(); // Hide all divs
$(currentTab).show(); // Show div with id equal to variable currentTab
return false;
});
});

//TAB 2
$(document).ready(function(){
$('#tabs2 div').hide(); // Hide all divs
$('#tabs2 div:first').show(); // Show the first div
$('#tabs2 ul li:first').addClass('active'); // Set the class of the first link to active
$('#tabs2 ul li a').click(function(){ //When any link is clicked
$('#tabs2 ul li').removeClass('active'); // Remove active class from all links
$(this).parent().addClass('active'); //Set clicked link class to active
var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
$('#tabs2 div').hide(); // Hide all divs
$(currentTab).show(); // Show div with id equal to variable currentTab
return false;
});
});
//TAB MENU END 

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel();
});

jQuery(function($){
   $("#date").mask("9999-99-99");
});


$(function() {

	$(".submit1").click(function() {

		var name = $("#name").val();
		var type = "comment";
		//var box_id = 5;
		var comment = $("#comment").val();
		var dataString = 'name='+ name + '&comment=' + comment + '&type=' + type + '&bid=' + box_id;
		
		if(box_id == 0){
		
		alert('Tartalom megosztáshoz válassz egy műsort!');
		
		}else{
			if(name=='' || comment==''){
			
			alert('Kérlek írj be egy szöveget! Figyelem a tartalom megosztáshoz be kell jelentkezned!');
			
			}
			else{
				$.ajax({
				type: "POST",
				url: HOST_PREFIX+"inc/commentajax.php",
				data: dataString,
				cache: false,
				success: function(html){
			 
					//$('#hozzaszolas').load(HOST_PREFIX+'inc/commentajax.php');
					Lapozo(1,box_id);					
					$("#comment").val('');
				
				}
				});
			}
		}
		return false;
	});
});

$(function() {

	$(".submit2").click(function() {

		var name = $("#name").val();
		var type = "link";
		var comment = $("#link").val();
		var dataString = 'name='+ name + '&comment=' + comment + '&type=' + type + '&bid=' + box_id;
		
		if(box_id == 0){
		
		alert('Tartalom megosztáshoz válassz egy műsort!');
		
		}else{		
		
			if(name=='' || comment==''){
			
			alert('Kérlek írj be egy linket! Figyelem a tartalom megosztáshoz be kell jelentkezned!');
			
			}
			else{
				$.ajax({
				type: "POST",
				url: HOST_PREFIX+"inc/commentajax.php",
				data: dataString,
				cache: false,
				success: function(html){
			 
					//$('#hozzaszolas').load(HOST_PREFIX+'inc/commentajax.php');
					Lapozo(1,box_id);
					$("#link").val('');
				
				}
				});
			}
		}
		return false;
	});
});

$(function() {

	$(".submit3").click(function() {

		var name = $("#name").val();
		var type = "video";
		var comment = $("#video").val();
		var dataString = 'name='+ name + '&comment=' + comment + '&type=' + type + '&bid=' + box_id;
		
		if(box_id == 0){
		
		alert('Tartalom megosztáshoz válassz egy műsort!');
		
		}else{		
		
			if(name=='' || comment==''){
			
			alert('Kérlek linkelj be egy videót! Figyelem a tartalom megosztáshoz be kell jelentkezned!');
				
			}
			else{
				$.ajax({
				type: "POST",
				url: HOST_PREFIX+"inc/commentajax.php",
				data: dataString,
				cache: false,
				success: function(html){
			 
					//$('#hozzaszolas').load(HOST_PREFIX+'inc/commentajax.php');
					Lapozo(1,box_id);
					$("#video").val('');
				
				}
				});
			}
		}	
		return false;
	});
});

$(function() {

	$(".submit4").click(function() {

		var name = $("#name").val();
		var type = "kep";
		var comment = $("#kep").val();
		var dataString = 'name='+ name + '&comment=' + comment + '&type=' + type + '&bid=' + box_id;
		
		if(box_id == 0){
		
		alert('Tartalom megosztáshoz válassz egy műsort!');
		
		}else{		
		
			if(name=='' || comment==''){
			
			alert('Kérlek linkelj be egy képet! Figyelem a tartalom megosztáshoz be kell jelentkezned!');
			
			}
			else{
				$.ajax({
				type: "POST",
				url: HOST_PREFIX+"inc/commentajax.php",
				data: dataString,
				cache: false,
				success: function(html){
			 
					//$('#hozzaszolas').load(HOST_PREFIX+'inc/commentajax.php');
					Lapozo(1,box_id);
					$("#kep").val('');
				
				}
				});
			}
		}
		return false;
	});
});

function Musor_Radio(tovabb,box){					
				
	$('#musor_radio').load(HOST_PREFIX+'inc/radio_musor.php?tovabb='+tovabb);

		if(box != ''){
		
			Lapozo('1',box);
			
			box_id = box;
		
		}
		
}

function Lapozo(oldal,box){	
				//document.getElementById('LoadingAnim').style.visibility = "visible";
	$('#hozzaszolas').stop().animate({'opacity':'0.1'},200,function(){
		$('#hozzaszolas').load(HOST_PREFIX+'inc/commentajax.php?oldal='+oldal+'&box='+box,function(){
			$('#hozzaszolas').stop().animate({'opacity':'1'},200,function(){
								//document.getElementById('LoadingAnim').style.visibility = "hidden";
			});
		});
	});
}
				
function HTorles(oldal,hid,box){				
				
	$('#hozzaszolas').load(HOST_PREFIX+'inc/commentajax.php?oldal='+oldal+'&hid='+hid+'&box='+box);
				
}

function naptarFrissit(datum){
							
	$('#esemenynaptar').load(HOST_PREFIX+'inc/naptar.php?datum='+datum);
								
}
