/* modal box def: tdcMsg(text, title, buttons, style, func1, func2); text: text of the message in quotes - 'This is the text.' title: title of the message in quotes - 'This is my Title' buttons: one of two options in quotes - 'ok' or 'yesno' style: one of three options in quotes - 'info' or 'error' or 'question' func1: optional: the function to run if ok or yes is clicked in quotes - 'infoOK()' func2: optional: the function to run if no is clicked in quotes - 'questionNo()' */ tdc_pageWidth = function(){ return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null; } tdc_pageHeight = function(){ return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null; } tdc_posLeft = function(){ return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0; } tdc_posTop = function(){ return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0; } tdc_scrollFix = function(){ var obol=document.getElementById('tdc_ol'); obol.style.top=tdc_posTop()+'px'; obol.style.left=tdc_posLeft()+'px'; } tdc_sizeFix = function(){ var obol=document.getElementById('tdc_ol'); obol.style.height=tdc_pageHeight()+'px'; obol.style.width=tdc_pageWidth()+'px'; } /*this can be deleted unless i want to develop key command*/ /*function kp(e){ ky=e?e.which:event.keyCode; if(ky==88||ky==120)tdc_hm();return false }*/ /*i believe this can be deleted, need to test with select, flash, or iframe*/ /*function inf(h){ tag=document.getElementsByTagName('select'); for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h; tag=document.getElementsByTagName('iframe'); for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h; tag=document.getElementsByTagName('object'); for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h; }*/ tdc_sm = function(/*wd, ht*/){ //var h='hidden'; var b='block'; var p='px'; var obol=document.getElementById('tdc_ol'); obol.style.height=tdc_pageHeight()+p; obol.style.width=tdc_pageWidth()+p; obol.style.top=tdc_posTop()+p; obol.style.left=tdc_posLeft()+p; obol.style.display=b; var obbx=document.getElementById('tdc_mbox'); var wd = obbx.style.width.substring(0, obbx.style.width.indexOf('p')); var tp=tdc_posTop()+((tdc_pageHeight()-300)/2)-12; var lt=tdc_posLeft()+((tdc_pageWidth()-wd)/2)-12; obbx.style.top=(tp<0?0:tp)+p; obbx.style.left=(lt<0?0:lt)+p; //inf(h); obbx.style.display=b; return false; } tdc_hm = function(){ //var v='visible'; var n='none'; document.getElementById('tdc_ol').style.display=n; document.getElementById('tdc_mbox').style.display=n; //inf(v); document.onkeypress='' } initmb = function(){ var ab='absolute'; var n='none'; var obody=document.getElementsByTagName('body')[0]; var frag=document.createDocumentFragment(); var obol=document.createElement('div'); obol.setAttribute('id','tdc_ol'); obol.style.display=n; obol.style.position=ab; obol.style.top=0; obol.style.left=0; obol.style.zIndex=998; obol.style.width='100%'; frag.appendChild(obol); var obbx=document.createElement('div'); obbx.setAttribute('id','tdc_mbox'); obbx.style.display=n; obbx.style.position=ab; obbx.style.zIndex=999; obbx.style.width='300px'; /*var obl=document.createElement('span'); obbx.appendChild(obl);*/ var obbxd=document.createElement('div'); obbxd.setAttribute('id','tdc_mbd'); obbx.appendChild(obbxd); var obbxttl=document.createElement('div'); obbxttl.setAttribute('id','tdc_mbtitle'); obbx.appendChild(obbxttl); var obbxtxt=document.createElement('div'); obbxtxt.setAttribute('id','tdc_mbtext'); obbx.appendChild(obbxtxt); var obbxbtn=document.createElement('div'); obbxbtn.setAttribute('id','tdc_mbbtns'); obbx.appendChild(obbxbtn); frag.insertBefore(obbx,obol.nextSibling); obody.insertBefore(frag,obody.firstChild); window.onscroll = tdc_scrollFix; window.onresize = tdc_sizeFix; } tdcMsg = function(msg, ttl, b, i, func1, func2){ document.getElementById('tdc_mbtitle').innerHTML = ttl; switch(i){ case 'info': document.getElementById('tdc_mbtext').innerHTML = '
' + msg + '
'; break; case 'error': document.getElementById('tdc_mbtext').innerHTML = '
' + msg + '
'; break; case 'question': document.getElementById('tdc_mbtext').innerHTML = '
' + msg + '
'; break; default: document.getElementById('tdc_mbtext').innerHTML = '
' + msg + '
'; break; } switch(b){ case 'ok': document.getElementById('tdc_mbbtns').innerHTML = ''; break; case 'yesno': document.getElementById('tdc_mbbtns').innerHTML = ' '; break; default: document.getElementById('tdc_mbbtns').innerHTML = ''; break; } tdc_sm(); } //window.onload = initmb;