// config.js

//Dominios de proyectosinformaticos.biz
var domain = new Array();

domain[1] = "www.proyectosinformaticos.biz"; //Español

//Dimensiones de logos (pixels).
var LOGO_PROYECTO_WIDTH = 120;
var LOGO_PROYECTO_HEIGHT = 60;
var LOGO_MICROSITE_WIDTH = 120;
var LOGO_MICROSITE_HEIGHT = 60;
var LOGO_OFERTA_WIDTH = 120;
var LOGO_OFERTA_HEIGHT = 60;
var LOGO_PRODUCTO_WIDTH = 150;
var LOGO_PRODUCTO_HEIGHT = 150;
var LOGO_NOTICIA_WIDTH = 150;
var LOGO_NOTICIA_HEIGHT = 150;

//Tamaño máximo campos texto (número de caracteres).
var TEXTO_PROYECTO_ENTRADA_REG_SIZE = 256;
var TEXTO_MICROSITE_ENTRADA_REG_SIZE = 256;
var TEXTO_NOTICIA_ENTRADA_REG_SIZE = 512;
var TEXTO_PRODUCTO_ENTRADA_REG_SIZE = 256;
var TEXTO_OFERTA_ENTRADA_REG_SIZE = 256;
var TEXTO_PRESUP_OFERTA_REG_SIZE = 512;
var TEXTO_PRESUP_CARTA_REG_SIZE = 512;

var TEXTO_PROYECTO_ENTRADA_SIZE = 512;
var TEXTO_PROYECTO_PLIEGO_SIZE = 12288;
var TEXTO_MICROSITE_ENTRADA_SIZE = 512;
var TEXTO_MICROSITE_ACTIVIDAD_SIZE = 1024;
var TEXTO_NOTICIA_ENTRADA_SIZE = 1024;
var TEXTO_NOTICIA_CUERPO_SIZE = 24000;
var TEXTO_PRODUCTO_ENTRADA_SIZE = 512;
var TEXTO_PRODUCTO_DESCRIPCION_SIZE = 2048;
var TEXTO_PRODUCTO_CONDICIONES_SIZE = 6144;
var TEXTO_OFERTA_DESCRIPCION_SIZE = 512;
var TEXTO_OFERTA_SEOFRECE_SIZE = 512;
var TEXTO_OFERTA_FUNCIONES_SIZE = 1024;
var TEXTO_OFERTA_COMPETEC_SIZE = 1024;
var TEXTO_PRESUP_ACTIVIDAD_SIZE = 1024;
var TEXTO_PRESUP_OFERTA_SIZE = 12288;
var TEXTO_PRESUP_CARTA_SIZE = 512;
var TEXTO_CV_CARTA_SIZE = 512;
var TEXTO_COMENTARIO_SIZE = 2048;
var TEXTO_CONTACTO_SIZE = 2048;
var TEXTO_SOLICITAR_PROYECTO_SIZE = 6144;
var TEXTO_SOLICITAR_CARTA_SIZE = 512;


