/*
________________________________________
¤¤¤ Common: Template byBrick ¤¤¤
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function getForm(){
	for(var i=0; i < 5; i++){
		if(document.forms[i].name.indexOf('j_id') > -1){
			return document.forms[i];
		}
	}
	
	return document.forms[0];
}

function showAltTextF2K(objName, txt, bToggleHideShowSelecteBoxes){
	var objAltMsg = document.getElementById(objName);
	if(objAltMsg){
		objAltMsg.innerHTML = txt;
		objAltMsg.style.width = '200px';
		if(txt.length > 100){
			objAltMsg.style.width = '400px';
		}
		objAltMsg.style.display = "block";
		if(bToggleHideShowSelecteBoxes){
			toggleHideShowAllSelectBoxesF2K(false);
		}
	}
}


function hideAltTextF2K(objName){
	var objAltMsg = document.getElementById(objName);
	if(objAltMsg){
		objAltMsg.style.display = "none";
		toggleHideShowAllSelectBoxesF2K(true);
	}
}

function toggleHideShowAllSelectBoxesF2K(bShow){
	var appName = navigator.appName;
	if(appName.indexOf("Microsoft") > -1){
		var i = 0;
	  var selectObjects = document.getElementsByTagName("select")
	  if(selectObjects){
	  	for(var i=0; i < selectObjects.length; i++){
	  		if(selectObjects[i].type == "select-one"){
					if(bShow){  			
		  			selectObjects[i].style.visibility = "visible";
		  		}
		  		else {
		  			selectObjects[i].style.visibility = "hidden";
		  		}
	  		}
	  	}
	  }
  }
}

 
function rootOver(obj, bCurrent){
	if(obj){
		if(bCurrent){
			obj.style.backgroundColor = "#898989";
		}
		else{
			obj.style.backgroundColor = "#6e6e6e";
		}
	}
}

function rootOut(obj, bCurrent){
	if(obj){
		if(bCurrent){
			obj.style.backgroundColor = "#6e6e6e";
		}
		else{
			obj.style.backgroundColor = "#565656";
		}
	}
}

function subOver(obj, bCurrent){
	if(obj){
		if(bCurrent){
			obj.style.backgroundColor = "#eaeaea";
		}
		else{
			obj.style.backgroundColor = "#dbdbdb";
		}
	}
}

function subOut(obj, bCurrent){
	if(obj){
		if(bCurrent){
			obj.style.backgroundColor = "#dbdbdb";
		}
		else{
			obj.style.backgroundColor = "#ffffff";
		}
	}
}

function loadUrl(url, target){
	if(target.length > 0){
		switch(target){
			case "_top":
				//alert('_top');
				top.location.href = url;
				break;
			
			case "_parent":
				//alert('_parent');
				partent.location.href = url;
				break;
				
			case "_blank":
				//alert('_blank');
				window.open(url,'');
				break;
			
			default:
				//alert('default');
				document.location.href = url;
				break;
		}
	}
	else{
		//alert('load page');
		document.location.href = url;
	}
}
