CLEI_Application={total:0,stop_pts:null,app_form:null,len:null,curr:null,nav_box:"cf-sb",req_txt:"reqtxt",email_txt:"emailreqtxt",nav_box_el:null,sbt_btn:null,email_index:null,email:null,single_mail:null,req_list:null,labels:[],fields:[],start_end:[],lifield_bx:[],drop_down:[],cust_flds:[],date_info:null,intense_info:null,accomm_info:null,guide:null,curr_hover_ref:null,curr_hover_id:null,startDate:null,endDate:null,releaseDateAlert:false,canSubmit:false,daysDiff:0,init:function(c,d,f,h){this.total=
c-2;this.curr=0;this.stop_pts=d;this.len=d.length;this.email_index=f;this.app_form=document.getElementById("cforms2form");this.email=this.classElements(this.email_txt);this.createDropDown();this.lifield_bx=this.classElements("cf-ol");c=this.lifield_bx[0].childNodes;d=[];for(b=a=0;a<c.length;a++)if(c[a].nodeName=="LI"){d[b]=c[a];b++}this.lifield_bx[0].insertBefore(this.drop_down[0],d[this.total-2]);this.lifield_bx[0].insertBefore(this.drop_down[1],d[this.total-2]);this.clear_all();this.cust_flds=h;
for(i=1;i<this.stop_pts[1]+1;i++){this.labels[i-1]=document.getElementById("li-2-"+i);this.labels[i-1].style.display="block";this.fields[i-1]=document.getElementById("cf2_field_"+i);this.fields[i-1].onblur=new Function("CLEI_Application.check_req(this)")}this.layout_nav();this.setReqList();this.date_info='Classes at Community run in <div class="alertCheck">one-week</div> increments, and they range from <div class="alertCheck">one</div> to <div class="alertCheck">four</div> weeks long.  We definitely accept students looking to stay for longer, but we cannot give you an exact price right now.';
this.intense_info="Standard - Designed for people who want the best mix between learning with us, and enjoying more time to delve into the city. <br/><br/> Intensive - Designed for business travelers or anyone looking to focus their time on learning Spanish. Intense courses are easier to tailor for your learningneeds.";this.accomm_info="Homestay - Our pre-selected Dominican homes are safe and comprable with middle-class homes in North America. <br/><br/>Private - Pricing is seasonal, and it will also depend on your taste. Santiago has an array of choices from luxurious hotels to furnished apartments. ";
this.classElements("sendbutton")[0].style.height="32px";this.classElements("sendbutton")[0].style.paddingTop="4px";this.classElements("sendbutton")[0].style.position="relative";this.classElements("sendbutton")[0].style.width="77px";this.app_form.onsubmit=function(){return CLEI_Application.leaveStay()}},leaveStay:function(){var c=false,d="";d=this.curr==1||this.curr==0?this.stop_pts[1]:this.req_list.length;for(k=0;k<d;k++)if(this.fields[k].value==""&&k!=10){this.fields[k].style.border="1px solid red";
this.req_list[k].style.color="red";this.req_list[k].fontSize="13px";c=true}if(c)return false;else{d=this.drop_down[0].childNodes[1].value;d+="  ";d+=this.drop_down[1].childNodes[1].value;this.fields[this.fields.length-1].value+=d;return true}},createDropDown:function(){var c=document.createElement("div");c.setAttribute("id","intensity");c.setAttribute("class","addtnl");c.innerHTML='<label for="drop_menu"> <span> Intensity </span></label><select name="drop_menu" id="drop_menu" onclick=" CLEI_Application.addtnInfo(2, this) "> \n<option selected value="Standard"> Standard (4 hours a day) \n<option value="Intensive"> Intensive (6 hours a day) \n</select>';
c.style.display="none";this.drop_down[0]=c;c=document.createElement("div");c.setAttribute("id","accommdation");c.setAttribute("class","addtnl");c.innerHTML='<label for="drop_menu"> <span> Accommodations </span></label><select name="drop_menu" id="drop_menu" onclick =" CLEI_Application.addtnInfo(3, this) "> \n<option selected value="Dominican Homestay"> Dominican Homestay \n<option value="Private Apartment"> Private Apartment \n</select>';c.style.display="none";this.drop_down[1]=c},switch_page:function(c){var d=
this.curr;this.curr=Number(c.value);this.guide=document.getElementById("guide");c=false;for(k=0;k<this.fields.length;k++)if(this.fields[k].value==""&&k!=10){this.fields[k].style.border="1px solid red";this.req_list[k].style.color="red";this.req_list[k].fontSize="13px";c=true}if(!c){for(j=0;j<this.fields.length;j++)if(!(j==11||j==12||j==10)){this.fields[j].style.border="none";this.req_list[j].style.color="#888888";this.req_list[j].fontSize="11px"}this.clear_all();this.display_formel();c=this.classElements("sendbutton")[1];
if((d==1||d==0)&&this.curr==2){this.drop_down[0].style.display="block";this.drop_down[1].style.display="block";this.guide.style.display="block";c.style.display="none";this.classElements("sendbutton")[0].style.display="inline";this.canSubmit=true}else{this.classElements("sendbutton")[0].style.display="none";c.style.display="inline";this.drop_down[0].style.display="none";this.drop_down[1].style.display="none";this.guide.style.display="none"}this.setReqList()}},display_formel:function(){var c=this.curr-
1;c=c===0?1:this.stop_pts[this.curr-1]+1;var d=this.curr;d=d==this.len?this.total+1:this.stop_pts[this.curr]+1;for(i=c;i<d;i++){this.labels[i-1]=document.getElementById("li-2-"+i);this.labels[i-1].style.display="block";this.fields[i-1]=document.getElementById("cf2_field_"+i);this.fields[i-1].onblur=new Function("CLEI_Application.check_req(this)");if(i==9||i==10){this.fields[i-1].style.backgroundImage='url("/wp-content/themes/clei_home/img/calendar.png")';this.fields[i-1].style.backgroundPosition=
"top right";this.fields[i-1].style.backgroundRepeat="no-repeat";this.fields[i-1].onfocus=new Function("showCalendarControl(this)");this.fields[i-1].onclick=new Function("CLEI_Application.addtnInfo(1, this)");this.fields[i-1].onblur=function(){}}if(i==12)this.labels[i-1].style.display="none"}},clear_all:function(){for(i=1;i<this.total+1;i++)document.getElementById("li-2-"+i).style.display="none"},addtnInfo:function(c,d){this.curr_hover_ref=d;this.curr_hover_id=d.id;this.curr_hover_ref.value="";switch(c){case 1:document.getElementById("dyn_guide").innerHTML=
this.date_info;break;case 2:document.getElementById("dyn_guide").innerHTML=this.intense_info;break;case 3:document.getElementById("dyn_guide").innerHTML=this.accomm_info;break}this.packagePrice()},changeInputType:function(c,d,f){var h=document.createElement("input");h.type=d;h.value=f;if(c.size)h.size=c.size;if(c.name)h.name=c.name;if(c.id)h.id=c.id;if(c.className)h.className=c.className;c.parentNode.replaceChild(h,c);return h},layout_nav:function(){this.setNavBoxEl(this.nav_box);for(i=this.len;i>
0;i--)this.addMenuItem(i)},addMenuItem:function(c){var d=this.nav_box_el[0],f=document.createElement("div");c='<input type="buttom" value="'+c+'" class="sendbutton" id="sendbutton3" name="sendbutton2" onClick="CLEI_Application.switch_page(this);"/>';f.setAttribute("id","layout_nav");f.innerHTML=c;this.sbt_btn=d.childNodes[0];this.sbt_btn.style.display="none";d.appendChild(f)},setNavBoxEl:function(c){var d=[],f=this.app_form.getElementsByTagName("*"),h=f.length;c=new RegExp("(^|\\\\s)"+c+"(\\\\s|$)");
for(j=i=0;i<h;i++)if(c.test(f[i].className)){d[j]=f[i];j++}this.nav_box_el=d},reqElements:function(c){var d=[],f=this.app_form.getElementsByTagName("*"),h=f.length;c=new RegExp("(^|\\\\s)"+c+"(\\\\s|$)");for(j=i=0;i<h;i++)if(c.test(f[i].className)){d[j]=f[i];j++}return d},classElements:function(c){var d=[],f=this.app_form.getElementsByTagName("*"),h=f.length;c=new RegExp("(^|\\\\s)"+c+"(\\\\s|$)");for(j=i=0;i<h;i++)if(c.test(f[i].className)){d[j]=f[i];j++}return d},emailSpan:function(){var c=document.createElement("span");
c.setAttribute("id","");c.setAttribute("class","reqtxt");c.innerHTML="(required)";return c},check_req:function(c){var d=null;d=c.id.length<12?c.id.charAt(c.id.length-1):c.id.charAt(c.id.length-2)+c.id.charAt(c.id.length-1);if(c.value===null||c.value==""){this.req_list[d-1].style.color="red";this.req_list[d-1].style.fontSize="13px"}else{this.fields[d-1].style.border="none";this.req_list[d-1].style.color="#888888";this.req_list[d-1].style.fontSize="11px"}},setReqList:function(){this.req_list=this.classElements(this.req_txt);
for(i=0;i<this.req_list.length;i++){for(j=0;j<this.email_index.length;j++)i==this.email_index[j]&&this.req_list.splice(i-1,0,this.email[j]);for(k=0;k<this.cust_flds.length;k++)i==this.cust_flds[k]&&this.req_list.splice(i-1,0,this.drop_down[k])}},setStart:function(c,d,f){this.startDate=new Date(c,d,f);this.startDate.setHours(0,0,0,0);this.startDateFlag=true;this.endDateFlag==true&&this.startDateFlag==true&&this.checkDate()},setEnd:function(c,d,f){this.endDate=new Date(c,d,f);this.endDate.setHours(0,
0,0,0);this.endDateFlag=true;this.endDateFlag==true&&this.startDateFlag==true&&this.checkDate()},checkDate:function(){if(this.startDate<this.endDate){this.releaseDateAlert=true;this.daysDiff=Math.ceil((this.endDate.getTime()-this.startDate.getTime())/864E5);if(this.daysDiff%7==0&&this.daysDiff<29&&this.daysDiff>0){this.alertDateCheck("alertCheck");this.packagePrice()}else this.alertDateCheck("alertCheckRed")}},alertDateCheck:function(c){switch(c){case "alertCheck":this.date_info='Classes at Community run in <div class="alertCheck">one-week</div> increments, and they range from <div class="alertCheck">one</div> to <div class="alertCheck">four</div> weeks long.  We definitely accept students looking to stay for longer, but we cannot give you an exact price right now.';
break;case "alertCheckRed":this.date_info='Classes at Community run in <div class="alertCheckRed">one-week</div> increments, and they range from <div class="alertCheckRed">one</div> to <div class="alertCheckRed">four</div> weeks long.  We definitely accept students looking to stay for longer, but we cannot give you an exact price right now.';break}document.getElementById("dyn_guide").innerHTML=this.date_info},packagePrice:function(){var c=this.daysDiff/7,d=this.drop_down[0].childNodes[1].value;if(this.drop_down[1].childNodes[1].value==
"Private Apartment")document.getElementById("curr_price").innerHTML='<span style="color: red;">  We will contact you very soon about pricing.</span>';else{document.getElementById("curr_price").innerHTML=' Your current price is $ <span id="class_price"></span>.';switch(c){case 1:c=d=="Intensive"?"475":"375";break;case 2:c=d=="Intensive"?"775":"700";break;case 3:c=d=="Intensive"?"1100":"925";break;case 4:c=d=="Intensive"?"1425":"1125";break;default:c="0"}document.getElementById("class_price").innerHTML=
c}}};
function positionInfo(c){function d(){var p=0,q;for(q=typeof l=="object"?l:document.getElementById(l);q!=null;){p+=q.offsetLeft;q=q.offsetParent}return parseInt(p)}function f(){var p;p=typeof l=="object"?l:document.getElementById(l);return parseInt(p.offsetWidth)}function h(){return d(l)+f(l)}function z(){var p=0,q;for(q=typeof l=="object"?l:document.getElementById(l);q!=null;){p+=q.offsetTop;q=q.offsetParent}return parseInt(p)}function A(){var p;p=typeof l=="object"?l:document.getElementById(l);return parseInt(p.offsetHeight)}
function B(){return z(l)+A(l)}var l=c;this.getElementLeft=d;this.getElementWidth=f;this.getElementRight=h;this.getElementTop=z;this.getElementHeight=A;this.getElementBottom=B}
function CalendarControl(){function c(e,g,m){var o=null;o=typeof m=="object"?m:document.getElementById(m);if(o!=null&&o.style!=null){o=o.style;o[e]=g}}function d(e,g){c(e,g,u)}function f(e,g){return[31,!(e%4)&&(e%100||!(e%400))?29:28,31,30,31,30,31,31,30,31,30,31][g-1]}function h(e,g,m){return(new Date(e,g-1,m)).getDay()}function z(){s.value="";C()}function A(e,g,m){if(s){if(g<10)g="0"+g;if(m<10)m="0"+m;s.value=g+"/"+m+"/"+e;CLEI_Application.curr_hover_id=="cf2_field_9"&&CLEI_Application.setStart(e,
g-1,m);CLEI_Application.curr_hover_id=="cf2_field_10"&&CLEI_Application.setEnd(e,g-1,m);C()}}function B(e){r+=e;D=0;if(r>12){r=1;t++}else if(r<1){r=12;t--}calendar=document.getElementById(u);calendar.innerHTML=E()}function l(e){t+=e;D=0;calendar=document.getElementById(u);calendar.innerHTML=E()}function p(){var e=(new Date).getYear();if(e<1900)e+=1900;return e}function q(){return(new Date).getMonth()+1}function I(){return(new Date).getDate()}function E(){var e=1,g=0,m=h(t,r,e),o=f(t,r),G=null,n="<table cellspacing='0' cellpadding='0' border='0'>";
n+="<tr class='header'>";n+=" <td colspan='2' class='previous'><a href='javascript:changeCalendarControlMonth(-1);'>&lt;</a> <a href='javascript:changeCalendarControlYear(-1);'>&laquo;</a></td>";n=n+" <td colspan='3' class='title'>"+J[r-1]+"<br>"+t+"</td>";n+=" <td colspan='2' class='next'><a href='javascript:changeCalendarControlYear(1);'>&raquo;</a> <a href='javascript:changeCalendarControlMonth(1);'>&gt;</a></td>";n+="</tr>";n+="<tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr>";
for(var F=0;F<6;F++){n+="<tr>";for(var v=0;v<7;v++){if(F==0&&m==v)g=1;else if(g==1&&e>o)g=0;if(g){G=e==w&&t==x&&r==y?"current":v==0||v==6?"weekend":"weekday";n=n+"<td><a class='"+G+"' href=\"javascript:setCalendarControlDate("+t+","+r+","+e+')">'+e+"</a></td>";e++}else n+="<td class='empty'>&nbsp;</td>"}n+="</tr>"}n+="<tr class='header'><th colspan='7' style='padding: 3px;'><a href='javascript:clearCalendarControl();'>Clear</a> | <a href='javascript:hideCalendarControl();'>Close</a></td></tr>";n+=
"</table>";return n}function K(e){H=0;if(s!=e){if(s=e)try{var g=(new String(s.value)).split("-");y=parseInt(g[0],10);w=parseInt(g[1],10);x=parseInt(g[2],10)}catch(m){}if(!(x&&y&&w)){y=q();w=I();x=p()}r=y;D=w;t=x;if(document.getElementById){calendar=document.getElementById(u);calendar.innerHTML=E(t,r);d("display","block");var o=new positionInfo(s);e=new positionInfo(u);g=o.getElementLeft();o=o.getElementBottom();d("left",g+"px");d("top",o+"px");if(document.all){c("display","block","CalendarControlIFrame");
c("left",g+"px","CalendarControlIFrame");c("top",o+"px","CalendarControlIFrame");c("width",e.getElementWidth()+"px","CalendarControlIFrame");c("height",e.getElementHeight()+"px","CalendarControlIFrame")}}}}function C(){if(s){d("display","none");c("display","none","CalendarControlIFrame");s=null}CLEI_Application.check_req(document.getElementById(CLEI_Application.curr_hover_id))}function L(){return s}var u="CalendarControl",t=0,r=0,D=0,x=0,y=0,w=0,J=["January","February","March","April","May","June",
"July","August","September","October","November","December"],s=null;this.clearDate=z;this.setDate=A;this.changeMonth=B;this.changeYear=l;this.show=K;this.hide=C;this.visible=L;this.can_hide=H;var H=0}var calendarControl=new CalendarControl;function showCalendarControl(c){calendarControl.show(c)}function clearCalendarControl(){calendarControl.clearDate()}function hideCalendarControl(){calendarControl.visible()&&calendarControl.hide()}
function setCalendarControlDate(c,d,f){calendarControl.setDate(c,d,f)}function changeCalendarControlYear(c){calendarControl.changeYear(c)}function changeCalendarControlMonth(c){calendarControl.changeMonth(c)}document.write("<iframe id='CalendarControlIFrame' src='javascript:false;' frameBorder='0' scrolling='no'></iframe>");document.write("<div id='CalendarControl'></div>");