//Funciones goto

  function gotoshowpage(op,sessid) {
     document.enlace.op.value=op;
     document.enlace.SESSID.value=sessid;
     document.enlace.submit();
  }
  function gotobuscarmicrosites(falta,destacado,empresa,idsector,poblacion,provincia,idpais,idfj,cp,numestrellas,idusuario,numpag,sessid) {
     document.enlace.op.value="buscarmicrosites";
     document.enlace.numpag.value=numpag;
     document.enlace.SESSID.value=sessid;
     document.enlace.falta.value=falta;
     document.enlace.destacado.value=destacado;
     document.enlace.empresa.value=empresa;
     document.enlace.idsector.value=idsector;
	 document.enlace.poblacion.value=poblacion;
	 document.enlace.provincia.value=provincia;
	 document.enlace.idpais.value=idpais;
	 document.enlace.idfj.value=idfj;
     document.enlace.cp.value=cp;
     document.enlace.numestrellas.value=numestrellas;
     document.enlace.idusuario.value=idusuario;
     document.enlace.submit();
  }
  function gotobuscaralertas(idusuario,numpag,sessid) {
     document.enlace.op.value="buscaralertas";
     document.enlace.numpag.value=numpag;
     document.enlace.SESSID.value=sessid;
     document.enlace.idusuario.value=idusuario;
     document.enlace.submit();
  }
  function gotobuscarproyectos(finicio1,finicio2,duracion1,duracion2,presup1,presup2,falta,destacado,proyecto,idsector,idcategoria,idtecnologia,poblacion,provincia,idpais,cp,numestrellas,idusuario,numpag,sessid) {
     document.enlace.op.value="buscarproyectos";
     document.enlace.numpag.value=numpag;
     document.enlace.SESSID.value=sessid;
     document.enlace.finicio1.value=finicio1;
     document.enlace.finicio2.value=finicio2;
     document.enlace.duracion1.value=duracion1;
     document.enlace.duracion2.value=duracion2;
     document.enlace.presup1.value=presup1;
     document.enlace.presup2.value=presup2;
     document.enlace.falta.value=falta;
     document.enlace.destacado.value=destacado;
     document.enlace.proyecto.value=proyecto;
     document.enlace.idsector.value=idsector;
     document.enlace.idcategoria.value=idcategoria;
     document.enlace.idtecnologia.value=idtecnologia;
	 document.enlace.poblacion.value=poblacion;
	 document.enlace.provincia.value=provincia;
	 document.enlace.idpais.value=idpais;
     document.enlace.cp.value=cp;
     document.enlace.numestrellas.value=numestrellas;
     document.enlace.idusuario.value=idusuario;
     document.enlace.submit();
  }
  function gotobuscarnoticias(destacada,idseccion,empresa,titulo,falta1,falta2,cuerpo,numestrellas,idusuario,numpag,sessid) {
     document.enlace.op.value="buscarnoticias";
     document.enlace.numpag.value=numpag;
     document.enlace.SESSID.value=sessid;
     document.enlace.destacada.value=destacada;
     document.enlace.idseccion.value=idseccion;
     document.enlace.empresa.value=empresa;
	 document.enlace.titulo.value=titulo;
     document.enlace.falta1.value=falta1;
     document.enlace.falta2.value=falta2;
     document.enlace.cuerpo.value=cuerpo;
     document.enlace.numestrellas.value=numestrellas;
     document.enlace.idusuario.value=idusuario;
     document.enlace.submit();
  }
  function gotorecurso(op,idrecurso,sessid) {
     document.enlace.op.value=op;
     document.enlace.idrecurso.value=idrecurso;
     document.enlace.SESSID.value=sessid;
     document.enlace.submit();
  }
  function gotoanadircomentario(op,idrecurso,sessid) {
     document.enlace.op.value=op;
     document.enlace.idrecurso.value=idrecurso;
     document.enlace.SESSID.value=sessid;
     document.enlace.submit();
  }
  function gotocomentario(op,idcomentario,idrecurso,sessid) {
     document.enlace.op.value=op;
     document.enlace.idcomentario.value=idcomentario;
     document.enlace.idrecurso.value=idrecurso;
     document.enlace.SESSID.value=sessid;
     document.enlace.submit();
  }


//Funciones Util

var WINDOW_PORTAL_NAME = "proyectosinformaticos.biz";
var WINDOW_PRINT_WIDTH = 875;
var WINDOW_PRINT_HEIGHT = 450;
var WINDOW_PRINT_TOP = 100;
var WINDOW_PRINT_LEFT = 100;

var WINDOW_URLRECURSO_TOP = 0;
var WINDOW_URLRECURSO_LEFT = 0;

var WINDOW_VALI_WIDTH = 600;
var WINDOW_VALI_HEIGHT = 450;
var WINDOW_VALI_TOP = 100;
var WINDOW_VALI_LEFT = 200;



var CSUtil_esIE;
var CSUtil_esNN;

