function drag(id){
	$('#'+id).Draggable(
			{
				ghosting:	false,
				opacity: 	0.7,
				handle:	'#barra_superior',
				onStop : function(){
					stopDrag(id);
					drag(id);
				}
			}
	);
}

function stopDrag(id){
	$('#'+id).DraggableDestroy();
}



function newXMLHttpRequest(){
	var xmlhttp = false;
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}

	return xmlhttp;
}

function AbrePop ( url, altura, largura ) {
	if(navigator.appName == "Netscape")
		popup = window.open(url,url,'width='+largura+' , height='+altura+', top=50, left=40, scrollbars=no,fullscreen=no');
	else
		popup =  window.open(url,"acao",'status=yes,scrollbars=no,width='+largura+',height='+altura);
	popup.focus();
}


String.prototype.trim = function() {
	return this.replace("/^\s+|\s+$/g, ","");
}

function valorForm(valor){
	return escape(valor);
}

function pegaValorXML(no){
    if(no.childNodes.length>0){
            return no.firstChild.nodeValue; //Tem filho
      } else {
            try{
                  return no.nodeValue
            } catch (e) {
            return "";
        }
      }
}

function PopUpView(theURL,width,height){
	var URL = theURL;
	tmp= window.open(URL, '_blank', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,width='+width+',height='+height+',align=top');
	tmp.opener2 = self;
}


function exibe(uf){
		$("#div_revendas").fadeOut("slow", function(){
			$("#div_revendas").load("revendas/"+uf+".asp", function(){
							$("#div_revendas").fadeIn("slow");										
			})											
		})
		
}
