
var isNS4 = (document.layers) ? true : false; //to detect if the browser is NS4
var isNS6 = (!document.all && document.getElementById) ? true : false; //to detect if the browser is NS6 and above

/** 
  *  Function to detect the type of the Browser
  *  @return Name of the browser to detect the type of the Browser
  */

function browserDetect()
{
    var browsername = navigator.appName;
	if (browsername.indexOf("Netscape") != -1)
    {
 		browsername = "NS"
    }
    else
    {
        if (browsername.indexOf("Microsoft") != -1)
        {
            browsername = "MSIE"
        }
        else
        {
            browsername = "N/A"
        }
    }
    return(browsername);
}                      

/** 
  *  Function to check if the given character is spaces or not
  *  @param inChar the character to check
  *  @return true if is space 
  *  @return false if is not space
  */

function isSpace(inChar)
{
    return (inChar == ' ' || inChar == '\t' || inChar == '\n');
}


/** 
  *  Function to trim the spaces of the given string
  *  @param tmpStr the String to trim the spaces
  *  @return the trimed string
  */

function trim(tmpStr)
{
    var atChar;
	tmpStr = new String(tmpStr);
    if (tmpStr.length > 0)
    {
        atChar = tmpStr.charAt(0);
    }
    while (isSpace(atChar))
    {
        tmpStr = tmpStr.substring(1,tmpStr.length);
        atChar = tmpStr.charAt(0);
    }
    if (tmpStr.length > 0)
    {
        atChar = tmpStr.charAt(tmpStr.length - 1);
    }
    while (isSpace(atChar))
    {
        tmpStr = tmpStr.substring(0,(tmpStr.length - 1));
        atChar = tmpStr.charAt(tmpStr.length - 1);
    }
    return tmpStr;
}


/** 
  *  Function to check if the string is atleast of 8 characters
  *  @param str the String to check 
  *  @return 1 if str is less than 8 characters
  *  @return 0 if str is 8 or more charaters
  *  Added on APR 29th while adding functions to request minimum of 8 characters in a field
  *  Added by Prashant.
  */

function stringIsShort(str)
{
    var retVal = 0;
	if ((trim(str)).length < 8 )
    {
 		retVal = 1;
    }
	return retVal;    
}


/** 
  *  Function to check if the string is empty or not
  *  @param str the String to check 
  *  @return 1 if str is empty
  *  @return 0 if str is not empty
  */

function stringIsEmpty(str)
{
    var retVal = 0;
	if ((trim(str)).length == 0)
    {
 		retVal = 1;
    }
	return retVal;    
}

/** 
  *  Function to check if the value entered is 0 
  *  @param str
  *  @return 1 :- indicates is 0, 0 :- indicates not 0 
  */

function checkValue(str)
{
    var isZero = 0;
    if (str == '0' || str == 0)
        isZero = 1;

    return isZero;
}

function isAlphabetic(chr)
{
    var inval = 1;
    var isNotAlpha = "1234567890-+=_~`<,>./?:;\"\'{[}]|\()&^%$#@!* ";

    for (x = 0; x < isNotAlpha.length; x++)
    {
        if (chr.charAt(0) == isNotAlpha.charAt(x))
            inval = 0;
    }
    return(inval);
}


/** 
  *  Function to check if the string contains any alpha numeric or not
  *  @param str the Numeric String to check 
  *  @return 1 if str contains alpha numeric 
  *  @return 0 if str contain only numbers
  */

function checkNumber(str)
{
    var isnot = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()+=|-\~`?>.<,':;{[}]_ ";  
    var inval = 0;
    var x;
    for (var i = 0; i < str.length; i++)
    {
        for (x = 0; x < isnot.length; x++)
        {
            if (str.charAt(i) == (isnot.charAt(x)))
            {
                inval = 1;
            }
        }
    }
    return(inval);
}

/**
  * Function to check that User ID is in the proper format or not.
  * Names can contain only . / - _ and must begin with an Alphabet.
  */
function checkUserIdFormat(name)
{
//alert("in main userid format");    
var isnot = "!@#$%^&*()+=|/\\~`?><:,;{[}] \"'";  
    var inval = 0;
    var x;

        for (var i = 0; i < name.length; i++)
        {

            for (x = 0; x < isnot.length; x++)
            {
                if (name.charAt(i) == (isnot.charAt(x)))
                {
                    inval = 1;
                }
            }
        }
     return(inval);
}

