function OpenWindow(URL,nome,propriedades) { //v2.0
   window.open(URL,nome,propriedades);
}


function showIMG(sValue, frmname, objname){
	
 	x = eval('document.' + frmname + '.' + objname)
	x.value = x.value + sValue;
}

var campo='Text';

function defineObj(frmname, objname){
	x = eval('document.' + frmname + '.' + objname)	
	if (x.onfocus){	
		campo = x.name;
	}	
}


function AddFav(sUrl,sTexto){
	
	//x = eval(sbrowser);
	
	if (navigator.appName == "Microsoft Internet Explorer") {
		window.external.AddFavorite(sUrl,sTexto);
	}
	else {
	if(navigator.appName == "Netscape"){
	
		alert("Para adicionar esta notícia aos favoritos (BookMarks) faça 'CTRL' + 'D'");
		//window.open("");
		}
	}
}

function ComboSubmit(targ,selObj,restore,page){ //v3.0
  
  if (selObj.options[selObj.selectedIndex].value == 0 ){
		return false;   
   }
  eval(targ+".location='" + page + selObj.options[selObj.selectedIndex].value+"&AutorName="+selObj.options[selObj.selectedIndex].text+"'");  
  if (restore) selObj.selectedIndex=0;
  
}

function ComboSubmitFarmacias(selObj){
   if (selObj.options[selObj.selectedIndex].value == 0 ){
		return false;   
   }
  document.frmZona.nome.value = selObj.options[selObj.selectedIndex].text;
  
  document.frmZona.submit();
}

function ComboSubmitFarmaciasLoc(selObj){
	var id;
	var arr = new Array();

	
	if (selObj.options[selObj.selectedIndex].value == 0 ){
		return false;   
	}
	document.frmZona.action = "/pharmacy/farmacialoc.asp";
	document.frmZona.nome.value = selObj.options[selObj.selectedIndex].text;
  

	document.frmZona.submit();
}

function SubmitDataFarmacias(id, Nome, m, y, data){
  document.frmZona.nome.value = Nome; 
  document.frmZona.id.value = id; 
  document.frmZona.m.value = m; 
  document.frmZona.y.value = y;
  document.frmZona.data.value = data;  
  document.frmZona.submit();
}

//francisco 22-07-2002

function ComboClassifiedsp(frmname ,selObj,page){ //v3.0
  
  if (selObj.options[selObj.selectedIndex].value == 0 ){
		return false;   
   }


	x = eval('document.' + frmname )
	x.categoria.value = selObj.options[selObj.selectedIndex].text;
	x.submit();
  
}

function BlocLink(){
	window.alert('A funcionalidade não está disponível no Preview');
}


function newWin(url,name, args, width, height,centrada, focus) {

		var newWin = new Object();

		newWin.args = args;
		newWin.url = url;
		newWin.name = name;
		newWin.width = width;
		newWin.height = height;
		if(centrada=='1'){
			if (document.layers) {// browser is NN
				newWin.left = window.screenX + ((window.outerWidth - newWin.width) / 2);
				newWin.top = window.screenY + ((window.outerHeight - newWin.height) / 2);
				var attr = 'screenX=' + newWin.left + ',screenY=' + newWin.top + ',resizable=yes,width=' + newWin.width + ',height=' + newWin.height + ',' + newWin.args + ',WindowState=0';
			}
			else {// browser is MSIE
				newWin.left = (screen.width - newWin.width) / 2;
				newWin.top = (screen.height - newWin.height) / 2;
				var attr = 'left=' + newWin.left + ',top=' + newWin.top + ',width=' + newWin.width + ',height=' + newWin.height + ',' + newWin.args + ',WindowState=0';
			}
		}
		else
			{
				var attr = newWin.args;
			}
		
		newWin.win=window.open(newWin.url,newWin.name, attr);

		
		if (focus==1){
			newWin.win.focus();
		}
	}

 function pageredir(page)
     {
        //window.navigate(page);
	window.location=page;
      }
      
function popup(name, url, width, height, args) {
		var newWin = new Object();

		newWin.args = args;
		newWin.url = url;
		newWin.name = name;
		newWin.width = width;
		newWin.height = height;

		if (document.layers) {// browser is NN
			newWin.left = window.screenX + ((window.outerWidth - newWin.width) / 2);
			newWin.top = window.screenY + ((window.outerHeight - newWin.height) / 2);
			var attr = 'screenX=' + newWin.left + ',screenY=' + newWin.top + ',resizable=yes,width=' + newWin.width + ',height=' + newWin.height + ',' + newWin.args;
		}
		else {// browser is MSIE
			newWin.left = (screen.width - newWin.width) / 2;
			newWin.top = (screen.height - newWin.height) / 2;
			var attr = 'left=' + newWin.left + ',top=' + newWin.top + ',scrollbars=1,' + ',width=' + newWin.width + ',height=' + newWin.height + newWin.args;
		}

		newWin.win=window.open(newWin.url, newWin.name, attr);
				
		newWin.win.opener=self;
		newWin.win.focus();
}
	

function validade_pesq_jornal(){

	if (document.frmsearch.parametros.value.length<3){
		result= "Deve inserir pelo menos 3 caracteres." + "\n";
		window.alert (result);
		document.frmsearch.parametros.focus(); 
		return false;
	}
	/*
	if (document.frmsearch.parametros.value.indexOf("'",0)!=-1){
		result= "O texto a pequisar contêm o caracter ' que não pode ser incluído nas pesquisas." + "\n" ;
		window.alert (result);
		document.frmsearch.parametros.focus(); 
		return false;
	}
	*/
	return true
}


function ShowDetalhes(tipo, ObjSelect) {
	obj_list = document.getElementById(ObjSelect);
	if (obj_list != null) {
		obj_list=obj_list.style; 
		if (tipo=='visible'){ 
			obj_list.visibility = 'visible';
			obj_list.position='relative';
		}
		else {
			obj_list.visibility='hidden';
			obj_list.position='absolute';		
		}
			
	}
}
