/**********************************************
web concept by positv media (http://www.positiv.com.es)
positivGo.js -x/10/03
Version: 0.2
Autor: jaime.crespillo.vilchez
Comentarios: jota@positiv.com.es
************************************************/
//posiciones x de los primeros niveles
arrXDivs=[12,65,370,510,620];

arrWDivs=new Array();
arrWDivs[0]=[0,105,190,305,440];
arrWDivs[1]=[0,140];

//nombre de items
arrNameDivs[0]=["Presentaci&oacute;n","Servicios","Junta directiva","Zonas de trabajo","Asociaciones Internacionales"];
arrNameDivs[1]=["Solicitud Afiliaci&oacute;n","Dosier Informativo"];

//urls de items
var arrNameDivsURL=new Array();
arrNameDivsURL[0]=["acn_presentacion.php","acn_servicios.php","acn_junta_directiva.php","comites.php","acn_internacional.php"];
arrNameDivsURL[1]=["afiliacion_solicitud.php","afiliacion_dossier.php"];
/////////////////////////
//funciones
function reBuscador(){
	var formu;
	formu=document.forms.f1;
	if(formu.donde.selectedIndex==0){//asociados
		formu.action="plantilla_buscador.php";
		formu.submit();
	}else{
		if(formu.donde.selectedIndex==1){//google
			formu.REQ.value=formu.cadenaBusqueda.value;
			formu.action="plantilla_buscador_google.php";
			formu.submit();
		}else{
			alert("error!");
		}
	}
}
function mapaweb(){
	w=600;
	h=500;
	xF=60+Math.ceil(Math.random()*50);
	yF=60+Math.ceil(Math.random()*50);
	var crc="width="+w+",height="+h+",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,top="+yF+",left="+xF+",fullscreen=no,hotkeys=no";
	v=window.open("mapaweb.html","mapaweb",crc);
	v.resizeTo(w,h);
	v.moveTo(xF,yF);
}
//////////////////////////
function pop(w,h,url){
	var v=null;
	var xMax=screen.availWidth;
	var yMax=screen.availHeight;
	//xF=(xMax/2)-(w/2);
	//yF=(yMax/2)-(h/2);
	//if(yF<0){yF=0;}
	xF=60+Math.ceil(Math.random()*30);
	yF=60+Math.ceil(Math.random()*30);
	var crc="width="+w+",height="+h+",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,top="+yF+",left="+xF+",fullscreen=no,hotkeys=no";
	v=window.open(url ,("pop"+Math.ceil(Math.random()*1000)), crc);
	v.resizeTo(w,h);
	v.moveTo(xF,yF);
	return v;
}
//////////////////////////
function popbars(w,h,url){
	var v=null;
	var xMax=screen.availWidth;
	var yMax=screen.availHeight;
	//xF=(xMax/2)-(w/2);
	//yF=(yMax/2)-(h/2);
	//if(yF<0){yF=0;}
	xF=60+Math.ceil(Math.random()*30);
	yF=60+Math.ceil(Math.random()*30);
	var crc="width="+w+",height="+h+",toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=no,top="+yF+",left="+xF+",fullscreen=no,hotkeys=no";
	v=window.open(url ,("pop"+Math.ceil(Math.random()*1000)), crc);
	v.resizeTo(w,h);
	v.moveTo(xF,yF);
}
////
function ampliaFoto(id,tipo){
	var wnd=pop(700,500,"plantilla_imagenes.php?id="+id+"&tipo="+tipo);
}
////////////////////////
function setEnter(){
	if(event.keyCode==13){
		if(document.forms.fasociados.nick.value!="" && document.forms.fasociados.password.value!=""){
			document.forms.fasociados.submit();	
		}
	}
}
//////////////////////////
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 MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener un e-mail correcto.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe contener un numero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un numero entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+'\n'; }
  } if (errors) alert('revise los siguientes datos:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
///////////////////
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function printPage() {
  if (pr) // NS4, IE5
    window.print()
  else if (da && !mac) // IE4 (Windows)
    vbPrintPage()
  else // other browsers
    alert("Lo sentimos, pero tu navegador no permite imprimir");
 // return false;
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}
////////////////////////////////////////////////////
finalX=Math.ceil(document.body.clientWidth/2)-375;
//document.write('<div id="falsa" style="position:absolute;left:'+(finalX-30)+'px;top:126px;z-index:20;background-color:#ffffff;width:700px;height:21px"></div>');