/** 
  *  Function to check if the string contains any alpha numeric or not
  *  @param str the Numeric String to check 
  *  @return 1 if str contains alpha numeric 
  *  @return 0 if str contain only numbers
  */

function checkPhoneAndFax(str)
{
    var isnot = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*=|\~`?>.<,':;{[}]";  
    var inval = 0;
    var x;
    for (var i = 0; i < str.length; i++)
    {
        for (x = 0; x < isnot.length; x++)
        {
            if (str.charAt(i) == (isnot.charAt(x)))
            {
                inval = 1;
            }
        }
    }
    return(inval);
}


/** 
  *  Function to check the data validity 
  *  @param day   day of the date 
  *  @param month   month of the date 
  *  @param year  year of the date 
  *  @return 1 if it is invalid date
  *  @return 0 if it is valid date
  */

function validateDate(day, month, year)
{
    var arrMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    var err;
    var retVal = 0;
    if (day == "0" || month == "0" || year == "0")
	{
		return 1;
	}
	if ((day > 30) &&
        ((month == "APR") ||
         (month == "JUN") ||
         (month == "SEP") ||
         (month == "NOV")))
    {
        retVal = 1;
    }

    if (month == "FEB")
    {
        if (day >= 30)
            retVal = 1;
        else
        {
            flg = leapYearTest(year);
            if (flg)
            {
                if (day > 28)
                    retVal = 1;
            }
            else
            {
                if (day > 29)
                    retVal = 1;
            }
        }
    }

    return retVal;
}


/** 
  *  Function to check the leap year test
  *  @param year  year of the date 
  *  @return 1 if it is not leap year
  *  @return 0 if it is leap year 
  */

function leapYearTest(year)
{
    if (((year % 4 == 0) && (year % 100 != 0)) || year % 400 == 0)
    {
        return 0;
    }
    else
    {
        return 1;
    }
}


/** 
  *  Function to check the Email address Syntax
  *  @param mail  string containing the mail address
  *  @return 0 if it has valid E-mail Syntax
  *  @return 1 if it does not have valid E-mail Syntax
  */

function checkEmail(mail)
{
    var isnot = "!#$%^&*()+=|,\\~`?><:;{[}]\"\' ";  
    var inval = 0;
    var x;

        for (var i = 0; i < mail.length; i++)
        {
            for (x = 0; x < isnot.length; x++)
            {
                if (mail.charAt(i) == (isnot.charAt(x)))
                {
                    inval = 1;
                }
		else  if (mail.charCodeAt(i) < 32 || mail.charCodeAt(i) > 126)
		{
			inval = 1;
		}

            }
        }
    if(inval == 1)
		return(inval);
	 var alphabets="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	var result = 1;
    var email = mail;
    var theStr = new String(email)
    var index = theStr.indexOf("@");
	var indexLast =  theStr.lastIndexOf("@");
    var indexDot =  theStr.indexOf("..");
	 var dotindex = theStr.indexOf(".");
	var indxComma = theStr.indexOf(",");
    var AtArr = theStr.split("@");
    var lastChar = theStr.charAt(theStr.length - 1);
    /*** If last Char is not an @ or . ****/
    if (lastChar != "@" && 
	    lastChar != "." && 
		indxComma == -1 && 
		index > 0 && dotindex > 0 &&
		index == indexLast && 
		indexDot == -1  ) 
    {
		
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index + 1) && (theStr.length > pindex + 1))
		{
			if (AtArr.length != 2)
				result = 1;
			else
				 
			{ // Added by vijaya w.r.t to supportcentralcase 9520	
				for(x = 0; x < alphabets.length; x++)
				{        
				if (theStr.charAt(index - 1) == (alphabets.charAt(x)))
					{   
                   		 		result = 0; break;
					}
				
				}	
				
			}

		}
    }
   return result;
}


