function switch_to_live(nr)
{
	loadLive('/theme/motorshow2007/xml/motorshow'+nr+'.xml','live'+nr);
	new Ajax.Updater('video-titolo', '/content/livetitle/title/Live+TV+'+nr+'/update/video-titolo', {asynchronous:true, evalScripts:false});
}


function list_vod_channel(id, update, count)
{
	new Ajax.Updater(update, '/index.php/content/video_list/CatId/'+id+'/count/'+count, {asynchronous:true, evalScripts:true, onComplete:function(request, json){frontend_hide('ticker_loader'+count, 'ticker'+count)}, onLoading:function(request, json){frontend_show('ticker_loader'+count, 'ticker'+count)}})
}
function list_vod_channel2(id)
{
	new Ajax.Updater('ticker', '/index.php/content/video_list/CatId/'+id, {asynchronous:true, evalScripts:true, onComplete:function(request, json){frontend_hide('ticker_loader', 'ticker')}, onLoading:function(request, json){frontend_show('ticker_loader', 'ticker')}})
}
function pager_hide(id)
{
	var temp  = document.getElementById(id);
	if(temp && temp !="undefined")
	{
		temp.style.display="none";
	}
}
function pager_show(id)
{
	var temp  = document.getElementById(id);
	if(temp && temp !="undefined")
	{
		temp.style.display="block";
	}
}
function frontend_hide(id)
{
	document.getElementById(id).style.display = "none";
}
function frontend_show(id)
{
	document.getElementById(id).style.display = "block";
}
function videolist_hide(id){
	document.getElementById(id).style.display = "none";
}
function videolist_show(id){
	document.getElementById(id).style.display = "block";
}
function hidePlayerInfo(){
	new Effect.SlideUp('player_info',{queue:{scope:'myscope', position:'end', limit: 1}});
}
function showTellForm(){
	var theForm = document.getElementById('tellAFirend');
	if (theForm.style.display =='none') {
		theForm.style.display='block';
	}else{
		theForm.style.display='none';
	}
}
function validateComment(content_id){
	alert(content_id);
	var name = document.getElementById('name').value;
	var comment = document.getElementById('comment').value;

	if ((name == "") && (comment == ""))
	{
		alert("Inserite i vostri dati!");
	}else{
		new Ajax.Updater('comment_view', '/frontend_dev.php/comment/update/content_id/'+content_id+'/name/'+name+'/comment/'+comment, {asynchronous:true, evalScripts:false}); return false;
	}
}


