window.addEvent('domready',TB_init);TB_WIDTH=0;TB_HEIGHT=0;var TB_doneOnce=0;function TB_init(){$$("a.smoothbox").each(function(el){el.onclick=TB_bind});}
function TB_bind(event){var event=new Event(event);event.preventDefault();this.blur();var caption=this.title||this.name||"";var group=this.rel||false;TB_show(caption,this.href,group);this.onclick=TB_bind;return false;}
function TB_show(caption,url,rel){if(!$("TB_overlay"))
{new Element('iframe').setProperty('id','TB_HideSelect').injectInside(document.body);$('TB_HideSelect').setOpacity(0);new Element('div').setProperty('id','TB_overlay').injectInside(document.body);$('TB_overlay').setOpacity(0);TB_overlaySize();new Element('div').setProperty('id','TB_load').injectInside(document.body);$('TB_load').innerHTML="<img src='components/com_chronocontact/css/smoothbox/loading.gif' />";TB_load_position();new Fx.Style('TB_overlay','opacity',{duration:400,transition:Fx.Transitions.sineInOut}).start(0,0.6);}
if(!$("TB_load"))
{new Element('div').setProperty('id','TB_load').injectInside(document.body);$('TB_load').innerHTML="<img src='components/com_chronocontact/css/smoothbox/loading.gif' />";TB_load_position();}
if(!$("TB_window"))
{new Element('div').setProperty('id','TB_window').injectInside(document.body);$('TB_window').setOpacity(0);}
$("TB_overlay").onclick=TB_remove;window.onscroll=TB_positionEffect;var baseURL=url.match(/(.+)?/)[1]||url;var imageURL=/\.(jpe?g|png|gif|bmp)/gi;if(baseURL.match(imageURL)){}else{var queryString=url.match(/\?(.+)/)[1];var params=TB_parseQuery(queryString);TB_WIDTH=params['homeId']?($(params['homeId']).getStyle('width').toInt()+40):((params['width']*1)+40);TB_HEIGHT=500;params['homeId']?($(params['homeId']).setStyle('display','none')):'';if(caption=='Form Preview'){Output=$(params['homeId']).clone();$ES('.delete_icon',Output).each(function(delete_div){delete_div.remove();});$ES('.slabel',Output).each(function(delete_div){delete_div.remove();});$ES('.drag',Output).each(function(delete_div){delete_div.remove();});$ES('.config_icon',Output).each(function(delete_div){delete_div.remove();});Output.getChildren().each(function(element){element.removeEvents();});$ES('.form_item',Output).each(function(element){element.setStyle('border','0px');});$ES('.cf_hidden',Output).each(function(element){element.setStyle('display','none');});$(params['inlineId']).innerHTML=Output.innerHTML;$ES('input[id^=date_]',$(params['inlineId'])).each(function(date_field){date_field.setProperty('onClick',"new Calendar(this);");});}else if(caption=='HTML Source'){$(params['inlineId']).innerHTML='';Output=$(params['homeId']).clone();$ES('.delete_icon',Output).each(function(delete_div){delete_div.remove();});$ES('.slabel',Output).each(function(delete_div){delete_div.remove();});$ES('.drag',Output).each(function(delete_div){delete_div.remove();});$ES('.config_icon',Output).each(function(delete_div){delete_div.remove();});$ES('',Output).each(function(element){element.removeEvents();});$ES('.form_item',Output).each(function(element){element.setStyle('border','0px');});var sourcecode=Output.innerHTML.replace(/\$included="null"/g,'').replace(/\$events="null"/g,'');Output.innerHTML=sourcecode;$ES('.cf_hidden',Output).each(function(element){element.setStyle('display','none');});sourcearea=new Element('textarea');sourcearea.setText(Output.innerHTML.replace(/\$included="null"/g,'').replace(/\$events="null"/g,''));sourcearea.setStyle('width',(TB_WIDTH-60));sourcearea.setStyle('height',(TB_HEIGHT-80));sourcearea.injectInside($(params['inlineId']));}else if(caption=='Select Field'){$(params['inlineId']).innerHTML='';$(params['inlineId']).setStyles({'display':'none'});Output=$(params['homeId']).clone();$ES('.delete_icon',Output).each(function(delete_div){delete_div.remove();});$ES('.slabel',Output).each(function(delete_div){delete_div.remove();});$ES('.drag',Output).each(function(delete_div){delete_div.remove();});$ES('.config_icon',Output).each(function(delete_div){delete_div.empty();delete_div.injectHTML('<div class="config_icon"><img src="components/com_chronocontact/css/images/checkin.png" alt="Select" width="15" height="15"  /></div>','after');});$ES('',Output).each(function(element){element.removeEvents();});$ES('label',Output).each(function(element){element.setProperty('for','');});$ES('.form_item',Output).each(function(element){element.setStyle('border','0px');});$ES('.cf_hidden',Output).each(function(element){element.setStyle('display','none');});if((params['sourceId']).contains('dto_')){var header='<div style="color:#ff0000">Please select the field which will have the email address to be used as the TO EMAIL</div><br><br>';}else if((params['sourceId']).contains('dsubject_')){var header='<div style="color:#ff0000">Please select the field which will have the text to be used as the Email Subject</div><br><br>';}else if((params['sourceId']).contains('dfromname_')){var header='<div style="color:#ff0000">Please select the field which will have the text to be used as the Email From Name</div><br><br>';}else if((params['sourceId']).contains('dfromemail_')){var header='<div style="color:#ff0000">Please select the field which will have the email to be used as the Email From Email</div><br><br>';}else if((params['sourceId']).contains('dcc_')){var header='<div style="color:#ff0000">Please select the field which will have the email to be used as a CC Email</div><br><br>';}else if((params['sourceId']).contains('dbcc_')){var header='<div style="color:#ff0000">Please select the field which will have the email to be used as a BCC Email</div><br><br>';}else{}
$(params['inlineId']).innerHTML=header+Output.innerHTML.replace(/\$included="null"/g,'').replace(/\$events="null"/g,'');}else if(caption=='Add Field'){$(params['inlineId']).innerHTML='';$(params['inlineId']).setStyles({'display':'none'});Output=$(params['homeId']).clone();$ES('.delete_icon',Output).each(function(delete_div){delete_div.remove();});$ES('.slabel',Output).each(function(delete_div){delete_div.remove();});$ES('.drag',Output).each(function(delete_div){delete_div.remove();});$ES('.config_icon',Output).each(function(delete_div){delete_div.empty();delete_div.injectHTML('<div class="config_icon"><img src="components/com_chronocontact/css/images/checkin.png" alt="Select" width="15" height="15"  /></div>','after');});$ES('',Output).each(function(element){element.removeEvents();});$ES('label',Output).each(function(element){element.setProperty('for','');});$ES('.form_item',Output).each(function(element){element.setStyle('border','0px');});$ES('.cf_hidden',Output).each(function(element){element.setStyle('display','none');});$(params['inlineId']).innerHTML=Output.innerHTML.replace(/\$included="null"/g,'').replace(/\$events="null"/g,'');}else{}
var ajaxContentW=TB_WIDTH-30,ajaxContentH=TB_HEIGHT-45;if(url.indexOf('TB_iframe')!=-1){urlNoQuery=url.split('TB_');$("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;' onload='TB_showWindow()'> </iframe>";}else{$("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>";}
$("TB_closeWindowButton").onclick=TB_remove;if(url.indexOf('TB_inline')!=-1){$("TB_ajaxContent").innerHTML=($(params['inlineId']).innerHTML);TB_position();TB_showWindow();}else if(url.indexOf('TB_iframe')!=-1){TB_position();if(frames['TB_iframeContent']==undefined){$(document).keyup(function(e){var key=e.keyCode;if(key==27){TB_remove()}});TB_showWindow();}}else{var handlerFunc=function(){TB_position();TB_showWindow();};var myRequest=new Ajax(url,{method:'get',update:$("TB_ajaxContent"),onComplete:handlerFunc}).request();}}
window.onresize=function(){TB_position();TB_load_position();TB_overlaySize();}
document.onkeyup=function(event){var event=new Event(event);if(event.code==27){TB_remove();}}
$ES('.tooltipimg',$("TB_ajaxContent")).each(function(ed){if($chk($('tool-tip-'+ed.getParent().getParent().getFirst().getNext().getProperty('id')+'_s'))){$('tool-tip-'+ed.getParent().getParent().getFirst().getNext().getProperty('id')+'_s').remove();}
var Tips2=new Tips(ed,$E('div.tooltipdiv',ed.getParent().getParent()).getText(),{elementid:ed.getParent().getParent().getFirst().getNext().getProperty('id')+'_s'});});if(caption=='Select Field'){$ES('.cf_inputbox',$("TB_ajaxContent")).each(function(element){element.addEvents({'click':function(){$(params['sourceId']).value=this.getProperty('name').replace('[]','');TB_remove();},'mouseover':function(){element.getParent().getParent().effect('background-color',{wait:false,duration:100}).start('E7DFE7','E7DFE7');},'mouseout':function(){element.getParent().getParent().effect('background-color',{wait:false,duration:100}).start('ffffff','ffffff');}})});$ES('.radio',$("TB_ajaxContent")).each(function(element){element.addEvents({'click':function(){$(params['sourceId']).value=this.getProperty('name').replace('[]','');TB_remove();},'mouseover':function(){element.getParent().getParent().getParent().effect('background-color',{wait:false,duration:100}).start('E7DFE7','E7DFE7');},'mouseout':function(){element.getParent().getParent().getParent().effect('background-color',{wait:false,duration:100}).start('ffffff','ffffff');}})});$ES('.config_icon',$("TB_ajaxContent")).each(function(element){element.addEvents({'click':function(){var name='';if($chk(element.getParent().getFirst().getFirst().getNext())){if(element.getParent().getFirst().getFirst().getNext().getProperty('name')==null){if(element.getParent().getFirst().getFirst().getNext().getProperty('class')=='float_left'){name=element.getParent().getFirst().getFirst().getNext().getFirst().getProperty('name');}}else{name=element.getParent().getFirst().getFirst().getNext().getProperty('name');}}
$(params['sourceId']).value=name.replace('[]','');TB_remove();},'mouseover':function(){element.getParent().effect('background-color',{wait:false,duration:100}).start('E7DFE7','E7DFE7');},'mouseout':function(){element.getParent().effect('background-color',{wait:false,duration:100}).start('ffffff','ffffff');}})});}
if(caption=='Add Field'){$ES('.cf_inputbox',$("TB_ajaxContent")).each(function(element){element.addEvents({'click':function(){TB_remove();if(params['sourceId']=='onsubmitcode'){tinyMCE.get('onsubmitcode').focus();tinyMCE.get('onsubmitcode').selection.moveToBookmark(ieBookmark);tinyMCE.execCommand('mceInsertContent',false,'{'+this.getProperty('name').replace('[]','')+'}');}else{tinyMCE.activeEditor.focus();tinyMCE.activeEditor.selection.moveToBookmark(ieBookmark);tinyMCE.execCommand('mceInsertContent',false,'{'+this.getProperty('name').replace('[]','')+'}');}},'mouseover':function(){element.getParent().getParent().effect('background-color',{wait:false,duration:100}).start('E7DFE7','E7DFE7');},'mouseout':function(){element.getParent().getParent().effect('background-color',{wait:false,duration:100}).start('ffffff','ffffff');}})});$ES('.radio',$("TB_ajaxContent")).each(function(element){element.addEvents({'click':function(){TB_remove();if(params['sourceId']=='onsubmitcode'){tinyMCE.get('onsubmitcode').focus();tinyMCE.get('onsubmitcode').selection.moveToBookmark(ieBookmark);tinyMCE.execCommand('mceInsertContent',false,'{'+this.getProperty('name').replace('[]','')+'}');}else{tinyMCE.activeEditor.focus();tinyMCE.activeEditor.selection.moveToBookmark(ieBookmark);tinyMCE.execCommand('mceInsertContent',false,'{'+this.getProperty('name').replace('[]','')+'}');}},'mouseover':function(){element.getParent().getParent().getParent().effect('background-color',{wait:false,duration:100}).start('E7DFE7','E7DFE7');},'mouseout':function(){element.getParent().getParent().getParent().effect('background-color',{wait:false,duration:100}).start('ffffff','ffffff');}})});$ES('.config_icon',$("TB_ajaxContent")).each(function(element){element.addEvents({'click':function(){TB_remove();var name='';if($chk(element.getParent().getFirst().getFirst().getNext())){if(element.getParent().getFirst().getFirst().getNext().getProperty('name')==null){if(element.getParent().getFirst().getFirst().getNext().getProperty('class')=='float_left'){name='{'+element.getParent().getFirst().getFirst().getNext().getFirst().getProperty('name').replace('[]','')+'}';}}else{name='{'+element.getParent().getFirst().getFirst().getNext().getProperty('name').replace('[]','')+'}';}}
if(params['sourceId']=='onsubmitcode'){tinyMCE.get('onsubmitcode').focus();tinyMCE.get('onsubmitcode').selection.moveToBookmark(ieBookmark);tinyMCE.execCommand('mceInsertContent',false,name);}else{tinyMCE.activeEditor.focus();tinyMCE.activeEditor.selection.moveToBookmark(ieBookmark);tinyMCE.execCommand('mceInsertContent',false,name);}},'mouseover':function(){element.getParent().effect('background-color',{wait:false,duration:100}).start('E7DFE7','E7DFE7');},'mouseout':function(){element.getParent().effect('background-color',{wait:false,duration:100}).start('ffffff','ffffff');}})});}}
function TB_showWindow(){if(TB_doneOnce==0){TB_doneOnce=1;var myFX=new Fx.Style('TB_window','opacity',{duration:250,transition:Fx.Transitions.sineInOut,onComplete:function(){if($('TB_load')){$('TB_load').remove();}}}).start(0,1);}else{$('TB_window').setStyle('opacity',1);if($('TB_load')){$('TB_load').remove();}}}
function TB_remove(){$('left_column').setStyle('display','inline');$('temp_code2').innerHTML='';$("TB_overlay").onclick=null;document.onkeyup=null;document.onkeydown=null;if($('TB_imageOff'))$("TB_imageOff").onclick=null;if($('TB_closeWindowButton'))$("TB_closeWindowButton").onclick=null;if($('TB_prev')){$("TB_prev").onclick=null;}
if($('TB_next')){$("TB_next").onclick=null;}
new Fx.Style('TB_window','opacity',{duration:250,transition:Fx.Transitions.sineInOut,onComplete:function(){$('TB_window').remove();}}).start(1,0);new Fx.Style('TB_overlay','opacity',{duration:400,transition:Fx.Transitions.sineInOut,onComplete:function(){$('TB_overlay').remove();}}).start(0.6,0);window.onscroll=null;window.onresize=null;$('TB_HideSelect').remove();TB_init();TB_doneOnce=0;return false;}
function TB_position(){$("TB_window").setStyles({width:TB_WIDTH+'px',left:(window.getScrollLeft()+(window.getWidth()-TB_WIDTH)/2)+'px',top:(window.getScrollTop()+(window.getHeight()-TB_HEIGHT)/2)+'px'});}
function TB_positionEffect(){new Fx.Styles('TB_window',{duration:75,transition:Fx.Transitions.sineInOut}).start({'left':(window.getScrollLeft()+(window.getWidth()-TB_WIDTH)/2)+'px','top':(window.getScrollTop()+(window.getHeight()-TB_HEIGHT)/2)+'px'});}
function TB_overlaySize(){$("TB_overlay").setStyles({"height":'0px',"width":'0px'});$("TB_HideSelect").setStyles({"height":'0px',"width":'0px'});$("TB_overlay").setStyles({"height":window.getScrollHeight()+'px',"width":window.getScrollWidth()+'px'});$("TB_HideSelect").setStyles({"height":window.getScrollHeight()+'px',"width":window.getScrollWidth()+'px'});}
function TB_load_position(){if($("TB_load")){$("TB_load").setStyles({left:(window.getScrollLeft()+(window.getWidth()-56)/2)+'px',top:(window.getScrollTop()+((window.getHeight()-20)/2))+'px',display:"block"});}}
function TB_parseQuery(query){if(!query)
return{};var params={};var pairs=query.split(/[;&]/);for(var i=0;i<pairs.length;i++){var pair=pairs[i].split('=');if(!pair||pair.length!=2)
continue;params[unescape(pair[0])]=unescape(pair[1]).replace(/\+/g,' ');}
return params;}