/**
  * Function to check that Common Name is in the proper format or not.
  * Names can contain only . / - _ and must begin with an Alphabet.
  */
function checkNameFormat(name)
{
    var isnot = "!@#$%^&*()+=|,\\/~`?><:;{[}]\"";  
    var inval = 0;
    var x;

        for (var i = 0; i < name.length; i++)
        {
            for (x = 0; x < isnot.length; x++)
            {
                if (name.charAt(i) == (isnot.charAt(x)))
                {
                    inval = 1;
                }
            }
        }
     return(inval);
}

/*
  *   Function to check if the string contains non keyboard characters.
  *   @param name the String to check
  *   @return 1 if name conatins non keyboard characters
  *   @return 0 if name doen not contains non keyboard characters
  *   Added on OCT 22 2009 by Vijaya for not to allow non keyboard characters
  */
  function checkSpecialCharacters(name)
  	{ 	
  		var val = 0;
  		for (var i = 0; i < name.length; i++)
  		{
  		
  		if (name.charCodeAt(i) < 32 || name.charCodeAt(i) > 126)
  		 {
  			var val = 1;
  		 }
  		}
  		return(val);
  	}
  



function checkAlphaNumeric(str)
{
    var isnot = "!@#$%^&*()+=|\~`?><,:;{[}]-_\"";
    var inval = 0;
    var x;
    for (var i = 0; i < str.length; i++)
    {
        for (x = 0; x < isnot.length; x++)
        {
            if (str.charAt(i) == (isnot.charAt(x)))
            {
                inval = 1;
            }
        }
    }
    return(inval);
}




/**
  * Function to check that PAN Number is in the proper format or not.
  */


/* 
	Function to check if the password is in secured or not.
	@param pwd - password to check
	@return 0 if password is secured
	@return 1 if unsecure
*/

function checkPassword(pwd)
{
	
  	pwd = trim(pwd);
	if(pwd.length < 8)
		return 1;
	if(pwd.indexOf(" ") > 0)
		return 1;
	return 0;	
	
}


/*
	Function is used to call any function which returns 0 or 1
	@param fnName - name of the funtion
	@param str - string to check for errors
	@param msg - variable to check if form alerady contains errors or not
	@param txt - the error message 
	@param sep - character which separates two error messages
	@param opt - if true validation is done on a optional field
	@return zero length string it str does not contains any errors
	@return txt if str validation is failed
 */


function validateField(fnName, str, msg, txt, sep, opt, id1)
{
	
	// if sep is undefined , is used as seperator 
	var id2;
	if(browserDetect()=="MSIE")
	{
		if(typeof(id1) != "undefined") 
		{
			id2 = document.getElementById(id1);
			id2.innerHTML = "";
		}
	}
	var imgMsg = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='images/2.gif' valign='middle' border=0>";
	if(typeof(sep) == "undefined")
		sep=", ";
	
	if(typeof(opt) == "undefined")
		opt = false;

	if(opt == false)
	{
		if(fnName=="validateDate" && eval(fnName+"("+str+")") == 1) 
		{
			if(typeof(id1) != "undefined" && browserDetect()=="MSIE") id2.innerHTML = imgMsg;
			return (msg.length==0)?txt:sep+txt;
		}
		else if(eval(fnName+"(str)") == 1 )
		{
			if(typeof(id1) != "undefined" && browserDetect()=="MSIE") id2.innerHTML = imgMsg;
			return (msg.length==0)?txt:sep+txt;
		}
		else
		{
			return "";
		}
	}
	else if(opt == true)
	{
		if(stringIsEmpty(str) == 1  || str == "0,\"0\",0")
		{
			return "";
		}
		else
		{
			if(fnName=="validateDate" && eval(fnName+"("+str+")") == 1) 
			{
				if(typeof(id1) != "undefined" && browserDetect()=="MSIE") id2.innerHTML = imgMsg;
				return (msg.length==0)?txt:sep+txt;
			}
			else if(eval(fnName+"(str)") == 1)
			{
				if(typeof(id1) != "undefined" && browserDetect()=="MSIE") id2.innerHTML = imgMsg;
				return (msg.length==0)?txt:sep+txt;
			}
			else
			{
				return "";
			}
		}
	}
}

