function change_size ()
{
	//document.getElementById('body').onresize = change_size;
	var background_image_height = 800;
	var background_image_width = 1203;
	var content = document.getElementById('content');
	var cap = document.getElementById('cap');
	var footer = document.getElementById('footer');
	var extra = document.getElementById ('extra');
	var extra2 = document.getElementById ('extra_2');
	var padding = document.getElementById('padding');

	var new_left = parseInt (content.offsetLeft) + parseInt(content.offsetWidth);

	var window_height;
	var window_width;

	if (window.innerHeight)	{
		window_height = window.innerHeight;
	}
	else{
		window_height = document.documentElement.clientHeight;
	}

	if (window.innerWidth)	{
		window_width = window.innerWidth;
	}
	else{
		window_width = document.documentElement.clientWidth;
	}

	if (window_height > background_image_height){
		if (navigator.appVersion.indexOf('MSIE 6.0') != -1){
			padding.style.height = window_height - background_image_height + 0 + 'px';
			footer.style.marginLeft = '22.9%';
			footer.style.marginTop = '-63px';
		}
		else if (navigator.appVersion.indexOf('MSIE 7.0') != -1){
			footer.style.top = background_image_height - 62 + 'px';
			footer.style.marginLeft = '13.8%';
			padding.style.height = window_height - background_image_height + 65 + 'px';
			cap.style.top = background_image_height + 'px';
			cap.style.height = window_height - background_image_height + 'px';
			cap.style.display = 'block';
			cap.style.width = '100%';
		}else{
			footer.style.top = background_image_height - 60 + 'px';
			padding.style.height = window_height - background_image_height + 65 + 'px';
			cap.style.top = background_image_height + 'px';
			cap.style.height = window_height - background_image_height + 'px';
			cap.style.display = 'block';
		}
	}
	else{
		if (navigator.appVersion.indexOf('MSIE 6.0') != -1){
			padding.style.height = '0px';
			footer.style.marginLeft = '22.9%';
			footer.style.marginTop = '-3px';
		}
		else if (navigator.appVersion.indexOf('MSIE 7.0') != -1){
			footer.style.top = 'auto';
			footer.style.marginLeft = '13.45%';
			padding.style.height = '70px';
		}else{
			footer.style.top = 'auto';
			padding.style.height = '72px';
		}
	}

	if (window_width < background_image_width){
		if (navigator.appVersion.indexOf('MSIE 6.0') == -1){
			footer.style.marginLeft = '0';
		}
	}

	if (navigator.appVersion.indexOf('MSIE 6.0') == -1){
		//extra.style.left = new_left + 'px';
		extra.style.display = 'block';
	}else{
		//extra2.style.left = new_left + 'px';
		extra2.style.display = 'block';
	}

	if (document.getElementById('noticia')){
		var noticia = document.getElementById('noticia');
		noticia.style.height= 600 + 'px';
	}

	footer.style.left = content.offsetLeft + 'px';
	footer.style.display = 'block';
}

function div_dark(){
	var background_image_height = 800;
	var footer = document.getElementById('footer');
	var cap = document.getElementById('cap');
	var window_height;

	if (window.innerHeight)	window_height = window.innerHeight;
	else window_height = document.documentElement.clientHeight;

	if (window_height > background_image_height){
		footer.style.marginBottom = window_height - background_image_height + 'px';
		cap.style.top = background_image_height + 'px';
		cap.style.height = window_height - background_image_height + 'px';
		cap.style.display = 'block';
	}
}

function on_scroll()
{
	if (navigator.appVersion.indexOf('MSIE 6.0') != -1){
		change_size ();
	}
}

var open_news = null;

function show_noticia(id)
{
	var noticia = document.getElementById('contenido_noticia_' + id);
	if (noticia)
	{
		if (open_news != null && noticia != open_news)
		{
			open_news.style.display = 'none';
		}

		if (noticia.style.display == 'none')
		{
			open_news = noticia;
			noticia.style.display = 'block';
		}
		else
		{
			open_news = null;
			noticia.style.display = 'none';
		}
	}
}

$(document).ready(function() {
	$('#formacio').click(function(){
		$('#tipos_formacion').slideToggle("fast");
	});
	$('#aula').click(function(){
		$('#aulas').slideToggle("fast");
	});
	if (navigator.appVersion.indexOf('MSIE 6.0')!=-1) {
		var win_height=$(window).height();
		var body_height=$("body").height();
		if(body_height>win_height && body_height>800) {
			$(window).scroll(function() {
				var scroll_top=$(window).scrollTop();
				$("#cap").css("top",800+scroll_top);
			});
		 }
	}
});
