window.onload = function(){
	adjustFooter();
}

function start_socialfeed(){
	new Ajax.Updater('explanation_message', '/users/start', {asynchronous:true, evalScripts:true, onLoading:function(request){loading('explanation_message')}}); return false;
}

function loading(area){
	document.getElementById(area).innerHTML = '<dt class="Explanation1-Label"></dt><dd class="Explanation1-Text"><p><img src="/images/gif/loading.gif"/></p><p>Initialzing and personalizing SocialFeed</p></dd>'
}

function hideAll() {
	var display_tag = document.getElementsByClassName("desc");
	for (var i = 0; i < display_tag.length; i++) {
		display_tag[i].style.display = "none";
	}
}
	
function showAll() {
	var display_tag = document.getElementsByClassName("desc");
	for (var i = 0; i < display_tag.length; i++) {
		display_tag[i].style.display = "block";
	}

}
function showOrHide(id,isShow) {
	ele = document.getElementById(id);
	if (isShow){
		ele.style.display = "block";}
	else{
		ele.style.display = "none";}		
}

window.onresize = function(){
	adjustFooter();
}
function fieldInit(obj,val){
	if($(obj)){obj = $(obj);}
	if(obj.value == val){
		obj.value = '';
	}
}


function nodeValueListener(){
	var obj_spanElements;
	array_nodeValue = new Array();
	obj_spanElements = document.getElementsByTagName('span');
	for(var i = 0; i < obj_spanElements.length; i++){
		if(obj_spanElements[i].className == 'nodeValue'){
			array_nodeValue.push(obj_spanElements[i]);
		}
	}
	for(var i = 0; i < array_nodeValue.length; i++){
		array_nodeValue[i].parentNode.title = array_nodeValue[i].firstChild.nodeValue;
	}
}

function adjustFooter(){
	switch ($("Contents").className){
		case 'columnTypeA':
			if($("columnA-1").clientHeight > $("columnA-2").clientHeight){
				$("Contents").style.height = $("columnA-1").clientHeight + 'px';
			}
			else{
				$("Contents").style.height = $("columnA-2").clientHeight + 'px';
			}
			break;
		case 'columnTypeB':
			if($("columnB-2").clientHeight > $("columnB-1").clientHeight){
				$("Contents").style.height = $("columnB-2").clientHeight + 'px';
			}
			else{
				$("Contents").style.height = $("columnB-1").clientHeight + 'px';
			}
			break;
		case 'columnTypeC':
			if($("columnC-2").clientHeight > $("columnC-1").clientHeight){
				$("columnTypeCWrapper").style.height = $("columnC-2").clientHeight + 'px';
			}
			else{
				$("columnTypeCWrapper").style.height = $("columnC-1").clientHeight + 'px';
			}
			break;
	}
}