function update_page(url){
	if(url){
		window.location = url;
	}
}

function hide_note(redirect_url){
	var div = $('alert_bar');
	div.style.display = 'none';
	if (redirect_url) {
		window.location = redirect_url;
	}
	return false;
}

function dismiss_note(url, pars, redirect_url){
	var my_ajax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: hide_note(redirect_url) } );
}

function show_help_answer(id, num_of_faqs){
	for(var i=0; i<20; i++){
			try{
			var opened_div = $('faq_opened'+i);
		    var closed_div = $('faq_closed'+i);
		    
		    	opened_div.style.display = 'none';
				closed_div.style.display = 'block';

				if(i == id){
				opened_div.style.display = 'block';
				closed_div.style.display = 'none';
				}
			}catch(e){
			}
		
	}
}

function show_tab(tab_group, tab_name){
	var tab_group = $('tab_group');
	var tds = tab_group.getElementsByTagName('td');
	
	for(var i=0; i<tds.length; i++){
		if(tds[i].className.substring(0,7) != 'tab_gap'){
			var tab = $(tds[i].id);
			var panel = $('panel_' + tds[i].id )
			if(tab != null && panel != null){
				// hide panel
				panel.style.display = 'none';
				// set tab to unselected
				tds[i].className = 'tab';
			}
		}
	}
	
    var my_tab = $(tab_name);
    var my_panel = $('panel_' + tab_name);
	
    if(my_tab != null && my_panel != null){
		// show proper panel
        my_panel.style.display = '';
		// select proper tab
        my_tab.className = 'tab_selected';
	}

	// return false so href won't fire
	return false;
}
function activeMenu(cell,imageUrl){
	document.getElementById(cell).src = imageUrl;
	//cell.style.backgroundColor="#80ADE8";
	//var StaticHostPath="http://localhost:8080/static";
	//cell.background="http://localhost:8080/static/images/but_index02.gif";
	//cell.innerHTML="<a href=\"<c:url value='/welcome.do?method=viewWelcome'/>\" class=\"linkMenu\" id=\"MenuLink_home\"><img src=\""+StaticHostPath+"/images/but_index02.gif\" border=\"0\"></a>";
}
function deactiveMenu(cell,imageUrl){
	document.getElementById(cell).src = imageUrl;
	//cell.style.backgroundColor="transparent";
	//var StaticHostPath="http://localhost:8080/static";
	//cell.innerHTML="<a href=\"<c:url value='/welcome.do?method=viewWelcome'/>\" class=\"linkMenu\" id=\"MenuLink_home\"><img src=\""+StaticHostPath+"/images/but_index01.gif\" border=\"0\"></a>";
}
function showMenu(groupName,itemName){
				//var groupCell=$("MenuGroup_"+groupName);
				//var groupLink=$("MenuLink_"+groupName);
				//var groupRow=$("MenuRow_"+groupName);
				var itemLink=$("MenuItem_"+itemName);
				//groupCell.style.backgroundColor="#05ADE8";
				//groupCell.onmouseover=null;
				//groupCell.onmouseout=null;
				//groupLink.className="linkMenuActive";
				//groupRow.style.display="";
				itemLink.style.textDecoration="underline";
}

function isdigit(s){
	var r,re;
	re = /\d*/i; //\d表示数字,*表示匹配多个数字
	r = s.match(re);
	return (r==s);
}
function IsDigit(){
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
function _trim(str){
	if(str == null){
		return '';
	}
	return str.replace(/(^\s*)|(\s*$)/g, "");
}
