﻿// JScript File

var restrict=new Array();
restrict[0]='\'';
restrict[1]='@';
restrict[2]='*';
restrict[3]='"';
restrict[4]='create';
restrict[5]='\\';
restrict[6]='<';
restrict[7]='>';
restrict[8]='exec';
restrict[9]=';';
restrict[10]='%';
restrict[11]='#';
restrict[12]='drop';
restrict[13]='delete';
restrict[14]='select';
restrict[15]='alter';
restrict[16]='update';
restrict[17]='$';
restrict[18]='&';
restrict[19]='(';
restrict[20]=')';
restrict[21]='<script>';
restrict[22]='?';
restrict[23]='=';
restrict[24]='|';
restrict[25]='!';
restrict[26]=':*';
restrict[27]='help';
//restrict[28]='create';
//restrict[29]='exec';

function lib_bwcheck(){ //Browsercheck (needed)
//alert(navigator.userAgent+"  +++ "+navigator.appVersion);
	this.ver=navigator.appVersion; 
	this.agent=navigator.userAgent;
	this.dom=document.getElementById?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom)
	return this
}

function handleSql(d)
{
var id=d.split('|');
var i=0;
while(i<id.length)
{
    obj=document.getElementById(id[i]).value;
    for(j=0;j<restrict.length;j++)
    {
        if(obj.indexOf(restrict[j])!=-1)
        {
            alert("Special Characters are not allowd!");
            document.getElementById(id[i]).value='';
            document.getElementById(id[i]).focus();
            return;
        }
    }
    i++;
}
return;
}

var checkno=/^\d{6}$/;

function checkNo(id)
{
obj=document.getElementById(id).value;
if(obj.length==6)
{
    if(obj.search(checkno)==-1)
    {
        alert ('Instrument number must be numeric!');
        document.getElementById(id).focus();
        return;
    }
}
else if(document.getElementById(id).value='')
    return;
else
    {
        alert ('Instrument number must be 6 digit long!');
        document.getElementById(id).focus();
        return;
    }
}


 

