function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } function addEvent(obj, evType, fn) { if (obj.addEventListener){ obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } function ha_canviat_formulari(objecte){ var anterior=objecte.getAttribute('tag2') var ara=objecte.value if (anterior!=ara) { if (mostrar_butons) { mostrar_butons() } else { posar_butons(); } } return true; } function afegir_control_canvi_formulari(nom_form) { var elem = document.getElementById(nom_form).elements; for(var i = 0; i < elem.length; i++) { elem[i].setAttribute('tag2',elem[i].value) temp="ha_canviat_formulari(document.getElementById(\'"+elem[i].id+"\'))" elem[i].setAttribute('tag3',temp) var fn=new Function(temp) if (elem[i].type=='text') { addEvent(elem[i], 'keyup', fn) } if (elem[i].type=='select-one') { addEvent(elem[i], 'change', fn) } } if(typeof mostrar_butons == 'function') { mostrar_butons(); } else { if(typeof ocultar_butons == 'function') { ocultar_butons() } } } function acabarload(el_frame,funcion_ejecutar){ if (document.getElementById(el_frame).style.display=='none') { document.getElementById(el_frame).style.display='block' } document.getElementById(el_frame).style.top=0; document.getElementById(el_frame).style.height=document.getElementById(el_frame+'waitframe').style.height; document.getElementById(el_frame).style.visibility='visible'; document.getElementById(el_frame+'waitframe').style.display='none'; if(funcion_ejecutar!=null) { eval(funcion_ejecutar) } } function posarwait(el_frame,funcion_ejecutar){ var iframe = document.getElementById(el_frame); document.getElementById(el_frame).style.top=0; document.getElementById(el_frame).style.height=1; document.getElementById(el_frame).style.visibility='hidden'; document.getElementById(el_frame).src="/pagina/paginas/blanco.asp" document.getElementById(el_frame+'waitframe').style.display='block'; if (document.getElementById(el_frame).style.display=='block') { document.getElementById(el_frame).style.display='none' } if (navigator.userAgent.indexOf("MSIE") > -1 && !window.opera){ iframe.onreadystatechange = function(){ if (iframe.readyState == "complete"){ acabarload(el_frame,funcion_ejecutar) } }; } else { iframe.onload = function(){ acabarload(el_frame,funcion_ejecutar) }; } } var url_busqueda='' cr = -1; mr = 9; objecte_retorn=null; function el_ajax(){ var xmlhttp=false; try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function getPos(inputElement) { var coords = new Object(); coords.x = 0; coords.y = 0; try { targetElement = inputElement; if(targetElement.x && targetElement.y) { coords.x = targetElement.x; coords.y = targetElement.y; } else { if(targetElement.offsetParent) { coords.x += targetElement.offsetLeft; coords.y += targetElement.offsetTop; while(targetElement = targetElement.offsetParent) { coords.x += targetElement.offsetLeft; coords.y += targetElement.offsetTop; } } } return coords; } catch(error) { return coords; } } function la_busqueda(el_campo,url_ejecutar,mi_width){ var la_url=''; var buscar_ori='#{'; var buscar_fin='}#'; if ((url_ejecutar==undefined) || (url_ejecutar==null)) { la_url=url_busqueda } else { la_url=url_ejecutar } var a=la_url.indexOf(buscar_ori) var b=la_url.indexOf(buscar_fin) if ((a!=-1) && (b!=-1)) { la_id=la_url.substring(a+2,b) if (document.getElementById(la_id)) { var buscar=buscar_ori+la_id+buscar_fin la_url=la_url.replace(buscar,document.getElementById(la_id).value) } } if (document.onkeydown != KeyCheck) { document.onkeydown = KeyCheck; } var A = document.getElementById('A'); objecte_retorn=el_campo bus=escape(el_campo.value); if (bus!='') { A.style.top=getPos(el_campo).y+17; A.style.left=getPos(el_campo).x; // if ((url_ejecutar!=undefined) && (url_ejecutar!=null)) { if ((mi_width!=undefined) && (mi_width!=null)){ A.style.width=parseFloat(mi_width) } // } ajax=el_ajax(); ajax.open("GET", la_url+bus,true); ajax.onreadystatechange=function(){ if(ajax.readyState==1){ A.style.display="block" A.innerHTML = ""; } if(ajax.readyState==4){ var temp=ajax.responseText if (ajax.responseText!='') { A.style.height='auto'; A.innerHTML = temp ; el_top=parseFloat(A.style.top) el_height=parseFloat(A.clientHeight) if ((el_top+el_height)>parseFloat(document.body.clientHeight)) { A.style.top=parseFloat(A.style.top)-el_height-18 } A.style.zIndex=99 } else { A.style.display="none" } } } ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-1;"); ajax.send("bs="+bus) } else { tancar_tot() } } function creatediv_ajax(id, width, height, left, top) { var newdiv = document.createElement('div'); newdiv.setAttribute('id', id); if (width) { newdiv.style.width = width; } if (height) { newdiv.style.height = height; } if ((left || top) || (left && top)) { newdiv.style.position = "absolute"; if (left) { newdiv.style.left = left; } if (top) { newdiv.style.top = top; } } newdiv.style.display = "none"; newdiv.style.background = "#FFFFFF"; newdiv.style.border = "1px solid #7F9DB9"; document.body.appendChild(newdiv); } addLoadEvent(function (){ creatediv_ajax('A', '550', '32', '1', '1') }) function normal_row_color() { if (document.getElementById('row' + cr)) { document.getElementById('row' + cr).bgColor="#FAFAFF"; } } function change_row_color() { if (document.getElementById('row' + cr)) { document.getElementById('row' + cr).bgColor="#C6E2FF"; document.getElementById('row' + cr).focus(); } if (document.getElementById('el_href')){ document.getElementById('el_href').focus(); } } function ocultar_busqueda(){ tancar_tot() } function final(dato){ var resultado=document.getElementById('la_respuesta'+dato).innerHTML objecte_retorn.value=resultado tancar_tot() omplir_dades() } function tancar_tot(){ document.onkeydown = null; if (document.getElementById('A')) { document.getElementById('A').style.display='none'; } } function KeyCheck(e) { var keyID = (window.event) ? event.keyCode : e.keyCode; switch(keyID) { case 9: { objecte_retorn.value=''; tancar_tot(); event.returnValue = true; } break; case 27: { objecte_retorn.value=''; tancar_tot(); event.returnValue = false; } break; case 38: // focus up if (cr > 0) { normal_row_color(); cr = cr - 1; change_row_color(); event.returnValue = false; } break; case 40: // focus down if (document.getElementById('row' + (cr+1))) { normal_row_color(); cr = cr + 1; change_row_color(); event.returnValue = false; } break; case 13: if ((cr<0) || !(cr)) { cr=0 } final(cr); event.returnValue = false; break; } } /* XSM: Rev. 4.0003 19-10-2011 30-06-2011: Afegit funcio "on_closewindow(div_nom)" Quan es tenca la finestra si la pàgina que tenca de la finestra té aquest funció executa aquesta funció enlloc de tancar() function on_closewindow(div_nom){ Cal posar la función tancar la finestra dins de on_closewindow, sinó no es tencarà la finestra 01-07-2011: S'afegeix el color com opció al "crear_div_opacogeneral" 01-07-2011: S'afegeix una nova funcion "crear_mensage(num,titulo,texto_mensage,texto_boton,accion)" Posa una finestra d'informació o alerta 19-10-2011: S'afegeix la opció de triar el fondo en el mensage "crear_mensage(num,titulo,texto_mensage,texto_boton,accion,fondo)" */ var div_wait_name='' var dragapproved=false var minrestore=0 var initialwidth,initialheight var ie5=document.all&&document.getElementById var ns6=document.getElementById&&!document.all var div_es_mou='' function getPos(inputElement) { var coords = new Object(); coords.x = 0; coords.y = 0; try { targetElement = inputElement; if(targetElement.x && targetElement.y) { coords.x = targetElement.x; coords.y = targetElement.y; } else { if(targetElement.offsetParent) { coords.x += targetElement.offsetLeft; coords.y += targetElement.offsetTop; while(targetElement = targetElement.offsetParent) { coords.x += targetElement.offsetLeft; coords.y += targetElement.offsetTop; } } } return coords; } catch(error) { return coords; } } function addonresizevent() { } function mides(){ if (window.innerHeight && window.scrollMaxY) {// Firefox yWithScroll = window.innerHeight + window.scrollMaxY; xWithScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac yWithScroll = document.body.scrollHeight; xWithScroll = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; xWithScroll = document.body.offsetWidth; } return {w : xWithScroll, h : yWithScroll};; } function ajustar_div_opacogeneral(opaco){ if (document.getElementById('opacogeneral'+opaco)) { var el_div = document.getElementById('opacogeneral'+opaco); el_div.style.width=mides().w; el_div.style.height=mides().h; } } function crear_div_opacogeneral(opaco,opacitat,el_color){ var newone = document.createElement("div"); newone.id='opacogeneral'+opaco; newone.style.display='block'; newone.style.position="absolute"; if ((el_color==undefined) || (el_color==null)) { el_color="#000000" } newone.style.backgroundColor=el_color; newone.style.top=0; newone.style.left=0; newone.style.width=mides().w-1; newone.style.height=mides().h-1; opacitat2=(parseFloat(opacitat)/100) newone.style.opacity=opacitat2 newone.style.filter='alpha(opacity='+opacitat+')' document.body.appendChild(newone); window.onresize = function() { ajustar_div_opacogeneral(opaco); } } function iecompattest(){ return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } function drag_drop(e){ if (ie5&&dragapproved&&event.button==1){ document.getElementById(div_es_mou).style.left=tempx+event.clientX-offsetx+"px" document.getElementById(div_es_mou).style.top=tempy+event.clientY-offsety+"px" } else if (ns6&&dragapproved){ document.getElementById(div_es_mou).style.left=tempx+e.clientX-offsetx+"px" document.getElementById(div_es_mou).style.top=tempy+e.clientY-offsety+"px" } } function initializedrag(e,div_nom){ offsetx=ie5? event.clientX : e.clientX offsety=ie5? event.clientY : e.clientY tempx=parseInt(document.getElementById(div_nom).style.left) tempy=parseInt(document.getElementById(div_nom).style.top) dragapproved=true div_es_mou=div_nom document.getElementById(div_nom).onmousemove=drag_drop; } function ampliar_flotant(div_nom,height){ initialheight=height document.getElementById(div_nom).style.height=height+"px" } function posicionar_window(div_nom,align){ // posibilitats de align // l --> left // t --> top align=align.toLowerCase(); align=align.substring(0,1); if (align='l') { document.getElementById(div_nom).style.left=((document.body.offsetWidth-initialwidth)/2); } if (align='t') { document.getElementById(div_nom).style.top=((document.body.scrollHeight-initialheight)/2); } } function auto_ajust_window(el_window){ var el_height=document.getElementById(el_window+'contentframe').contentWindow.document.body.scrollHeight document.getElementById(el_window+'content').style.height=el_height document.getElementById(el_window+'contentframe').style.height=el_height } function loadwindowfinish(auto_height){ if (document.getElementById(div_wait_name+'contentframe')){ if(document.getElementById(div_wait_name+'waitframe')){ document.getElementById(div_wait_name+'waitframe').style.display='none'; } if (document.getElementById(div_wait_name+'contentframe').src.indexOf('/pagins/paginas/buit.asp')==-1){ if (auto_height=='S') { auto_ajust_window(div_wait_name) } else { document.getElementById(div_wait_name+'contentframe').style.height=document.getElementById(div_wait_name+'content').style.height; } document.getElementById(div_wait_name+'contentframe').style.visibility='visible'; focus_window(div_wait_name+'contentframe') } } } function focus_window(div_name){ if (navigator.userAgent.indexOf("MSIE")!=-1) { var box = window.frames[div_name].document; } else { var box = document.getElementById(div_name).contentDocument } if (box.getElementsByTagName("body")[0]) { if ( (box.getElementsByTagName("body")[0].style.visibility!='hidden') && (box.getElementsByTagName("body")[0].style.display!='none') ) { box.getElementsByTagName("body")[0].focus(); } } } function loadwindow(div_nom,left,top,width,height,mostrar){ if (mostrar=='S') { if (document.getElementById('opacogeneral'+div_nom)!=null) { crear_div_opacogeneral(div_nom,'75'); bringToFront('opacogeneral'+div_nom) } else { crear_div_opacogeneral(div_nom,'50'); bringToFront('opacogeneral'+div_nom) } } // Sustituides les variables // initialwidth per .tag // initialheight per .tag2 document.getElementById(div_nom).setAttribute("tag",width) initialwidth=width document.getElementById(div_nom).setAttribute("tag2",height) initialheight=height document.getElementById(div_nom).style.visibility='visible' document.getElementById(div_nom).style.display='' document.getElementById(div_nom).style.width=width+"px" document.getElementById(div_nom).style.height=height+"px" document.getElementById(div_nom+"content").style.height=initialheight-20; document.getElementById(div_nom+"barratitul").style.width=width; document.getElementById(div_nom+"content").style.width=width; document.getElementById(div_nom+"waitframe").style.width=width; document.getElementById(div_nom+"waitframe").style.height=initialheight-20; div_wait_name=div_nom if (left<0) { if (left==-1) { left=(document.body.offsetWidth-initialwidth)/2 // Genera un event de Onresize per posicionat al centre la finestra //window.onresize = function() //{ //posicionar_window(div_nom,'l'); //} } else { left=((document.body.offsetWidth-initialwidth)/2)+Math.abs(left); } } document.getElementById(div_nom).style.left=left; if (top==-1) { if (ns6) { top=(document.body.scrollHeight-initialheight)/2 } else { top=(document.body.offsetHeight-initialheight)/2 } // Genera un event de Onresize per posicionat al mig la finestra //window.onresize = function() //{ //posicionar_window(div_nom,'t'); //} } if (top<0) { top=1; } document.getElementById(div_nom).style.top=top; bringToFront(div_nom) // guardar_apariencia(div_nom); } function guardar_apariencia(div_nom){ if (document.getElementById('frameacciones')!=null){ var valor valor = div_nom +'|' valor = valor + document.getElementById(div_nom).style.left +'|' valor = valor + document.getElementById(div_nom).style.top +'|' valor = valor + document.getElementById(div_nom).getAttribute('tag') +'|' valor = valor + document.getElementById(div_nom).getAttribute('tag2') +'|' // Sustituides les variables // initialwidth per .tag // initialheight per .tag2 // valor = valor + initialwidth +'|' // valor = valor + initialheight +'|' if (document.getElementById(div_nom).style.height!='10px'){ valor = valor + 'N|' } else { valor = valor + 'S|' } if ((document.getElementById(div_nom).style.display!='none') || (document.getElementById(div_nom).style.visibility=='visible')){ valor = valor + 'S|' } else { valor = valor + 'N|' } // document.getElementById('frameacciones').src='/includes/guardar/home.asp?v='+valor } } function plegar(div_nom,el_width){ if (document.getElementById(div_nom).style.height!='10px'){ minrestore=1 document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/obrir.gif"); document.getElementById(div_nom+"content").style.height=1; document.getElementById(div_nom+"content").style.visibility='hidden'; document.getElementById(div_nom).style.height=10; if (el_width!=null){ document.getElementById(div_nom).style.width=el_width; } else { document.getElementById(div_nom).style.width=250; } } else { minrestore=0 document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/tancar.gif"); document.getElementById(div_nom).style.width=document.getElementById(div_nom).getAttribute('tag'); document.getElementById(div_nom).style.height=document.getElementById(div_nom).getAttribute('tag2'); // document.getElementById(div_nom).style.width=initialwidth; // document.getElementById(div_nom).style.height=initialheight; document.getElementById(div_nom+"content").style.visibility='visible'; document.getElementById(div_nom+"content").style.height=initialheight-20; } // guardar_apariencia(div_nom); } function plegar_fix2(div_nom,funcio){ plegar_fix(div_nom); eval(funcio); } function plegar_fix(div_nom){ if (document.getElementById(div_nom+"content").style.visibility!='hidden'){ document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/obrir.gif"); document.getElementById(div_nom+"content").style.height='1px'; document.getElementById(div_nom+"content").style.visibility='hidden'; // document.getElementById(div_nom).style.height=10; } else { document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/tancar.gif"); // document.getElementById(div_nom).style.height="auto"; document.getElementById(div_nom+"content").style.visibility='visible'; document.getElementById(div_nom+"content").style.height="auto"; } // guardar_apariencia(div_nom); // $('#cuerpo_2').jScrollPane({showArrows:true}); if (window.CSBfleXcroll) {CSBfleXcroll('cuerpo_2');} } function plegar_tot(div_nom){ if (document.getElementById(div_nom).style.height!='1px'){ minrestore=1 document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/obrir.gif"); document.getElementById(div_nom).style.height=1; document.getElementById(div_nom).style.visibility='hidden'; } else { minrestore=0 document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/tancar.gif"); document.getElementById(div_nom).style.height="auto"; document.getElementById(div_nom).style.visibility='visible'; } // $('#cuerpo_2').jScrollPane({showArrows:true}); if (window.CSBfleXcroll) {CSBfleXcroll('cuerpo_2');} } function cerrar_window(div_nom){ var fet=false if (document.getElementById(div_nom+"contentframe")) { // if (navigator.userAgent.indexOf("MSIE")!=-1) { // var box = window.frames[div_name].document; // } else { // var box = document.getElementById(div_name).contentDocument // } if (window.frames[div_nom+'contentframe'].on_closewindow){ window.frames[div_nom+'contentframe'].on_closewindow(div_nom) fet=true } } if (!fet){ tancar(div_nom) } } function borrar_opaco(div_nom){ if (document.getElementById('opacogeneral'+div_nom)) { document.body.removeChild(document.getElementById('opacogeneral'+div_nom)); } } function tancar(div_nom){ if (document.getElementById(div_nom)) { document.getElementById(div_nom).style.visibility='hidden' document.getElementById(div_nom).style.display='none' if (document.getElementById(div_nom+"waitframe")) { document.getElementById(div_nom+"waitframe").style.display='block'; } if (document.getElementById(div_nom+"contentframe")) { document.getElementById(div_nom+"contentframe").setAttribute('src','/datos/blanco.asp'); document.getElementById(div_nom+"contentframe").setAttribute('src',null); } borrar_opaco(div_nom) // if (document.getElementById('opacogeneral2'+div_nom)) { // document.body.removeChild(document.getElementById('opacogeneral2'+div_nom)); // } else { // if (document.getElementById('opacogeneral'+div_nom)) { // document.body.removeChild(document.getElementById('opacogeneral'+div_nom)); // } // } if (document.getElementById(div_nom)) { document.body.removeChild(document.getElementById(div_nom)); } if (document.getElementById('opacogeneral'+div_nom)) { document.body.removeChild(document.getElementById('opacogeneral'+div_nom)) } // guardar_apariencia(div_nom); } } function stopdrag(div_nom){ dragapproved=false; div_es_mou=''; document.getElementById(div_nom).onmousemove=null; // guardar_apariencia(div_nom); } function getAbsoluteDivs() { var arr = new Array(); var all_divs = document.body.getElementsByTagName("div"); var j = 0; for (i = 0; i < all_divs.length; i++) if (all_divs.item(i).style.position=='absolute') { arr[j] = all_divs.item(i); j++; } return arr; } function bringToFront(id) { if (!document.getElementById || !document.getElementsByTagName) return; var obj = document.getElementById(id); var divs = getAbsoluteDivs(); var max_index = 0; var cur_index; // Compute the maximal z-index of // other absolute-positioned divs for (i = 0; i < divs.length; i++) { var item = divs[i]; if (item == obj || item.style.zIndex == '') continue; cur_index = parseInt(item.style.zIndex); if (max_index < cur_index) { max_index = cur_index; } } obj.style.zIndex = max_index + 1; } function sendToBack(id) { if (!document.getElementById || !document.getElementsByTagName) return; var obj = document.getElementById(id); var divs = getAbsoluteDivs(); var min_index = 999999; var cur_index; if (divs.length < 2) return; // Compute the minimal z-index of // other absolute-positioned divs for (i = 0; i < divs.length; i++) { var item = divs[i]; if (item == obj) continue; if (item.style.zIndex == '') { min_index = 0; break; } cur_index = parseInt(item.style.zIndex); if (min_index > cur_index) { min_index = cur_index; } } if (min_index > parseInt(obj.style.zIndex)) { return; } obj.style.zIndex = 1; if (min_index > 1) return; var add = min_index == 0 ? 2 : 1; for (i = 0; i < divs.length; i++) { var item = divs[i]; if (item == obj) continue; item.style.zIndex += add; } } function plegar_listado(div_nom,img){ if (document.getElementById(div_nom).style.height!='1px'){ document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/obertura/"+img+"_2.gif"); document.getElementById(div_nom).style.height=1; document.getElementById(div_nom).style.display='none'; } else { document.getElementById(div_nom+"buto").setAttribute("src","/imagenes/v11/finestres/obertura/"+img+"_1.gif"); document.getElementById(div_nom).style.height="auto"; document.getElementById(div_nom).style.display='block'; } } function ampliar_finestra(la_finestra,maxim){ var width_actual=parseFloat(document.getElementById(la_finestra+'contentframe').style.width) if (width_actualmaxim) { document.getElementById(la_finestra).style.width=width_actual-50 document.getElementById(la_finestra+'barratitul').style.width=width_actual-50 document.getElementById(la_finestra+'content').style.width=width_actual-50 document.getElementById(la_finestra+'contentframe').style.width=width_actual-50 document.getElementById(la_finestra).style.left=parseFloat(document.getElementById(la_finestra).style.left)+25 if (window.frames[la_finestra+'contentframe'].document.getElementById('cuerpo_2')) { window.frames[la_finestra+'contentframe'].document.getElementById('cuerpo_2').style.width=document.getElementById(la_finestra+'contentframe').style.width window.frames[la_finestra+'contentframe'].CSBfleXcroll('cuerpo_2'); } ampliarfinetra=setTimeout('ampliar_finestra("'+la_finestra+'",'+maxim+');',1); } else { clearTimeout(ampliarfinetra); ampliarfinetra=null } } } function crear_globo(num,url,width,height,left,top,sombra){ var newdiv = document.createElement("div"); width=width+20 height=height+20 top=top-10 left=left-10 var el_html='' if (sombra=='S'){ crear_div_opacogeneral('wflotante'+num,60,'#C0C0C0') } el_html = el_html + '
' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' // el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' el_html = el_html + '
' newdiv.id='wflotante'+num; newdiv.name='wflotante'+num; newdiv.style.position='absolute'; newdiv.style.backgroundColor='transparent'; var w=width var h=height newdiv.style.width=w; newdiv.height=h; if ((left==undefined) || (left==null)) { var l=(document.body.offsetWidth-w)/2 } else { var l=left } if ((top==undefined) || (top==null)) { var t=(document.body.scrollHeight-h)/2 } else { var t=top } newdiv.style.top=t; newdiv.style.left=l; newdiv.innerHTML=el_html document.body.appendChild(newdiv); bringToFront('wflotante'+num) } function crear_notificacion(num,url,width,height,left,top,sombra,html){ if (!document.getElementById('wflotante'+num)) { var newdiv = document.createElement("div"); var el_width=width-(19+18) var el_height=height-(19+19) var el_top=top var el_left=left var el_html='' if (sombra=='S'){ crear_div_opacogeneral('wflotante'+num,60,'#C0C0C0') } el_html = el_html + '
' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' if (url!='') { // el_html = el_html + '' el_html = el_html + '' } if (html!='') { el_html = el_html + '
' el_html = el_html + html el_html = el_html + '
' } el_html = el_html + '
' el_html = el_html + '
' newdiv.id='wflotante'+num; newdiv.name='wflotante'+num; newdiv.style.position='absolute'; newdiv.style.backgroundColor='transparent'; var w=width var h=height newdiv.style.width=w; newdiv.height=h; if ((left==undefined) || (left==null)) { var l=(document.body.offsetWidth-w)/2 } else { var l=left } if ((top==undefined) || (top==null)) { var t=(document.body.scrollHeight-h)/2 } else { var t=top } newdiv.style.top=t; newdiv.style.left=l; newdiv.innerHTML=el_html document.body.appendChild(newdiv); bringToFront('wflotante'+num) } else { if (document.getElementById('wflotante'+num+'el_html')) { document.getElementById('wflotante'+num+'el_html').innerHTML=html } } } function crear_mensage(num,titulo,texto_mensage,texto_boton,accion,fondo,height) { var newdiv = document.createElement("div"); var el_html='' var la_accion = '' if ((fondo==undefined) || (fondo==null)) { fondo='1' } if ((accion==undefined) || (accion==null)) { var la_accion='' } else { var la_accion = accion + ';' } switch(fondo) { case 1: var el_fondo='/imagenes/v11/vermell_deg.jpg' var el_color_fondo='#fe0000' var el_color_texto='#FFFFFF' var el_color_titulo='#FFFFFF' var el_boton_tipo='Buto_g150' break; case 2: var el_fondo='/imagenes/v11/verd_deg.jpg' var el_color_fondo='#3cc543' var el_color_texto='#000000' var el_color_titulo='#000000' var el_boton_tipo='Buto_r150' break; case 3: var el_fondo='/imagenes/v11/tronja2_deg.jpg' var el_color_fondo='#d45f0f' var el_color_texto='#000000' var el_color_titulo='#000000' var el_boton_tipo='Buto_r150' break; case 4: var el_fondo='/imagenes/v11/tronja_deg.jpg' var el_color_fondo='#fa9c3a' var el_color_texto='#000000' var el_color_titulo='#000000' var el_boton_tipo='Buto_r150' break; case 5: var el_fondo='/imagenes/v11/groc_deg.jpg' var el_color_fondo='#d9d244' var el_color_texto='#000000' var el_color_titulo='#000000' var el_boton_tipo='Buto_r150' break; case 6: var el_fondo='/imagenes/v11/gris_deg.jpg' var el_color_fondo='#666666' var el_color_texto='#000000' var el_color_titulo='#000000' var el_boton_tipo='Buto_r150' break; case 7: var el_fondo='/imagenes/v11/fucsia_deg.jpg' var el_color_fondo='#c98eff' var el_color_texto='#000000' var el_color_titulo='#000000' var el_boton_tipo='Buto_b150' break; case 8: var el_fondo='/imagenes/v11/blau_deg2.jpg' var el_color_fondo='#badff2' var el_color_texto='#FFFFFF' var el_color_titulo='#FFFFFF' var el_boton_tipo='Buto_r150' break; case 9: var el_fondo='/imagenes/v11/blau_deg.jpg' var el_color_fondo='#519cd3' var el_color_texto='#FFFFFF' var el_color_titulo='#FFFFFF' var el_boton_tipo='Buto_r150' break; default: var el_fondo='/imagenes/v11/vermell_deg.jpg' var el_color_fondo='/imagenes/v11/vermell_deg.jpg' var el_color_texto='#FFFFFF' var el_color_titulo='#FFFFFF' var el_boton_tipo='Buto_r150' } crear_div_opacogeneral('wflotante'+num,60,'#C0C0C0') el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
'+texto_mensage+'
' el_html = el_html + ''+texto_boton+'' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '
' newdiv.id='wflotante'+num; newdiv.name='wflotante'+num; newdiv.style.position='absolute'; newdiv.style.backgroundColor='transparent'; var w=400 if ((height==undefined) || (height==null)) { var h=400 } else { var h=height } newdiv.style.width=w; newdiv.height=h; var l=(document.body.offsetWidth-w)/2 if (navigator.userAgent.indexOf("IE")!=-1) { var t=document.body.scrollTop+(document.body.offsetHeight-h)/2 } else { var t=document.body.scrollTop+(window.innerHeight-h)/2 } newdiv.style.top=t; newdiv.style.left=l; newdiv.innerHTML=el_html document.body.appendChild(newdiv); // document.getElementById('wflotante'+num+'content').style.height=h bringToFront('wflotante'+num) setTimeout(function() { document.getElementById('wflotante'+num+'boton').focus(); }, 50); } function crear_window(num,color_fons) { var newdiv = document.createElement("div"); var el_html='' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '
' el_html = el_html + '' el_html = el_html + '' el_html = el_html + '
' el_html = el_html + '
' newdiv.id='wflotante'+num; newdiv.name='wflotante'+num; newdiv.style.position='absolute'; newdiv.style.backgroundColor='transparent'; newdiv.style.top=0; newdiv.style.left=0; newdiv.style.display='none' newdiv.style.width=200; newdiv.style.height='auto'; newdiv.innerHTML=el_html document.body.appendChild(newdiv); } function info_window(div_nombre){ var info = new Object(); info.left = parseFloat(top.document.getElementById(div_nombre).style.left) info.top = parseFloat(top.document.getElementById(div_nombre).style.top) info.height = parseFloat(top.document.getElementById(div_nombre+'content').style.height) info.width = parseFloat(top.document.getElementById(div_nombre+'content').style.width) return info; } function veure_detall(num,url,width,height,titul,left,top,sombra,tancar,color_barra,color_texte,classname,barradetitul,color_fons,auto_height) { crear_window(num,color_fons); if ((auto_height==undefined) || (auto_height==null)) { auto_height='S' } if (document.getElementById("wflotante"+num).style.visibility=='visible') { document.getElementById("wflotante"+num+"buto").click(); } document.getElementById("wflotante"+num+"titulo").innerHTML=titul; var iframe = document.getElementById("wflotante"+num+"contentframe"); iframe.src = url; if (navigator.userAgent.indexOf("MSIE") > -1 && !window.opera){ iframe.onreadystatechange = function(){ if (iframe.readyState == "complete"){ loadwindowfinish(auto_height) } }; } else { iframe.onload = function(){ loadwindowfinish(auto_height) }; } document.getElementById("wflotante"+num).style.width=width document.getElementById("wflotante"+num+'barratitul').style.width=width document.getElementById("wflotante"+num+'content').style.width=width if ((color_fons!=undefined) && (color_fons!=null)) { document.getElementById("wflotante"+num+'content').style.backgroundcolor=color_fons document.getElementById("wflotante"+num+'waitframe').style.backgroundcolor=color_fons } document.getElementById("wflotante"+num+"contentframe").style.top=0 document.getElementById("wflotante"+num+"contentframe").style.width=width document.getElementById("wflotante"+num+"contentframe").style.height=1 document.getElementById("wflotante"+num+"waitframe").style.top=0 document.getElementById("wflotante"+num+"waitframe").style.width=width document.getElementById("wflotante"+num+"waitframe").style.height=height document.getElementById("wflotante"+num+"waitframe").style.display=''; if (num=='E') { tancar='N' } if ((barradetitul!=undefined) || (barradetitul==null)) { if (barradetitul=='N') { document.getElementById("wflotante"+num+"barratitul").style.display='none' } else { document.getElementById("wflotante"+num+"barratitul").style.display='' } } if ((classname!=undefined) || (classname==null)) { document.getElementById("wflotante"+num+"barra").className=classname; } if ((color_barra!=undefined) && (color_barra!=null) && (color_barra!='')) { document.getElementById("wflotante"+num+"barra").style.backgroundColor=color_barra } else{ document.getElementById("wflotante"+num+"barra").style.backgroundColor='#D0D0D0'; } if ((color_texte!=undefined) && (color_texte!=null) && (color_texte!='')) { document.getElementById("wflotante"+num+"titulo").style.color=color_texte } else{ document.getElementById("wflotante"+num+"titulo").style.color='#000000'; } if ((left==undefined) || (left==null)) { left=-1 } if ((top==undefined) || (top==null)) { top=-1 } if ((sombra==undefined) || (sombra==null)) { sombra='S' } if ((tancar==undefined) || (tancar==null)) { tancar='S' } if (tancar=='N') { document.getElementById("wflotante"+num+"buto").style.display='none' } else { document.getElementById("wflotante"+num+"buto").style.display='' } loadwindow('wflotante'+num,left,top,width,height,sombra); if (tancar=='R') { document.getElementById("wflotante"+num+"buto").setAttribute('src','/imagenes/v11/finestres/close_rojo.gif') } if (tancar=='B') { document.getElementById("wflotante"+num+"buto").setAttribute('src','/imagenes/v11/finestres/close_blanco.gif') } num=null url=null width=null height=null titul=null left=null top=null sombra=null tancar=null color_barra=null color_texte=null classname=null barradetitul=null } function el_ajax(){ var xmlhttp=false; try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function addLoadEventFrame(func,div_nom) { var oldonload = window.frames[div_nom+'contentframe'].onload; if (typeof window.frames[div_nom+'contentframe'].onload != 'function') { window.frames[div_nom+'contentframe'].onload = func; } else { window.frames[div_nom+'contentframe'].onload = function() { func(); if (oldonload) { oldonload(); } } } } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } function addEvent(obj, evType, fn) { if (obj.addEventListener){ obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } function ha_canviat_formulari(objecte){ var anterior=objecte.getAttribute('tag2') var ara=objecte.value if (anterior!=ara) { if (mostrar_butons) { mostrar_butons() } else { posar_butons(); } } return true; } function afegir_control_canvi_formulari(nom_form) { if (document.getElementById(nom_form)) { var elem = document.getElementById(nom_form).elements; for(var i = 0; i < elem.length; i++) { elem[i].setAttribute('tag2',elem[i].value) temp="ha_canviat_formulari(document.getElementById(\'"+elem[i].id+"\'))" elem[i].setAttribute('tag3',temp) var fn=new Function(temp) if (elem[i].type=='text') { addEvent(elem[i], 'keyup', fn) } if (elem[i].type=='select-one') { addEvent(elem[i], 'change', fn) } } } }