function inserir(string) 
{ 
parent.frames.editor.document.FORM.Post.value = parent.frames.editor.document.FORM.Post.value+" "+string; 
parent.frames.editor.document.FORM.Post.focus(); 
} 

function verfonte(url)
{
window.location = "view-source:" + url;
}



//Abre janela de servicos
	function midiaWindow(pge)
	{
	window.open(pge,'','width=400,height=350,left=0,top=0,status=1');
	window.location.reload();
	}

	function midiaPanel(pge)
	{
	window.open(pge,'','status=1,resizable=1,scrollbars=1,top=0,left=0,width=750,height=440');
	}


//Contar caracteres de campoTexto
// onKeyUp='ContaCaracteres(this,car,500);
	function ContaCaracteres(texto,restantes,caracteres)
	{ 
	var campoTexto = texto;
	var contar = restantes;
	var caracteres = caracteres;
	
	intCaracteres = caracteres - campoTexto.value.length; 
	if (intCaracteres > 0)
	{ 
	contar.value = intCaracteres; 
	return true; 
	} 
	else 
	{ 
	contar.value = 0; 
	campoTexto.value = campoTexto.value.substr(0,caracteres) 
	return false; 
	} 
	} 

	function erroMsg(msg)
	{
	alert(msg); window.history.back(-1);
	}

	// Prosseguir acao
	function prosseguir(msg)
	{
	if (!confirm(msg));
	window.history.back(-1); 
	}

	// Verifica se o usuario deseja apagar a conta
	function apagar(PagIr,msgAlerta)
	{
		if(confirm(msgAlerta)) 
		{
		window.location.href=(PagIr);
		}
	}
	
	function apagarServico(msg,url)
	{
		if (!confirm(msg))
		{
		window.location.reload();
		}
		else
		{
		window.location.href=(url);
		}
	
	}




function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) 
{
var i, j;
var prompt;

// empty existing items
for (i = selectCtrl.options.length; i >= 0; i--) 
{
selectCtrl.options[i] = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) 
{
j = 0;
}
else 
{
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) 
{
// add new items
for (i = 0; i < itemArray.length; i++) 
{
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) 
{
selectCtrl.options[j].value = itemArray[i][1];
}
j++;
}

// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
}
}


function createTarget(t,lar,alt)
{
window.open("", t, "width="+lar+",height="+alt+",status=1");
return true;
}


