var h=null,i=false;function j(a,b,e){if(a.attachEvent)a.attachEvent("on"+b,e);else if(a.addEventListener)a.addEventListener(b,e,true);else a["on"+b]=e}function k(a){var b=(a.c-a.f)*((a.a-a.min)/(a.max-a.min));if(b<a.d)b=a.d;if(b>a.c-a.d-a.g)b=a.c-a.d-a.g;a.handle.style.left=b+"px"}function m(a,b){a.a=(a.max-a.min)*((b-a.element.offsetLeft-a.d)/(a.c-a.f))+a.min;o(a)}
function o(a){var b=a.a;if(a.i){b=Math.round(b*a.b);b=(b-b%a.h)/a.b}else b=Math.round(b-b%a.e);if(b>a.max)b=a.max;if(b<a.min)b=a.min;a.a=b;k(a);p(a.input,b);a.onchange!=h&&a.onchange()}function q(a){if(!a&&window.event)a=window.event;if(!a)return i;var b;if(a.target)b=a.target;if(a.srcElement)b=a.srcElement;for(a=0;a<r.length;a++)if(r[a].element==b||r[a].handle==b)return r[a];return h}
function s(){for(var a=0;a<r.length;a++){var b=r[a];k(b);p(b.input,b.a);j(b.element,"mousedown",function(e){var c=q(e);c&&m(c,e.clientX);c=q(e);t(e);if(c)u=c});j(b.element,"mouseup",function(){u=h})}}function t(a){if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.returnValue=i;a.cancelBubble=true}}j(document,"mousemove",function(a){if(u!=h){m(u,a.clientX);t(a)}});j(document,"mouseup",function(){u=h});var u=h,r=[];
function v(a,b,e){var c=document.getElementById(a+"_"+b+"_arrow"),g=b+"_arrow_hover",l=b+"_arrow_mousedown",f=b+"_arrow";c.className=f;c.onmouseover=function(){c.className=g};c.onmouseup=c.onmouseover;c.onmousedown=function(){c.className=l};c.onmouseout=function(){c.className=f};c.onclick=e}
function w(a,b,e,c,g,l,f,n){var M=r.length,d={};d.id=a;d.min=b;d.max=e;d.a=c;d.handle=document.getElementById(a+"_handle");d.g=d.handle.offsetWidth;d.onchange=f;d.i=g;d.e=l;d.input=document.getElementById(a);d.input.onkeyup=function(){d.onchange&&d.onchange();d.a=d.input.value;k(d)};d.input.onmouseup=d.input.onkeyup;d.element=document.getElementById("slider_"+a);d.c=d.element.scrollWidth;if(d.c==0)d.c=parseInt(d.element.style.width.replace(/px/,""));d.d=n;d.f=n*2;if(g){for(d.b=1;l*10!=parseInt(l*
10)&&d.b<5;){d.b++;l*=10}d.b=Math.pow(10,d.b);d.h=d.e*d.b}v(a,"left",function(){d.a-=d.e;o(d)});v(a,"right",function(){d.a+=d.e;o(d)});d.element.j=function(){return i};d.handle.j=function(){return i};r[M]=d}function x(a){return a.options[a.selectedIndex].value}function y(a,b){a.options[0]=new Option("Yes",true);a.options[1]=new Option("No",i);if(!b)a.selectedIndex=1}
function p(a,b){if(typeof a.options=="undefined")a.value=b;else{var e=a.options.length,c=a.selectedIndex;if(c<0)c=0;for(var g=c+1;g<e||c>=0;){if(g<e&&a.options[g].value==b){a.selectedIndex=g;break}if(c>=0&&a.options[c].value==b){a.selectedIndex=c;break}g++;c--}}}function z(a,b){for(var e=a.options.length;e-- >0;)a.remove(0);e=b.length;for(var c=0;c<e;c++)a.options[c]=new Option(b[c][1],b[c][0])}var A,B,C,D,E;
function F(){document.getElementById("tax_value").value="";var a=0,b=x(E),e=x(A),c=x(B),g=x(C),l=x(D),f=document.getElementById("base_value").value.replace(/,/g,"");switch(parseInt(e)){case 0:a=f;e=SINGLE_APT_SECOND_STEP-SINGLE_APT_FIRST_STEP;var n=0;a-=SINGLE_APT_FIRST_STEP;if(a>0){n=Math.min(e,a)*SINGLE_APT_SECOND_STEP_TAX;a-=e;if(a>0)n+=a*SINGLE_APT_THIRD_STEP_TAX}a=n;break;case 1:a=f;e=0;e=Math.min(EXTRA_APT_STEP_1,a)*EXTRA_APT_STEP_1_TAX;a-=EXTRA_APT_STEP_1;if(a>0){e+=Math.min(EXTRA_APT_STEP_2-
EXTRA_APT_STEP_1,a)*EXTRA_APT_STEP_2_TAX;a-=EXTRA_APT_STEP_2-EXTRA_APT_STEP_1;if(a>0)e+=a*EXTRA_APT_STEP_3_TAX}a=e;break;case 2:a=f;e=0;e=Math.min(AGRICULTURE_LIMIT,a)*AGRICULTURE_TAX;a-=AGRICULTURE_LIMIT;if(a>0)e+=a*THIRD_STEP_TAX;a=e}switch(parseInt(b)){case 0:if(c=="true"||g=="true")a=Math.min(a,f*LOW_RATE);else if(l=="true"){b=Math.min(OLE_TOP,f)*LOW_RATE;b+=Math.max(f-OLE_TOP,0)*OLE_HIGH_RATE;a=Math.min(a,b)}break;case 1:a=0;break;case 2:a/=3}f=a;if(f==0)f=0;else{b="";if(f<0){b="-";f*=-1}c="";
for(f=parseInt(f);f>0;){g=f%1E3+"";f=Math.floor(f/1E3);if(f>0){if(g.length==1)g="00"+g;if(g.length==2)g="0"+g}c=g+c;if(f>0)c=","+c}f=c=b+c}document.getElementById("tax_value").value=f}
function G(){var a=document.createElement("link");a.setAttribute("rel","stylesheet");a.setAttribute("type","text/css");a.setAttribute("href","http://www.buyitinisrael.com/wp-content/uploads/2010/01/acquisition.css");document.getElementsByTagName("head")[0].appendChild(a);document.getElementById("calculator_code").innerHTML="<table class='article_table' border='1'><tr class='dri_nut_title'><td><strong>Question:</strong></td><td><strong>Answer:</strong></td><td><strong>Additional Information:</strong></td></tr><tr><td class='table_right_panel'>Purchase price (NIS):</td><td><input id='base_value' class='text_input' type='text' /></td><td class='slider_container_cell'><div id='slider_base_value' class='slider' style='width: 350px;'><div id='base_value_left_arrow'></div><div id='base_value_right_arrow'></div><img id='base_value_handle' src='http://www.buyitinisrael.com/wp-content/uploads/2010/01/handle_gray.png' alt='' /></div></td></tr><tr><td class='bmi_calc_label'>"+
PURPOSE_OF_PROPERTY_STR+"</td><td><select id='realestate_type_list' class='row1_select'></select></td><td>"+SINGLE_RESIDENCE_COMMENT_STR+"</td></tr><tr><td class='bmi_calc_label'>"+DISABLED_QUESTION_STR+"</td><td><select id='handicap_list' class='row1_select'></select></td><td>"+DISABLED_COMMENT_STR+"</td></tr><tr><td class='bmi_calc_label'>"+CASUALTY_QUESTION_STR+"</td><td><select id='casulty_list' class='row1_select'></select></td><td>"+CASUALTY_COMMENT_STR+"</td></tr><tr><td class='bmi_calc_label'>"+
OLE_QUESTION_STR+"</td><td><select id='aliya_list' class='row1_select'></select></td><td>"+OLE_COMMENT_STR+"</td></tr><tr><td class='bmi_calc_label'>"+FREE_OF_CHARGE_QUESTION_STR+"</td><td><select id='no_return_list' class='row1_select'></select></td><td>"+FREE_OF_CHARGE_COMMENT_STR+"</td></tr><tr class='article_table_totals bold'><td class='bmi_calc_label'>"+TOTAL_DUE_STR+"</td><td><span><input id='tax_value' class='readonly_text_input' readonly='readonly' type='text' /></span></td><td></td></tr></table><form><input id='calc_button' type='button' value='"+
BUTTON_CAPTION+"' ></input></form>";document.getElementById("calc_button").onclick=F;A=document.getElementById("realestate_type_list");B=document.getElementById("handicap_list");C=document.getElementById("casulty_list");D=document.getElementById("aliya_list");E=document.getElementById("no_return_list");y(B,i);y(C,i);y(D,i);a=[];a[a.length]=[0,SINGLE_APT_STR];a[a.length]=[1,EXTRA_APT_STR];a[a.length]=[2,AGRICULTURE_STR];z(A,a);delete a;a=[];a[a.length]=[0,NO_STR];a[a.length]=[1,FROM_MY_SPOUSE];a[a.length]=
[2,FROM_ANOTHER_RELATIVE];z(E,a);delete a;w("base_value",MIN_SLIDER_VALUE,MAX_SLIDER_VALUE,DEFAULT_SLIDER_VALUE,i,SLIDER_SCROLL_STEP_VALUE,F,15);s()}G();if(typeof DOMParser=="undefined"){DOMParser=function(){};DOMParser.prototype.parseFromString=function(a){if(typeof ActiveXObject!="undefined"){var b=new ActiveXObject("MSXML.DomDocument");b.async=i;b.loadXML(a);return b}}}
function H(){switch(I.readyState){case 4:if(I.status!=200)break;if(J)J.style.visibility="hidden";if(K){var a=h,b=I.responseText,e=I.responseXML;if(e!=h)a=e.documentElement;if(a==h){e=L.parseFromString(b,"text/xml");a=e.documentElement}K(b,e,a)}}}var I,N;if(!N&&typeof XMLHttpRequest!="undefined")try{N=new XMLHttpRequest}catch(O){alert("Your browser does not support XMLHTTPRequest");N=i}else N=new ActiveXObject("Microsoft.XMLHTTP");I=N;I.onreadystatechange=H;var K=h,J=h,L=new DOMParser;
K=function(a,b,e){for(a=0;a<e.childNodes.length;a++){b=e.childNodes[a];if(b.nodeType==1){var c=b.attributes[0].nodeValue,g;g=b.localName?b.localName:b.tagName;if(c=="int"||c=="float")eval(g+"="+b.childNodes[0].nodeValue);c=="string"&&eval(g+'="'+b.childNodes[0].nodeValue.replace(/\n/,"<br/>")+'";')}}G()};J=void 0;try{if(J)J.style.visibility="visible"}catch(P){if(J)J.style.visibility="hidden"}
I.open("POST","http://www.buyitinisrael.com/wp-content/uploads/acquisition_tax/update_api/acquisition_calculator.xml",true);I.setRequestHeader("Content-type","application/x-www-form-urlencoded");I.send("");I.onreadystatechange=H;

