function isDefined(variable){return(typeof(window[variable])=='undefined')?false:true};function ArrayInsert(arr,index,v){if(index>=0){len=arr.length;for(i=len-1;i>index;i--){if(arr[i+1]==undefined){arr[i+1]=new Array}arr[i+1]=arr[i]}arr.splice(parseInt(index)+1,1,v);return arr}return-1};function ArrayIndexOf(arr,v){for(i in arr){if(arr[i]==v){return parseInt(i)}}return-1};function ajax(url,method,params,before,success,error){options={url:url,method:method};if(params!=undefined&¶ms!='')options['data']=params;if(before!=undefined&&before!='')options['beforeSend']=before;if(success!=undefined&&success!='')options['success']=success;if(error!=undefined&&error!='')options['error']=error;$.ajax(options)};function setupCalendar(input_id,btn_id){Zapatec.Calendar.setup({inputField:input_id,ifFormat:"%m/%d/%Y",showsTime:false,button:btn_id,align:"B2"})};function startWait(msg){if(msg==undefined)msg='Loading...';notifier.display(msg)};function endWait(){notifier.hide()};function win_popup(url){if(!window.popupNum)window.popupNum=0;window.popupNum++;mywindow=window.open(url,window.name+"_popup"+window.popupNum,"menubar=1,resizable=1,location=1,status=1,scrollbars=1, width=450,height=550");mywindow.moveTo(100,100)};var popupOpened=false;var response;function ajaxpopup(url,width,height,before,success){if(!isDefined('before')){before=function(){startWait()}}if(success==undefined){success=function(msg){endWait()}}ajax(url,'GET','',before,function(msg){success(msg);popup(msg,width,height)})};function popup(text,width,height){if(width==undefined){width=600}if($("div.popup").length>0){popupclean()}$("body").append(""+"");center("div.popup");applyCurtain();popupOpened=true};function popupclose(){popupclean();removeCurtain();popupOpened=false};function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft}return[scrOfX,scrOfY]};function getWindowSize(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight}return[myWidth,myHeight]};function getCenteredArea(el){w=$(el).width();h=$(el).height();wsize=getWindowSize();wscroll=getScrollXY();if($("#page-all").width()!=null){x=(wsize[0]-$("#page-all").width())/2+(925-w)/2}else{x=(wsize[0]-w)/2+wscroll[0]}y=(wsize[1]-h)/2+wscroll[1];return[x,y,x+w,y+h]};function center(el){area=getCenteredArea(el);$(el).css("left",area[0]);$(el).css("top",Math.max(area[1], 5))};function removeCurtain(){$("#popupcurtain1").remove()};function ShowBlock(data,width,height){popup(data,width,height)};function applyCurtain(){wsize=getWindowSize();$('body').append('');$('#popupcurtain1').fadeTo(0,0.0,function(){$("div.popup").show()})};function popupclean(){$("div.popup").remove()};function escapeURI(value){return escape(encodeURI(value))};function getFormFields(formName,popup,url,callback,method){if(method='undefined'){method='POST'}str='';for(i=0;i errors > error").each(function(){if($(this).attr("type")=="blank"){blankFieldsPresent=true;error=true}if($(this).attr("type")=="validate"){emailInvalid=true;error=true}if($(this).attr("type")=="already_registered"){responseTxt+="You have already registered with us.\n\n";error=true}});if(blankFieldsPresent){responseTxt+="Please fill all required fields.\n\n"};if(emailInvalid){responseTxt+="E-mail Address is invalid.\n\n"};if(!error){$(xml).find("returnedData > message").each(function(){if($(this).attr("type")=="thank"){responseTxt+="
Thank you for your interest.
You will be hearing from us soon.
";document.getElementById(divId).innerHTML=responseTxt}else{error=true}});if(error){responseTxt+="Unknown error, please try again later.\n\n"}};if(error){alert(form_title+":\n\n"+responseTxt)}},error:function(XMLHttpRequest,textStatus,errorThrown){if(notifier)notifier.hide();alert(form_title+": an error occured while connecting to the server, please try again later.\n\n")}})};function setup_fc_form(form_title,form_id){var divId=form_id+"_div";var options={type:"POST",dataType:"xml",url:'?controller=firstcontactadaptor&action=fcsubmit',async:"true",beforeSubmit:function(){if(notifier)notifier.display("Please wait...")},success:function(xml){if(notifier)notifier.hide();var blankFieldsPresent=emailInvalid=error=false;var responseTxt="";$(xml).find("returnedData > errors > error").each(function(){if($(this).attr("type")=="blank"){blankFieldsPresent=true;error=true}if($(this).attr("type")=="validate"){emailInvalid=true;error=true}if($(this).attr("type")=="already_registered"){responseTxt+="You have already registered with us.\n\n";error=true}});if(blankFieldsPresent){responseTxt+="Please fill all required fields.\n\n"};if(emailInvalid){responseTxt+="E-mail Address is invalid.\n\n"};if(!error){$(xml).find("returnedData > message").each(function(){if($(this).attr("type")=="thank"){responseTxt+="
Thank you for your interest.
You will be hearing from us soon.
";document.getElementById(divId).innerHTML=responseTxt}else{error=true}});if(error){responseTxt+="Unknown error, please try again later.\n\n"}};if(error){alert(form_title+":\n\n"+responseTxt)}},error:function(XMLHttpRequest,textStatus,errorThrown){if(notifier)notifier.hide();alert(form_title+": an error occured while connecting to the server, please try again later.\n\n")}};$('#'+form_id).ajaxForm(options)};