
	function jtakaEncrypt(ID,catID){
		/* functions takes the key a random 25digit string on the top off this page and encrpts it
		 with tha ID and CatID values provided by the caller of function and returns the encryted
		 string to the caller of function */
	
		//if prodID not pass in set ID = 0
		if (ID == ""){ ID = 0;}
		
		// if catID not pass in set catID = 0		
		if (catID == ""){ catID = 0;}
		
		/* initializing digitsCnt and tempID to break prodID which has a maximum of more than 3 digits
		 into individual digist to calulate a sum to encryt the key 
		 reason due to ascii charaters supporting only from 0-255 or a number of 256 characters
		 */
		var tempID = String(ID);
		var digitsCnt=tempID.length;	// character counter for number of characters
		
		var i=0;							// Initializing loop counter for retrieving postion of chracter in string
		tempID=0;							// tempID to contain the previous digit in the loop
		//var specialKey = "CIPG&DJ.NFYMO4U\*W`#2J8#8-<'J.`H;)^WBG6G";
		var specialKey = "PQqMnNnikJlhoKj";
		var idSum=0;						// Sum calculated to encrypt key initialize to 0
		ID=String(ID);
		
		
		// while loop to search through the string
		while(i < digitsCnt){
			// if conditional will add current character Ascii value to Sum if prev number > current number
			if(idSum+Number(ID.charAt(i)) > 5){
				idSum=idSum-Number(ID.charAt(i));
			}else{
				idSum=idSum+Number(ID.charAt(i));
			}
			
			// Setting value of previous character Ascii value if it is greater than 0
			if(Number(ID.charAt(i)) > 0)tempID=Number(ID.charAt(i));
			
			i++;	// Incrementing character position counter
		}
		catID=String(catID);
		catID=catID.charAt(0);	// geting only the first character for the catID string for encrytion	
		
		i=0;	//Setting Encryted Key count to 1
		var takaEncrypt = ""; // Clearing return value

	
		/* 
			while loop to encrypt to by adding first digit of catID and sum calculated in top of this function to the 
		 	ascii value of each character in the key
		 */
		while(i <= specialKey.length){
			//curChar = specialKey.charAt(i);	// Retreiving each character of the key
			curChar = parseInt(specialKey.charCodeAt(i))- parseInt(catID) + parseInt(idSum);	// Encrypting each character of the key
			takaEncrypt = takaEncrypt+String.fromCharCode(curChar);	// Adding Encrypted to form new Encrypted String
			i++;	
			//if(i < specialKey.length){
			//	takaEncrypt = takaEncrypt;
			//}			
		}
		//takaEncrypt=catID + "---" + idSum;
		return takaEncrypt;
	}
