function content(file)
{
    var cont = $('content');
    new Ajax.Request('ajax.php',
    {
        method: 'get',
        parameters: 'do=load_content&file=content+' + file,
        onSuccess: function(obj)
        {
            cont.innerHTML = obj.responseText;
        },
        onLoading: function()
        {
            cont.innerHTML = '<div align="center"><img src="http://habbohut.com/images/layout/loading.gif" alt="Loading" title="Loading" /></div>';
        }
  });
}

function showContent(hide){
	var overlay = 'black-underlay';
	var content = 'content-overlay';
 
	var objOverlay = $(overlay);
	var objContent = $(content);
	var arrayPageSize = getPageSize();
	
	if(hide == 1){
		objOverlay.hide();
		objContent.hide();	
	}else{
		objOverlay.setStyle({height: arrayPageSize[1] + 'px'});
		objOverlay.show();
		objContent.show();
                objContent.innerHTML = '<div class="close-button"><a href="javascript:showContent(\'1\');">Close</a></div>';
	}
}

function issue_preview(magid){
    var preview = $('preview');
    new Ajax.Request('ajax.php',
    {
        method: 'get',
        parameters: 'do=mag_preview&id=' + magid,
        onSuccess: function(obj)
        {
            preview.innerHTML = obj.responseText;
        },
        onLoading: function()
        {
            preview.innerHTML = '<div align="center"><img src="http://habbohut.com/images/layout/loading.gif" alt="Loading" title="Loading" /></div>';
        }
  });
}

function issue_load(url,parts,part){
    showContent();
    var content = 'content-overlay';
    var objContent = $(content);
    
    if(parts == 1){
        var file = 'content+magazine+issues+'+ url +'+index.html';
    }
    
    if(parts == 2){
        var file = 'content+magazine+issues+'+ url +'+part'+ part +'+index.html';
    }
    
    new Ajax.Request('ajax.php',
    {
        method: 'get',
        parameters: 'do=mag_load&file=' + file,
        onSuccess: function(obj)
        {
            objContent.innerHTML += 'A new window should pop up!';
        },
        onLoading: function()
        {
            objContent.innerHTML += '<div align="center"><img src="http://habbohut.com/images/layout/loading.gif" alt="Loading" title="Loading" /></div>';
        }
  });
}

function contact_us()
{
    var process = $('submit_form');
    var form_div = $('submit_contact_form');
    var form = $('contact_submit_form');
    
    if($F('name') == '' || $F('email') == '' || $F('subject') == '' || $F('message') == ''){
        process.innerHTML = 'Please complete all fields.';
        return false;
    }else{
        process.innerHTML = '';
    }
    
    new Ajax.Request('content/about/contact_us_process.php',
    {
        method: 'post',
        parameters: form.serialize(true),
        onSuccess: function(obj)
        {
            if(obj.responseText == '0'){
                process.innerHTML = 'An unexpected has occurred.';
                form.enable();
            }else{
                form_div.innerHTML = obj.responseText;
                form_div.hide();
                Effect.Appear('submit_contact_form');
            }
        },
        onLoading: function()
        {
            form.disable();
            process.innerHTML = '<img src="/images/layout/loading-bar.gif" alt="Loading" title="Loading" />';
        }
  });
}

function contact_us_b()
{
    var process = $('submit_form');
    var form_div = $('submit_contact_form2');
    var form = $('contact_submit_form2');
    
    if($F('message') == ''){
        process.innerHTML = 'Please complete all fields.';
        return false;
    }else{
        process.innerHTML = '';
    }
    
    new Ajax.Request('content/about/retrieve_process.php',
    {
        method: 'post',
        parameters: form.serialize(true),
        onSuccess: function(obj)
        {
            if(obj.responseText == '0'){
                process.innerHTML = 'An unexpected has occurred.';
                form.enable();
            }else{
                form_div.innerHTML = obj.responseText;
                form_div.hide();
                Effect.Appear('submit_contact_form2');
            }
        },
        onLoading: function()
        {
            form.disable();
            process.innerHTML = '<img src="/images/layout/loading-bar.gif" alt="Loading" title="Loading" />';
        }
  });
}

function send_request()
{
    var process = $('submit_form');
    var form_div = $('submit_request_form');
    var form = $('request_submit_form');
    
    if($F('name') == '' || $F('type') == '' || $F('message') == ''){
        process.innerHTML = 'Please complete all fields.';
        return false;
    }else{
        process.innerHTML = '';
    }
    
    new Ajax.Request('content/radio/requests_process.php',
    {
        method: 'post',
        parameters: form.serialize(true),
        onSuccess: function(obj)
        {
            if(obj.responseText == '0'){
                process.innerHTML = 'An unexpected has occurred.';
                form.enable();
            }else{
                form_div.innerHTML = obj.responseText;
                form_div.hide();
                Effect.Appear('submit_request_form');
            }
        },
        onLoading: function()
        {
            form.disable();
            process.innerHTML = '<img src="/images/layout/loading-bar.gif" alt="Loading" title="Loading" />';
        }
  });
}

new Ajax.PeriodicalUpdater('stats', '/content/radio/stats/4_stats.php',{
    method: 'get',frequency: 15,decay: 1
});

new Ajax.PeriodicalUpdater('statsie', '/content/radio/stats/show_stats.php',{
    method: 'get',frequency: 15,decay: 1
});

new Ajax.PeriodicalUpdater('dj_says', '/content/radio/stats/4_djsays.php',{
    method: 'get',frequency: 15,decay: 1
});

function HomeBanner()
{
	$('shoutout').style.background = "url(images40hbk/home_banner.png) no-repeat";
}

function AboutBanner()
{
	$('shoutout').style.background = "url(images40hbk/about_banner.png) no-repeat";
}

function NewsBanner()
{
	$('shoutout').style.background = "url(images40hbk/news_banner.png) no-repeat";
}

function GoodiesBanner()
{
	$('shoutout').style.background = "url(images40hbk/goodies_banner.png) no-repeat";
}

function CommunityBanner()
{
	$('shoutout').style.background = "url(images40hbk/community_banner.png) no-repeat";
}

function AboutNav()
{
	$('sub_about').style.display = "block";
	$('sub_community').style.display = "none";
	$('hide_nav').style.display = "none";
}

function CommunityNav()
{
	$('sub_about').style.display = "none";
	$('sub_community').style.display = "block";
	$('hide_nav').style.display = "none";
}

function ClearNav()
{
	$('sub_about').style.display = "none";
	$('sub_community').style.display = "none";
	$('hide_nav').style.display = "block";
}

