function ajax(url,resposta,msg){

		var parametros	= url.split("?")[1];
		var url 		= url.split("?")[0];
		
		//alert(parametros);
		//alert(parametros);
		
		try{eval("var "+resposta+" = new XMLHttpRequest();");
		}catch(ee){
	    try{eval(resposta + " = new ActiveXObject(\"Msxml2.XMLHTTP\");");
	    }catch(e){try{eval(resposta + " = new ActiveXObject(\"Microsoft.XMLHTTP\");");
        }catch(E){eval(resposta + " = false");

		document.getElementById(resposta).innerHTML='erro';

       			 }
  	  		}

	}
			document.getElementById(resposta).innerHTML=('<center><img style="border:1px solid #c0c0c0;background-color:white;padding:5px;" src="/img/loading.gif" ></center>');
		

		eval(resposta).onreadystatechange=function(){			

			if (eval(resposta).readyState == 4){

				//if (eval(resposta).status == 200){

					var html = eval(resposta).responseText;

					if (document.getElementById(resposta)!= null){

						document.getElementById(resposta).innerHTML=url_decode(html);

					}

				//}

			}

		}



		eval(resposta).open("GET",url,true);		
   
		eval(resposta).setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=utf-8;');
		//eval(resposta).setRequestHeader("Cache-Control","no-cache"); 
		//eval(resposta).setRequestHeader("Pragma","no-cache");       
		//eval(resposta).setRequestHeader ("Expires", 0);    
		//eval(resposta).send(url_encode(parametros));
		eval(resposta).send(parametros);	

}


function ajaxs(url,resposta,msg){

		var parametros	= url.split("?")[1];
		var url 		= url.split("?")[0];
		try{eval("var "+resposta+" = new XMLHttpRequest();");
		}catch(ee){
	    try{eval(resposta + " = new ActiveXObject(\"Msxml2.XMLHTTP\");");
	    }catch(e){try{eval(resposta + " = new ActiveXObject(\"Microsoft.XMLHTTP\");");
        }catch(E){eval(resposta + " = false");

		document.getElementById(resposta).innerHTML='erro';

       			 }
  	  		}

	}


		eval(resposta).onreadystatechange=function(){			

			if (eval(resposta).readyState == 4){

				//if (eval(resposta).status == 200){

					var html = eval(resposta).responseText;

					if (document.getElementById(resposta)!= null){

						document.getElementById(resposta).innerHTML=url_decode(html);

					}

				//}

			}

		}



		eval(resposta).open("GET",url,true);		

		eval(resposta).setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=iso-8859-1;');

		eval(resposta).send(url_encode(parametros));	

}

function parentAjax(url,resposta,msg){

	

		var parametros	= url.split("?")[1];

		var url 		= url.split("?")[0];

				

		try{

			eval("var "+resposta+" = new XMLHttpRequest();");

		}catch(ee){

	    try{

	        eval(resposta + " = new ActiveXObject(\"Msxml2.XMLHTTP\");");

	    }catch(e){

	        try{

	      	   eval(resposta + " = new ActiveXObject(\"Microsoft.XMLHTTP\");");

	        }catch(E){

	        eval(resposta + " = false");

		parent.document.getElementById(resposta).innerHTML='erro';

	       			 }

	  	  		}

		}

		

		if (msg != null){

			parent.document.getElementById(resposta).innerHTML=('<div style="float:right;background:#CC4444;color:white;">'+msg+'</div>');

		}

		

		eval(resposta).onreadystatechange=function(){			

			if (eval(resposta).readyState == 4){

				//if (eval(resposta).status == 200){

					var html = eval(resposta).responseText;

					if (parent.document.getElementById(resposta)!= null){

						parent.document.getElementById(resposta).innerHTML=html;

					}

				//}

			}

		}



		eval(resposta).open("POST", url,true);		

		eval(resposta).setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=UTF-8;');

		eval(resposta).setRequestHeader('Cache-Control','no-cache, no-store;');

		eval(resposta).send(encodeURI(parametros));	

}



