function getWindowDimensions() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	    myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return {width: myWidth, height: myHeight};
}

function showElements(menus){
	var i = 0;
	for(i; i < menus.length; i++){
		if($(menus[i])){
			$(menus[i]).style.visibility = "visible";
		}
	}
}

function hideElements(menus){
	var i = 0;
	for(i; i < menus.length; i++){
		if($(menus[i])){
			$(menus[i]).style.visibility = "hidden";
		}
	}
}

function showBlockElements(menus){
	var i = 0;
	for(i; i < menus.length; i++){
		if($(menus[i])){
			$(menus[i]).style.display = "block";
		}
	}
}

function hideBlockElements(menus){
	var i = 0;
	for(i; i < menus.length; i++){
		if($(menus[i])){
			$(menus[i]).style.display = "none";
		}
	}
}

function toggleElement(elemId){
	if($(elemId)){
		var whatState = $(elemId).style.visibility;
		whatState = whatState == 'visible' ? 'hidden' : 'visible';
		$(elemId).style.visibility = whatState;
	}
}

function centerElement(elem, fromTop){
	if($(elem)){
		var dims = getWindowDimensions();
		$(elem).style.left = ((dims.width - $(elem).offsetWidth) / 2) + "px";
		if(fromTop){
			$(elem).style.top = fromTop + "px";
		}else{
			$(elem).style.top = (((dims.height - $(elem).offsetHeight) / 2) - 100) + "px";
		}
	}
}

