function fflash(tsrc,w,h){
	document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
	document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' ");
	document.write("WIDTH='"+ w + "' HEIGHT='"+ h + "' id='iflash' ALIGN='center'> ");
	document.write("<PARAM NAME=movie VALUE='" + tsrc + "'> <PARAM NAME=quality VALUE=high> <PARAM NAME=menu VALUE=false> ");
	document.write("<PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src='" + tsrc + "' quality=high ");
	document.write("bgcolor=#FFFFFF  WIDTH='"+ w + "' HEIGHT='"+ h + "' NAME='iflash' ALIGN='center' ");
	document.write("TYPE='application/x-shockwave-flash' menu='false' ");
	document.write("PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>");
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function openwinr(url,w,h){
	if(w>screen.width) w=screen.width-20;
	if(h>screen.height) h=screen.height-80;
	l=(screen.width-w)/2;
	t=(screen.height-h)/2;
	feat="width="+w+",height="+h+",top="+t+",left="+l+",statusbar=no,scrollbars=yes,menubar=no,resizable=yes";
	w1=window.open(url,'',feat);
}

function viewdoc(cual){
	openwinr('downfile.asp?id='+cual,500,310);
}

var ultimoparam=0;

function closewinjx(target){
	obj=MM_findObj("bladdcontain");
	obj.innerHTML="";
	ultimoparam=0;
}
function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var curX=0;
var curY=0;
var offsetX=20;
var offsetY=-12;
var ie=document.all;
var ns6=document.getElementById && !document.all;

function fgety(e){
	curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft+offsetX;
	curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop+offsetY;
}

document.onmousemove=fgety

function setajaxtxt(target,param){
	obj=MM_findObj(target);
	if(param==ultimoparam){
		obj.innerHTML="";
		ultimoparam=0;
	}
	else{
		obj.innerHTML="<img src=\"img/waiting.gif\" width=\"28\" height=\"28\" border=\"0\" alt=\"Cargando\">";
		 var pars = "id="+param;
		 var myAjax = new Ajax.Updater(target, "descriplink_ajax.php", {method: 'get', parameters: pars});
		 ultimoparam=param;
		 obj.style.left=curX+"px";
		 obj.style.top=curY+"px";
	}
}

function getClassName(obj) {
	if (typeof obj != "object" || obj === null) return false;
	return /(\w+)\(/.exec(obj.constructor.toString())[1];
}

function fvoto(){
	document.formstat.submit();
}

function decodem(txt){
	var orig="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.@";
	var dest="bcqNdghT1YUV2Xi9jaQklm0LpJDr@stKuv6734wx_yzABCE.FGHMnIOPRSefWZ58-o";
	var out="";
	if(txt!=""){
		for(i=0;i<txt.length;i++){
			ind=orig.indexOf(txt.substring(i,i+1));
			if(ind!=-1) out+=dest.substring(ind,ind+1);
			else out+=txt.substring(i,i+1);
		}
	}
	return out;
}

function emailto(witch){
	document.location.href="mailto:"+decodem(witch);
}

function fdirectorio(modi,dpto,tlfno,emailcoded){
	edecoded=decodem(emailcoded);
	document.write("<tr class='row"+modi+"'><td>"+dpto+"</td>");
	document.write("<td>"+tlfno+"</td>");
	document.write("<td><a href='mailto:"+edecoded+"'>"+edecoded+"</a></td></tr>");
}

function frecuerda(tipo){
	openwinr("recuerda.php?tipo="+tipo,460,300);
}

function isemail(elemail){
	var p,valid,err;
	valid="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.@";
	err=0;
	if(elemail!="" && elemail.length>6){
		for(i=0;i<elemail.length;i++){
			if(valid.indexOf(elemail.substring(i,i+1))==-1) err++;
		}
		if(elemail.indexOf('@')==-1) err++;
		if(elemail.indexOf('.')==-1) err++;
	}
	else{
		err++;
	}
	if(err==0) return true;
	else return false;
}

function fmaildocentes(email1,email2){
	if(email1!=""){
		document.write("<a href='mailto:"+decodem(email1)+"'>"+decodem(email1)+"</a>");
	}
	if(email2!="") document.write(", ");
	if(email2!=""){
		document.write("<a href='mailto:"+decodem(email2)+"'>"+decodem(email2)+"</a>");
	}
}