function borderOut(idTable,idLayer,borderColor,bgColor1,bgColor2,mode,title){	

	function td(style,id,title){

		if (title!=undefined){	

			return '<td '+style+' id="'+id+'" >'+title+'</td>';

		}else{

			return '<td '+style+' id="'+id+'"></td>';	

		}

	}	

	var txt;

	var borderWidth = '1';	

	var b1 = 'style="width:'+ borderWidth +'px;height:'+ borderWidth +'px;"';
	var n1 = 'style="width:'+ borderWidth +'px;height:'+ borderWidth +'px;background-color:'+borderColor+'"';
	var n2 = 'style="width:'+ borderWidth +'px;height:'+ borderWidth +'px;background-color:#d0d0d0;"';

	if (mode==1){

	var n3 = 'style="width:'+ borderWidth +'px;height:'+ borderWidth +'px;background-color:blue;"';

	}else if (mode==2){

	var n3 = 'style="width:'+ borderWidth +'px;height:'+ borderWidth +'px;background-color:#e0e0e0;"';

	}	

	var d1 = 'style="background-color:white;"';

	var d2 = 'style="background-color:#f0f0f0;"';	

	onmouseover="this.src=\'img/closeon.gif\'"

	onmouseout="this.src=\'img/closeoff.gif\'"	

	txt='';

	txt+='<table style="position:absolute;" align="center" style="display:none;" id="'+ idTable +'" cellpadding="0" cellspacing="0">';

	txt+='<tr>'+td(b1)+td(b1)+td(b1)+td(b1)+td(n1)+td(n1)+td(n1)+td(b1)+td(b1)+td(b1)+td(b1)+'</tr>';

	txt+='<tr>'+td(b1)+td(b1)+td(n1)+td(n2)+td(n3)+td(d2)+td(n3)+td(n2)+td(n1)+td(b1)+td(b1)+'</tr>';

	txt+='<tr>'+td(b1)+td(n1)+td(n2)+td(d2)+td(d2)+td(d2)+td(d2)+td(d2)+td(n2)+td(n1)+td(b1)+'</tr>';

	txt+='<tr>'+td(b1)+td(n2)+td(d2)+td(d2)+td(d2)+td(d2)+td(d2)+td(d2)+td(d2)+td(n2)+td(b1)+'</tr>';

	txt+='<tr>'+td(n1)+td(n3)+td(d2)+td(d2)+td(d2)+td(d2)+td(d2)+td(d2)+td(d2)+td(n3)+td(n1)+'</tr>';

	

	txt+='<tr>'+td(n1)+td(d2)+td(d2)+td(d2)+td(d2)+'<td bgcolor="#f0f0f0" height="18px" valign="top"><table width="100%" cellpadding="0" cellspacing="0"><tr><td style="font-weight:bold;color:#a0a0a0;">'+ title +'</td><td width="1"><img onclick="closeLayer(\''+idTable+'\');" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" src="img/closeoff.gif"></td></tr></table></td>'+td(d2)+td(d2)+td(d2)+td(d2)+td(n1)+'</tr>';

	

	txt+='<tr>'+td(n1)+td(d2)+td(d2)+td(d2)+td(d2)+'<td bgcolor="#ffffff" id='+idLayer+'></td>'+td(d2)+td(d2)+td(d2)+td(d2)+td(n1)+'</tr>';

	

	txt+='<tr>'+td(n1)+td(n3)+td(d1)+td(d1)+td(d1)+td(d1)+td(d1)+td(d1)+td(d1)+td(n3)+td(n1)+'</tr>';

	txt+='<tr>'+td(b1)+td(n2)+td(d1)+td(d1)+td(d1)+td(d1)+td(d1)+td(d1)+td(d1)+td(n2)+td(b1)+'</tr>';

	txt+='<tr>'+td(b1)+td(n1)+td(n2)+td(d1)+td(d1)+td(d1)+td(d1)+td(d1)+td(n2)+td(n1)+td(b1)+'</tr>';

	txt+='<tr>'+td(b1)+td(b1)+td(n1)+td(n2)+td(n3)+td(d1)+td(n3)+td(n2)+td(n1)+td(b1)+td(b1)+'</tr>';

	txt+='<tr>'+td(b1)+td(b1)+td(b1)+td(b1)+td(n1)+td(n1)+td(n1)+td(b1)+td(b1)+td(b1)+td(b1)+'</tr>';

	txt+='</table>';	

	document.getElementById("resto").innerHTML=txt;


}	






// url_encode version 1.0 
function url_encode(str) { 
    var hex_chars = "0123456789ABCDEF"; 
    var noEncode = /^([a-zA-Z0-9\_\-\.&=])$/; 

    var n, strCode, hex1, hex2, strEncode = ""; 

    for(n = 0; n < str.length; n++) { 
        if (noEncode.test(str.charAt(n))) { 
            strEncode += str.charAt(n); 
        } else { 
            strCode = str.charCodeAt(n); 
            hex1 = hex_chars.charAt(Math.floor(strCode / 16)); 
            hex2 = hex_chars.charAt(strCode % 16); 
            strEncode += "%" + (hex1 + hex2); 
        } 
    } 
    return strEncode; 
} 

// url_decode version 1.0 
function url_decode(str) { 
    var n, strCode, strDecode = ""; 

    for (n = 0; n < str.length; n++) { 
        if (str.charAt(n) == "%") { 
            strCode = str.charAt(n + 1) + str.charAt(n + 2); 
            strDecode += String.fromCharCode(parseInt(strCode, 16)); 
            n += 2; 
        } else { 
            strDecode += str.charAt(n); 
        } 
    } 
    return strDecode; 
} 
//-->  