function targetBlank (url) {
  blankWin = window.open(links[thisimg],'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=yes,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
}


var imgs = new Array(); var links = new Array();
var imgcnt = 0; var thisimg = 0;
links[imgcnt] = 'http://hr.turistika.tv';
imgs[imgcnt++] = '/theme/turistika/images/ttv_hr.jpg';
links[imgcnt] = 'http://bih.turistika.tv';
imgs[imgcnt++] = '/theme/turistika/images/ttv_bih.jpg';

/*
function rotate() {
	if (document.images) {
		thisimg++;
		if (thisimg >= imgcnt) thisimg = 0;
		document.rollimg.src = imgs[thisimg];
		setTimeout("rotate();",10000);
	}
}
setTimeout("rotate();",10000);
*/




   var contentHeight = 0;     // The total height of the content
    var visibleContentHeight = 0;
    var scrollActive = false;

    var scrollHandleObj = false; // reference to the scroll handle
    var scrollHandleHeight = false;
    var scrollbarTop = false;
    var eventYPos = false;

    var scrollbuttonActive = false;
    var scrollbuttonDirection = false;
    var scrollbuttonSpeed = 2; // How fast the content scrolls when you click the scroll buttons(Up and down arrows)
    var scrollTimer = 10;    // Also how fast the content scrolls. By decreasing this value, the content will move faster

    var scrollMoveToActive = false;
    var scrollMoveToYPosition = false;
    function scrollDiv_startScroll(e)
    {
        if(document.all)e = event;
        scrollbarTop = document.getElementById('scrolldiv_theScroll').offsetTop;
        eventYPos = e.clientY;
        scrollActive = true;
    }

    function scrollDiv_stopScroll()
    {
        scrollActive = false;
        scrollbuttonActive = false;
        scrollMoveToActive = false;
    }
    function scrollDiv_scroll(e)
    {
        if(!scrollActive)return;
        if(document.all)e = event;
        if(e.button!=1 && document.all)return;
        var topPos = scrollbarTop + e.clientY - eventYPos;
        if(topPos<0)topPos=0;
        if(topPos/1>visibleContentHeight-(scrollHandleHeight+4)/1)topPos = visibleContentHeight-(scrollHandleHeight+4);
        document.getElementById('scrolldiv_theScroll').style.top = topPos + 'px';
        document.getElementById('scrolldiv_content').style.top = 0 - Math.floor((contentHeight) * ((topPos)/(visibleContentHeight-scrollHandleHeight)))+'px'
    }

    /*
    Click on the slider
    Move the content to the this point
    */
    function scrolldiv_scrollMoveToInit(e)
    {
        if(document.all)e = event;
        scrollMoveToActive = true;
        scrollMoveToYPosition = e.clientY - document.getElementById('scrolldiv_scrollbar').offsetTop;
        if(document.getElementById('scrolldiv_theScroll').offsetTop/1 > scrollMoveToYPosition) scrollbuttonDirection = scrollbuttonSpeed*-2; else  scrollbuttonDirection = scrollbuttonSpeed*2;
        scrolldiv_scrollMoveTo();
    }

    function scrolldiv_scrollMoveTo()
    {
        if(!scrollMoveToActive || scrollActive)return;
        var topPos = document.getElementById('scrolldiv_theScroll').style.top.replace('px','');
        topPos = topPos/1 + scrollbuttonDirection;
        if(topPos<0){
            topPos=0;
            scrollMoveToActive=false;
        }
        if(topPos/1>visibleContentHeight-(scrollHandleHeight+4)/1){
            topPos = visibleContentHeight-(scrollHandleHeight+4);
            scrollMoveToActive=false;
        }
        if(scrollbuttonDirection<0 && topPos<scrollMoveToYPosition-scrollHandleHeight/2)return;
        if(scrollbuttonDirection>0 && topPos>scrollMoveToYPosition-scrollHandleHeight/2)return;
        document.getElementById('scrolldiv_theScroll').style.top = topPos + 'px';
        document.getElementById('scrolldiv_content').style.top = 0 - Math.floor((contentHeight) * ((topPos)/(visibleContentHeight-scrollHandleHeight)))+'px'
        setTimeout('scrolldiv_scrollMoveTo()',scrollTimer);
    }

    function cancelEvent()
    {
        return false;
    }

    function scrolldiv_scrollButton()
    {
        if(this.id=='scrolldiv_scrollDown')scrollbuttonDirection = scrollbuttonSpeed; else scrollbuttonDirection = scrollbuttonSpeed*-1;
        scrollbuttonActive=true;
        scrolldiv_scrollButtonScroll();
    }
    function scrolldiv_scrollButtonScroll()
    {
        if(!scrollbuttonActive)return;
        var topPos = document.getElementById('scrolldiv_theScroll').style.top.replace('px','');
        //if(!topPos) topPos = 0;
        topPos = topPos/1 + scrollbuttonDirection;
        if(topPos<0){
            topPos=0;
            scrollbuttonActive=false;
        }
        if(topPos/1>visibleContentHeight-(scrollHandleHeight+4)/1){
            topPos = visibleContentHeight-(scrollHandleHeight+4);
            scrollbuttonActive=false;
        }
        document.getElementById('scrolldiv_theScroll').style.top = topPos + 'px';
        document.getElementById('scrolldiv_content').style.top = 0 - Math.floor((contentHeight) * ((topPos)/(visibleContentHeight-scrollHandleHeight)))+'px'
        setTimeout('scrolldiv_scrollButtonScroll()',scrollTimer);
    }
    function scrolldiv_scrollButtonStop()
    {
        scrollbuttonActive = false;
    }


    function scrolldiv_initScroll()
    {
        var ch = document.getElementById('scrolldiv_content').offsetHeight;
        var ph = document.getElementById('scrolldiv_parentContainer').offsetHeight;
        if(ch>ph) document.getElementById('scrolldiv_slider').style.display='block';
        visibleContentHeight = document.getElementById('scrolldiv_scrollbar').offsetHeight ;
        contentHeight = document.getElementById('scrolldiv_content').offsetHeight - visibleContentHeight;
        scrollHandleObj = document.getElementById('scrolldiv_theScroll');
        scrollHandleHeight = scrollHandleObj.offsetHeight;
        scrollbarTop = document.getElementById('scrolldiv_scrollbar').offsetTop;
        document.getElementById('scrolldiv_theScroll').onmousedown = scrollDiv_startScroll;
        document.body.onmousemove = scrollDiv_scroll;
        document.getElementById('scrolldiv_scrollbar').onselectstart = cancelEvent;
        document.getElementById('scrolldiv_theScroll').onmouseup = scrollDiv_stopScroll;
        if(document.all)document.body.onmouseup = scrollDiv_stopScroll; else document.documentElement.onmouseup = scrollDiv_stopScroll;
        document.getElementById('scrolldiv_scrollDown').onmousedown = scrolldiv_scrollButton;
        document.getElementById('scrolldiv_scrollUp').onmousedown = scrolldiv_scrollButton;
        document.getElementById('scrolldiv_scrollDown').onmouseup = scrolldiv_scrollButtonStop;
        document.getElementById('scrolldiv_scrollUp').onmouseup = scrolldiv_scrollButtonStop;
        document.getElementById('scrolldiv_scrollUp').onselectstart = cancelEvent;
        document.getElementById('scrolldiv_scrollDown').onselectstart = cancelEvent;
        document.getElementById('scrolldiv_scrollbar').onmousedown = scrolldiv_scrollMoveToInit;

    }
    /*
    Change from the default color
    */
    function scrolldiv_setColor(rgbColor)
    {
        document.getElementById('scrolldiv_scrollbar').style.borderColor = rgbColor;
        document.getElementById('scrolldiv_theScroll').style.backgroundColor = '#F4A6D7';
        document.getElementById('scrolldiv_scrollUp').style.borderColor = rgbColor;
        document.getElementById('scrolldiv_scrollDown').style.borderColor = rgbColor;
        document.getElementById('scrolldiv_scrollUp').style.color = rgbColor;
        document.getElementById('scrolldiv_scrollDown').style.color = rgbColor;
        document.getElementById('scrolldiv_parentContainer').style.borderColor = rgbColor;
    }
    /*
    Setting total width of scrolling div
    */
    function scrolldiv_setWidth(newWidth)
    {
        document.getElementById('dhtmlgoodies_scrolldiv').style.width = newWidth + 'px';
        document.getElementById('scrolldiv_parentContainer').style.width = newWidth-30 + 'px';
    }

    /*
    Setting total height of scrolling div
    */
    function scrolldiv_setHeight(newHeight)
    {
        document.getElementById('dhtmlgoodies_scrolldiv').style.height = newHeight + 'px';
        document.getElementById('scrolldiv_parentContainer').style.height = newHeight + 'px';
        document.getElementById('scrolldiv_slider').style.height = newHeight + 'px';
        document.getElementById('scrolldiv_scrollbar').style.height = newHeight-40 + 'px';
    }
    /*
    Setting new background color to the slider
    */
    function setSliderBgColor(rgbColor)
    {
        document.getElementById('scrolldiv_scrollbar').style.backgroundColor = rgbColor;
        document.getElementById('scrolldiv_scrollUp').style.backgroundColor = rgbColor;
        document.getElementById('scrolldiv_scrollDown').style.backgroundColor = rgbColor;
    }
    /*
    Setting new content background color
    */
    function setContentBgColor(rgbColor)
    {
        document.getElementById('scrolldiv_parentContainer').style.backgroundColor = rgbColor;
    }

    /*
    Setting scroll button speed
    */
    function setScrollButtonSpeed(newScrollButtonSpeed)
    {
        scrollbuttonSpeed = newScrollButtonSpeed;
    }
    /*
    Setting interval of the scroll
    */
    function setScrollTimer(newInterval)
    {
        scrollTimer = newInterval;
    }
    function loadScroll(){
        scrolldiv_setColor('#FFFFFF');    // Setting border color of the scrolling content
        setScrollButtonSpeed(1);    // Setting speed of scrolling when someone clicks on the arrow or the slider
        setScrollTimer(5);    // speed of 1 and timer of 5 is the same as speed of 2 and timer on 10 - what's the difference? 1 and 5 will make the scroll move a little smoother.
        scrolldiv_setWidth(520);    // Setting total width of scrolling div
        scrolldiv_setHeight(393);    // Setting total height of scrolling div
        scrolldiv_initScroll();    // Initialize javascript functions
    }
	var sp1;
	var currentPage;
	function createPager(p){
		if(p){
			sp1 = new Spry.Widget.SlidingPanels('ticker'+p);
			currentPage=1;
		}else{
			sp1 = new Spry.Widget.SlidingPanels('ticker');
			currentPage=1;
		}
	}
    function pager(page){
    	currenttPage = page;
	}
	function pagerNext(pages){
		document.getElementById('current_page').innerHTML
		if(currentPage<pages)
			currentPage++;
		document.getElementById('current_page').innerHTML = currentPage;
		sp1.showNextPanel();
		
	}
	function pagerPrev(pages){
		if(currentPage>1)
		currentPage--;
		document.getElementById('current_page').innerHTML = currentPage;
		sp1.showPreviousPanel();
		
	}
	
	var selected = "content_info";
	function changeInfo(active){
		if (active != selected){
			new Effect.SlideUp(selected);
			new Effect.BlindDown(active);
			selected = active;
		}
	}
	
	var openLink = 0;
	function openPage(link){
		document.getElementById('frame_open_link').src = link;
		if(openLink == 0){
  			Effect.toggle('link_open_div','slide');
  			openLink = 1;
  		}
  	}
  	function closePage(){
  		Effect.toggle('link_open_div','slide');
  		openLink = 0;
  	}
  	function openChiSiamo(){
 		var stringId = 'chi_siamo';
 	 	window.open("/frontend.php/staticpage/showByStringId?string_id="+stringId,
 		"test","menubar=0, resizable=1, scrollbars=1; status=0, left=100, top=100, width=600,height=400");
 	}
 	
 	
 	function startclock()
	{
		var thetime=new Date();
		
		var nhours=thetime.getHours();
		var nmins=thetime.getMinutes();
		var nsecn=thetime.getSeconds();
		var nday=thetime.getDay();
		var nmonth=thetime.getMonth();
		var ntoday=thetime.getDate();
		var nyear=thetime.getYear();
		var AorP=" ";
		
		if (nhours>=12)
		    AorP="P.M.";
		else
		    AorP="A.M.";
		
		if (nsecn<10)
		 nsecn="0"+nsecn;
		
		if (nmins<10)
		 nmins="0"+nmins;
		
		if (nday==0)
		  nday="Sunday";
		if (nday==1)
		  nday="Monday";
		if (nday==2)
		  nday="Tuesday";
		if (nday==3)
		  nday="Wednesday";
		if (nday==4)
		  nday="Thursday";
		if (nday==5)
		  nday="Friday";
		if (nday==6)
		  nday="Saturday";
		
		nmonth+=1;
		
		if (nyear<=99)
		  nyear= "19"+nyear;
		
		if ((nyear>99) && (nyear<2000))
		 nyear+=1900;
		
		document.getElementById("clock_time").innerHTML = nhours+":"+nmins+":"+nsecn;
		
		setTimeout('startclock()',1000);
	
	} 
	
function resizeQTPlayer(player_id, newWidth, newHeight)
{
	var qt_player = document.getElementById(player_id);
	qt_player.style.width = newWidth + 'px';
	qt_player.style.height = newHeight + 'px';
}

function resizeRMPlayer(player_id, newWidth, newHeight, zoom)
{
	var rm_player = document.getElementById(player_id);
	var real_player_con = document.getElementById(player_id + '_con');
	
	if(zoom){
		if(real_player_con){
			real_player_con.style.visibility = 'visible';
			real_player_con.style.width = newWidth + 'px';
			real_player_con.style.height = '36px';
			newHeight = newHeight - 36;
		}	
	}
	else{
		if(real_player_con){
			real_player_con.style.visibility = 'hidden';
			real_player_con.style.width = '0px';
			real_player_con.style.height = '0px';
		}
		
	}
	
	rm_player.style.width = newWidth + 'px';
	rm_player.style.height = newHeight + 'px';
}

function reSizeAndShow(divId, newWidth, newHeight, showDivId)
{
	//flv i silverlight player
	var player2 = document.getElementById('player2');
	//wmv player
	var player1 = document.getElementById('player1');
	
	//quicktime player ie and firefox
	var qt_player_obj = document.getElementById('qt_player_obj');
	var qt_player_emb = document.getElementById('qt_player_emb');
	
	if(qt_player_obj)
		resizeQTPlayer('qt_player_obj', newWidth, newHeight);
	if(qt_player_emb)
		resizeQTPlayer('qt_player_emb', newWidth, newHeight);
	// ------------------------------- 
	
	//real player player ie and firefox
	var real_player_obj = document.getElementById('real_player_obj');
	var real_player_emb = document.getElementById('real_player_emb');
	
	if(real_player_obj)
		resizeRMPlayer('real_player_obj', newWidth, newHeight, false);
	if(real_player_emb)
		resizeRMPlayer('real_player_emb', newWidth, newHeight, false);
	// ------------------------------- 
	
	if(player2){
		document.getElementById(divId).style.width = newWidth + 'px';
		document.getElementById(divId).style.height = newHeight + 'px';
	}
	
	if(player1){
		resizeWMVPlayer(0);
	}
	
	document.getElementById('related_content').style.display = 'none';
	
	document.getElementById('video_full').style.display = 'block';
	document.getElementById('info_details').style.display = 'block';

	
	document.getElementById(showDivId).style.display = 'block';
	
	if(showDivId == 'content_images')
		scrollContentImages();
}

function isExplorer() {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return true; alert("e");
	} else {
		return false
	}
};
	
