function openCategory(string_id){
	new Ajax.Updater('content_list', '/frontend.php/content/video_list/StringId/'+string_id, {asynchronous:true, evalScripts:true});
	new Ajax.Updater('bottom_content_list', '/frontend.php/contentcategory/show/string_id/'+string_id, {asynchronous:true, evalScripts:true});
}
function loadStaticPage(stringId)
{
	new Ajax.Updater('static_page_content', 
		'/staticpage/showByStringId?string_id=' + stringId, 
		{
			asynchronous:true, 
	 		evalScripts:true 
	 	});
}

function openStaticPage(stringId){
	document.getElementById('video_container').style.display = 'none';
	
	if(jQuery("#static_page_container").css('display') == 'block'){
		jQuery("#static_page_container").slideUp('normal', 
			function callback() {
 				jQuery("#static_page_content").html("");
 				openStaticPage(stringId);
 		});
	}	
	else{	
		jQuery("#static_page_container").slideDown('normal', 
			function callback() {
 				loadStaticPage(stringId);
 		});
 	}
}
function closeStaticPage(){
 	document.getElementById('static_page_container').style.display = 'none';
 	jQuery("#static_page_content").html("");
 	
 	if(document.getElementById('video_container').style.display == 'none')
 		document.getElementById('video_container').style.display = 'block';
 	else
		document.getElementById('video_container').style.visibility = 'visible';
}

function reSizeAndShow(divId, newWidth, newHeight, showDivId)
{
	var player2 = document.getElementById('player2');

	if(player2){
		document.getElementById(divId).style.width = newWidth + 'px';
		document.getElementById(divId).style.height = newHeight + 'px';
	}
	document.getElementById(showDivId).style.display = 'block';
	document.getElementById('video_full').style.display = 'block';
}

function fullSize(divId)
{
	document.getElementById('content_info1').style.display = 'none';
	document.getElementById('video_full').style.display = 'none';

	var player2 = document.getElementById('player2');
	
	if(player2){
		document.getElementById(divId).style.width = '588px';
		document.getElementById(divId).style.height = '336px';
	}
}

function toggleTerms(oc) {
    if (oc) {
        document.getElementById("register_text").style.display = "none";
        document.getElementById("register_terms").style.display = "block";

        if (document.getElementById('register_terms_scroll').style.display != 'block') {
            document.getElementById('register_terms_scroll').style.display = 'block';
            ScrollLoad("register_terms_scrollholder", "register_terms_scroll", 1);
        }
    }
    else {
        document.getElementById("register_terms").style.display = "none";
        document.getElementById("register_text").style.display = "block";
    }
}

function search_by_author(){
	document.getElementById('search').value = "";
	if(document.getElementById('author_id').value != ""){
		new Ajax.Updater('content_list', '/search/search/update/content_list', {	
			asynchronous:true, 
			evalScripts:true, 
			onComplete:function(request, json){frontend_hide('contents_loader');frontend_show('contents');}, 
			onLoading:function(request, json){videolist_hide('contents');frontend_show('contents_loader');},
			parameters: { author_id: document.getElementById('author_id').value}
		}); 
	}
	
	openAuthor(document.getElementById('author_id').value);

	return false;
	
}

function loadAuthor(author_id)
{
        new Ajax.Updater('static_page_content',
                '/author/show?id=' + author_id,
                {
                        asynchronous:true,
                        evalScripts:true
                });
}


function openAuthor(author_id){
        document.getElementById('video_container').style.visibility = 'hidden';

        if(jQuery("#static_page_container").css('display') == 'block'){
                jQuery("#static_page_container").slideUp('normal',
                        function callback() {
                                jQuery("#static_page_content").html("");
                                openAuthor(author_id);
                });
        }
        else{
                jQuery("#static_page_container").slideDown('normal',
                        function callback() {
                                loadAuthor(author_id);
                });
        }
}

function search_click(){
	document.getElementById('author_id').value = "";
}