/*
	function which contains all error messages 
	* Added one element "should have a minimum of 8 characters."  to the array on Apr 29th.
	* Added by prashant.
	* Added one element "must not contain non keyboard characters. Note: Do not copy paste from Microsoft Word." to the array on OCT 28 09 by vijaya
*/

function messages(text,type)
{
	eMsgs=new Array("must have only alphabets, numbers, spaces, dots, - and '.",
                "must have only alphabets, spaces, dots and numbers.",
			    "must contain only numbers, - and ().",
			    "must contain only numbers.",
			    "must be a valid one.", 
			    ": fill all the details",
				"must contain a minimum of 8 characters without spaces.",
				"entered should contain only alphabetical or numerical characters and please do not use any of these symbols\, ! @ $ % ^ & * ( ) ~ ?> < / \"",
				"needs to be in the format of name@domain.com",
                                "must contain only alphabets, numbers, dots, '-' and '_'",
                                "should have a minimum of 8 characters.",
                                "must not contain non keyboard characters. Note: Do not copy paste from Microsoft Word.");

	return text+" "+eMsgs[type];
}


function getStr(str)
{
	if(str=="null")
		return "";
	else
		return str;
}

function getIndexFromList(lst,str)
{
	for(i=0;i<lst.options.length;i++)
		if(lst.options[i].value == str)
			break;
	return i;
}

function getDateStr(day, month, year)
{
	dayIndex   = day.selectedIndex;
	monthIndex = month.selectedIndex;
	yearIndex  = year.selectedIndex;
	tday = day.options[dayIndex].value;
	tmonth = month.options[monthIndex].value;
	tyear = year.options[yearIndex].value;
	dateStr = tday + tmonth + tyear;
	if(dateStr == "000")
		dateStr = "";
	return trim(dateStr);
}

function empty(val)
{
	if(val == "0")
		return "";
	else
		return val;
}

