	var error=1
	currentCol = 0
	previousCol = -1

//function for submit the form if all checks are correct 
	function IsValid(frm)
	{
		if(error==1)
		{
			frm.submit();
		}
		error=1
	}

// function for check blank value of text box ,should be call before submit the page for every text box
	function checkblank(txtb)
	{
		if(txtb.value=="")
		{
			alert("can't be blank");
			txtb.focus();
			error=0;
			return false;
		}
		else
			return true;	
	}

//function for remove space (character)  of textbox value from left and right both sides , should be call onblur of text box
	function Trim (ns)
	{
		s=ns.value;
		//trim lefthand spaces
		var i=0;
		while(s.charAt(i)==' ')
		i++;
		s=s.substring(i,s.length);
		//trim righthand spaces
		if (s.length > 0) 
		{
			while(''+s.charAt(s.length-1)==' ') 
			s = s.substring(0,s.length-1);
			ns.value=s;
		}
		else
			ns.value=s;
	}

// function for check special character in the textbox , should be call onkeyup of the textbox
// check from the ASCII value of the character
	function Checktxtbox(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode>=33 && chrCode<=44)||(chrCode==47)||(chrCode>=58 && chrCode<=64)||(chrCode>=91 && chrCode<=94)||(chrCode==96)||(chrCode>=123 && chrCode<=126))
			{
				alert("Special Character not allowed.")
				txtB.value=nstr
				break;
			}
			if(chrCode==32)
			{
				alert("Space not allowed");
                                txtB.value=nstr
                                break;
			}
			nstr=nstr+ str.charAt(i)
		}
	}

//function for checking hostname
	function checkalphabet(txtB)
	{
		var str,lnth,chrCode,nStr
                str = txtB.value
                lnth = str.length
		nstr=""
		for(i=0;i<lnth;i++)
                {
                        chrCode=str.charCodeAt(i)

                        if((chrCode>=65 && chrCode<=90)||(chrCode>=97 && chrCode<=122))
                        {}
			else
			{
                                alert("Only alphabets are allowed.")
                                txtB.value=nstr
                                break;
                        }
                        nstr=nstr+ str.charAt(i)
                }

	}
// function for check special ,numbers character in the textbox for , should be call onkeyup of the textbox
// check from the ASCII value of the character
	function Checkalpha(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode>=33 && chrCode<=47)||(chrCode>=58 && chrCode<=64)||(chrCode>=91 && chrCode<=96)||(chrCode>=123 && chrCode<=255))
			{
				alert("Character not allowed.")
				txtB.value=nstr
				break;
			}
			/*else if(chrCode>=48 && chrCode<=57)
			{
				alert("Digits not allowed.")
                                txtB.value=nstr
                                break;
		 	}*/
			else
			{}
			nstr=nstr+ str.charAt(i)
		}
	}
//function for checking of telephone no
	function Checkteleph(txtB)
	{
		var str,lnth
		str =txtB.value
		lnth =str.length
		if(str!="" && str!=0)
		{	if(str<1000000)
			{
			alert("Enter Valid Telephone Number")
			txtB.focus();
			return false;
			}
			else if(lnth>16 | lnth<7)
			{
			alert("Enter Valid Telephone Number")
			txtB.focus();
			return false;
			}
			else
			return true;
		}
		else
			return true;
	}
 //check for mobile number
	function Checkmobileno(txtB)
        {
                var str,lnth
                str = txtB.value
                lnth = str.length
        	if(str!="" && str!=0)
		{
			if(str<=10000000)
			{	
			alert("Enter Valid Mobile No")
			txtB.focus();	
			return false;
			}
			if(lnth>14 | lnth<10)
			{
			alert("Enter Valid Mobile No")
			txtB.focus();
			return false;
			}
			else
			{
			return true;
                	}
		}
		else
		return true;
        }
