// este JS contiene todos los metodos que son comunes a la mayoria de las plantillas
// coloque metodos aqui, solo si esta seguro que esto es de utilidad para todos, de los
// contrario, arme rancho en otro lado
// author Oliver ACE
// since  27 dec 2002
//////////////////////////////////////////////////////////////////////////////////////
var isIE=document.all?true:false;
function openWindow(mypage,myname,w,h,options){ return openWin(mypage,myname,w,h,options); }
/*#######################################################*/
function openWin(mypage,myname,w,h,options){
if ((!options)||(options==null)) alert('no options ERR:01138 ['+mypage+']');
  var help     = (options.toUpperCase().indexOf("HELP")      != -1)?'1':'0';
  var fullscr  = (options.toUpperCase().indexOf("FULLSCREEN")!= -1)?'yes':'0';
  var center   = (options.toUpperCase().indexOf("CENTER")    != -1)?'1':'0';
  var scroll   = (options.toUpperCase().indexOf("SCROLL")    != -1)?'1':'0';
  var toolbar  = (options.toUpperCase().indexOf("TOOLBAR")   != -1)?'1':'0';
  var location = (options.toUpperCase().indexOf("LOCATION")  != -1)?'1':'0';
  var status   = (options.toUpperCase().indexOf("STATUS")    != -1)?'1':'0';
  var menubar  = (options.toUpperCase().indexOf("MENUBAR")   != -1)?'1':'0';
  var resizable= (options.toUpperCase().indexOf("RESIZABLE") != -1)?'1':'0';
  var notitlebar=(options.toUpperCase().indexOf("NOTITLEBAR")!= -1)?'1':'0';//? no aplica a todos los browwsers, ie es <titlebar>
  var borde    = (options.toUpperCase().indexOf("BORDE")     != -1)?'Raised':'Sunken';
  var left     = 0;
  var top      = 0;
  var day      = new Date();
  var now      = day.getTime();
 if (fullscr=='yes'){w    = screen.width; h = screen.height;}
 if (center)        {left = (screen.width  - w)/2; top = (screen.height - h)/2; }
  settings = 'width='+w+',height='+h+',left='+left+',top='+top+',scrollbars='+scroll+', status='+status+',resizable='+resizable+',menubar='+menubar+',toolbar='+toolbar+',location='+location+',fullscreen='+fullscr;
  eval("page" + now + " = window.open(mypage,'"+myname+"','"+settings+"');"); // tiene que ser con eval!
  eval("page" + now + ".focus();"); // focus en la nueva pagina creada!!
  return (eval("page"+now));
}
/*#######################*/
function showlayer(whichLayer){
  if (document.getElementById)
		if (document.getElementById(whichLayer)==null){alert('layer id='+whichLayer+' is null'); }else{ document.getElementById(whichLayer).style.display = "block";}
  if (document.all)            document.all[whichLayer].style.display            = "block";
  if (document.layers)         document.layers[whichLayer].style.display         = "block";
 return;
}
/*#######################*/
function hidelayer(whichLayer){
  if (document.getElementById) document.getElementById(whichLayer).style.display = "none";
  if (document.all)            document.all[whichLayer].style.display            = "none";
  if (document.layers)         document.layers[whichLayer].style.display         = "none";
 return;
}
/*#######################*/
function resizeblock(blockone,blocktwo,offset){
 document.getElementById(blockone).style.height=document.getElementById(blocktwo).offsetHeight+offset;
  return;
}
/*#######################*/
function linkto(url){
 document.location=url;
 return;
}
/*#######################*/
function loadPDF(doc_dir,msg){
  if (msg!='') alert(msg);
  return openWin(doc_dir,'PDF',700,700,'CENTER RESIZABLE NOTITLEBAR');
}
/*#######################*/
// remove the TM logos as other not compatible with some browsers
//
function changetm(obja){
var res = '';
  for (var i=0;i<obja.value.length; i++){
    // alert('char='+obja.value[i]+' value='+obja.value.charCodeAt(i));
 switch (obja.value.charCodeAt(i)){
 case 8482 : res +="&#8482;"; break;
 case 8216 : res +="'"; break;
 case 8217 : res +="'"; break;
 case 8211 : res +="-"; break;
 case 8220 : res +="\""; break;
 case 8221 : res +="\""; break;
 default   : res +=obja.value[i];
 }
  }
  obja.value = res;
}
/*#######################*/
function getobj(objname){
 if (document.all)            return document.all(objname);
 if (document.getElementById) return document.getElementById(objname);
 return false;
}
/*#######################*/
function chgv(idOb){
  var idObj = getobj(idOb);
  if (idObj.style.display=="block") idObj.style.display = 'none';
  else                              idObj.style.display = 'block';
}
/*#######################*/
function c_clip(dataobj){
	dataobj.select();
	datatext = dataobj.value; 
  if (window.clipboardData){    window.clipboardData.setData("text", datatext);
  } else if (window.netscape){ // alert ("function not available in firefox")
  }
  return false;
}
/*#######################*/
function swait(){
	indicatort = document.getElementById("indicator");
	if (indicatort!=null) indicatort.style.visibility="visible";
}
window.onbeforeunload = swait;