function popup(file,wdt,hgt)
{
	if(typeof(wdt)=="undefined")
		wdt = 300;
	if(typeof(hgt)=="undefined")
		hgt = 400;
	if(typeof(myWindow)=='object')
		if(!myWindow.closed)	
			myWindow.close();
	myWindow = window.open(file, "help", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width="+wdt+",height="+hgt)
}

function errorDisplay(message)
{
	document.write('<img src="images/transparent.gif" width="2" height="10"><br>');
    document.write('<table width="771" border="0" cellspacing="0" cellpadding="0" >');
	document.write('<tr><td background="images/headerBack.gif" class="boldBlack" height="22">&nbsp;&nbsp;</td></tr>');
	document.write('<td class="celColourDarkGray">');
    document.write('<table width="100%" border="0" cellspacing="1" cellpadding="40" height="370">');
	document.write('<tr><td class="whiteBack" align="center" valign="top">'); 
	document.write('<table width="80%" border="0" cellspacing="1" cellpadding="0" align="center">');
    document.write('<tr><td class="celColourDarkGray">');
	document.write('<table width="100%" border="0" cellspacing="1" cellpadding="4">');
    document.write('<tr><td class="whiteBack" ><font size="+1">'+message+'</font></td>');
	document.write('<td class="active_in" width="6%"><a href="javascript:history.go(-1)" class="topLink">Back</a></td>');
    document.write('</tr></table></td></tr></table></td></tr></table></td></tr></table>');
}

function createButtonLink(params, txt, frmName)
{
  var str=params;
  var splitParams = str.split("&");
  var paramNames = new Array();
  var paramValues = new Array();
  
  for(i=0;i<splitParams.length;i++)
  {
     var tmp = splitParams[i];
     var tmpSplt = tmp.split("=");
     paramNames[i] = tmpSplt[0];
     paramValues[i] = tmpSplt[1];
  }

  temp="<form name='"+frmName+"' action='index.jsp' method='post'>";

  for(i=0;i<paramNames.length;i++)
  {
   temp+="<input type='hidden' name='"+paramNames[i]+"' value='"+paramValues[i]+"'>";
  }
  temp+="<input type='button' value='"+txt+"' onClick='javascript:document."+frmName+".submit()'>"
  temp+="</form>";
  document.write(temp);
  
  
}


function createForm(params, frmName)
{
  var str=params;
  var splitParams = str.split("&");
  var paramNames = new Array();
  var paramValues = new Array();
  
  for(i=0;i<splitParams.length;i++)
  {
     var tmp = splitParams[i];
     var tmpSplt = tmp.split("=");
     paramNames[i] = tmpSplt[0];
     paramValues[i] = tmpSplt[1];
  }

  temp="<form name='"+frmName+"' action='index.jsp' method='post'>";

  for(i=0;i<paramNames.length;i++)
  {
   temp+="<input type='hidden' name='"+paramNames[i]+"' value='"+paramValues[i]+"'>";
  }
  temp+="</form>";
  document.write(temp);
//  document.write("<a href='javascript:document."+frmName+".submit()' class='"+classId+"'>"+txt+"</a>");
  
}


function createLink2(params, txt, frmName)
{
  var str=params;
  var splitParams = str.split("&");
  var paramNames = new Array();
  var paramValues = new Array();
  
  for(i=0;i<splitParams.length;i++)
  {
     var tmp = splitParams[i];
     var tmpSplt = tmp.split("=");
     paramNames[i] = tmpSplt[0];
     paramValues[i] = tmpSplt[1];
  }

  temp="<form name='"+frmName+"' action='index.jsp' method='post'>";

  for(i=0;i<paramNames.length;i++)
  {
   temp+="<input type='hidden' name='"+paramNames[i]+"' value='"+paramValues[i]+"'>";
  }
  temp+="</form>";
  document.write(temp);
  document.write("<a href='javascript:document."+frmName+".submit()'>"+txt+"</a>");
}

function splitDn(str)
{	
	var splitParams = str.split(",");
	//var Arr = new Array("CN","EmailAddress","O","OU","L","ST","C");
	var arr = new Array();
	arr["CN"] = "Common Name";
	arr["EMAILADDRESS"] = "E-mail Address";
	arr["EmailAddress"] = "E-mail Address";
	arr["O"] = "Organisation";
	arr["OU"] = "Organisation Unit";
	arr["L"] = "Locality/ City";
	arr["ST"] = "State";
	//	arr["SERIALNUMBER"] = "PAN Serial Number";
	arr["C"] = "Country";
		arr["SERIALNUMBER"] = "PAN Serial Number";
		arr["serialNumber"] = "PAN Serial Number";
		arr["OID.2.5.4.5"] = "PAN Serial Number";
		//end of change	
	      /* change related to the CR No. SS-PROD/2010/1 Phase 1 */
		arr["PostalCode"] = "Postal Code";
		arr["OID.2.5.4.17"] = "Postal Code";
	
	for(i=0;i<splitParams.length;i++)
	{
		var tmp = splitParams[i];
		var tmpSplit = tmp.split("=");
		document.write('<tr><td width="30%" class="rowColour1">'+ arr[trim(tmpSplit[0])] +'</td>');
     document.write(' <td width="70%" class="rowColour1">'+tmpSplit[1] +'</td>         </tr> '); 
	//	document.write(arr[trim(tmpSplit[0])] + " = " + tmpSplit[1] + "<br>");	
	}
}
	/* change related to the CR No. SS-PROD/2010/1 Phase 1 */
function splitDnValue(str,name)
{
	var splitParams = str.split(",");
	//var Arr = new Array("CN","EmailAddress","O","OU","L","ST","C");
	var arr = new Array();
	arr["CN"] = "Common Name";
	arr["EmailAddress"] = "E-mail Address";
	arr["O"] = "Organisation";
	arr["OU"] = "Organisation Unit";
	arr["L"] = "Locality/ City";
	arr["ST"] = "State";
	arr["C"] = "Country";
	//Changes made wrt CR No. NICCA/2010/01 made on 21 Oct 2010 
		arr["SERIALNUMBER"] = "PAN Serial Number";
	//end of changes
	/* change related to the CR No. SS-PROD/2010/1 Phase 1 */
		arr["PostalCode"] = "Postal Code";
		arr["OID.2.5.4.17"] = "Postal Code";
	/* end of change related to the CR No. SS-PROD/2010/1 Phase 1 */
	
	for(i=0;i<splitParams.length;i++)
	{
		var tmp = splitParams[i];
		var tmpSplit = tmp.split("=");
		if(trim(tmpSplit[0])==name)
		{
			return tmpSplit[1];
		}
	}		
//document.write('<tr><td width="30%" class="rowColour1">'+ arr[trim(tmpSplit[0])] +'</td>');
     //document.write(' <td width="70%" class="rowColour1"><span class="boldBlack"><b>'+tmpSplit[1] +'</b></span></td>         </tr> '); 
	//	document.write(arr[trim(tmpSplit[0])] + " = " + tmpSplit[1] + "<br>");	
	
}

function sessionExpire()
{
		
		alert("Your session has expired.you are redirected to home page");
			window.parent.location.href="../index.jsp";
		
}
	/* end of change related to the CR No. SS-PROD/2010/1 Phase 1 */
function jSign(text,storeType,signerSno,strIssuerDN,strCertSNo)
{
	try
	{
		var retval = setUI(signerSno,storeType,strIssuerDN,strCertSNo);
		if(retval == false)
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
		retval = signData(text);
		if(retval == false)
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
		return retval;
	}
	catch(e)
	{
		 alert ("Error in detecting token/certificate. \n"+e);
		 return false;
	}	
}
function jSignArray(textArray,storeType,signerSno,strIssuerDN,strCertSNo)
{
	try
	{	
		
		var retval = setUI(signerSno,storeType,strIssuerDN,strCertSNo);
		if(retval == false)
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
		for(i = 0; i < textArray.length; i++)
		{
			signedData[i]=signData(textArray[i]);
		}
		return signedData;
	}	
	catch(e)
	{
		alert ("Error in detecting token/certificate. \n"+e);
		return false;
	}
}
function setUI(signerSno,storeType,strIssuerDN,strCertSNo)
{
	var retval;
	try
	{
		if((strIssuerDN != "null") && (strCertSNo != "null") && (strIssuerDN != undefined) && (strCertSNo != undefined) &&(strIssuerDN != "") && (strCertSNo != ""))
		{
			retval = dsign.setSigningCertFromStore(strIssuerDN,strCertSNo);
		}
		else
		{	dsign.setLoggingEnabled(true);// Creates fs7.log in client userhome
			if(storeType.toLowerCase() == "hardware")
			{
				retval = dsign.setPKCS11UI();
			}
			if(storeType.toLowerCase() == "browser")
			{
				retval = dsign.setStoreType("WINDOWS-MY");
			}
			if(storeType.toLowerCase() == "mozilla")
			{
				retval = dsign.setMozillaUI();
			}
			if(storeType.toLowerCase() == "pfx")
			{
				retval = dsign.setPKCS12UI();
			}
			
			if(retval == false)
			{
				alert("Error in detecting token/certificate.");
				return false;
			}
			retval = dsign.selectSigningCertFromUI();
		}
		if(retval == false)
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
						
		var certSno = dsign.getSelectedSignerCertDetails(3).toUpperCase();
		if(signerSno!="null" && signerSno != undefined)
    	{
    		if(certSno!=signerSno)
    		{  
	   			alert("Select proper certificate for signing.");
      			return false;
    		}
		}
		return true;
	}
	catch(e)
	{
		alert ("Error in detecting token/certificate. \n"+e);
		return false;
	}
}
function signData(text)
{
	try
	{
		var textSigned="";
		var retval = dsign.updateData(text);
		if(retval == false)
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
		retval = dsign.setDetached(true);
		if(retval == false)
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
		retval = dsign.setHashAlgorithm("SHA-256");
		if(retval == false)
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
		textSigned = dsign.sign();
		if(textSigned == "")
		{
			alert("Error in detecting token/certificate.");
			return false;
		}
		return textSigned;
	}
	catch(e)
	{
		alert ("Error in detecting token/certificate. \n"+e);
		return false;
	}
}