var CSUtil_agente = navigator.userAgent.toLowerCase();
var CSUtil_esIE = ((CSUtil_agente.indexOf("msie") != -1) && (CSUtil_agente.indexOf("opera") == -1) && (CSUtil_agente.indexOf("webtv") == -1)); 
var CSUtil_esNN = (CSUtil_agente.indexOf("netscape") != -1); 
var CSUtil_esFX = (CSUtil_agente.indexOf("firefox") != -1); 

  var week = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
  var months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  var today = new Date;
  var dayofweek = week[today.getDay()];
  var month = months[today.getMonth()];
  var day = today.getDate();
  var ord;
  if ((day % 10) == 1) {
   ord = "st";
  } else if ((day % 10) == 2) {
   ord = "nd";
  } else if ((day % 10) == 3) {
   ord = "rd";
  } else {
   ord = "th";
  }
  var year = today.getFullYear();
  var hour = today.getHours();
  hour = (hour <= 9 ? "0" + hour : hour);
  var minute = today.getMinutes();
  minute = (minute <= 9 ? "0" + minute : minute);  
  var second = today.getSeconds();
  second = (second <= 9 ? "0" + second : second);    
  var tzoff = today.getTimezoneOffset()/60;
  tzoff = (tzoff <= 0 ? ("*" + (tzoff * (-1))) : ("\-" + (tzoff * (-1))));

  var fech = dayofweek + ", " + month + " " +  day + ord +  " " + year + " " + hour + ":" + minute + ":" + second + " GMT " + tzoff;

  var expdate = new Date;
  expdate.setSeconds(expdate.getSeconds()+15552000);

  document.cookie = "ZD=" + fech + ";expires=" + expdate.toGMTString();


function formatdate(dia,mes,anyo,formato) {
 if (formato == 'YYYY MM DD') {
   return anyo + ' ' + mes + ' ' + dia;
 } else if (formato == 'DD MM YYYY') {
   return dia + ' ' + mes + ' ' + anyo;
 } else if (formato == 'MM DD YYYY') {
   return mes + ' ' + dia + ' ' + anyo;
 } else if (formato == 'MM DDth YYYY') {
   if (dia == 1) {
    return mes + ' ' + dia + 'st ' + anyo;
   }
   else if (dia == 2) {
   return mes + ' ' + dia + 'nd ' + anyo;
   }
   else if (dia == 3) {
   return mes + ' ' + dia + 'rd ' + anyo;
   }
   else {
   return mes + ' ' + dia + 'th ' + anyo;
   }
 } else {
   return anyo + ' ' + mes + ' ' + dia;
 }

}


function setDateFormat(dia,mes,anyo,formato) {

if (formato == 'YYYY-MM-DD') {
   return anyo + '-' + mes + '-' + dia;
} else if (formato == 'MM-DD-YYYY') {
   return mes + '-' + dia + '-' + anyo;
} else if (formato == 'DD-MM-YYYY') {
   return dia + '-' + mes + '-' + anyo;
} else if (formato == 'YYYY/MM/DD') {
   return anyo + '/' + mes + '/' + dia;
} else if (formato == 'MM/DD/YYYY') {
   return mes + '/' + dia + '/' + anyo;
} else if (formato == 'DD/MM/YYYY') {
   return dia + '/' + mes + '/' + anyo;
} else if (formato == 'YYYY.MM.DD') {
   return anyo + '.' + mes + '.' + dia;
} else if (formato == 'MM.DD.YYYY') {
   return mes + '.' + dia + '.' + anyo;
} else if (formato == 'DD.MM.YYYY') {
   return dia + '.' + mes + '.' + anyo;
} else if (formato == 'MM-DD') {
   return mes + '-' + dia;
} else if (formato == 'DD-MM') {
   return dia + '-' + mes;
} else if (formato == 'MM/DD') {
   return mes + '/' + dia;
} else if (formato == 'DD/MM') {
   return dia + '/' + mes;
} else if (formato == 'MM.DD') {
   return mes + '.' + dia;
} else {
   return dia + '.' + mes;
}

}



function calcImporte(unidades,precio,importesoporte,portes) {
	
return (parseInt(unidades)*parseFloat(precio))+parseFloat(importesoporte)+parseFloat(portes);	
	
}

function cFontsize(size) {
  var expdate = new Date;
  expdate.setSeconds(expdate.getSeconds()+15552000);

  document.cookie = "ZA=" + size + ";expires=" + expdate.toGMTString();
  location.reload();
}