function resizeWMVPlayer(zoom){
 	
 		var id = null;
 		if(isExplorer()){
 			id = "player1";
 		}
 		else{
 			id = "embed_player1";
 		}
		
		vendor = navigator.vendor;
		
		//ako je safari
		if(vendor == 'Apple Computer, Inc.')
			id = 'player1';
			
 		if(zoom == 1){
 			zoomP = 1;
	 		
	 		if(id == "embed_player1" || vendor == 'Apple Computer, Inc.')
	 			document.getElementById(id).style.position = "absolute";
	 		
	 		document.getElementById(id).style.width = '600px';
	 		document.getElementById(id).style.height = '315px';
	 		
	 		document.getElementById('PlayerControls').style.position = "relative";
	 		document.getElementById('PlayerControls').style.display = "block";
	 		//document.getElementById('PlayerControls').style.left = 10;
 		}else{
 			//document.getElementById(id).style.left = 0;
 			
 			if(id == "embed_player1" || vendor == 'Apple Computer, Inc.')
 				document.getElementById(id).style.position = "relative";
 			
 			document.getElementById(id).style.width = '250px';
 			document.getElementById(id).style.height = '180px';
 			
 			document.getElementById('PlayerControls').style.position = "relative";
 			document.getElementById('PlayerControls').style.display = "none";
 		}
 	}