// check from the ASCII value of the character
        function Checkalphanumeric(txtB)
        {
                var str,lnth,chrCode,nStr,i,j

                str = txtB.value
                lnth = str.length
                for(i=0;i<lnth;i++)
		{
		chrCode=str.charCodeAt(i)
		if((chrCode>=65 && chrCode<=90)||(chrCode>=97 && chrCode<=122))
		continue;
		else
		break;
		}
		for(j=0;j<lnth;j++)
                {
                chrCode=str.charCodeAt(j)
                if((chrCode>=48 && chrCode<=57))
                continue;
                else
                break;
                }
		if(i==lnth ||j==lnth)
		{
		alert("Enter AlphaNumeric Value")
		return false;
		}
		else
		return true;
        }

// function for check special character in the textbox for port's values only allow number and ',', should be call onkeyup of the textbox
// check from the ASCII value of the character 
	function Checkport(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
			//if((chrCode>=1 && chrCode<=43)||(chrCode>=45 && chrCode<=47)||(chrCode>=58 && chrCode<=255))
			if((chrCode>=1 && chrCode<=47)||(chrCode>=58 && chrCode<=255))
			{
				alert("Character not allowed.")
				txtB.value=nstr
				break;
			}
			nstr=nstr+ str.charAt(i)
		}
	}

// function for check special character in the textbox for port's values only allow number and ',', should be call onkeyup of the textbox
// check from the ASCII value of the character 
	function Checkport_all(txtB)
	{
		var str,lnth,chrCode,nStr
		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
			if((chrCode>=1 && chrCode<=41)||(chrCode==43)||(chrCode>=46 && chrCode<=47)||(chrCode>=58 && chrCode<=255))
			{
				alert("Character not allowed.")
				txtB.value=nstr
				break;
			}
			nstr=nstr+ str.charAt(i)
		}
	}


// function for check special character in the textbox for ip range values only allow number and ',' and '.' ,should be call onkeyup of the textbox
// check from the ASCII value of the character 
	function CheckIprange(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode>=1 && chrCode<=43)||(chrCode==45 )||( chrCode==47)||(chrCode>=58 && chrCode<=255))
			{
				alert("Character not allowed.")
				txtB.value=nstr
				break;
			}
			nstr=nstr+ str.charAt(i)
		}
	}
	// check domain name
        function domain(txtB)
        {
                var str,lnth,chrCode,nStr

                str = txtB.value
                lnth = str.length
                //nstr=""

                for(i=0;i<lnth;i++)
                {
                        chrCode=str.charCodeAt(i)
			if((chrCode>=65 && chrCode<=90)||(chrCode>=97 && chrCode<=122) ||(chrCode>=48 && chrCode<=57)||(chrCode==46))
                        {
                              continue; 
				return true;
                                
                        }
			else
			{
			alert("Only Alphanumeric and dot allowed.")
			return false;
			}

                }
	 return true;
        }



	// function for check special character in the textbox for ip range values only allow number and '*' and '.' ,should be call onkeyup of the textbox
	// check from the ASCII value of the character 
	function CheckIp_all(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode>=1 && chrCode<=41)||(chrCode>=43 && chrCode<=45)||(chrCode==47 )||(chrCode>=58 && chrCode<=255))
			{
				alert("Character not allowed.")
				txtB.value=nstr
				break;
			}
			nstr=nstr+ str.charAt(i)
		}
	}

// function for check special character in the textbox for mac values only allow number, ",",":" and " A,B,C,D,E,F "  , should be call onkeyup of the textbox
// check from the ASCII value of the character 
	function CheckMACrange(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode>=1 && chrCode<=43)||(chrCode>=45 && chrCode<=47)||(chrCode>=59 && chrCode<=64)||(chrCode>=71 && chrCode<=255))
			{
				alert("Character not allowed.")
				txtB.value=nstr
				break;
			}
			nstr=nstr+ str.charAt(i)
		}
	}