function showView(cookie) {
  var expdate = new Date;
  expdate.setSeconds(expdate.getSeconds()+15552000);

  document.cookie = cookie + "=1;expires=" + expdate.toGMTString();
  location.reload();
}


function hideView(cookie) {
  var expdate = new Date;
  expdate.setSeconds(expdate.getSeconds()+15552000);

  document.cookie = cookie + "=0;expires=" + expdate.toGMTString();
  location.reload();
}

function onboton(obj,color,fondo) {
  var MYDOM=obj.style;
  MYDOM.color=color;
  MYDOM.backgroundColor=fondo;
  MYDOM.cursor='hand';
}

function offboton(obj,color,fondo) {
  var MYDOM=obj.style;
  MYDOM.color=color;
  MYDOM.backgroundColor=fondo;
  MYDOM.cursor='pointer';  
}

function resetFormBuscarProyectos(form) {
  form.reset();
}

function resetFormBuscarMicrosites(form) {  
  form.reset();
}

function resetFormBuscarNoticias(form) {  
  form.reset();
}


function resetFormCrearMiProyecto(form) {
  form.reset();
  entrada.SetHTML('');
  pliego.SetHTML('');  
}

function resetFormCrearMiNoticia(form) {
  form.reset();
  entrada.SetHTML('');
  cuerpo.SetHTML('');  
}

function resetFormContacto(form) {
  form.reset();
  mensaje.SetHTML('');
}

function resetFormPublicarAnuncio(form) {
  form.reset();
  entrada.SetHTML('');
}

function resetFormPublicarDatosContacto(form) {
  form.reset();
  pliego.SetHTML('');
}

function resetFormEditarMiNoticia(form,entr,cuerp) {
  form.reset();
  entrada.SetHTML(entr);
  cuerpo.SetHTML(cuerp);  
}


function resetFormCrearMiAlerta(form) {
  form.reset();
}

function resetFormEditarMiAlerta(form) {
  form.reset();
}

function resetFormEditarMiProyecto(form,entr,plieg) {
  form.reset();
  entrada.SetHTML(entr);
  pliego.SetHTML(plieg);  
}

function resetFormModificarMisdatos(form,activ) {
  form.reset();
  actividad.SetHTML(activ);
}

function resetFormRegistroCuenta(form,activ) {
  form.reset();
  entrada.SetHTML(activ);
}

function resetFormCrearFAQ(form) {
  form.reset();
  respuesta.SetHTML('');
}

function resetFormEditarFAQ(form,res) {
  form.reset();
  respuesta.SetHTML(res);
}

function resetFormCrearNoticia(form) {
  form.reset();
  entrada.SetHTML('');  
  cuerpo.SetHTML('');    
}

function resetFormEditarNoticia(form,entr,cuer) {
  form.reset();
  entrada.SetHTML(entr);  
  cuerpo.SetHTML(cuer);    
}


function resetFormCrearPromocion(form) {
  form.reset();
  comentarios.SetHTML('');
}

function resetFormEditarPromocion(form) {
  form.reset();
  comentarios.SetHTML(form.comentarios.value);
}


function HasiScript() {
   return String.fromCharCode(60, 115, 99, 114, 105, 112, 116, 62);
}

function HasiScript2() {
   return String.fromCharCode(60, 115, 99, 114, 105, 112, 116);
}

function AmaituScript() {
   return String.fromCharCode(60, 47, 115, 99, 114, 105, 112, 116, 62);
}