function fullSize(divId, newWidth, newHeight)
{
	document.getElementById('video_full').style.display = 'none';
	document.getElementById('related_content').style.display = 'none';
	document.getElementById('info_details').style.display = 'none';
	
	//flv i silverlight player
	var player2 = document.getElementById('player2');
	//wmv player
	var player1 = document.getElementById('player1');
	
	//quicktime player ie and firefox
	var qt_player_obj = document.getElementById('qt_player_obj');
	var qt_player_emb = document.getElementById('qt_player_emb');
	
	if(qt_player_obj)
		resizeQTPlayer('qt_player_obj', 600, 338);
	if(qt_player_emb)
		resizeQTPlayer('qt_player_emb', 600, 338);
	// ------------------------------- 
	
	//real player player ie and firefox
	var real_player_obj = document.getElementById('real_player_obj');
	var real_player_emb = document.getElementById('real_player_emb');
	
	if(real_player_obj)
		resizeRMPlayer('real_player_obj', 600, 338, true);
	if(real_player_emb)
		resizeRMPlayer('real_player_emb', 600, 338, true);
	// ------------------------------- 
	
	
	if(player2){
		document.getElementById(divId).style.width = newWidth + 'px';
		document.getElementById(divId).style.height = + newHeight + 'px';
	}
	
	if(player1){
		resizeWMVPlayer(1);
	}
}