// function for check special character in the textbox for values only allow number , should be call onkeyup of the textbox
// check from the ASCII value of the character 
	function Checknum(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode>=1 && chrCode<=47)||(chrCode>=58 && chrCode<=255))
			{
				alert("Character not allowed.")
				txtB.value=nstr
				break;
			}
			nstr=nstr+ str.charAt(i)
		}
	}

// function for check for the IP value of textbox
	function CheckIP(con_ip)
	{		
		//validating numeric entry only
		var ip =con_ip.value;
		if(ip=="*")
		{
		return true;
		}
		var checkOK = '0123456789.';
		var checkStr = ip;
		var allNum = '';
		var temp;
		var splitIP;
		splitIP = ip.split(".");
		// to check that there are dots between the numbers.
		if(ip!="")
		{
		if (splitIP.length == 1)		
			return false; 
		// to check that there are only 3 dots between the numbers.
		else if (splitIP.length != 4)	
			return false;
		// to check that the each part of the ip has a length, i.e. no 2 dots after each other.
		else if ( (splitIP[0].length == 0) | (splitIP[1].length == 0) | (splitIP[2].length == 0) | (splitIP[3].length == 0) )
			return false;
		// to check that each part has a length not greater than 3 digits.
		else if ( (splitIP[0].length > 3) | (splitIP[1].length > 3) | (splitIP[2].length > 3) | (splitIP[3].length > 3) )
			return false;
		// to check on each part that it is not excceeding 255.
		else if ( (splitIP[0] > 255) | (splitIP[1] > 255) | (splitIP[2] > 255) | (splitIP[3] > 255) )
			return false;
		// to check that the first part's value is not equal to zero.
		else if (splitIP[0] == 0)
			return false;
		// to check that the not all parts value are equal to zero.
		else if ( (splitIP[0] == 0) & (splitIP[1] == 0) & (splitIP[2] == 0) & (splitIP[3] == 0) )
			return false;
		// to check that it is not a local machine  IP.
		else if ( (splitIP[0] == 127) & (splitIP[1] == 0) & (splitIP[2] == 0) & (splitIP[3] == 1) )
			return false;
		// to check that the not all parts value are equal to 255.
		else if ( (splitIP[0] == 255) & (splitIP[1] == 255) & (splitIP[2] == 255) & (splitIP[3] == 255) )
			return false;
		


		// otherwise return true, that is IP is valid.
		else if (splitIP[0] < 10)
			 return false;
		else
			return true;
		}
		else 
			 return true;	
	}
// function for check for the IP value of textbox
        function CheckIP1(con_ip)
        {
                //validating numeric entry only
                var ip =con_ip;
                var checkOK = '0123456789.';
                var checkStr = ip;
                var allNum = '';
                var temp;
                var splitIP;
                splitIP = ip.split(".");
                // to check that there are dots between the numbers.
                if(ip!="")
                {
                if (splitIP.length == 1)
                        return false;
                // to check that there are only 3 dots between the numbers.
                else if (splitIP.length != 4)
                        return false;
                // to check that the each part of the ip has a length, i.e. no 2 dots after each other.
                else if ( (splitIP[0].length == 0) | (splitIP[1].length == 0) | (splitIP[2].length == 0) | (splitIP[3].length == 0) )
                        return false;
                // to check that each part has a length not greater than 3 digits.
                else if ( (splitIP[0].length > 3) | (splitIP[1].length > 3) | (splitIP[2].length > 3) | (splitIP[3].length > 3) )
                        return false;
                // to check on each part that it is not excceeding 255.
                else if ( (splitIP[0] > 255) | (splitIP[1] > 255) | (splitIP[2] > 255) | (splitIP[3] > 255) )
                        return false;
 // to check that the first part's value is not equal to zero.
                else if (splitIP[0] == 0)
                        return false;
                // to check that the not all parts value are equal to zero.
                else if ( (splitIP[0] == 0) & (splitIP[1] == 0) & (splitIP[2] == 0) & (splitIP[3] == 0) )
                        return false;
                // to check that it is not a local machine  IP.
                else if ( (splitIP[0] == 127) & (splitIP[1] == 0) & (splitIP[2] == 0) & (splitIP[3] == 1) )
                        return false;
                // to check that the not all parts value are equal to 255.
                else if ( (splitIP[0] == 255) & (splitIP[1] == 255) & (splitIP[2] == 255) & (splitIP[3] == 255) )
                        return false;
                // otherwise return true, that is IP is valid.
                else if (splitIP[0] < 10)
                         return false;
                else
                        return true;
                }
                else
                         return true;
        }



















