	var alphabets ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var numbers ="0123456789"; var ns = (navigator.appName.indexOf("Netscape") != -1); var d = document; var n=navigator.appName; var ie=(n=="Microsoft Internet Explorer"); function $ip(){ var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if(typeof element == 'string') element = d.getElementById(element); if(arguments.length == 1) return element; elements.push(element); } return elements; } var ip = { loadingStr : '<img src="http://imgs.indiaproperty.com/loading.gif" alt="" width="16" height="16" class="AlignM" hspace="3" />Loading... Please wait...', url:"", pageFrom : "index.php", pageLoaded : false, Str:"", strLen : 0, mouseX : 0, mouseY : 0, errMsg : "Unable to access this service currently, Please try again later.<br />", err : { timeOut : "Unable to access this service currently, Please try again later.<br />", spam : "Entered text seems to be spam message, Mail will be send within next 24 hours.<br />", codeErr : "Unable to access this service currently, Due to Security issues it has been stoped." }, loading : function(Str){ return '<img src="http://imgs.indiaproperty.com/loading.gif" alt="" width="16" height="16" class="AlignM" hspace="3" />' + Str; }, loadingLB: function(Str,w){ if(!w) w = "auto"; else w = w + "px"; return '<div style="float:left; display:block; background-color:#fff; width:'+ w +';"><div class="lBox_dotB"><div class="lBox_dotR"><div class="lBox_dotT"><div class="lBox_dotL"><div class="lBox_bRC"><div class="lBox_bLC"><div class="lBox_tRC"><div class="lBox_tLC"><div style="padding:20px;"><img src="http://imgs.indiaproperty.com/loading.gif" alt="" width="16" height="16" class="AlignM" hspace="3" />' + Str + '</div></div></div></div></div></div></div></div></div><br clear="all" />'; }, confirmActive : false, confirmFocusTimer : null, confirmStatus : null, confirmLBDivObj : null, lbActive : false,lbObject : null,lbFocusTimer : null,lbType : "alert", lbDivObj : null, simpleAlertActive : false,simpleAlertObject : null,simpleAlertFocusTimer : null, simpleAlertDivObj : null, lbContent: function(Str,w,onCloseF){ if(!onCloseF || onCloseF==null) onCloseF = "ip.exitLB()"; if(!w) w = "auto"; else w = w + "px"; return '<div style="float:left; display:block; background-color:#fff; width:'+ w +';"><div class="lBox_dotB"><div class="lBox_dotR"><div class="lBox_dotT"><div class="lBox_dotL"><div class="lBox_bRC"><div class="lBox_bLC"><div class="lBox_tRC"><div class="lBox_tLC" style="padding:20px;"><div style="float:right;" id="divGlobalClose"><a href="javascript:void(0)" class="closeX" onclick="javascript:'+ onCloseF +';">&nbsp;</a></div><br clear="all" />' + Str + '</div></div></div></div></div></div></div></div></div><br clear="all" />'; }, lbAlert: function(Str,w,AlertType,onCloseF){ if(!w) w = "300"; else w = w + "px"; if(!onCloseF || onCloseF==null) onCloseF = "ip.exitLB()"; return '<div style="float:left; display:block; background-color:#fff; width:'+ w +';"><div class="lBox_dotB"><div class="lBox_dotR"><div class="lBox_dotT"><div class="lBox_dotL"><div class="lBox_bRC"><div class="lBox_bLC"><div class="lBox_tRC"><div class="lBox_tLC" style="padding:20px 20px 0px;"> ' + '<div style="background:url(\'http://imgs.indiaproperty.com/icons/alert_lb.gif\') no-repeat 0% 30%; color:#4B4B4B; line-height:17px; font-family:Arial; font-weight:normal; padding:20px 20px 20px 50px;"><span id="divLBGlobalMsg">' + Str + '</span><br /><div style="text-align:right; padding-top:10px;" id="divGlobalClose"><a href="javascript:void(0);" onclick="javascript:'+ onCloseF +';" class="button" style="pointer:cursor;" id="lbAlertCloseBtn">Close</a></div>' + ' </div></div></div></div></div></div></div></div></div></div><br clear="all" />'; }, simpleAlert : function(Str,w,AlertType,onCloseF){ if(!w) w = "300"; else w = w + "px"; if(!onCloseF || onCloseF==null) onCloseF='ip.exitSimpleAlert()'; return '<div id="DivAlertLB" style="float:left; display:block; background-color:#fff; width:'+ w +';"><div class="lBox_dotB"><div class="lBox_dotR"><div class="lBox_dotT"><div class="lBox_dotL"><div class="lBox_bRC"><div class="lBox_bLC"><div class="lBox_tRC"><div class="lBox_tLC" style="padding:20px 20px 0px;"> ' + '<div style="background:url(\'http://imgs.indiaproperty.com/icons/alert_lb.gif\') no-repeat 0% 30%; color:#4B4B4B; line-height:17px; font-family:Arial; font-weight:normal; padding:20px 20px 20px 50px;">' + Str + '<br /><div style="text-align:right; padding-top:10px;" id="divGlobalClose"><a href="javascript:void(0);" onclick="javascript:'+ onCloseF +';" class="button" style="pointer:cursor;" id="lbAlertCloseBtn">Close</a></div>' + ' </div></div></div></div></div></div></div></div></div></div><br clear="all" />'; }, makeCenterLB : function(){ if(ip.confirmActive)lbA.setCenterPos(this.confirmLBDivObj); if(ip.simpleAlertActive){ lb.setCenterPos(this.lbDivObj); lbA.setCenterPos(this.simpleAlertDivObj); } if(ip.lbActive)lb.setCenterPos(this.lbDivObj); }, startLB: function(Obj,Str,w,AlertType,onCloseF,url,focusObj){ if(!w) w=300; try{ if(lb==null || typeof(lb)=="undefined"){ lb = new ipLightBox('divLightBox','',"",250);} lb.init(); clearTimeout(this.lbFocusTimer); this.lbActive = true; this.lbType = AlertType; this.lbObject = Obj; var divObj = $ip("divLBcontent"); this.lbDivObj = divObj; divObj.innerHTML = ip.loadingLB("Loading info... Please wait...",280); divObj.style.display =""; this.makeCenter(divObj,w,200); /*divObj.onclick = function(){ip.exitLB(divObj,Obj);}*/ switch(AlertType){ case "aJax": var aJax = new getHTTPObject(); url = (url.indexOf("http://")!=-1) ?  url : String(ip.host() + url); aJax.open("get",url,true); aJax.onreadystatechange = function(){ if(aJax.readyState==4){ var res = aJax.responseText; if(res=="") res=ip.errMsg; ip.makeCenter(divObj,500,300); divObj.innerHTML = ip.lbContent(res,500); ip.makeCenter(divObj); try{ if(typeof(focusObj)=="string"){ if(focusObj.indexOf(".")!=-1){eval(focusObj+".focus();");}else{$ip(focusObj).focus();} }else{ if(focusObj!=null || focusObj!=""){$ip(focusObj).focus();} } }catch(e){ip.traceErr(e,"startLB");} } }; aJax.send(null); ip.sleep(function(){ if( String(divObj.innerHTML).indexOf("Please wait...")!=-1){ divObj.innerHTML =  ip.lbAlert("Unable to access this service currently, Please try again later.<br />",w,AlertType,onCloseF); } },40000); break; case "message": divObj.innerHTML = ip.lbContent(Str,w); ip.makeCenter(divObj,divObj.offsetWidth,divObj.offsetHeight); break; default: divObj.innerHTML = ip.lbAlert(Str,w,AlertType,onCloseF); ip.sleep(function(){try{$ip("lbAlertCloseBtn").focus();}catch(e){ip.traceErr(e,"startLB","ip_common.js");}},"2000"); break; } this.startKeyDetect(this.getKey); }catch(e){ip.traceErr(e,"startLB","ipcommon");} }, startAlert: function(Obj,Str,w,AlertType,onCloseF,url,focusObj){ if(!w) w=300; try{ if(lbA==null || typeof(lbA)=="undefined"){lbA = new ipLightBox('divLBAlertWindow','',"",250);} this.simpleAlertActive = true; this.simpleAlertObject = Obj; lbA.init(); clearTimeout(this.simpleAlertFocusTimer); var divObj = $ip("divLBAlert"); this.simpleAlertDivObj = divObj; divObj.style.display =""; divObj.innerHTML = ip.loadingLB("Loading info... Please wait...",280); this.makeCenter(divObj,w,200); /*divObj.onclick = function(){ip.exitLB(divObj,Obj);}*/ switch(AlertType){ case "aJax": var aJax = new getHTTPObject(); var url = ip.host() + url; aJax.open("get",url,true); aJax.onreadystatechange = function(){ if(aJax.readyState==4){ var res = aJax.responseText; if(res=="") res="Unable to access this service currently, Please try again later.<br />"; ip.makeCenter(divObj,500,300); divObj.innerHTML = ip.lbContent(res,500); window.setTimeout(function(){ if(focusObj!=null || focusObj!=""){ try{$ip(focusObj).focus();}catch(e){ip.traceErr(e,"startLB");} } },2000); } }; aJax.send(null); ip.sleep(function(){ if( String(divObj.innerHTML).indexOf("Please wait...")!=-1){ divObj.innerHTML = "Unable to access this service currently, Please try again later.<br />"; } },20000); break; default: divObj.innerHTML = ip.simpleAlert(Str,w,AlertType,onCloseF); break; } }catch(e){ip.traceErr(e,"startAlert","ipcommon");} }, Confirm: function(Str,w,confirmOptions){ if(!w) w=300; try{ if(lbA==null || typeof(lbA)=="undefined"){lbA = new ipLightBox('divLBAlertWindow','',"",250);} lbA.init(); this.confirmStatus = null; this.confirmActive = true; clearTimeout(this.confirmFocusTimer); var divObj = $ip("divLBAlert"); this.confirmLBDivObj= divObj; divObj.style.display =""; this.makeCenter(divObj,w,200); divObj.innerHTML = ip.lbConfirm(Str,w,confirmOptions); this.startKeyDetect(this.getKey); }catch(e){ip.traceErr(e,"ip.confirm","ipcommon");} }, lbConfirm : function(Str,w,confirmOptions){ var imgW = parseInt(w / 10); if(!w) w = "300"; else w = w + "px"; var arr = confirmOptions.split("|"); if(arr.length<=1) arr = ["Yes","No"]; return '<div style="float:left; display:block; background-color:#fff; width:'+ w +';"><div class="lBox_dotB"><div class="lBox_dotR"><div class="lBox_dotT"><div class="lBox_dotL"><div class="lBox_bRC"><div class="lBox_bLC"><div class="lBox_tRC"><div class="lBox_tLC" style="padding:20px 20px 0px;"> ' + '<div style="background:url(\'http://imgs.indiaproperty.com/icons/alert_q.gif\') no-repeat 0% 30%; color:#4B4B4B; line-height:17px; font-family:Arial; font-weight:normal; padding:20px 20px 20px 50px;">' + Str + '<br /><div style="text-align:center; padding-top:10px;"><input type="button" class="button" onclick="javascript:ip.exitConfirm(null,1);" value="'+ ip.toTitleCase(arr[0]) +'"  id="lbAlertYesBtn" /><img src="http://imgs.indiaproperty.com/trans.gif" width="'+ imgW +'" height="1" alt="" /><input type="button" class="button" onclick="javascript:ip.exitConfirm(null,0);" value="'+ ip.toTitleCase(arr[1]) +'" id="lbAlertNoBtn"/></div>' + ' </div></div></div></div></div></div></div></div></div></div><br clear="all" />'; }, exitLB : function(fromObj,Obj){ if(!fromObj) fromObj=$ip("divLBcontent"); this.lbActive = false; if(!Obj) Obj=this.lbObject; this.lbObject = null; lb.exit(); fromObj.style.display="none"; fromObj.innerHTML =""; this.stopEvent(d.onkeyup); this.lbFocusTimer = window.setTimeout(function(){try{Obj.focus();}catch(e){try{Obj[0].focus();}catch(e1){}};},1000); }, exitSimpleAlert : function(fromObj,Obj){ if(!fromObj) fromObj=$ip("divLBAlert"); lbA.exit(); this.simpleAlertActive= false; if(!Obj) Obj=this.simpleAlertObject; this.simpleAlertObject= null; fromObj.style.display="none"; fromObj.innerHTML =""; this.simpleAlertFocusTimer = window.setTimeout(function(){try{Obj.focus();}catch(e){try{Obj[0].focus();}catch(e1){}};},1000); }, exitConfirm: function(fromObj,confirmStatus){ if(!fromObj) fromObj=$ip("divLBAlert"); this.confirmActive= false; lbA.exit(); fromObj.style.display="none"; fromObj.innerHTML =""; this.confirmFocusTimer = window.setTimeout(function(){try{Obj.focus();}catch(e){try{Obj[0].focus();}catch(e1){}};},1000); this.confirmStatus=confirmStatus; }, toTitleCase : function(String){ this.Str = String; this.Str=this.Str.replace(/  /g," "); this.Str = this.Str.toLowerCase(); Arr = this.Str.split(" "); for (var i=0; i<Arr.length; i++){ Arr[i] = Arr[i].substr(0,1).toUpperCase() + Arr[i].substr(1,Arr[i].length); } this.Str = ""; for (var i=0; i<Arr.length; i++){ this.Str = (i==0) ? Arr[i] : this.Str + " " + Arr[i]; } return this.Str; }, OpenPage:function(url){window.location=url;}, Ask:function(str){return confirm(str) ? true : false;}, showtcpopup : function(){ this.url = ip.host() + "/index.php?option=site&page=termsandcondition&notemplate=yes"; this.OpenPopUp(this.url,0,0,615,600,"TermsAndCondition","yes"); }, populate : function(Obj,frm,bflag,isBuyer,addAny){ var a=""; var bStr=""; if(!frm) frm=d.quicksearch; if(this.isObject(Obj)){try{a=Obj.options[Obj.selectedIndex].value;}catch(e){a =Obj.value;}}else{a=Obj;} if(!bflag) bStr="individualhouse"; else bStr="bungalow"; if(a=="buy" || a=="sell" || a=="sale" || a=="0"){ arr = new Array('0','Property Type','allresidential','All Residential','apartment_individualapartment','Apartment', 'bungalow_individualhouse','Independent House/Villa', 'apartment_builderfloor','Builder Floor', 'bungalow_farmhouse','Farm House', 'allcommercial','All Commercial', 'retail_retailshowroomshop','Retail Showroom/Shop', 'officespace_commercialbuilding','Commercial Building', 'officespace_officecomplex','Office Complex', 'officespace_itsoftwaretechnologypark','IT/ Software Technology Park', 'specialeconomiczone','All SEZ', 'sez_commercialbuilding','Commercial Building', 'sez_industrialestate','Industrial Estate', 'sez_itsoftwaretechnologypark','IT/ Software Technology Park', 'allland','All Land / Plots', 'land_residentialuse','Residential Land', 'land_commercialuse','Commercial Land', 'land_industrialuse','Industrial Land', 'land_agriculturaluse','Agricultural Land', 'land_farmhouseplots','Farm House Land'); }else if(a=="rent"){ arr =  new Array('0','Property Type','allresidential','All Residential','apartment_individualapartment','Apartment', 'bungalow_individualhouse','Independent House/Villa','apartment_servicedapartment','Serviced Apartment', 'bungalow_farmhouse','Farm House', 'allcommercial','All Commercial', 'retail_retailshowroomshop','Retail Showroom/Shop', 'officespace_commercialbuilding','Commercial Building', 'officespace_officecomplex','Office Complex', 'officespace_itsoftwaretechnologypark','IT/ Software Technology Park', 'specialeconomiczone','All SEZ', 'sez_commercialbuilding','Commercial Building', 'sez_industrialestate','Industrial Estate', 'sez_itsoftwaretechnologypark','IT/ Software Technology Park', 'allland','All Land / Plots', 'land_residentialuse','Residential Land', 'land_commercialuse','Commercial Land', 'land_industrialuse','Industrial Land', 'land_agriculturaluse','Agricultural Land', 'land_farmhouseplots','Farm House Land'); }else if(a=="rentzone"){ arr =  new Array('0','Property Type','allresidential','All Residential','apartment_individualapartment','Apartment', 'bungalow_individualhouse','Independent House/Villa','apartment_servicedapartment','Serviced Apartment', 'bungalow_farmhouse','Farm House', 'allcommercial','All Commercial', 'retail_retailshowroomshop','Retail Showroom/Shop', 'officespace_commercialbuilding','Commercial Building', 'officespace_officecomplex','Office Complex', 'officespace_itsoftwaretechnologypark','IT/ Software Technology Park'); }else if(a=="accommodation"){ arr =  new Array('0','Property Type','apartment_individualapartment','Apartment', 'bungalow_individualhouse','Independent House/Villa');/*,*/ }else{ arr = new Array('0','Property Type','allresidential','Residential','apartment_individualapartment','Apartment', 'bungalow_individualhouse','Independent House/Villa', 'apartment_builderfloor','Builder Floor', 'bungalow_farmhouse','Farm House'); } if(isBuyer){arr = new Array('0','Property Type','apartment','Apartment',bStr,'Independent house','retail','Retail space','officespace','Office space','land','Land','specialeconomiczone','SEZ (Special Economic Zone)');} if(addAny){arr.push('any'); arr.push('Any');} var ObjPropertyCat = frm.property; for(i=0;i<ObjPropertyCat.length;i++) ObjPropertyCat.options[i]=null; ObjPropertyCat.options.length = 0; for(i=0;i<arr.length;i+=2){ ObjPropertyCat.options[i/2] = new Option(arr[i+1],arr[i]); if(arr[i].toLowerCase().indexOf("all")==0 || arr[i].toLowerCase().indexOf("any")==0 || arr[i].toLowerCase().indexOf("specialeconomiczone")==0){ObjPropertyCat.options[i/2].className = "optionbg";} } }, getPropertyTypeArr:function(trans,propertyArr,Obj,addOptionsPrefix,addOptionsSuffix){ var arr=new Array(); var tempArr=new Array(); switch(trans){ case "rent": tempArr = propertyArr.rent; break; case "pg": try{tempArr = propertyArr.pg;}catch(e){ip.traceErr(e,"getPropertyTypeArr");tempArr=propertyArr.sell;} break; default: tempArr = propertyArr.sell; break; } if(addOptionsPrefix && addOptionsPrefix!="") arr.push(addOptionsPrefix); for (var i=0; i<tempArr.length; i++) for (var j=0; j<tempArr[i].length; j++) arr.push(tempArr[i][j]); if(addOptionsSuffix && addOptionsSuffix!="") arr.push(addOptionsSuffix); for(i=0;i<Obj.length;i++) Obj.options[i]=null; Obj.options.length = 0; for(i=0;i<arr.length;i++){ optArr = arr[i].split("|"); Obj.options[i] = new Option(optArr[1],optArr[0]); if(optArr[0].toLowerCase().indexOf("all")==0 || optArr[0].toLowerCase().indexOf("any")==0 || optArr[0].toLowerCase().indexOf("specialeconomiczone")==0){Obj.options[i].className = "optionbg";} } }, genProperty: function(trans,frm,bflag,isBuyer){ this.populate(trans,frm,bflag,isBuyer); }, throwErr :function(Obj,Msg,ErrType,DivId){ if(!ErrType) alert(Msg); else if(ErrType==1){ var DivObj = ($ip(DivId)) ? $ip(DivId) : new Object; DivObj.innerHTML = Msg; DivObj.style.display=""; }else{ if(this.lbActive){ try{ if(this.isObject($ip("divLBGlobalMsg"))){ if(this.Trim($ip("divLBGlobalMsg").innerHTML)==Msg) return false; } }catch(e){this.traceErr(e,"throwErr","ip_common");} this.startAlert(Obj,Msg,300,'alert'); } else this.startLB(Obj,Msg); return false; } if(!Obj) return false; try{Obj.focus();}catch(e){try{Obj[0].focus();}catch(e1){}} return false; }, throwSuccess:function(Obj,Msg,ErrType,DivId){ if(!ErrType) return true; else if(ErrType==1){ var DivObj = ($ip(DivId)) ? $ip(DivId) : new Object; DivObj.innerHTML = ""; DivObj.style.display="none"; }else{ /* Exit All LightBox Eff*/ } return true; }, infiniteCharInString : function(string,Allchar){ for(var i=0; i<Allchar.length; i++) { arr = string.split(Allchar.charAt(i)); if( (parseInt(arr.length) - 1)>1) return false; } return true; }, print : function(Str){ try{ if($ip("divDebug")){ with($ip("divDebug")){ style.padding = "10px"; style.display = "none"; innerHTML+='<br /><span style="color:#'+Math.floor(Math.random() * 999999)+'">' + Str+'</span>'; } }else{window.setTimeout(function(){ip.print(Str)},3000);} }catch(e){this.traceErr(e,'ip.print','common');} }, host : function(){ try{ if(location.href==null || location.href=="" || String(location.href).indexOf("indiaproperty")==-1){ return "http://yahoo.indiaproperty.com"; } var startDotCom = location.href.indexOf(".com"); startDotCom = startDotCom + 4; return (location.href.substring(0,startDotCom).indexOf("indiaproperty.com")) ? location.href.substring(0,startDotCom) : "http://yahoo.indiaproperty.com"; }catch(e){return "http://yahoo.indiaproperty.com";} }, LTrim : function(Str){ var i = 0; var j = Str.length - 1; if (Str== null){return (false);} for (i = 0; i < Str.length; i++){ if (Str.substr(i, 1) != ' ' && Str.substr(i, 1) != '\t') break; } if (i <= j) return (Str.substr(i, (j+1)-i)); else return (''); }, RTrim : function(Str){ var i = 0; var j = Str.length - 1; if(Str == null)return (false); for(j = Str.length - 1; j >= 0; j--){ if (Str.substr(j, 1) != ' ' && Str.substr(j, 1) != '\t') break; } if (i <= j) return (Str.substr(i, (j+1)-i)); else return (''); }, Trim : function(Str){ if (Str == null) return (false); return this.RTrim(this.LTrim(Str)); }, IsValidEmail : function(Str){ var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; return (filter.test(Str)) ? true : false; }, traceErr : function(e,from,jsFile,NoPrintStatus){ if(!NoPrintStatus) ip.print("<b><i>Func : " + from + "</i></b>, "+ e.name +" : " + e.message + ", Desc = "+ e.description + ", JS : " + jsFile + ", LineNumber : " + e.lineNumber); }, sleep : function(func,time){ window.setTimeout(func,time); }, setTimer : function(func,time){ window.setInterval(func,time); }, area_calc:function(){ url="/index.php?option=calculator&page=plotareaconverter&notemplate=yes"; this.startLB(null,null,null,"aJax",null,url,"sqft"); }, calc:function(page){ url="/index.php?option=calculator&page="+page+"&notemplate=yes"; var Obj = (page=="emi") ? "emi_amount" : "affordamt"; this.startLB(null,null,null,"aJax",null,url,Obj); }, getKey : function(e){ if( !e ) { if( window.event ) { e = window.event; } else { return 0; } } if( typeof( e.keyCode ) == 'number'  ) { e = e.keyCode; } else if( typeof( e.which ) == 'number' ) { e = e.which; } else if( typeof( e.charCode ) == 'number'  ) { e = e.charCode; } else { return 0; } var rKey = parseInt(e); if(ip.confirmActive){ if(rKey==27 || rKey==32){/*esc || enter (is problem) || space */ ip.exitConfirm($ip('divLBAlert'),0); return false; } } if(ip.simpleAlertActive){ if(rKey==27 || rKey==32){/*esc || enter (is problem) || space */ ip.exitSimpleAlert($ip('divLBAlert'),ip.simpleAlertObject); return false; } } if(ip.lbActive){ if(rKey==27 || (rKey==32 && ip.lbType!="aJax") ){/*esc || enter (is problem) || space */ ip.exitLB($ip('divLBcontent'),ip.lbObject); return false; } } return [e,String.fromCharCode( e )]; }, startKeyDetect : function(f){ /* Netscape 4 Need this IF Condition */ if(d.captureEvents && Event.KEYUP ) d.captureEvents( Event.KEYUP ); if(!f) return; else d.onkeyup = f; }, stopEvent : function(e){ try{ e.returnValue = false; e.cancelBubble = true; if(e.stopPropagation) e.stopPropagation(); /*Event.stop(e);*/ }catch(e){ip.traceErr(e,"stop event","comon")} }, getPageScroll : function(){ var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( d.body && ( d.body.scrollLeft || d.body.scrollTop ) ) { scrOfY = d.body.scrollTop; scrOfX = d.body.scrollLeft; } else if( d.documentElement && ( d.documentElement.scrollLeft || d.documentElement.scrollTop ) ) { scrOfY = d.documentElement.scrollTop; scrOfX = d.documentElement.scrollLeft; } return [ scrOfX, scrOfY ]; }, getCenterXY : function(w,h){ var x=0,y=0; x = (this.getPageSize()[2] - w) / 2; y = (this.getPageScroll()[1] + ((this.getPageSize()[3] - h) / 2)); return [x,y]; }, makeCenter : function(Obj,w,h){ if(!w || w==0 || w==null){w=Obj.offsetWidth;} if(!h || h==0 || h==null){h=Obj.offsetHeight;} var xy = this.getCenterXY(w,h); ip.print("xy = " + xy); with(Obj.style){ left = (xy[0]) + "px"; top= (xy[1]) + "px"; } }, getScrollWidth : function(){ var w = window.pageXOffset || d.body.scrollLeft || d.documentElement.scrollLeft; return w ? w : 0; }, getScrollHeight : function (){ var h = window.pageYOffset || d.body.scrollTop || d.documentElement.scrollTop; return h ? h : 0; }, getPos: function(inputElement) { var coords =  new Object(); coords.x = 0; coords.y = 0; try { targetElement = inputElement; if(targetElement.x && targetElement.y) { coords.x = targetElement.x; coords.y = targetElement.y; } else { if(targetElement.offsetParent) { coords.x += targetElement.offsetLeft; coords.y += targetElement.offsetTop; while(targetElement = targetElement.offsetParent) { coords.x += targetElement.offsetLeft; coords.y += targetElement.offsetTop; } } else { /*/alert("Could not find any reference for coordinate positioning.");*/ } } return coords; } catch(e){ ip.traceErr(e,"getPos","ipCommon"); return coords; } }, getPageSize : function(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = d.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (d.body.scrollHeight > d.body.offsetHeight){ /* all but Explorer Mac*/ xScroll = d.body.scrollWidth; yScroll = d.body.scrollHeight; } else { /* Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari*/ xScroll = d.body.offsetWidth; yScroll = d.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) {	/* all except Explorer*/ windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (d.documentElement && d.documentElement.clientHeight) { /* Explorer 6 Strict Mode*/ windowWidth = d.documentElement.clientWidth; windowHeight = d.documentElement.clientHeight; } else if (d.body) { windowWidth = d.body.clientWidth; windowHeight = d.body.clientHeight; } /* for small pages with total height less then height of the viewport*/ if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } /* for small pages with total width less then width of the viewport*/ if(xScroll < windowWidth){pageWidth = windowWidth;} else {pageWidth = xScroll;} arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); return arrayPageSize; }, isObject : function(Obj){ return (!Obj || Obj==null || Obj=="undefined") ? false : true; }, formQueryString : function(frm,Arr){ var Qry=""; if(!Arr){ for (var i=0; i<frm.elements.length; i++) { Qry+=frm.elements[i].name + "=" + frm.elements[i].value; if(frm.elements.length!=i) Qry+="&"; } }else{ for (var i=0; i<Arr.length; i++) { Qry+=frm.elements[Arr[i]].name + "=" + frm.elements[Arr[i]].value; if(Arr.length!=i) Qry+="&"; } } return Qry; } }; var Preloader = { callbacks: [], images: [], loadedImages: [], imagesLoaded: 0, add: function(image){ if (typeof image == 'string') this.images.push(image); if (typeof image == 'array' || typeof image == 'object'){for (var i=0; i< image.length; i++){this.images.push(image[i]);}} }, onFinish: function(func){ if (typeof func == 'function') this.callbacks.push(func); if (typeof func == 'array' || typeof func == 'object'){for (var i=0; i< func.length; i++){this.callbacks.push(func[i]);}} }, load: function(){ for(var i=0; i<this.images.length; i++){ this.loadedImages[i]= new Image(); this.loadedImages[i].onload = function(){Preloader.checkFinished.apply(Preloader);}; this.loadedImages[i].src = this.images[i]; } }, checkFinished: function(){ this.imagesLoaded++; if(this.imagesLoaded == this.images.length){this.fireFinish();} }, fireFinish: function(){ for (var i=0; i<this.callbacks.length; i++){this.callbacks[i]();} this.images = []; this.loadedImages = []; this.imagesLoaded = 0; this.callbacks = []; } }; function StartPreLoader(ImageSrc,ImageId,LoadingDivId){ Preloader.add(ImageSrc); var finishFunc = function(){ if($ip(LoadingDivId)){$ip(LoadingDivId).style.display = 'none';} if($ip(ImageId)){$ip(ImageId).src =ImageSrc;} }; Preloader.onFinish(finishFunc); Preloader.load(); } function IsMandatory(obj, obj_type,	Msg,	ErrType, DivId){ if (obj_type == "text" || obj_type == "password" || obj_type == "textarea" || obj_type == "file"){ if(obj_type != "file") obj.value = ip.Trim(obj.value); var objValue; objValue = obj.value.replace(/\s+$/,""); if (objValue.length == 0){return ip.throwErr(obj,Msg,ErrType,DivId);}else{return ip.throwSuccess(obj, Msg, ErrType, DivId);} }else if (obj_type == "select"){ if(obj.selectedIndex==-1 || obj.options[obj.selectedIndex].value=="0" || obj.options[obj.selectedIndex].value=="00" || obj.options[obj.selectedIndex].value=="" || (obj.options[obj.selectedIndex].value=="any" && obj.name=="state") ) return ip.throwErr(obj,Msg,ErrType,DivId); else{return ip.throwSuccess(obj, Msg, ErrType, DivId);} }else if (obj_type == "radio" || obj_type == "checkbox"){ if (!obj[0] && obj){ if (!obj.checked){return ip.throwErr(obj,Msg,ErrType,DivId);}else {return ip.throwSuccess(obj, Msg, ErrType, DivId);} }else{ for (i=0; i < obj.length; i++){ if(obj[i].checked){return ip.throwSuccess(obj, Msg, ErrType, DivId);}} return ip.throwErr(obj[0],Msg,ErrType,DivId); } }else{return ip.throwErr(obj,Msg,ErrType,DivId);} } function IsEmpty(obj, obj_type){ if(!obj || obj=="undefined" || obj==null || obj=="null") return; if (obj_type == "text" || obj_type == "password" || obj_type == "textarea" || obj_type == "file"){ var objValue; if(obj_type != "file") if(obj.value.length>0) obj.value = ip.Trim(obj.value); objValue = obj.value.replace(/\s+$/,""); return (objValue.length==0) ? true : false; }else if (obj_type == "select"){ if(obj.selectedIndex==-1 || obj.options[obj.selectedIndex].value=="0" || obj.options[obj.selectedIndex].value=="00" || obj.options[obj.selectedIndex].value=="" || (obj.options[obj.selectedIndex].value=="any" && obj.name=="state") ){ return true; }else{return false;} }else if (obj_type == "radio" || obj_type == "checkbox"){ if (!obj[0] && obj){ return (obj.checked) ? false : true; }else{ for (i=0; i < obj.length; i++){if(obj[i].checked) return false;} return true; } }else{return true;} } function IsFoundCharacters(ObjVal, str){ for( var i= 0; i< ObjVal.length; i++ ){ var m = false; for( var j= 0; j< str.length; j++){ if( ObjVal.charAt(i) == str.charAt(j) || String(ObjVal.charCodeAt(i))==String(10) || String(ObjVal.charCodeAt(i))==String(13)) m = true; } if(!m) return false; } return true; } function IsValidCharacters(Value, AllChars, AtleastChars){ /*AllChars = AllChars.replace(/\n/g,"");*/ if(IsFoundCharacters(Value,AllChars) && AtleastOneChar(Value,AtleastChars) && IsFoundCharacters(Value.substr(0,1),AtleastChars) ) return true; else return false; } function AtleastOneChar(Expression,ValidateChar){ ValidateChar = (ValidateChar=="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ? /[^a-zA-Z]/g : ValidateChar; ValidateChar = (ValidateChar=="0123456789") ? /[^0-9]/g : ValidateChar; var charString = Expression.replace(ValidateChar, ""); if(charString.length < 1){return false;} return true; } function IsMin(Str,Len){return (Str.length<Len) ? true : false;} function IsMax(Str,Len){return (Str.length>Len) ? true : false;} var ArrText = new Array("Delhi / NCR (All)","Mumbai (All)","Bangalore (All)","Chennai (All)","Hyderabad (All)","Ahmedabad (All)","International Cities","Any City","Other Cities","Kolkata (All)"); var ArrNew = new Array("Delhi","Mumbai","Bangalore","Chennai","Hyderabad","Ahmedabad","AbuDhabi","Any","Others","Kolkata"); function propertiesByArray(e){ var propByArr=""; for (var i=0; i<e.length; i++){ propByArr = propByArr + ( (e[i].checked) ? ((propByArr=="") ? "" : "|") + e[i].value  : ""); } return propByArr; } function checkquicksearchbox(frm){ if(!frm) frm = d.quicksearch; try{if(!IsMandatory(frm.transaction,"select","Please Select Transaction Type",2)) return false;}catch(e){} if(!IsMandatory(frm.property,"select","Please Select Property type",2)) return false; if(!IsMandatory(frm.city,"select","Please Select City",2))  return false; tempcity = frm.city.options[frm.city.selectedIndex].text; for(var i=0; i<ArrText.length; i++) {if(tempcity==ArrText[i]) tempcity=ArrNew[i];} tempcity=tempcity.replace(" ","+"); var qry = ip.host()+"/search/" +  frm.transaction.value + "/" + frm.property.options[frm.property.selectedIndex].value + "-in/"; try{ var usertypeArr = frm.elements["strusertype[]"]; var newpath = "/"; var propByArr=propertiesByArray(usertypeArr); var ipCookie = new ip_cookie(); ipCookie.setCookie("propertyBy",propByArr,"","","",newpath); }catch(e){ ip.traceErr(e); } window.location.href = qry + tempcity + ".html"; return false; } function searchPropertiesBy(frm,CurrentObj){ /*	0 - All ,	1-Ind,	2-Builder,	3-Agents */ /* 0 - ind, 1-Agents, 2- builder, 3- All */ var Status = CurrentObj.checked; var objArr = frm.elements["strusertype[]"]; if(CurrentObj==objArr[3] && Status){ for (var i=0; i<objArr.length; i++) {objArr[i].checked=false;} CurrentObj.checked = true; }else if(objArr[0].checked && objArr[1].checked && objArr[2].checked){ for (var i=0; i<objArr.length; i++) {objArr[i].checked=false;} objArr[3].checked =true; }else{ objArr[3].checked =false; } } function ip_cookie(){ this.cookieString = ""; } ip_cookie.prototype.setCookie = function(cName,val, exp_y, exp_m, exp_d, path, domain, secure){ this.cookieString = cName + "=" + val; if(exp_y){ var expires = new Date ( exp_y, exp_m, exp_d ); this.cookieString += "; expires=" + expires.toGMTString(); } if(path)this.cookieString += "; path=" + path; if (domain) this.cookieString += "; domain=" + domain; else this.cookieString += "; domain=.indiaproperty.com"; if(secure) this.cookieString += "; secure"; d.cookie = this.cookieString; }; ip_cookie.prototype.getCookie = function(name){ if(d.cookie.length>0){ /*alert("Current Cookies" + d.cookie);*/ c_start=d.cookie.indexOf(name + "="); if (c_start!=-1){ c_start=c_start + name.length+1; c_end=d.cookie.indexOf(";",c_start); if (c_end==-1) c_end=d.cookie.length; return unescape(d.cookie.substring(c_start,c_end)); } } return ""; }; var tempArr=new Array(); var html=""; function onSaleRent(Obj,frm){ if(!frm) frm=d.quicksearch; var SR = new Array(); SR[SR.length] = $ip("tranS"); SR[SR.length] = $ip("tranR"); if(Obj.className == "radioN"){ Obj.className == "radioY"; frm.transaction.value=Obj.title; SR[0].className = (Obj.title=="sale") ? "radioY" : "radioN"; SR[1].className = (Obj.title=="rent") ? "radioY" : "radioN"; } ip.populate(frm.transaction,frm); } function ipNextPrev(arrList,divID){ this.curLayer=0; this.divObj = $ip(divID); this.arrList = arrList; try{this.goTo();}catch(e){ip.traceErr(e,"ipPrevNext","ip_layers.js");} }; ipNextPrev.prototype.goTo = function(Method){ if(this.curLayer==0 && Method=="prev") this.curLayer=this.arrList.length; if(this.curLayer==parseInt(this.arrList.length) - 1 && Method=="next") this.curLayer=-1; if(Method=="next"){++this.curLayer;}else if(Method=="prev"){--this.curLayer;} this.divObj.innerHTML = this.arrList[this.curLayer][0]; }; var hidenObjs= new Array(); function ipLightBox(divID, method, msg, width, height, url){ this.mainDivObj = (typeof($ip(divID))=="object") ? $ip(divID) : ( $ip("divLightBox") ) ? $ip("divLightBox") : null; this.method = method || "message"; this.msg = msg; this.failureMessage = "Sorry! Initialization failed."; this.url = url; this.width = width; this.height = height; switch(method){ case "ajax": break; default: break; } }; ipLightBox.prototype.init = function(){ this.mainDivObj = (this.mainDivObj==null || this.mainDivObj=="undefined") ? $ip("divLightBox") : this.mainDivObj; if(ie && ip.simpleAlertActive==false)  hideLayerObjects(); with(this.mainDivObj.style){ display = ""; position = "absolute"; left = "0px"; top = "0px"; width = ((ip.getPageSize()[0]>1020) ? ip.getPageSize()[0] - 25 : ip.getPageSize()[0]) + "px"; height = ip.getPageSize()[1] + "px"; }; /* this.mainDivObj.onclick = function(){ //this.style.display="none"; , here i have to write a safe script if LB doesnt work properly }; try{ var objLBContent = $ip("divLBcontent"); }catch(e){ var body = d.getElementsByTagName("body")[0]; var objLBContent = d.createElement("div"); objLBContent.setAttribute('id','divLBcontent'); objLBContent.style.display = 'none'; objLBContent.style.position = 'absolute'; objLBContent.style.zIndex = '1000'; objLBContent.style.width = this.width + "px"; objLBContent.style.width = this.height+ "px"; objLBContent.innerHTML = this.msg; body.appendChild(objLBContent); }*/ }; ipLightBox.prototype.exit= function(){ try{ this.mainDivObj.style.display="none"; if(ie && ip.simpleAlertActive==false) showHiddenLayerObjects(); }catch(e){} }; ipLightBox.prototype.startEffect= function(){ }; function hideLayerObjects(conditionObjs){ var overlayObjs = ["select","embed","iframe"]; for (var i=0; i<overlayObjs.length; i++) { var objArr = d.getElementsByTagName(overlayObjs[i]); for (var j=0; j<objArr.length; j++) { if(objArr[j].style.display=="none") hidenObjs[hidenObjs.length] = objArr[j]; objArr[j].style.display = "none"; } } } function showHiddenLayerObjects(){ var overlayObjs = ["select","embed","iframe"]; for (var i=0; i<overlayObjs.length; i++) { var objArr = d.getElementsByTagName(overlayObjs[i]); for (var j=0; j<objArr.length; j++) { objArr[j].style.display = ""; } } for (var i=0; i<hidenObjs.length; i++) {hidenObjs[i].style.display="none";} } function getHTTPObject(){ try {return new XMLHttpRequest();}catch(e){} try {return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){} try {return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){} return ip.throwErr(null,"Your Browser doesn't support the XML HTTP Request!",2); } function setPropertyBytes(){ ip.sleep(function(){ if(typeof ($ip("div_propertybytes"))!="object") return; if(!ip.isObject($ip("div_propertybytes"))) return; $ip("div_propertybytes").style.display=""; var date = new Date(); var sReq = new getHTTPObject(); var url = ip.host() + "/probyarticles.php?city=1&rndm="+date.getTime(); $ip("div_propertybytes").innerHTML = "<br /><br />"+ ip.loading("Loading Property News...<br /><br /><br />"); sReq.open("get",url,true); sReq.onreadystatechange = function(){ if(sReq.readyState==4){ var res = sReq.responseText; $ip("div_propertybytes").innerHTML ='<div style="padding:10px 0px;">' + res + '</div>'; } }; sReq.send(null); },3000); } function validateID(frm){ var first2letter = frm.listingid.value.substr(0,2); var next6letter = frm.listingid.value.substr(2,6); if(!IsMandatory(frm.listingid,"text","Please enter a Property ID",2,"Div_listingid")) return false; if(IsMin(frm.listingid.value,8)) return ip.throwErr(frm.listingid,"Please enter a valid IndiaProperty ID eg:IP123456",2,"Div_listingid"); if( (first2letter.toLowerCase() == "ip" || first2letter.toLowerCase() == "ib" || first2letter.toLowerCase() == "ia" || first2letter.toLowerCase() == "bl")){ if(!IsFoundCharacters(next6letter,"1234567890")) return ip.throwErr(frm.listingid,"Please enter a valid IndiaProperty ID eg:IP123456",2,"Div_listingid"); }else return ip.throwErr(frm.listingid,"Please enter a valid IndiaProperty ID eg:IP123456",2,"Div_listingid"); ip.OpenPage(ip.host() + "/index.php?option=search&page=searchbyidresult&listingid="+frm.listingid.value); ip.exitLB(); return false; } var preImgs = ["http://imgs.indiaproperty.com/bg/ipheadbg.gif","http://imgs.indiaproperty.com/lbox_b_lc.gif","http://imgs.indiaproperty.com/curves/lbox_b_rc.gif","http://imgs.indiaproperty.com/curves/lbox_lc.gif", "http://imgs.indiaproperty.com/curves/lbox_rc.gif","http://imgs.indiaproperty.com/dots/lbox_dot_l.gif","http://imgs.indiaproperty.com/dots/lbox_dot_b.gif", "http://imgs.indiaproperty.com/curves/h_blc.gif","http://imgs.indiaproperty.com/curves/h_brc.gif","http://imgs.indiaproperty.com/curves/h_lc.gif", "http://imgs.indiaproperty.com/curves/h_rc.gif","http://imgs.indiaproperty.com/bg/h_n_bg.gif","http://imgs.indiaproperty.com/curves/h_n_lc.gif", "http://imgs.indiaproperty.com/curves/h_n_rc.gif","http://imgs.indiaproperty.com/bg/h_n_a_bg.gif","http://imgs.indiaproperty.com/dots/h_n_dot.gif", "http://imgs.indiaproperty.com/dots/dot2_79A4CE.gif","http://imgs.indiaproperty.com/curves/box_bg.gif","http://imgs.indiaproperty.com/curves/box_rc.gif", "http://imgs.indiaproperty.com/curves/box_lc.gif","http://imgs.indiaproperty.com/bg/buttonbg.gif","http://imgs.indiaproperty.com/home_google_alexa_comscore.gif", "http://imgs.indiaproperty.com/home_pcworld.gif","http://imgs.indiaproperty.com/home_yahoo.gif","http://imgs.indiaproperty.com/home_testimonials.gif", "http://imgs.indiaproperty.com/buttons/closex.gif"]; StartPreLoader(preImgs); var lb = null; var lbA = null; window.onload = function(){ setPropertyBytes(); lb = new ipLightBox('divLightBox','',"",250); lbA = new ipLightBox('divLBAlertWindow','',"",250); }; /* LB Scripts */ /* Plot Area Calculator */ function onChangeArea(Obj){ Obj.value=toFloat(Obj.value,Obj); } function toFloat(checkString,Obj){ if(!ip.infiniteCharInString(".",checkString)) return ip.throwErr(Obj,"The value you have entered is invalid. Avoid multiple dots.",2); var newString = ""; var count = 0; for (i = 0; i < checkString.length; i++){ ch = checkString.substring(i, i+1); if ((ch >= "0" && ch <= "9") || (ch == ".")){ newString += ch; } } if (checkString != newString){ var Str = "The value you have entered contains invalid \n characters, is it okay to remove them ?"; ip.Confirm(Str,400,"yes|no"); var confirmTimer = window.setInterval( function(){ var confirmstatus = ip.confirmStatus; if(confirmstatus!=null){ clearInterval(confirmTimer); ip.confirmStatus = null; if(confirmstatus==1){ Obj.value =  newString; Obj.focus(); }else { Obj.value = checkString; Obj.focus(); } } },1000 ); }else{ return checkString; } return ""; } function noedit(form1){ if(form1.sqft.value!=""){ form1.button1.focus(); }else{ form1.reset1.focus(); } } /*function clearForm1(){d.form1.reset();}*/ function calculate(frm){ var arrM = [frm.sqft, frm.sqmt, frm.sqyd, frm.acre, frm.hectare, frm.ground, frm.cent]; var count = 20; var factor = new Array(); factor[1]=1; 			/*sq.ft */ factor[2]=0.0930000000000000000;/*sq.mts*/ factor[3]=0.1111111111111000000;/*sq.yards*/ factor[4]=0.0000229566300000000;/*acres*/ factor[5]=0.0000092904166000000;/*hectares*/ factor[6]= 0.00041666667000000;/*ground*/ factor[7]= 0.00229600000000000;/*cent*/ var element =  new Array(); for (var i=1; i<=arrM.length; i++) { element[i] = arrM[i-1].value; } element[1]= frm.sqft.value; element[2]= frm.sqmt.value; element[3]= frm.sqyd.value; element[4]= frm.acre.value; element[5]= frm.hectare.value; element[6]= frm.ground.value; element[7]= frm.cent.value; var firstvalue =0, position =0, nullcount=0; for (var i=1; i <= count; i++){ if(element[i] != null && element[i].length!=0){ if(i==1 && element[2]!="") var parsecheck=""+parseFloat(element[i]); if(parseFloat(element[i])==0 || parsecheck=="NaN"){ return ip.throwErr(frm.sqft,"Please Enter a Non-Zero Number",2); } firstvalue=element[i]/factor[i]; position= i; value=element[i]; break; }else{ nullcount=nullcount+1 } if (nullcount==count){return ip.throwErr(frm.sqft,"Please enter a value",2);} } if (firstvalue==0){d.form1.reset();} for (var i=0; i<arrM.length; i++) { arrM[i].value = firstvalue*factor[i+1]; } /*frm.sqft.value=firstvalue*factor[1]; frm.sqmt.value=firstvalue*factor[2]; frm.sqyd.value=firstvalue*factor[3]; frm.acre.value=firstvalue*factor[4]; frm.hectare.value=firstvalue*factor[5]; frm.ground.value=firstvalue*factor[6]; frm.cent.value=firstvalue*factor[7]; */ var foundNaN=false; for (var i=0; i<arrM.length; i++) { if(!ip.infiniteCharInString(".",arrM[i].value)) return ip.throwErr(arrM[i],"The value you have entered is invalid. Avoid multiple dots.",2); if(arrM[i].value < 0.00000001) arrM[i].value=0; if(arrM[i].value > 9999999999) arrM[i].value="-"; if(arrM[i].value =="NaN"){foundNaN=true;arrM[i].value="";} } if(foundNaN) return ip.throwErr(arrM[0],"The value you have entered is invalid.",2); } function setfocus(){d.form1.sqft.focus();} /* End Plot Area Calculator */ /* Affordability  Calculator */ function calc_afd(frm){ if(!frm) frm=d.frm1; var interestValue = frm.interest.options[frm.interest.selectedIndex].value; if(!IsMandatory(frm.affordamt,"text","Please enter your EMI amount",2)) return false; if(parseInt(frm.affordamt.value)==0 || frm.affordamt.value<0) return ip.throwErr(frm.affordamt,"Invalid EMI amount",2); if(!IsValidCharacters(frm.affordamt.value,numbers + ".", numbers)) return ip.throwErr(frm.affordamt,"Invalid EMI amount",2); if(!IsMandatory(frm.loanperiod,"text","Please enter loan period",2)) return false; if(parseInt(frm.loanperiod.value)==0 || frm.loanperiod.value<0) return ip.throwErr(frm.loanperiod,"Invalid loan period",2); if(!IsValidCharacters(frm.loanperiod.value,numbers + ".", numbers)) return ip.throwErr(frm.loanperiod,"Invalid loan period",2); if(frm.affordamt.value!=""  && frm.loanperiod.value!="" ){ var affordamt = frm.affordamt.value; /*var d = frm.d.value;*/ var loanperiod = frm.loanperiod.value; var f = (1+interestValue/1200); var pv = (1200*affordamt/interestValue)*(1-Math.pow( f,- loanperiod)); var  result =0; result= round_decimals(pv,2); frm.afd.value =parseInt(result) ; return false; } } function round_decimals(original_number, decimals) { var result1 = original_number * Math.pow(10, decimals); var result2 = Math.round(result1); var result3 = result2 / Math.pow(10, decimals); return (result3); } /* End Affordability Calculator */ /* Emi Calculator */ function checkNumber(input, min, max, msg, field){ var str = input.value; var num = 0 + str; if (num < min || max < num){ return ip.throwErr(form1.amount,msg,2); } input.value = str; return true; } function computeForm(form1){ for( var  i=0; i<3; i++){ if (form1.elements[i].value == null || form1.elements[i].value.length == 0){ return ip.throwErr(form1.elements[i],"Please enter values in the textbox \n and then submit the form.",2); }else{ var fstr="",flag =0; for (var z = 0; z<form1.elements[i].value.length; z++){ var  str= form1.elements[i].value; var ch = str.substring(z, z + 1); if ((ch < "0" || "9" < ch) && ch != '.'){flag++;}else{fstr=fstr+ch;} } if (flag >0 ){ form1.elements[i].value=fstr; return ip.throwErr(form1.elements[i],"Please enter a numeric value.",2); } } } if (form1.interest.value == 0)return ip.throwErr(form1.interest,"Interest rate cannot be zero!",2); if (form1.tenure.value == 0) return ip.throwErr(form1.tenure,"Tenure cannot be zero!",2); var maxloan; if((form1.amount.value < 100)) return ip.throwErr(form1.amount,"Loan Amount has to be from Rs.100 and above.",2); maxloan= (form1.amount.value); if (!checkNumber(form1.amount.value, 100, maxloan,"The loan amount cannot exceed 85% of the property value - Rs." + form1.amount.value +".",  "'Amount Of Loan'") ||!checkNumber(form1.tenure.value, 1, 30, "Tenure has to be  1  to 30 years.", "'Tenure'") ){ form1.emi.value = ""; form1.interest.value =""; return; } var numpayment; numpayment = form1.tenure.value; var interest=(form1.interest.value); if (form1.amount.value > 99){ i = form1.interest.value; }else{ return ip.throwErr(form1.amount,"loan Amount should be greater than Rs.100.",2); } var indcnt= 1; if(indcnt == 0){ var r = i; if (i > 1.0){i = i / 100.0;} var pow = 1; for(var j = 0; j < numpayment; j++) pow = pow * (1 + i); form1.emi.value = Math.round((form1.amount.value * pow * i) / ((pow - 1)*12)); } if(indcnt==1){ var r = i; if (i > 1.0){ i = i / 100.0; i = i/12; } var pow = 1; for (var j = 0; j < numpayment ; j++){ pow = pow * (1 + i); } form1.emi.value =  Math.round((form1.amount.value * pow * i) / (pow - 1) ); } if (indcnt==2){ var r = i; var d =0; if (i > 1.0){ i = i / 100.0; d = i / 365; } var pow = 1; for (var j = 0; j < numpayment*365; j++) pow = pow * (1 + d); form1.emi.value = Math.round(((form1.amount.value * pow * d)*30) / (pow - 1) ); } return false; } /* End EMI Calculator */ /* End of LB Scripts*/