function openStaticPage(string_id)
{
	new Ajax.Updater('contentlist', '/staticpage/showByStringId/string_id/' + string_id + '/update/contentlist', 
	{asynchronous:true, evalScripts:true, onComplete:function(request, json)
	{frontend_hide('contentlist_loader');frontend_show('contentlist');}, 
	onLoading:function(request, json){videolist_hide('contentlist');
	frontend_show('contentlist_loader');}});;return false;
}

function epg()
{
	window.open("/frontend.php/live_playlist/programInfo",
 	"test","menubar=0, resizable=1, scrollbars=1, status=0, left=100, top=100, width=720,height=580");
 
}

function scrollContentImages()
{
	if(document.getElementById('images_scrollholder').style.display != 'block')
	{
		document.getElementById('images_scrollholder').style.display = 'block';
		ScrollLoad ('images_scrollholder', 'images_scroll', 1);
	}
}

function changeStyleCss(css){
	if(css!='')
		document.getElementById('styles').href = css;
}
function openRelatedContent(id){
	new Ajax.Updater('content_list', '/frontend.php/content/relatedcontent/ContentId/'+id, {asynchronous:true, evalScripts:true, onComplete:function(request, json){frontend_hide('content_list_loader');frontend_show('content_list');}, onLoading:function(request, json){videolist_hide('content_list');frontend_show('content_list_loader');}}); return false;
}
function dole(obj, event){
	obj.buttonDown(event, obj.scrollDown.bind(obj))
}
var sb = null;
function initializeScroll(id,sroll_height){
	sb = new ScrollBox(document.getElementById(id),{scroll_increment:sroll_height});
}

