
$(document).ready(function() {
    $("a[@rel='external']").addClass("external-link")
    .click(function() { window.open($(this).href()); return false; });	
});

function checksize() {
	window.onresize = windowresize;
}

var h_global;
var w_global;

function windowresize(isroot){
	if(window.innerHeight){
		//mozilla based navigators
		h = window.innerHeight;
		w = window.innerWidth ;
		//alert('firefox window height:' + h);
	} else {
		if(document.documentElement){
			//iexplorer based navigators
			h = document.documentElement.clientHeight;
			w = document.documentElement.clientWidth;
			//alert('explorer 6 window height:' + h);
		}
		else {
			if (document.body.clientHeight){
				h = document.body.clientHeight;
				w = document.body.clientWidth;
				//alert('other explorer window height:' + h);
			}
			else {
				h = 560;
				w = 780;
			}
		}
	}

	


	h = h-10; /*Le resto el margen por la sombra de arriba*/
	w = w-25; /*Le resto el ancho de la barra de scroll por si hay*/

	h_global = h;
	w_global = w;

	if(h < 630) {
		h = 630;
	} else 	if(h > 695){
			h = 695;
		}

	if(w > 1000){
		w = 1000;
	} else
		if(w < 780){
			w = 780;
		}




	if(window.innerHeight){
		/*var content_h = document.body.parentNode.scrollHeight;*/
		var h_wrapper = parseInt(document.getElementById('center-content').scrollHeight);
		h_wrapper = h_wrapper + 60;

		if(h_wrapper > h){
			h = h_wrapper;
		}

		if(isroot){h = h + 400;}
		

		document.getElementById('sidebar-left').style.height = (h - 100) +'px';
		
		

		document.getElementById('background').style.height = h +'px';
		document.getElementById('wrapper').style.height = h +'px';
		document.getElementById('left-shadow').style.height = h +'px';

		document.getElementById('container').style.height = (h - 100) +'px';
		document.getElementById('center').style.height = (h - 100) +'px';
		document.getElementById('center-content').style.height = (h - 100 -20 -40 ) +'px'; /*100 del header, 70 del padding arriba y abajo, 76 de la altura y padding footer*/
		
		
	}else{


		document.getElementById('sidebar-left').style.height = (h - 100 ) +'px';

		
		document.getElementById('background').style.height = h +'px';
		document.getElementById('wrapper').style.height = h +'px';
		document.getElementById('left-shadow').style.height = h +'px';
		
		document.getElementById('container').style.height = (h - 100) +'px';
		document.getElementById('center').style.height = (h - 100) +'px';
		document.getElementById('center-content').style.height = (h - 100 -70 ) +'px'; /*100 del header, 70 del padding arriba y abajo, 76 de la altura y padding footer*/
		document.getElementById('footer-logo').style.marginBottom = '0px'; 
		document.getElementById('footer-logo').style.paddingBottom = '0px'; 
		
	}

	
	
	document.getElementById('left-shadow').style.width = w +'px';
	document.getElementById('top-shadow').style.width = w +'px';
	document.getElementById('top-right-shadow').style.width = w +'px';
	document.getElementById('top-left-shadow').style.width = w +'px';
	document.getElementById('bottom-shadow').style.width = w +'px';
	document.getElementById('bottom-right-shadow').style.width = w +'px';
	document.getElementById('bottom-left-shadow').style.width = w +'px';
	document.getElementById('wrapper').style.width = (w-20) +'px';
	document.getElementById('background').style.width = (w-20) +'px';
	document.getElementById('header-region').style.width = (w-20) +'px';	
	document.getElementById('center-content').style.width = (w-278) + 'px';
	
	/*document.getElementById('footer').style.height = '30px';*/
		


	/*Si el ancho de la ventana es menor de 1000px, que wrapper sea 100%. Si es menor que 780, que sea wrapper 780. Si es mayor que 1000, que wrapper sea 1000*/
	/*Si el alto de la ventana es menor que 560, que el alto de wrapper, sea 560 y de sidebar y de container, 460*/
	/*Si el alto de la ventana es mayor que 720, que el alto de wrapper sea 720 y de sidebar y de container sea 620*/

}


function showLogin(){
	jQuery('#user-form').fadeIn("slow", loginCallback);
}

function loginCallback(){
	var login = document.getElementById('user-form');
	var opacity = '95';
	login.style.opacity=opacity/100;
	login.style.filter='alpha(opacity='+opacity+')';
}

function hideLogin(){
	var login = document.getElementById('user-form');
	jQuery('#user-form').fadeOut("slow");
}

function showHandCursor(object){
	object.style.cursor = 'pointer';
}