/** * Common javascript functions * * webtrees: Web based Family History software * Copyright (C) 2010 webtrees development team. * * Derived from PhpGedView * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved. * * Modifications Copyright (c) 2010 Greg Roach * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @package webtrees * @subpackage Display * @version $Id$ */ if (!document.getElementById) // Check if browser supports the getElementByID function { curloc = window.location.toString(); if (curloc.indexOf('nosupport.php')==-1) window.location.href = "nosupport.php"; } var helpWin; function helpPopup(which, mod) { if (which==null) which = "help_contents_help"; if (mod!='') which=which+'&mod='+mod; if ((!helpWin)||(helpWin.closed)) { helpWin = window.open('help_text.php?help='+which,'_blank','left=50,top=50,width=500,height=320,resizable=1,scrollbars=1'); } else { helpWin.location = 'help_text.php?help='+which; } return false; } function closeHelp() { if (helpWin) helpWin.close(); } function openImage(filename, width, height) { height=height+50; screenW = screen.width; screenH = screen.height; if (width>screenW-100) width=screenW-100; if (height>screenH-110) height=screenH-120; // if (filename.search(/\.(jpe?g|gif|png)$/gi)!=-1) window.open('imageview.php?filename='+filename,'_blank','top=50,left=50,height='+height+',width='+width+',scrollbars=1,resizable=1'); // else window.open(unescape(filename),'_blank','top=50,left=50,height='+height+',width='+width+',scrollbars=1,resizable=1'); return false; } // variables to hold mouse x-y pos.s var msX = 0; var msY = 0; // the following javascript functions are for the positioning and hide/show of // DIV layers used in the display of the pedigree chart. 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 pagewidth-160) msX = msX-150-pobj.offsetLeft; contentdiv = document.getElementById("content"); msX = msX - contentdiv.offsetLeft; if (textDirection=="ltr") obj.left=(5+msX)+'px'; obj.zIndex=1000; } } else { //obj.top="auto"; if (SCRIPT_NAME.indexOf("fanchart")>0) { obj.top=(msY-20)+'px'; obj.left=(msX-20)+'px'; } else if (SCRIPT_NAME.indexOf("index.php")==-1) { Xadjust = document.getElementById('content').offsetLeft; obj.left=(5+(msX-Xadjust))+'px'; obj.top="auto"; } else { Xadjust = document.getElementById('content').offsetLeft; obj.top=(msY-50)+'px'; obj.left=(10+(msX-Xadjust))+'px'; } obj.zIndex=1000; } } } } } var show = false; function togglechildrenbox(pid) { if (!pid) pid=''; else pid = '.'+pid; if (show) { MM_showHideLayers('childbox'+pid, ' ', 'hide',' '); show=false; } else { MM_showHideLayers('childbox'+pid, ' ', 'show', ' '); show=true; } return false; } function togglefavoritesbox() { favsbox = document.getElementById("favs_popup"); if (favsbox) { if (favsbox.style.visibility=="visible") { MM_showHideLayers('favs_popup', ' ', 'hide',' '); } else { MM_showHideLayers('favs_popup', ' ', 'show', ' '); } } return false; } var lastfamilybox = ""; var popupopen = 0; function show_family_box(boxid, pboxid) { popupopen = 1; lastfamilybox=boxid; if (pboxid=='relatives') MM_showHideLayers('I'+boxid+'links', 'followmouse', 'show',''+pboxid); else { famlinks = document.getElementById("I"+boxid+"links"); divbox = document.getElementById("out-"+boxid); parentbox = document.getElementById("box"+boxid); //alert(famlinks+" "+divbox+" "+parentbox); if (famlinks && divbox && parentbox) { famlinks.style.top = "0px"; if (textDirection=="ltr") famleft = parseInt(divbox.style.width)+15; else famleft = 0; if (isNaN(famleft)) { famleft = 0; famlinks.style.top = parentbox.offsetTop+"px"; } pagewidth = document.documentElement.offsetWidth+document.documentElement.scrollLeft; if (textDirection=="rtl") pagewidth -= document.documentElement.scrollLeft; if (famleft+parseInt(parentbox.style.left) > pagewidth-100) famleft=25; famlinks.style.left = famleft + "px"; if (SCRIPT_NAME.indexOf("index.php")!=-1) famlinks.style.left = "100%"; MM_showHideLayers('I'+boxid+'links', ' ', 'show',''+pboxid); return; } MM_showHideLayers('I'+boxid+'links', 'followmouse', 'show',''+pboxid); } } function toggle_family_box(boxid, pboxid) { if (popupopen==1) { MM_showHideLayers('I'+lastfamilybox+'links', ' ', 'hide',''+pboxid); popupopen = 0; } if (boxid==lastfamilybox) { lastfamilybox = ""; return; } popupopen = 1; lastfamilybox=boxid; if (pboxid=='relatives') MM_showHideLayers('I'+boxid+'links', 'followmouse', 'show',''+pboxid); else { famlinks = document.getElementById("I"+boxid+"links"); divbox = document.getElementById("out-"+boxid); parentbox = document.getElementById("box"+boxid); if (!parentbox) parentbox = document.getElementById(pboxid+".0"); if (famlinks && divbox && parentbox) { divWidth = parseInt(divbox.style.width); linkWidth = parseInt(famlinks.style.width); parentWidth = parseInt(parentbox.style.width); //alert('Widths div:'+divWidth+' parent:'+parentWidth+' links:'+linkWidth); famlinks.style.top = "3px"; famleft = divWidth+8; if (textDirection=="rtl") { famleft -= (divWidth+linkWidth+5); if (browserType!="mozilla") famleft -= 11; } pagewidth = document.documentElement.offsetWidth+document.documentElement.scrollLeft; //alert(pagewidth); if (famleft+parseInt(parentbox.style.left) > pagewidth-100) famleft=25; famlinks.style.left = famleft + "px"; if (SCRIPT_NAME.indexOf("index.php")!=-1) famlinks.style.left = "100%"; MM_showHideLayers('I'+boxid+'links', ' ', 'show',''+pboxid); } else MM_showHideLayers('I'+boxid+'links', 'followmouse', 'show',''+pboxid); } } function hide_family_box(boxid) { MM_showHideLayers('I'+boxid+'links', '', 'hide',''); popupopen = 0; lastfamilybox=""; } var timeouts = new Array(); function family_box_timeout(boxid) { tout = setTimeout("hide_family_box('"+boxid+"')", 2500); timeouts[boxid] = tout; } function clear_family_box_timeout(boxid) { clearTimeout(timeouts[boxid]); } function expand_layer(sid,show) { var sbox = document.getElementById(sid); var sbox_img = document.getElementById(sid+"_img"); var sbox_style = sbox.style; if (show===true) { sbox_style.display='block'; if (sbox_img) { sbox_img.src = plusminus[1].src; sbox_img.title = plusminus[1].title; } } else if (show===false) { sbox_style.display='none'; if (sbox_img) { sbox_img.src = plusminus[0].src; sbox_img.title = plusminus[0].title; } } else { if ((sbox_style.display=='none')||(sbox_style.display=='')) { sbox_style.display='block'; if (sbox_img) { sbox_img.src = plusminus[1].src; sbox_img.title = plusminus[1].title; } } else { sbox_style.display='none'; if (sbox_img) { sbox_img.src = plusminus[0].src; sbox_img.title = plusminus[0].title; } } } //if (!lasttab) lasttab=0; return false; } //-- function used for mouse overs of arrows //- arrow is the id of the arrow to swap //- index is the index into the arrows array //- set index=0 for left pointing arrows //- set index=1 for right pointing arrows //- set index=2 for up pointing arrows //- set index=3 for down pointing arrows function swap_image(arrow, index) { arrowimg = document.getElementById(arrow); tmp = arrowimg.src; arrowimg.src = arrows[index].src; arrows[index].src = tmp; } // Main function to retrieve mouse x-y pos.s function getMouseXY(e) { if (IE) { // grab the x-y pos.s if browser is IE msX = event.clientX + document.documentElement.scrollLeft; msY = event.clientY + document.documentElement.scrollTop; } else { // grab the x-y pos.s if browser is NS msX = e.pageX; msY = e.pageY; } return true; } function edit_record(pid, linenum) { window.open('edit_interface.php?action=edit&pid='+pid+'&linenum='+linenum+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function edit_raw(pid) { window.open('edit_interface.php?action=editraw&pid='+pid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=510,height=520,resizable=1,scrollbars=1'); return false; } function edit_note(pid) { window.open('edit_interface.php?action=editnote&pid='+pid+'&linenum=1&'+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function edit_source(pid) { window.open('edit_interface.php?action=editsource&pid='+pid+'&linenum=1&'+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function add_record(pid, fact) { factfield = document.getElementById(fact); if (factfield) { factvalue = factfield.options[factfield.selectedIndex].value; if (factvalue == "OBJE") window.open('addmedia.php?action=showmediaform&linkid='+pid, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); else window.open('edit_interface.php?action=add&pid='+pid+'&fact='+factvalue+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); } return false; } function addClipboardRecord(pid, fact) { factfield = document.getElementById(fact); if (factfield) { factvalue = factfield.options[factfield.selectedIndex].value; window.open('edit_interface.php?action=paste&pid='+pid+'&fact='+factvalue.substr(10)+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); } return false; } function add_new_record(pid, fact) { window.open('edit_interface.php?action=add&pid='+pid+'&fact='+fact+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addnewchild(famid,gender) { window.open('edit_interface.php?action=addchild&gender='+gender+'&famid='+famid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addnewspouse(famid, famtag) { window.open('edit_interface.php?action=addspouse&famid='+famid+'&famtag='+famtag+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addopfchild(pid, gender) { window.open('edit_interface.php?action=addopfchild&pid='+pid+'&gender='+gender+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addspouse(pid, famtag) { window.open('edit_interface.php?action=addspouse&pid='+pid+'&famtag='+famtag+'&famid=new&'+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function linkspouse(pid, famtag) { window.open('edit_interface.php?action=linkspouse&pid='+pid+'&famtag='+famtag+'&famid=new&'+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function add_famc(pid) { window.open('edit_interface.php?action=addfamlink&pid='+pid+'&famtag=CHIL'+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function add_fams(pid, famtag) { window.open('edit_interface.php?action=addfamlink&pid='+pid+'&famtag='+famtag+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function edit_name(pid, linenum) { window.open('edit_interface.php?action=editname&pid='+pid+'&linenum='+linenum+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function add_name(pid) { window.open('edit_interface.php?action=addname&pid='+pid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addnewparent(pid, famtag) { window.open('edit_interface.php?action=addnewparent&pid='+pid+'&famtag='+famtag+'&famid=new'+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addnewparentfamily(pid, famtag, famid) { window.open('edit_interface.php?action=addnewparent&pid='+pid+'&famtag='+famtag+'&famid='+famid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function copy_record(pid, linenum) { window.open('edit_interface.php?action=copy&pid='+pid+'&linenum='+linenum+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function reorder_children(famid) { window.open('edit_interface.php?action=reorder_children&pid='+famid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function reorder_families(pid) { window.open('edit_interface.php?action=reorder_fams&pid='+pid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function chat(username) { alert('This feature is not implement yet'); return false; } function reply(username, subject) { window.open('message.php?to='+username+'&subject='+subject+"&"+sessionname+"="+sessionid, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function delete_message(id) { window.open('message.php?action=delete&id='+id+"&"+sessionname+"="+sessionid, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function delete_family(famid) { window.open('edit_interface.php?famid='+famid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime+"&action=deletefamily", '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function deletesource(pid) { window.open('edit_interface.php?action=deletesource&pid='+pid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function deletenote(pid) { window.open('edit_interface.php?action=deletenote&pid='+pid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime, '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function change_family_members(famid) { window.open('edit_interface.php?famid='+famid+"&"+sessionname+"="+sessionid+"&accesstime="+accesstime+"&action=changefamily", '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addnewsource(field) { pastefield = field; window.open('edit_interface.php?action=addnewsource&pid=newsour', '_blank', 'top=70,left=70,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addnewnote(field) { pastefield = field; window.open('edit_interface.php?action=addnewnote¬eid=newnote', '_blank', 'top=70,left=70,width=600,height=500,resizable=1,scrollbars=1'); return false; } function addnewnote_assisted(field, iid) { pastefield = field; window.open('edit_interface.php?action=addnewnote_assisted¬eid=newnote&pid='+iid, '_blank', 'top=70,left=70,width=870,height=726,scrollbars=no,resizable=no'); return false; } function addmedia_links(field, iid, iname) { pastefield = field; insertRowToTable(iid, iname); return false; } function valid_date(datefield) { var months = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"); var datestr=datefield.value; // if a date has a date phrase marked by () this has to be excluded from altering var datearr=datestr.split("("); var datephrase=""; if (datearr.length > 1) { datestr=datearr[0]; datephrase=datearr[1]; } // Gedcom dates are upper case datestr=datestr.toUpperCase(); // Gedcom dates have no leading/trailing/repeated whitespace datestr=datestr.replace(/\s+/, " "); datestr=datestr.replace(/(^\s)|(\s$)/, ""); // Gedcom dates have spaces between letters and digits, e.g. "01JAN2000" => "01 JAN 2000" datestr=datestr.replace(/(\d)([A-Z])/, "$1 $2"); datestr=datestr.replace(/([A-Z])(\d)/, "$1 $2"); // Shortcut for quarter format, "Q1 1900" => "BET JAN 1900 AND MAR 1900". See [ 1509083 ] if (datestr.match(/^Q ([1-4]) (\d\d\d\d)$/)) { datestr = "BET "+months[RegExp.$1*3-3]+" "+RegExp.$2+" AND "+months[RegExp.$1*3-1]+" "+RegExp.$2; } // e.g. 17.11.1860, 03/04/2005 or 1999-12-31. Use locale settings where DMY order is ambiguous. var qsearch = /(.*)(\d+)[^\d](\d+)[^\d](\d+)(.*)/i; if (qsearch.exec(datestr)) { var f0=RegExp.$1; var f1=parseInt(RegExp.$2, 10); var f2=parseInt(RegExp.$3, 10); var f3=parseInt(RegExp.$4, 10); var f4=RegExp.$5; var dmy='DMY'; if (typeof(locale_date_format)!='undefined') if (locale_date_format=='MDY' || locale_date_format=='YMD') dmy=locale_date_format; var yyyy=new Date().getFullYear(); var yy=yyyy % 100; var cc=yyyy - yy; if (dmy=='DMY' && f1<=31 && f2<=12 || f1>13 && f1<=31 && f2<=12 && f3>31) datestr=f0+f1+" "+months[f2-1]+" "+(f3>=100?f3:(f3<=yy?f3+cc:f3+cc-100))+f4; else if (dmy=='MDY' && f1<=12 && f2<=31 || f2>13 && f2<=31 && f1<=12 && f3>31) datestr=f0+f2+" "+months[f1-1]+" "+(f3>=100?f3:(f3<=yy?f3+cc:f3+cc-100))+f4; else if (dmy=='YMD' && f2<=12 && f3<=31 || f3>13 && f3<=31 && f2<=12 && f1>31) datestr=f0+f3+" "+months[f2-1]+" "+(f1>=100?f1:(f1<=yy?f1+cc:f1+cc-100))+f4; } // Shortcuts for date ranges datestr=datestr.replace(/^[>]([\w ]+)$/, "AFT $1"); datestr=datestr.replace(/^[<]([\w ]+)$/, "BEF $1"); datestr=datestr.replace(/^([\w ]+)[-]$/, "FROM $1"); datestr=datestr.replace(/^[-]([\w ]+)$/, "TO $1"); datestr=datestr.replace(/^[~]([\w ]+)$/, "ABT $1"); datestr=datestr.replace(/^[*]([\w ]+)$/, "EST $1"); datestr=datestr.replace(/^[#]([\w ]+)$/, "CAL $1"); datestr=datestr.replace(/^([\w ]+) ?- ?([\w ]+)$/, "BET $1 AND $2"); datestr=datestr.replace(/^([\w ]+) ?~ ?([\w ]+)$/, "FROM $1 TO $2"); if (datestr.match(/^=([\d ()\/+*-]+)$/)) datestr=eval(RegExp.$1); // Americans frequently enter dates as SEPTEMBER 20, 1999 // No need to internationalise this, as this is an english-language issue datestr=datestr.replace(/(JAN)(?:UARY)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(FEB)(?:RUARY)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(MAR)(?:CH)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(APR)(?:IL)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(MAY) (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(JUN)(?:E)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(JUL)(?:Y)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(AUG)(?:UST)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(SEP)(?:TEMBER)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(OCT)(?:OBER)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(NOV)(?:EMBER)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); datestr=datestr.replace(/(DEC)(?:EMBER)? (\d\d?)[, ]+(\d\d\d\d)/, "$2 $1 $3"); // Apply leading zero to day numbers datestr=datestr.replace(/(^| )(\d [A-Z]{3,5} \d{4})/, "$10$2"); if (datephrase != "") { datestr=datestr+" ("+datephrase; } datefield.value=datestr; } var oldheight = 0; var oldwidth = 0; var oldz = 0; var oldleft = 0; var big = 0; var oldboxid = ""; var oldimgw = 0; var oldimgh = 0; var oldimgw1 = 0; var oldimgh1 = 0; var diff = 0; var oldfont = 0; var oldname = 0; var oldthumbdisp = 0; var repositioned = 0; var oldiconsdislpay = 0; function expandbox(boxid, bstyle) { if (big==1) { restorebox(oldboxid, bstyle); if (boxid==oldboxid) return true; } url = window.location.toString(); divbox = document.getElementById("out-"+boxid); inbox = document.getElementById("inout-"+boxid); inbox2 = document.getElementById("inout2-"+boxid); parentbox = document.getElementById("box"+boxid); if (!parentbox) { parentbox=divbox; // if (bstyle!=2) divbox.style.position="absolute"; } gender = document.getElementById("box-"+boxid+"-gender"); thumb1 = document.getElementById("box-"+boxid+"-thumb"); famlinks = document.getElementById("I"+boxid+"links"); icons = document.getElementById("icons-"+boxid); iconz = document.getElementById("iconz-"+boxid); // This is the Zoom icon if (divbox) { if (icons) { oldiconsdislpay = icons.style.display; icons.style.display = "block"; } if (iconz) { if (iconz.src==zoominout[0].src) iconz.src = zoominout[1].src; else iconz.src = zoominout[0].src; } oldboxid=boxid; big = 1; oldheight=divbox.style.height; oldwidth=divbox.style.width; oldz = parentbox.style.zIndex; if (url.indexOf("descendancy.php")==-1) parentbox.style.zIndex='100'; if (bstyle!=2) { divbox.style.width='350px'; diff = 350-parseInt(oldwidth); if (famlinks) { famleft = parseInt(famlinks.style.left); famlinks.style.left = (famleft+diff)+"px"; } //parentbox.style.width = parseInt(parentbox.style.width)+diff; } divleft = parseInt(parentbox.style.left); if (textDirection=="rtl") divleft = parseInt(parentbox.style.right); oldleft=divleft; divleft = divleft - diff; repositioned = 0; if (divleft<0) { repositioned = 1; divleft=0; } if (url.indexOf("pedigree.php")!=-1) { if (textDirection=="ltr") parentbox.style.left=divleft+"px"; //else parentbox.style.right=divleft+"px"; } divbox.style.height='auto'; if (inbox) { inbox.style.display='block'; if ( inbox.innerHTML.indexOf("LOADING")>0 ) { //-- load data from expand_view.php var pid = boxid.split(".")[0]; var oXmlHttp = createXMLHttp(); oXmlHttp.open("get", "expand_view.php?pid=" + pid, true); oXmlHttp.onreadystatechange=function() { if (oXmlHttp.readyState==4) { inbox.innerHTML = oXmlHttp.responseText; } }; oXmlHttp.send(null); } } else { inbox.style.display='none'; } if (inbox2) inbox2.style.display='none'; fontdef = document.getElementById("fontdef-"+boxid); if (fontdef) { oldfont = fontdef.className; fontdef.className = 'detailsZoom'; } namedef = document.getElementById("namedef-"+boxid); if (namedef) { oldname = namedef.className; namedef.className = 'nameZoom'; } addnamedef = document.getElementById("addnamedef-"+boxid); if (addnamedef) { oldaddname = addnamedef.className; addnamedef.className = 'nameZoom'; } if (thumb1) { oldthumbdisp = thumb1.style.display; thumb1.style.display='block'; oldimgw = thumb1.offsetWidth; oldimgh = thumb1.offsetHeight; if (oldimgw) thumb1.style.width = (oldimgw*2)+"px"; if (oldimgh) thumb1.style.height = (oldimgh*2)+"px"; } if (gender) { oldimgw1 = gender.offsetWidth; oldimgh1 = gender.offsetHeight; if (oldimgw1) gender.style.width = "15px"; if (oldimgh1) gender.style.height = "15px"; } } return true; } function createXMLHttp() { if (typeof XMLHttpRequest != "undefined") { return new XMLHttpRequest(); } else if (window.ActiveXObject) { var ARR_XMLHTTP_VERS=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0", "MSXML2.XmlHttp.3.0","MSXML2.XmlHttp","Microsoft.XmlHttp"]; for (var i = 0; i < ARR_XMLHTTP_VERS.length; i++) { try { var oXmlHttp = new ActiveXObject(ARR_XMLHTTP_VERS[i]); return oXmlHttp; } catch (oError) {;} } } throw new Error("XMLHttp object could not be created."); }; /** * function to extract JS code from a text string. Useful to call when loading * content dynamically through AJAX which contains a mix of HTML and JavaScript. * retrieves all of the JS code between tags and adds it as a tag pos2 = text.indexOf(" tags if (!results || results.length==0) { jscode = text.substring(pos1+1, pos2); if (jscode.length>0) { ttext = document.createTextNode(jscode); //-- add the JS code to the