function showDesc(id){
	jQuery("#_description").html(jQuery("#"+id).html());
	
	if(id == 'long_desc'){
		document.getElementById('component2').style.display = 'none';
		document.getElementById('component1').style.display = 'none';
	}else{
		document.getElementById('component2').style.display = 'block';
		document.getElementById('component1').style.display = 'block';
	}
	
}

var selected_subcahnnel = "";
function showSubchannels(id){

	document.getElementById("subcategories").style.display="block";
	if(selected_subcahnnel != ""){
		document.getElementById(selected_subcahnnel).style.display="none";
	}
	if(document.getElementById(id))
		document.getElementById(id).style.display="block";
	
	selected_subcahnnel = id;
	
}


  var current_position = null;
  var last_selected = null;  
  var enable_chapter_controls = false;
  function playerReady(obj) {
		player = document.getElementById(obj['id']);
		
		player.addControllerListener("ITEM","plyItem");
		player.addModelListener("STATE","stateTracker");
	};
	
	function stateTracker(obj)
	{
		if(obj.newstate == 'COMPLETED') player.sendEvent("STOP");
	};
  function playVideo(idx)
  {
     player.sendEvent('ITEM', idx);
  };
  
  function timeHandler(t){
  	if(enable_chapter_controls)
		current_position = Math.round(t.position);
	else
		current_position = 0;
  }
  
  function doSeek(seek_position){
  	if(enable_chapter_controls)
  		player.sendEvent('SEEK', seek_position);
  }
  function plyItem(obj){
  		current_position = 0;
		if(obj.id == "ply"){
			playing = obj.index;
			
			last = obj.index;
			if(!locked)
				selectItem(playing);
			
			if(player.getPlaylist()[1].title){
		    	document.getElementById('title_box').innerHTML = player.getPlaylist()[obj.index].title;
		    	//document.getElementById('publication_time').style.display="block";
		    }
		}

		if(obj.id == "playlist"){
			if(player.getPlaylist()[obj.index].id != content_id){
				enable_chapter_controls = false;
			}
				
			if(player.getPlaylist()[obj.index].id == content_id){
				enable_chapter_controls = true;
				player.addModelListener("TIME","timeHandler");
			}
			
		}
  };

