
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_findObj(n,d){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&&document.getElementById)x=document.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function fillSelect(select,options)
{for(var i=0;i<options.length;i++)
{var option=options[i];select.options[select.options.length]=new Option(option.text,option.value);}
return select;}
function eliminarFecha(evt,id)
{if($('fechas').childElements().length==1)
{alert('Es requerida por lo menos una fecha');return;}
$('fecha_'+id).remove();return false;}
var opt_day=null;var opt_month=null;var opt_year=null;var opt_hour=null;var indexes=new Array();function agregarFecha()
{var id=$('fechas').childElements().length+1;if(opt_day==null)
{opt_day=$('fecha_Day').cloneNode(true).options;opt_month=$('fecha_Month').cloneNode(true).options;opt_year=$('fecha_Year').cloneNode(true).options;opt_hour=$('hora_').cloneNode(true).options;indexes[0]=$('fecha_Day').selectedIndex;indexes[1]=$('fecha_Month').selectedIndex;indexes[2]=$('fecha_Year').selectedIndex;indexes[3]=$('hora_').selectedIndex;}
var sel_day=fillSelect(Builder.node('select',{className:'form'}),opt_day);sel_day.setAttribute('name','fecha[Day][]');sel_day.selectedIndex=indexes[0];var sel_month=fillSelect(Builder.node('select',{className:'form'}),opt_month);sel_month.setAttribute('name','fecha[Month][]');sel_month.selectedIndex=indexes[1];var sel_year=fillSelect(Builder.node('select',{className:'form'}),opt_year);sel_year.name="fecha[Year][]";sel_year.selectedIndex=indexes[2];var sel_hour=fillSelect(Builder.node('select',{className:'form'}),opt_hour);sel_hour.name="hora[]";sel_hour.selectedIndex=indexes[3];var hs=Builder.node('span',{className:'verdana11'},'hs');var borrar=Builder.node('a',{className:'mod',style:'cursor: pointer'},'[-] borrar');Event.observe(borrar,'click',eliminarFecha.bindAsEventListener(this,id));$('fechas').appendChild(Builder.node('div',{id:'fecha_'+id},[sel_day,' ',sel_month,' ',sel_year,' ',sel_hour,' ',hs,' ',borrar]))}
