$(document).ready(function(){
	var siteurl = '/site/';
    $(".menu-carroussel").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 4,
        //vertical: true,
        circular: false
    });
	 
	$('#panel').jScrollPane({showArrows:true,scrollbarWidth:24, scrollbarMargin:24});
	
	$.setNewChannel = function(channelContentID,video) {
		$('#panel').html('<img src="'+siteurl+'wp-content/themes/TVLFG/img/ajax-loader.gif">');
		//alert(siteurl+"wp-content/themes/TVLFG/getChannelVideosFromCategory.php?"+"cat_id="+channelContentID+'&video='+video);
		$.ajax({
		   type: "GET",
		   url: siteurl+"wp-content/themes/TVLFG/getChannelVideosFromCategory.php",
		   data: "cat_id="+channelContentID+'&video='+video,
		   
		   success: function(msg){
				$('#panel').html('' + msg+ '');
				$('#panel').jScrollPane({showArrows:true,scrollbarWidth:24, scrollbarMargin:24});
		   }
	   });
	}
	$.setNewChannelFree = function(channelContentID,video) {
		$('#panel').html('<img src="'+siteurl+'wp-content/themes/TVLFG/img/ajax-loader.gif">');
		//alert(siteurl+"wp-content/themes/TVLFG/getChannelVideosFromCategoryFree.php?"+"cat_id="+channelContentID+'&video='+video);
		$.ajax({
		   type: "GET",
		   url: siteurl+"wp-content/themes/TVLFG/getChannelVideosFromCategoryFree.php",
		   data: "cat_id="+channelContentID+'&video='+video,
		   
		   success: function(msg){
				$('#panel').html('' + msg+ '');
				$('#panel').jScrollPane({showArrows:true,scrollbarWidth:24, scrollbarMargin:24});
		   }
	   });
	}
	
	$.setNewVideoAndContent = function(channelContentID,video) {
		$('#panel').html('<img src="'+siteurl+'wp-content/themes/TVLFG/img/ajax-loader.gif">');
		$.ajax({
		   type: "GET",
		   url: siteurl+"wp-content/themes/TVLFG/getVideoContent.php",
		   data: "cat_id="+channelContentID+'&post_id='+video,
		   success: function(msg){
				$('#panel').html('' + msg+ '');
				$('#panel').jScrollPane({showArrows:true,scrollbarWidth:24, scrollbarMargin:24});
		   }
	   });
	}
	$.setNewVideoAndContentFree = function(channelContentID,video) {
		$('#panel').html('<img src="'+siteurl+'wp-content/themes/TVLFG/img/ajax-loader.gif">');
		$.ajax({
		   type: "GET",
		   url: siteurl+"wp-content/themes/TVLFG/getVideoContentFree.php",
		   data: "cat_id="+channelContentID+'&post_id='+video,
		   success: function(msg){
				$('#panel').html('' + msg+ '');
				$('#panel').jScrollPane({showArrows:true,scrollbarWidth:24, scrollbarMargin:24});
		   }
	   });
	}
	
	$.setNewVideoList = function(channelContentID,video) {
		$('div #videoList').html('<img src="'+siteurl+'wp-content/themes/TVLFG/img/ajax-loader.gif">');
		$.ajax({
		   type: "GET",
		   url: siteurl+"wp-content/themes/TVLFG/getChannelListFromCategory.php",
		   data: "cat_id="+channelContentID+'&video='+video,
		   success: function(msg){
	   
				$('div #videoList').html('' + msg+ '');
				
		   }
	   });
	}
	
	$.setNewVideoFree = function(videoContent,videoAuthor,videoPubDate,videoTitle,videoProvider,videoAutoPlay) {
		var flashvars = {
			file:videoContent,
			author:videoAuthor,
			date:videoPubDate,
			title:videoTitle
		};
		if(videoAutoPlay!=undefined){
			flashvars.autostart=true;
		}else{
			flashvars.autostart=false;			
		}
		var params = {
		wmode: "transparent",
		quality: "high" ,
		allowfullscreen:"true",
		allowscriptaccess:"always"		
		};
		var attributes = {};
		swfobject.embedSWF(siteurl+"wp-content/themes/TVLFG/swf/player.swf", "flashContent", "640px", "480px", "9.0.0", "_swf/expressInstall.swf",flashvars, params, attributes);
		window.location = "#player"; 
	}
	count=0;
	$.setNewVideo = function(videoContent,videoContentHD,videoProvider,videoAutoPlay,cpf,userid,postid,pedidoid,assinatype,token) {
		//alert("videoContent: "+videoContent+" videoContentHD:"+videoContentHD+" videoProvider:"+videoProvider+" videoProvider:"+videoProvider+" cpf:"+cpf+" userid:"+userid+" postid:"+postid+" pedidoid:"+pedidoid+" assinatype:"+assinatype+" token:"+token);
		var flashvars = {
			server:'http://www.tvlfg.com.br/',
			file:videoContent,
			fileHD:videoContentHD,
			user_login:cpf ,
			user_id:userid,
			post_id:postid,
			pedido_id:pedidoid,
			assina_type:assinatype,
			token:token
		};
		if(videoAutoPlay!=undefined){ 
			flashvars.autostart=true;
		}else{
			flashvars.autostart=false;			
		}
		var params = {
			wmode: "transparent",
			quality: "high" ,
			allowfullscreen:"true",
			allowscriptaccess:"always"		
		};
		var attributes = {};
		swfobject.embedSWF(siteurl+"wp-content/themes/TVLFG/swf/player1.swf", "flashContent", "640px", "511px", "9.0.0", "_swf/expressInstall.swf",flashvars, params, attributes);
		count++;
		
		window.location = "#player"; 
	}

	
	$(function(){ $("ul#ticker").liScroll(); }); 
	$.setCalendar = function(startDate,authorId) {
    $('#calendarPannel').html('<img src="'+siteurl+'wp-content/themes/TVLFG/img/ajax-loader.gif"> Aguarde. Processando pesquisa ...');
		$.ajax({
		   type: "GET",
		   url: siteurl+"wp-content/themes/TVLFG/calendar_date.php",
		   data: "author="+authorId+'&startDate='+startDate,
		   success: function(msg){
				$('#calendarPannel').html('' + msg+ '');
		   }
	   });
	}
});