//function for checking of iprange
	function checkiprange(con_ip)
	{	var ip =con_ip.value;
                var splitIP;
                //splitIP = ip.split(",");
		// to check that there are dots between the numbers.
                if(ip!="")
                {	splitIP = ip.split(",");
			if(splitIP.length==1)
			{
			if((CheckIP1(splitIP[0]))==false)
			{
                        alert("Invalid  IP\nIt should be in XX.XX.XX.XX this format");
                        return false;
                        }
			else
			return true;
			}
			else{
			if (splitIP.length < 2 | splitIP.length >2 )
			{
			alert("Enter 2 IP Values"); 
			alert("Invalid IP Range\nIt should be in XX.XX.XX.XX,XX.XX.XX.XXthis format");
			return false;
			}
			else if ((splitIP[0].length == 0) | (splitIP[1].length == 0))
			{
			return false;
			}
			else if((CheckIP1(splitIP[0]))==false) 
			{
		 	alert("Invalid First IP\nIt should be in XX.XX.XX.XX this format");
			return false;
			}
			else if((CheckIP1(splitIP[1])==false))
			{
			alert("Invalid Second IP \nIt should be in XX.XX.XX.XX this format");
			return false;
			}
			else
			{
			return true;
			}
							}
		}
		else 
		{return true;}
	}

// function for check for the SUBNET MASK value of textbox
        function CheckSubnet(con_sub)
        {
                //validating numeric entry only
                var ip =con_sub.value;
		if(ip=="*")
		{
		return true;
		}
                var checkStr = ip;
                var splitIP;
                splitIP = ip.split(".");
                // to check that there are dots between the numbers.
	if(ip!="")
	{                
		if (splitIP.length == 1)
                        return false;
                // to check that there are only 3 dots between the numbers.
                else if (splitIP.length != 4)
                        return false;
                // to check that the each part of the ip has a length, i.e. no 2 dots after each other.
                else if ( (splitIP[0].length == 0) | (splitIP[1].length == 0) | (splitIP[2].length == 0) | (splitIP[3].length == 0) )
                        return false;
	
		// to check that each part has a length not greater than 3 digits.
                else if ( (splitIP[0].length > 3) | (splitIP[1].length > 3) | (splitIP[2].length > 3) | (splitIP[3].length > 3) )
                        return false;
                // to check on each part that it is not excceeding 255.
                else if ( (splitIP[0] > 255) | (splitIP[1] > 255) | (splitIP[2] > 255) | (splitIP[3] > 255) )
                        return false;
                // to check that the first part's value is not equal to zero.
                else if (splitIP[0] == 0)
                        return false;
                // to check that the not all parts value are equal to zero.
                else if ( (splitIP[0] == 0) & (splitIP[1] == 0) & (splitIP[2] == 0) & (splitIP[3] == 0) )
                        return false;
                /*// to check that it is not a local machine  IP.
                else if ( (splitIP[0] == 127) & (splitIP[1] == 0) & (splitIP[2] == 0) & (splitIP[3] == 1) )
                        return false;
                // to check that the not all parts value are equal to 255.*/
                /* // its a valid condition in static routes
		else if ( (splitIP[0] == 255) & (splitIP[1] == 255) & (splitIP[2] == 255) & (splitIP[3] == 255) )
                        return false;
		*/
                // otherwise return true, that is IP is valid.
                else if (splitIP[0]!=255)
                         return false;
                else
                        return true;
	}
	else 
		return true;
        }
