function getupper(str) {
str2=str.value.toUpperCase();
str.value=str2;
return true;
}
function getisincode(dfisincode) {
dfisincode.value=dfisincode.value.toUpperCase();
if(dfisincode.value.length !=12) {
    msg=msg+'ISINCODE Length must be 12 in Length\n';
    alert(msg);
    return false;
 }
}
function getchkqty(qty) {
 if (isNaN(qty.value)==true) {
       msg=msg+'Qty Should be Valid Number Value\n';
       qty.value="";
       return true;
             }
      }

function checkbrkgfixed(str2)
{
var bb=str2.value.length;
   for(var i=0;i<bb;i++)
   {

      var c1=str2.value.substring(i,i+1);
	  strr=str2.value.substr(i,5)
	  strr1=str2.value.substr(0,i)
	  strrm=str2.value.substr(0,i-1)
    if(c1==".")
     {
	 if(strr.length==3 && strr1.length==2)
           {
         	strr=str2.value.substr(0,2)+str2.value.substr(i,3)+"0";
	 	str2.value=strr
//		alert("1");
       	   }
         if(strr1.length>2)
 	   {
	 	str2.value="";
	 	str2.focus();
	 	return false;
	   }
       if(strr.length==3 && strr1.length==1)
          {
         	strr=str2.value.substr(0,1)+str2.value.substr(i,3)+"0";
	 	str2.value=strr
//alert("2");
       	  }
       if(strr.length==1 && strr1.length==2)
          {
         	strr=str2.value.substr(0,2)+str2.value.substr(i,3)+"000";
	 	str2.value=strr
//        alert("3");
 }

       if(strr.length==1 && strr1.length==1)
          {
         	strr=str2.value.substr(0,1)+str2.value.substr(i,3)+"000";
	        str2.value=strr
//       	alert("4");
 }
      if(strr.length==2 && strr1.length==2)
          {
	        strr=str2.value.substr(0,2)+str2.value.substr(i,3)+"00";
	 	str2.value=strr
//         alert("5");
 }
     if(strr.length==2 && strr1.length==1)
          {
         strr=str2.value.substr(0,1)+str2.value.substr(i,3)+"00";
	 str2.value=strr
//          alert("6");
}
    if(strr.length==2 && strrm.length==0)
          {
         strr="0"+str2.value.substr(0,0)+str2.value.substr(i,3)+"00";
	 str2.value=strr
  //    alert("7");
}
      if(strr.length==4 && strr1.length==2)
          {
//alert("8")
         strr=str2.value.substr(0,2)+str2.value.substr(i,4);
	 str2.value=strr
          }
    if(strr.length==3 && strrm.length==0)
          {
         strr="0"+str2.value.substr(0,0)+str2.value.substr(i,3)+"0";
	 str2.value=strr
        //  alert("9");
}
    if(strr.length==4 && strr1.length==0)
          {
     //alert("10")
      strr="0"+str2.value.substr(0,0)+str2.value.substr(i,4);
	 str2.value=strr

return true;}
       return true;
       break;
     }
      if(isNaN(c1)==true)
     {
       alert("Invalid Entry");
       str2.value="";
       str2.focus();
       break;
       }
}
if(isNaN(str2.value)==false){
        strr5=str2.value.substr(0,5)
         if(str2.value.length>2)
 	   {
	 	str2.value="";
	 	str2.focus();
	 	return false;
	   }
         if(str2.value.length<=2)
 	   {
	 	str2.value=str2.value+".000"


	   }

}

}

function checkbrkgmin(str2)
{
var bb=str2.value.length;
   for(var i=0;i<bb;i++)
   {

      var c1=str2.value.substring(i,i+1);
	  strr=str2.value.substr(i,4)
	  strr1=str2.value.substr(0,i)
	  strrm=str2.value.substr(0,i-1)
    if(c1==".")
     {

         if(strr1.length>2)
 	   {
	 	str2.value="";
	 	str2.focus();
	 	return false;
	   }
       if(strr.length==2 && strr1.length==1)
          {
         	strr=str2.value.substr(0,1)+str2.value.substr(i,3)+"0";
	 	str2.value=strr
		//alert("a");
       	  }



      if(strr.length==2 && strr1.length==2)
          {
	         strr=str2.value.substr(0,2)+str2.value.substr(i,3)+"0";
	 	str2.value=strr
		//alert("a1");
          }
     if(strr.length==3 && strr1.length==1)
          {
         strr=str2.value.substr(0,1)+str2.value.substr(i,3);
	 str2.value=strr
		//alert("a2");
          }
    if(strr.length==3 && strrm.length==0)
          {
         strr="0"+str2.value.substr(0,0)+str2.value.substr(i,3);
	 str2.value=strr
		//alert("a3");
          }
if(strr.length==2 && strrm.length==0)
          {
         strr="0"+str2.value.substr(0,0)+str2.value.substr(i,3)+"0";
	 str2.value=strr
		//alert("a3");
          }
if(strr.length==2 && strrm.length==0)
          {

         strr=str2.value.substr(0,2)+str2.value.substr(i,1)+"00";
	 str2.value=strr
		alert("a3");
          }
if(strr.length==1 && strrm.length==0)
          {
         strr=str2.value.substr(0,1)+str2.value.substr(i,1)+"00";
	 str2.value=strr
		//alert("a3");
          }

     if(strr.length==2 && strr1.length==1)
          {
         strr=str2.value.substr(0,1)+str2.value.substr(i,3)+"00";
	 str2.value=strr
//          alert("6");
          }
     if(strr.length==1 && strr1.length==2)
          {
        // alert("6");

         strr=str2.value.substr(0,2)+str2.value.substr(i,3)+"00";
	 str2.value=strr
          }


       return true;
       break;
     }
      if(isNaN(c1)==true)
     {
       alert("Invalid Entry");
       str2.value="";
       str2.focus();
str2.value="";
       break;
       }
}
if(isNaN(str2.value)==false){
        strr5=str2.value.substr(0,5)
         if(str2.value.length>2)
 	   {
	 	str2.value="";
	 	str2.focus();
	 	return false;
	   }
         if(str2.value.length<=2)
 	   {
	 	str2.value=str2.value+".00"


	   }

}

}