function hq_open_login(){
    document.getElementById('L-BoxLogin').style.display = "block";
	//document.getElementById('gd_welcome_not_logged').style.display = "none";
	jQuery("#L-BoxLogin").effect('pulsate',{ times:2 },500);
	
	jQuery.scrollTo(0, 1000);
}

function openDescription(id, height){
	document.getElementById("continua_"+id).style.display = "none";
	jQuery("#details_description_"+id).animate({"height": height}, "slow");
}

function closeDescription(id){
	jQuery("#details_description_"+id).animate({"height": "50"}, "slow");
	document.getElementById("continua_"+id).style.display = "inline";

}
function selectArchivio(selected_cat){
	document.getElementById('archivio_link').style.color="#000000";
	document.getElementById('archivio_link').style.fontWeight="bold";
	if(selected_cat){
		document.getElementById("cat"+selected_cat).style.color="#FFFFFF";
		document.getElementById("cat"+selected_cat).style.fontWeight="normal";
		document.getElementById('subcategories').style.display='none';
	}
}

function unselectCategory(selected_cat){
	if(selected_cat){
		document.getElementById("cat"+selected_cat).style.color="#FFFFFF";
		document.getElementById("cat"+selected_cat).style.fontWeight="normal";
		document.getElementById("archivio_link").style.color="#FFFFFF";
		document.getElementById("archivio_link").style.fontWeight="normal";
		document.getElementById('subcategories').style.display='none';
	}
}

function playContent(environment, content_id, channel_id){
	var dns_name = window.location.hostname;
	var link = '';
	var channel = '';
	
	if(environment == 'dev')
		link = '/frontend_dev.php';
		
	if(channel_id)
		channel = '/CatId/'+channel_id;
		
		
	new Ajax.Updater(
		'video_box', 
		link+'/content/show/ContentId/'+content_id+'/update/video_box'+channel, 
		{
			asynchronous:true,
			evalScripts:true
		}
	);
	new Ajax.Updater(
		'video_box_right', 
		'/content/details/ContentId/'+content_id+'/update/video_box_right'+channel, 
		{
			asynchronous:true, 
			evalScripts:true
		}
	);
	if(typeof updateCurrentLink == 'function') updateCurrentLink('http://'+dns_name+link+'/content/show/ContentId/'+content_id+channel)
	jQuery.scrollTo(0, 1500);
}

function expandVideo(){
	document.getElementById('video_box_right').style.display = "none";
	document.getElementById('player2').style.width = "925px";
	document.getElementById('player2').style.height = "345px";
	document.getElementById('video_box').style.marginTop = "0px";
}

function constrictVideo(){

}