// function for check for the MAC value of textbox
        function CheckMAC(con_mac)
        {
                //validating numeric entry only
                var mac =con_mac.value;
                var checkStr = mac;
                var temp;
                var splitmac;
                splitmac = mac.split(":");
                if(mac!="")
		{
		 // to check that there are colon between the numbers
		if (splitmac.length == 1)
                        return false;
                // to check that there are only 5 colons between the numbers.
                else if (splitmac.length != 6)
                        return false;
                // to check that the each part of the mac has a length, i.e. no 2 colons after each other.
                else if ( (splitmac[0].length == 0) | (splitmac[1].length == 0) | (splitmac[2].length == 0) | (splitmac[3].length == 0) |(splitmac[4].length == 0)|(splitmac[5].length == 0))
                        return false;
                // to check that each part has a length of  2 character.

		 else if ( (splitmac[0].length != 2) | (splitmac[1].length != 2) | (splitmac[2].length != 2) | (splitmac[3].length != 2) | (splitmac[4].length != 2) | (splitmac[5].length != 2) )
                        return false;
                else
                        return true;
		}
		else
			return true;
        }
// function for fill combo for shedule
	function makeshedule(j)
	{
		var k=pow(j);
		if (k%2)
		{
			i=k-5;
			p=24;
		}
		else
		{
			i=k-5;
			p=25;
		}

		for (i,j;i<p;i++,j=j*2 )
		{
			document.write("<option value="+j+">"+i+":00</option>");
		}
	}

// function for fill combo Age 
	function fn_age(j)
	{
		for(i=1;i<99;i++)
		{
			if(i==j)
				document.write("<option value="+i+" selected>"+i+"</option>");
			else
				document.write("<option value="+i+">"+i+"</option>");
		}	
	}

// function for calculate the power of 2
	function pow(i)
	{
		var count=0;
		while(i>1)
		{
			i=i/2;
			count++;
		}
		return count;
	}