function checksettno(str)
 {

  if (str.value.length!=6 &&str.value.length!=0)
     {
    alert("Sett.No Length must be 6 in Length");
    str.value="";
    str.focus();
    return false;
     }
 }


function click(ev)
{
if(document.all) { if (event.button == 2)
{ alert ("Right button is not active");
return false;
}
else if (document.layers) { if (ev.which ==3)
 return false; } }
if (document.layers) document.captureEvents
(Event.MOUSEDOWN);
document.onmousedown=click;
}


function checkpwd(str)
 {
  if (str.value.length<6 &&str.value.length!=0)
     {
    alert("Password must be atleast 6 in Length");
    str.value="";
    str.focus();
    return false;
     }
 }

function checkdate(str)
{

  if (str.value=="") {
      return true;
    }

    if (str.value.length==8) {
      str1=str.value.substr(0,2)+"-"+str.value.substr(2,2)+"-"+str.value.substr(4,4);
      str.value=str1;
    }
   if (str.value.length==6) {
     if (str.value.substr(4,2)>='00' && str.value.substr(4,2)<'50') {
       str1=str.value.substr(0,2)+"-"+str.value.substr(2,2)+"-"+'20'+str.value.substr(4,2);
       str.value=str1;
     }
     else {
       str1=str.value.substr(0,2)+"-"+str.value.substr(2,2)+"-"+'19'+str.value.substr(4,2);
       str.value=str1;
     }
   }

   var result = true;
   var result1 = true;
   var elems = str.value.split("-");
   result = (elems.length==3);
   if (result||result1) {
   //  var day   = parseInt(elems[0]);
     var month = str.value.substr(3,2);
     var year  = parseInt(elems[2]);
     var day=str.value.substr(0,2);
 //    var mm=form1.dftrdfr.value.substr(3,2);
   //  var yr=form1.dftrdfr.value.substr(6,4);

     result = !isNaN((month)) && ((month>0) && (month<13)) &&!isNaN((day)) && ((day>0) && (day<32)) &&
              ! isNaN(year) && (elems[2].length==4);


    }
   if (!result) {
       alert("Invalid Date, format should be dd-MM-yyyy");
       str.value="";
       str.focus();
       return false;
   }
      return true;
   }

 function checkisincode(str)
 {
  if(str.value.length!=12&&str.value.length!=0) {
    alert("ISINCODE Length must be 12 in Length");
    str.value="";
    str.focus();
    return false;
    }
     return true;
  }

function chkno(str)
{
if(isNaN(str.value)==true)
{
   if(str==dfchqno)
    {
     alert("Please Enter Valid Cheque Number");
   }
   if(str==dfchqamt)
   {
     alert("Please Enter Valid Cheque Amount");
   }
}
}

function chkno(str)
{
if(isNaN(str.value)==true)
 {
  str.focus();
  str.value="";
  alert("Invalid Entry")
 }
}

function chkfo(str1)
{
str1.select();
}



function checkstrprice(str2)
{
if (isNaN(str2.value)==true) {
  alert("Must be Valid Number Field");
  str2.value="";
  str2.focus();
  return false;
 }
 else
 {
if(str2.value!="")
 {
 str2.value=str2.value+".00";
 }
 }
}


function checksymbol(str)
{
var bb=str.value.length;
   for(var i=0;i<bb;i++)
   {
      var c1=str.value.substring(i,i+1);
       if(isNaN(c1)==false)
     {
       alert("Symbol Must be Valid Character Field");
       str.value="";
       str.focus();
      break;
       }
    }
 if(str.value!="")
 {
 //str2.value=str2.value+".00";
 }

}


function setvalue(str,str1,str2)
  {
var ab="disable"
if(ab=="demo")
{

        str.value="NN2175"
        str1.value="05-11-2002"
        str2.value="15-10-2002"
        str.disabled=true;
        str1.disabled=true;
        str2.disabled=true;
if(str2==window.document.form1.dfclosprice)
{
str2.value=str1.value
}
}
else
{
        str.value=""
        str1.value=""
        str2.value=""
        str.disabled=false;
        str1.disabled=false;
        str2.disabled=false;
 }

}

function setvaluecaptrdcnf(str)
{
//str.value="21-03-2002"
//str.disabled=true;
}

function setvaluecapfinldr(str,str1)
{
//str.value="20-07-2002"
//str.disabled=true;

//str1.value="25-07-2002"
//str1.disabled=true;
}

function checkpwd(str)
 {
  if (str.value== "") {
   alert("password can not be blank")
   return false;
  }
  if (str.value.length<6 || str.value.length>10)
    {
    alert("Password must be atleast minimum 6 or maximum 10 in Length");
    str.value="";
    str.focus();
    return false;
    }
 }

