function setTab(area,id) {
	var tabArea=document.getElementById(area);

	var contents=tabArea.childNodes;
	for(i=0; i<contents.length; i++) {
		if(contents[i].className=='tabcontent'){contents[i].style.display='none';}
	}
	document.getElementById(id).style.display='';

	var tabs=document.getElementById(area+'tabs').getElementsByTagName('div');
	for(i=0; i<tabs.length; i++) { tabs[i].className=''; }
	document.getElementById(id+'tab').className='active';
}




function showhidediv(id){
  try{
    var panel=document.getElementById(id);
    if(panel){
      if(panel.style.display=='none'){
        panel.style.display='block';
      }else{
        panel.style.display='none';
      }
    }
  }catch(e){}
}

function post2get(formId)
{
	var uri = '';
	var form_obj = document.getElementById(formId);
	//alert(form_obj.action);return false;
	for(i=0; i < form_obj.elements.length; i++ ){
		var key = form_obj.elements[i].name;
		var value = form_obj.elements[i].value;
		var type = form_obj.elements[i].type;
		
		if ('submit' == type || 'button' == type){
			continue
		}
		
		if ('radio' == type || 'checkbox' == type){
				if (!form_obj.elements[i].checked){
					continue;
				}
		}
		
		if ('' != value){
			if (uri.length > 1 ){
				uri += '&';
			}

			var value = encodeUri(value);
			
			uri += key+'='+value;
		}
	}
	
	var base_uri = '';
	if ('' == form_obj.action){
		base_uri += window.location.protocol
		base_uri += '//'+window.location.host;
		if (window.location.port){
			base_uri += ':'+window.location.port;
		}
		// controller action
		base_uri += window.location.pathname;
	}else{
		base_uri = form_obj.action;
	}
	
	if (uri == ''){
		window.open(base_uri, '_blank');
	}else{
		window.open(base_uri+'?'+uri, '_blank');
	}
	
	return false;
}

function encodeUri(str){
	if(encodeURIComponent){
		return encodeURIComponent(str);
	}else{
		return encodeURI(str);
	}
}

function decodeUri(str){
	if(decodeURIComponent ){
		return decodeURIComponent(str);
	}else{
		return decodeURI(str);
	}
}

