// JavaScript Document
var vFullList,vMissingLinks,vDetail;
vFullList="Assam:.0825,Bihar:.09,Calcutta:.07,Chennai:.08,Delhi:.08,Goa:.08,Gujarat:.07,Haryana:.125,HP:.08,Hyderabad:.1,Kerala:.085,Manipur:.07,MP:.075,Nagaland:.075,Orissa:.147,Punjab:.06,Rajasthan:.1,Tripura:.05,UP:.145,";
vDetail="Bangalore,Maharashtra,Meghalaya"
function testinput(re, str){
	 var i = frmST.txtFVProperty.value;
   if (str.search(re) != -1){
  		vStartPosition=str.search(re);
		vRate=str.slice(vStartPosition+re.length+1,str.indexOf(",",vStartPosition));		
		if (i > -1) {
		s = (i * vRate);
		frmST.txtSD.value = Math.round(s);
		}
	}
   else {
      //midstring = " does not contain ";
     // alert("work Pending");
     
		if (vDetail.search(re) != -1){
			switch(re) {
			case "Bangalore":	//alert("Bangalore");
						if (i > -1) {
						percent = 0.04;
						s = i * percent;
						frmST.txtSD.value = Math.round(s);
						}
						if (i > 500000) {
						percent = 0.06;
						s = (i - 500000) * percent + 20000;
						frmST.txtSD.value = Math.round(s);
						}
						if (i > 1500000) {
						percent = 0.08;
						s = (i - 1500000) * percent + 80000;
						frmST.txtSD.value = Math.round(s);
						}
						break;
			case "Maharashtra":	
						if (i > -1) {
						s = 0;
						frmST.txtSD.value = s;
						}
						
						if ((i >=1) && (i<=500000))
						{
							s = 8750;
							frmST.txtSD.value = s;
						}
						
						if (i>500000)
						{
							s=(i*5)/100;
							frmST.txtSD.value = s;
						}
						/*if (i > -1) {
						s = 0;
						frmST.txtSD.value = s;
						}
						if (i > 100000) {
						percent = 0.005;
						s = i * percent;
						frmST.txtSD.value = s;
						}
						if (i > 250000) {
						percent = 0.03;
						s = (i - 250000) * percent + 1250;
						frmST.txtSD.value = s;
						}
						if (i > 500000) {
						percent = 0.06;
						s = (i - 500000) * percent + 8750;
						frmST.txtSD.value = s;
						}
						if (i > 1000000) {
						percent = 0.08;
						s = (i - 1000000) * percent + 38750;
						frmST.txtSD.value = s;
						}*/
					break;
			case "Meghalaya":	
						if (i > -1) {
						s = (i * .046);
						frmST.txtSD.value = Math.round(s);
						}
						if (i > 50000) {
						s = (i * .06);
						frmST.txtSD.value = Math.round(s);
						}
						if (i > 90000) {
						s = (i * .08);
						frmST.txtSD.value = Math.round(s);
						}
						if (i > 150000) {
						s = (i * .099);
						frmST.txtSD.value = Math.round(s);
						}
						break;
			default : alert("Information is missing.");
			}
		}
  }
	
	var percent;
	var s;

	
	if (i < 0){
	alert("Error : Enter A Positive Value");
	}
}


function getSD(){
vCityName= document.frmST.sdlinks.options[document.frmST.sdlinks.selectedIndex].value ;
testinput(vCityName,vFullList);
}

function cleartxt(){
document.frmST.txtFVProperty.value = '';
document.frmST.txtSD.value = '';

}