function  imprimirmisdatos(title,sessid) {

   var win,win2,i,html;

   win=window.open('','Imprimir','width=' + WINDOW_PRINT_WIDTH + ',height=' + WINDOW_PRINT_HEIGHT + ',top=' + WINDOW_PRINT_TOP + ',left=' + WINDOW_PRINT_LEFT + ',location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
   win.document.open();
   win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
   win.document.write('<html><head><title>' + title + '</title>');
   win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
   win.document.write('</head>');
   win.document.write('<body onload="document.imprimirmisdatos.submit();">');
   win.document.write('<form action="index.php" name="imprimirmisdatos" method="post">');
   win.document.write('  <input type="hidden" name="op" value="imprimirmisdatos">');
   win.document.write('  <input type="hidden" name="SESSID" value="' + sessid + '">');
   win.document.write('</form>');
   win.document.write('</body></html>');   
   win.document.close();
}


function doc_HTML(ficha) {
  var texto=document.getElementById(ficha).innerHTML;

  var linkend = /(<\/a>)|(<\/A>)/g;  
  var linkstart = /(<a )|(<A )/g;
  texto=texto.replace(linkend,"</span>");  
  texto=texto.replace(linkstart,"<span ");  
  return texto;
}


function  getURLRecurso(url) {
   var win;

   win=window.open(url,'recursowin','top=' + WINDOW_URLRECURSO_TOP + ',left=' + WINDOW_URLRECURSO_LEFT + ',location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,fullsize');
}

function  getURLAnuncio(id,sessid) {

   var win,i;

   win=window.open('','recursowin','top=' + WINDOW_URLRECURSO_TOP + ',left=' + WINDOW_URLRECURSO_LEFT + ',location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,fullsize');
   win.document.open();
   win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
   win.document.write('<html><head><title></title>');
   win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
   win.document.write('</head>');
   win.document.write('<body onload="document.recurso.submit();">');
   win.document.write('<form action="getURLAnuncio.php" name="recurso" method="post">');
   win.document.write('  <input type="hidden" name="ID" value="' + id + '">');
   win.document.write('  <input type="hidden" name="sessid" value="' + sessid + '">');
   win.document.write('</form>');
   win.document.write('</body></html>');   
   win.document.close();
}


function  bajarAccesos(anyomes,tiporecurso,idrecurso,sessid) {

   var win,i;

   win=window.open('','recursowin','top=' + WINDOW_URLRECURSO_TOP + ',left=' + WINDOW_URLRECURSO_LEFT + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,fullsize');
   win.document.open();
   win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
   win.document.write('<html><head><title></title>');
   win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
   win.document.write('</head>');
   win.document.write('<body onload="document.accesos.submit();">');
   win.document.write('<form action="index.php" name="accesos" method="post">');
   win.document.write('  <input type="hidden" name="op" value="misaccesos2">');
   win.document.write('  <input type="hidden" name="SESSID" value="' + sessid + '">');
   win.document.write('  <input type="hidden" name="anyomes" value="' + anyomes + '">');   
   win.document.write('  <input type="hidden" name="tiporecurso" value="' + tiporecurso + '">');   
   win.document.write('  <input type="hidden" name="idrecurso" value="' + idrecurso + '">');   
   win.document.write('</form>');
   win.document.write('</body></html>');   
   win.document.close();
}


function seleccionarOpcionEncuesta(formu,i) {
    formu.opc[i].click();
	formu.ID.value=formu.opc[i].value;
}

function submitEncuesta(formu) {
if (formu.ID.value != "") {
       formu.submit();
    }
}

function altaSuscripcion(formu) {
   if (formu.email.value != "") {
    formu.op.value="altasuscripcion";
	formu.submit();
   }
}


function bajaSuscripcion(formu) {
   if (formu.email.value != "") {
    formu.op.value="bajasuscripcion";
	formu.submit();
   }
}

function entrarAcceso(formu) {
   if (formu.usuario.value != "" && formu.clave.value != "") {
	formu.submit();
   }
}


function gotobusquedarapida(formu,session) {
  var tipo = formu.tipobusqueda.options[formu.tipobusqueda.selectedIndex].value;
  var texto = formu.texto.value;

  if (tipo == 0) {
        gotobuscarproyectos('','','','','','','','',texto,'0','0','0','','','0','','','','1',session);
  } else if (tipo == 1) {
        gotobuscarmicrosites('','',texto,'0','','','0','0','','','','1',session);
  } else if (tipo == 2) {
        gotobuscarproductos('','',texto,'0','0','0','','0','','','1',session);
  } else if (tipo == 3) {
        gotobuscarnoticias('','0','',texto,'','','','','','1',session);
  } else if (tipo == 4) {
        gotobuscarofertas('','',texto,'0','0','0','','','0','','','1',session);
  } else if (tipo == 5) {
        gotobuscarencuestas('',texto,'0','','1',session);
  } else {
		gotobuscarfaqs('0',texto,'','1',session)
  }

}