// function for E-mail check
	function emailcheck(txtbox) 
	{
		var emailStr=txtbox.value;

		var FormData=document.frm
		var dot=0
		var at2=0
		var at
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

		var matchArray=emailStr.match(emailPat)
if(emailStr!="")
{
		if (matchArray==null) 
		{
			alert("Email address seems incorrect (check @ and .'s)")
			txtbox.focus();
			error=0;
			return false
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) 
		{
			alert("The username doesn't seem to be valid in Email.")
			txtbox.focus();
			error=0;
			return false
		}

		var IPArray=domain.match(ipDomainPat)

		if (IPArray!=null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					alert("Destination IP address is invalid!")
					txtbox.focus();
					error=0;
					return false
				}
			}
			return true
		}

		var domainArray=domain.match(domainPat)

		if (domainArray==null) 
		{
			alert("The domain name doesn't seem to be valid.")
			txtbox.focus();
			error=0;
			//document.frmsubscribe.txtemail.focus();
			return false
		}

		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length

		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
			alert("The address must end in a three-letter domain, or two letter country.")
			txtbox.focus();
			error=0;
			return false
		}

		if (len<2) 
		{
			var errStr="This address is missing a hostname!"
			alert(errStr)
			txtbox.focus();
			error=0;
			return false
		}
}	
else 
return true;	
	}
	function CompareAlpha(a, b) 
	{
		if (a[currentCol] < b[currentCol]) { return -1; }
		if (a[currentCol] > b[currentCol]) { return 1; }
		return 0;
	}

	function CompareAlphaIgnore(a, b) 
	{
		strA = a[currentCol].toLowerCase();
		strB = b[currentCol].toLowerCase();
		if (strA < strB) { return -1; }
		else {
			if (strA > strB) { return 1; }
			else { return 0; }
		}
	}

	function CompareDate(a, b) 
	{
		// this one works with date formats conforming to Javascript specifications, e.g. m/d/yyyy
		datA = new Date(a[currentCol]);
		datB = new Date(b[currentCol]);
		if (datA < datB) { return -1; }
		else {
			if (datA > datB) { return 1; }
			else { return 0; }
		}
	}

	function CompareDateEuro(a, b)
	{
		// this one works with european date formats, e.g. d.m.yyyy
		strA = a[currentCol].split(".");
		strB = b[currentCol].split(".")
		datA = new Date(strA[2], strA[1], strA[0]);
		datB = new Date(strB[2], strB[1], strB[0]);
		if (datA < datB) { return -1; }
		else {
			if (datA > datB) { return 1; }
			else { return 0; }
		}
	}
 	
	
	 function CompareDateSql(a, b)
        {
                // this one works with european date formats, e.g. d.m.yyyy
                strA = a[currentCol].split("-");
                strB = b[currentCol].split("-")
                datA = new Date(strA[0], strA[1], strA[2]);
                datB = new Date(strB[0], strB[1], strB[2]);
                if (datA < datB) { return -1; }
                else {
                        if (datA > datB) { return 1; }
                        else { return 0; }
                }
        }




	
	function CompareNumeric(a, b)
	{
		//window.alert ("CompareNumeric");
		numA = a[currentCol]
		numB = b[currentCol]
		if (isNaN(numA)) { return 0;}
		else {
			if (isNaN(numB)) { return 0; }
			else { return numA - numB; }
		}
	}

	function TableSort(myTable, myCol, myType)
	{
		// Create a two-dimensional array and fill it with the table's content
		var mySource = document.all(myTable);
		var myRows = mySource.rows.length;
		var myCols = mySource.rows(0).cells.length;
		currentCol = myCol
		myArray = new Array(myRows)
                tmpArray = new Array(myRows);
		//alert(myRows);
                for (i=0; i < myRows; i++) {
                        myArray[i] = new Array(myCols)
                        tmpArray[i] = new Array(myCols)
                        for (j=0; j < myCols; j++) {
			
                                //myArray[i][j] = document.all(myTable).rows(i).cells(j).innerText
				//alert(myArray[i][j]);
                                tmpArray[i][j] = document.all(myTable).rows(i).cells(j).innerText
				myArray[i][j] = document.all(myTable).rows(i).cells(j).innerHTML
				//alert(myArray[i][j]);
                        }
                }
                if (myCol == previousCol) {
                        myArray.reverse(); // clicked the same column as previously - reverse the sort
                       tmpArray.reverse();
                }
                else { // clicked on a new column - sort as indicated
                        switch (myType) {
                                case "a":
                                        myArray.sort(CompareAlpha);
                                        tmpArray.sort(CompareAlpha);
                                        break;
                                case "ai":
                                        myArray.sort(CompareAlphaIgnore);
                                        tmpArray.sort(CompareAlphaIgnore);
                                        break;
                                case "d":
                                        myArray.sort(CompareDate);
                                        tmpArray.sort(CompareDate);
                                        break;
                                case "de":
                                        myArray.sort(CompareDateEuro);
                                        tmpArray.sort(CompareDateEuro);
                                        break;
				case "ds":
                                        myArray.sort(CompareDateSql);
                                        tmpArray.sort(CompareDateSql);
                                        break;

                                case "n":
                                        myArray.sort(CompareNumeric);
                                        tmpArray.sort(CompareNumeric);
                                        break;
                                default:
                                        myArray.sort()
                                        tmpArray.sort()
			}
		}

		// Re-write the table contents
		for (i=0; i < myRows; i++) {
			for (j=0; j < myCols; j++) {
				//alert(myArray[i][j].substring(0,tmpArray[i][j].indexOf('>')));
				mySource.rows(i).cells(j).innerHTML = myArray[i][j].substring(0,tmpArray[i][j].indexOf('>'))+myArray[i][j];
				//mySource.rows(i).cells(j).innerText = myArray[i][j]
			}
		}
		previousCol = myCol; // remember the current sort column for the next pass
		return 0;
	}
