	var isEncodeInitialized = false;
	var BLANK_VALUE = "";

	
	function validate(serviceType,eventName,eventSource,sourceIndex){
		//alert("serviceType = "  + serviceType + " eventName = " + eventName + " eventSource = " + eventSource + " sourceIndex = " +sourceIndex);
			
	
		if(serviceType == null || serviceType == "" ){
			return false;
		}else{
			//Checking for serviceType, based on the service type the 				
			//respective valid	ate method will    
			//be called. 
		
			if(serviceType == "ip"){
				return validateIPService(eventName,eventSource,sourceIndex);
			}else if(serviceType=="broadband"){
				return validateBBService(eventName,eventSource,sourceIndex);		
			}else if(serviceType == "isdn"){
			   return validateISDNService(eventName,eventSource,sourceIndex);		
			}
		}	  
		
		return true;
	}//End of function
	
	
	function validateIPService(eventName,eventSource,sourceIndex){
		if(eventSource.indexOf("MYACCOUNT") >= 0){
			isEncodeInitialized = initEncodeLogic();
			//call respective method handle IP service - MYaccount operations	
			return validateIPServiceMyAccount(eventName,sourceIndex);
		}else if(eventSource.indexOf("SIGNUP")>= 0){
			if(sourceIndex == -1){
				//call respective method for  handling IP service - Sign up for renewal operations		  			
				return validateIPServiceSignUpRenew(eventName,sourceIndex);
			}else{
				//call respective method for  handling IP service - Sign up / new user operations		
				return validateIPServiceSignUp(eventName,sourceIndex);
			}
		}else if(eventSource.indexOf("RENEW")>=0){	
			//call respective method for  handling IP service - Renewal operations
			isEncodeInitialized = initEncodeLogic();
			return validateIPServiceRenew(eventName,sourceIndex);	
		}
		
		
	}//End of function 
	
	function validateBBService(eventName,eventSource,sourceIndex){
		if(eventSource.indexOf("MYACCOUNT") >= 0){
			isEncodeInitialized = initEncodeLogic();
			//call respective method handle Broadband  - MYaccount operations	
			return validateBBServiceMyAccount(eventName,sourceIndex);
		}else if(eventSource.indexOf("SIGNUP")>= 0){
		
			if(sourceIndex == -1){
				return validateBBServiceSignUpRenew(eventName,sourceIndex);													
				//call respective method for  handling broadband  - Sign up for renewal operations						
			}else{
				//call respective method for  handling broadband  - Sign up / new user operations		
				return validateBBServiceSignUp(eventName,sourceIndex);									
			}
		}else if(eventSource.indexOf("RENEW")>=0 ){
			//call respective method for  handling broadband  - Renew operations
			isEncodeInitialized = initEncodeLogic();
			return validateBBServiceRenew(eventName,sourceIndex);
		}			   
		
	}//end of function
	
	
	function validateISDNService(eventName,eventSource,sourceIndex){
		if(eventSource.indexOf("MYACCOUNT") >= 0){
			isEncodeInitialized = initEncodeLogic();
			//call respective method to handle ISDN service - MYaccount operations	
			return validateISDNServiceMyAccount(eventName,sourceIndex);
		}else if(eventSource.indexOf("SIGNUP")>= 0){
			if(sourceIndex == -1){
				return validateISDNServiceSignUpRenew(eventName,sourceIndex);			
			}else{
				//call respective method for  handling ISDN service - Sign up / new user operations		
				return validateISDNServiceSignUp(eventName,sourceIndex);
			}
		}else if(eventSource.indexOf("RENEW") >= 0){
			
			isEncodeInitialized = initEncodeLogic();			
			//call respective method to handle ISDN service - renew operations				
			return validateISDNServiceRenew(eventName,sourceIndex);
		}			   
	}//End of Function
	
	/*
		Validate method for IP service - MYAccount
	*/
	
																									
	function validateIPServiceMyAccount(eventName,sourceIndex){
		

		if(eventName == null || eventName == ""){
			return false;
		}				 
		
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}
		
		if(eventName.indexOf("Login") >= 0){
			//Need to read following parameters				
			/*
				user_id
				password 
				server	
			*/
			var userIDTextName 		= "user_id"+sourceIndex;
			var passwordTextName 	= "password"+sourceIndex;
			var serverSelectName 	= "server"+sourceIndex;
			
			var selectedDomain 	= eval('document.CRYPT.'+serverSelectName+'.options[document.CRYPT.'+serverSelectName+'.selectedIndex].value');
			var user_id 		= eval('document.CRYPT.'+userIDTextName+'.value');
			var password 		= eval('document.CRYPT.'+passwordTextName+'.value');
			
			if (user_id == "")
			{
					alert ("Please enter your User Name.");
					eval('document.CRYPT.'+userIDTextName+'.focus()');
					return false;
			}
			if (selectedDomain == "")
			{
					alert ("Please select the Domain/Server of your User Name.");
					eval('document.CRYPT.'+serverSelectName+'.focus()');
					return false;
			}
			if (password == "")
			{
					alert ("Please enter your Password.");
					eval('document.CRYPT.'+passwordTextName+'.focus()');
					return false;
			} 
			
			document.CRYPT.login.value 		= user_id.toLowerCase() +"@" + selectedDomain ; 
			document.CRYPT.user_id.value 	= user_id;
			document.CRYPT.password.value 	= password;
			document.CRYPT.service.value	= "ip";
			document.CRYPT.server.value		= selectedDomain;
		
			var v_password	=	document.CRYPT.password.value;
			var v_login		=	document.CRYPT.login.value;
			Javacrypt.displayPassword();
			anand();
			var i=document.CRYPT.XYZ.value;
			var j=encodeBase64(i);
			document.CRYPT.XYZ.value=j;
			v_server = 	selectedDomain;
			//development server URL 
			//document.CRYPT.action = "http://billsrv.vsnl.net/myaccountpromo_dev/login_verify_SSO.jsp";
			//Production Server URL 
			document.CRYPT.action = "http://services.vsnl.net/myaccount/login_verify_SSO.jsp";
			
			if(isEncodeInitialized){
				document.CRYPT.submit();
			}else{
				alert("Error Occured while processing screen Input.Please try again.");
			}
					
		}//End of If condition.
	}//End of function.		  
	

	/*
		Validate Method for broadband service - MY Account
	*/
	
	function validateBBServiceMyAccount(eventName,sourceIndex){
		
		if(eventName == null || eventName == ""){
			return false;
		}				 
		
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}
		
		if(eventName.indexOf("Login") >= 0){

			var userIDTextName 		= "user_id"+sourceIndex;
			var passwordTextName 	= "password"+sourceIndex;
			var serverSelectName 	= "server"+sourceIndex;
			
			var selectedDomain 	= eval('document.CRYPT.'+serverSelectName+'.options[document.CRYPT.'+serverSelectName+'.selectedIndex].value');
			var user_id 		= eval('document.CRYPT.'+userIDTextName+'.value');
			var password 		= eval('document.CRYPT.'+passwordTextName+'.value');
			
			if (user_id == "")
			{
					alert ("Please enter your User Name.");
					eval('document.CRYPT.'+userIDTextName+'.focus()');
					return false;
			}
			if (selectedDomain == "")
			{
					alert ("Please select the Domain/Server of your User Name.");
					eval('document.CRYPT.'+serverSelectName+'.focus()');
					return false;
			}
			if (password == "")
			{
					alert ("Please enter your Password.");
					eval('document.CRYPT.'+passwordTextName+'.focus()');
					return false;
			} 
				
				
			document.CRYPT.login.value 		= user_id.toLowerCase() +"@" + selectedDomain ; 
			document.CRYPT.user_id.value 	= user_id;
			document.CRYPT.password.value 	= password;
			document.CRYPT.service.value	= "broadband";
			document.CRYPT.server.value		= selectedDomain;
		
			var v_password	=	document.CRYPT.password.value;
			var v_login		=	document.CRYPT.login.value;
			Javacrypt.displayPassword();
			anand();
			var i=document.CRYPT.XYZ.value;
			var j=encodeBase64(i);
			document.CRYPT.XYZ.value=j;
			v_server = 	selectedDomain;
			//Development Server URL 
			//document.CRYPT.action = "http://billsrv.vsnl.net/myaccountbband_prod/LoginVerify_SSO.jsp";
			//Production Server URL 
			document.CRYPT.action = "http://tataindicombroadband.vsnl.com/myaccount/LoginVerify_SSO.jsp";
			
			if(isEncodeInitialized){
				document.CRYPT.submit();
			}else{
				alert("Error Occured while processing screen Input.Please try again.");
			}
		}//end of if - block (Login)
		
	}//End of function.
	
	/*
		Validate Method for ISDN service - MY Account 
	*/
	
	
	function validateISDNServiceMyAccount(eventName,sourceIndex){
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}
		if(eventName.indexOf("Login") >= 0){
			//Need to read following parameters				
			/*
				user_id
				password 
				server	
			*/
			var userIDTextName 		= "user_id"+sourceIndex;
			var passwordTextName 	= "password"+sourceIndex;
			var serverSelectName 	= "server"+sourceIndex;
			
			var selectedDomain 	= eval('document.CRYPT.'+serverSelectName+'.options[document.CRYPT.'+serverSelectName+'.selectedIndex].value');
			var user_id 		= eval('document.CRYPT.'+userIDTextName+'.value');
			var password 		= eval('document.CRYPT.'+passwordTextName+'.value');
			
		
			if (user_id == "")
			{
					alert ("Please enter your User Name.");
					eval('document.CRYPT.'+userIDTextName+'.focus()');
					return false;
			}
			if (selectedDomain == "")
			{
					alert ("Please select the Domain/Server of your User Name.");
					eval('document.CRYPT.'+serverSelectName+'.focus()');
					return false;
			}
			if (password == "")
			{
					alert ("Please enter your Password.");
					eval('document.CRYPT.'+passwordTextName+'.focus()');
					return false;
			} 
			
			document.CRYPT.login.value 		= user_id.toLowerCase() +"@" + selectedDomain ; 
			document.CRYPT.user_id.value 	= user_id;
			document.CRYPT.password.value 	= password;
			document.CRYPT.service.value	= "isdn";
			document.CRYPT.server.value		= selectedDomain;
		
			var v_password	=	document.CRYPT.password.value;
			var v_login		=	document.CRYPT.login.value;
			Javacrypt.displayPassword();
			anand();
			var i=document.CRYPT.XYZ.value;
			var j=encodeBase64(i);
			document.CRYPT.XYZ.value=j;
			v_server = 	selectedDomain;
			//development server URL 
			//document.CRYPT.action = "http://billsrv.vsnl.net/myaccountpromo_dev/login_verify_SSO.jsp";
			//Production server URL 
			document.CRYPT.action = "http://services.vsnl.net/myaccount/login_verify_SSO.jsp";
			
			if(isEncodeInitialized){
				document.CRYPT.submit();
			}else{
				alert("Error Occured while processing screen Input.Please try again.");
			}
					
		}//End of If condition.
	}//End of function.		  
	
	/*
		Validation for IP service - SignUp
	*/
	
		
	function validateIPServiceSignUp(eventName,sourceIndex){
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}
		if(eventName.indexOf("Submit") >= 0){
			//Need to read following parameters				
			/*
				seral no
				pin no 
			*/	
			var snoTextName 		= 	"sno"+sourceIndex;
			var pinTextName 		= 	"pin"+sourceIndex;

			
			var sno = eval('document.CRYPT.'+snoTextName+'.value');
			var pin = eval('document.CRYPT.'+pinTextName+'.value');
			
			
			
			document.CRYPT.sno.value = sno;
			document.CRYPT.pin.value = pin;
			
		      if (document.CRYPT.sno.value.length < 7 ){
				alert("The Serial Number entered by you is not valid. It must consist of at least 7 digits. Please enter the correct Serial Number.");
		        eval('document.CRYPT.'+snoTextName+'.focus()');
		        return false;
		      }//End of If
		
		      if ( document.CRYPT.sno.value != "" ){
		          var chars="0123456789";
		          temp1= document.CRYPT.sno.value.substring(0,1);
		
		          for(var i=0; i < document.CRYPT.sno.value.length; i++){
		               temp3= document.CRYPT.sno.value.substring(i,i+1);
		               if((chars.indexOf(temp3) == -1) ){
		                       alert("The Serial Number entered by you is not valid. It must consist of atleast 7 digits. Please enter the correct Serial Number.");
		                       clear(eval('document.CRYPT.'+snoTextName));
		                       eval('document.CRYPT.'+snoTextName+'.focus()');
		                       return false;
		               }//End of If
		          }//End of For
		      }//End of If
		
		       if (document.CRYPT.pin.value.length != 16 ){
				   if(document.CRYPT.pin.value.length != 10){
			           alert("The PIN provided by you is invalid. Please re-enter a correct PIN.");
			           eval('document.CRYPT.'+pinTextName+'.focus()');
			           return false;
				   }//end of if-inner
		   	  }//end of if-outer
			  document.CRYPT.service.value	= "ip";
			 
			 //development server URL 	
			 //document.CRYPT.action = "http://billsrv.vsnl.net/netsignup_dev/check_credentials_SSO.jsp";
			 //Production Server URL 
			 document.CRYPT.action = "https://services.vsnl.net/signup/check_credentials_SSO.jsp";
			 document.CRYPT.submit();
		}//End if condition	  - event name - Submit
	}//End of function 
	
	
	/* Validate function for broadband service - signup */
	function validateBBServiceSignUp(eventName,sourceIndex){
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}
		if(eventName.indexOf("Submit") >= 0){
			//Need to read following parameters				
			/*
				seral no
				pin no 
			*/	
			var snoTextName 		= 	"sno"+sourceIndex;
			var pinTextName 		= 	"pin"+sourceIndex;
			
			var sno = eval('document.CRYPT.'+snoTextName+'.value');
			var pin = eval('document.CRYPT.'+pinTextName+'.value');
			
			
			
			document.CRYPT.sno.value = sno;
			document.CRYPT.pin.value = pin;
			
	      if (document.CRYPT.sno.value.length < 7 ){
			alert("The Serial Number entered by you is not valid. It must consist of at least 7 digits. Please enter the correct Serial Number.");
	        eval('document.CRYPT.'+snoTextName+'.focus()');
	        return false;
	      }//End of If
	
	      if ( document.CRYPT.sno.value != "" ){
	          var chars="0123456789";
	          temp1= document.CRYPT.sno.value.substring(0,1);
	
	          for(var i=0; i < document.CRYPT.sno.value.length; i++){
	               temp3= document.CRYPT.sno.value.substring(i,i+1);
	               if((chars.indexOf(temp3) == -1) ){
	                       alert("The Serial Number entered by you is not valid. It must consist of atleast 7 digits. Please enter the correct Serial Number.");
	                       clear(eval('document.CRYPT.'+snoTextName));
	                       eval('document.CRYPT.'+snoTextName+'.focus()');
	                       return false;
	               }//End of If
	          }//End of For
	      }//End of If
	
	       if (document.CRYPT.pin.value.length != 16 ){
			   if(document.CRYPT.pin.value.length != 10){
		           alert("The PIN provided by you is invalid. Please re-enter a correct PIN.");
		           eval('document.CRYPT.'+pinTextName+'.focus()');
		           return false;
			   }//end of if-inner
	   	  }//end of if-outer
		  document.CRYPT.service.value	= "broadband";
		  //development server url
		  //document.CRYPT.action = "http://billsrv.vsnl.net/signupbband_dev/check_credentials_SSO.jsp";
		  //Production server URL 
		  document.CRYPT.action = "http://tataindicombroadband.vsnl.com/signup/check_credentials_SSO.jsp";

		  document.CRYPT.submit();
		}//End of if - eventName - Submit 
	}//End of function
	
	
	/*
		Validate method for ISDN service - Signup
	*/
	
	function validateISDNServiceSignUp(eventName,sourceIndex){
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}
		if(eventName.indexOf("Submit") >= 0){
			//Need to read following parameters				
			/*
				seral no
				pin no 
			*/	
			var snoTextName 		= 	"sno"+sourceIndex;
			var pinTextName 		= 	"pin"+sourceIndex;
			
			var sno = eval('document.CRYPT.'+snoTextName+'.value');
			var pin = eval('document.CRYPT.'+pinTextName+'.value');
			
			
			
			document.CRYPT.sno.value = sno;
			document.CRYPT.pin.value = pin;
			
		      if (document.CRYPT.sno.value.length < 7 ){
				alert("The Serial Number entered by you is not valid. It must consist of at least 7 digits. Please enter the correct Serial Number.");
		        eval('document.CRYPT.'+snoTextName+'.focus()');
		        return false;
		      }//End of If
		
		      if ( document.CRYPT.sno.value != "" ){
		          var chars="0123456789";
		          temp1= document.CRYPT.sno.value.substring(0,1);
		
		          for(var i=0; i < document.CRYPT.sno.value.length; i++){
		               temp3= document.CRYPT.sno.value.substring(i,i+1);
		               if((chars.indexOf(temp3) == -1) ){
		                       alert("The Serial Number entered by you is not valid. It must consist of atleast 7 digits. Please enter the correct Serial Number.");
		                       clear(eval('document.CRYPT.'+snoTextName));
		                       eval('document.CRYPT.'+snoTextName+'.focus()');
		                       return false;
		               }//End of If
		          }//End of For
		      }//End of If
		
		       if (document.CRYPT.pin.value.length != 16 ){
				   if(document.CRYPT.pin.value.length != 10){
			           alert("The PIN provided by you is invalid. Please re-enter a correct PIN.");
			           eval('document.CRYPT.'+pinTextName+'.focus()');
			           return false;
				   }//end of if-inner
		   	  }//end of if-outer
			  document.CRYPT.service.value	= " isdn";
			  //Development server URL 
			  //document.CRYPT.action = "http://billsrv.vsnl.net/netsignup_dev/check_credentials_SSO.jsp";
			  //Production server URL 
			  document.CRYPT.action = " https://services.vsnl.net/signup/check_credentials_SSO.jsp";
			  document.CRYPT.submit();
		}//End if condition	  - event name - Submit	
	
	}//End of function.
	


	function validateIPServiceRenew(eventName,sourceIndex){
		
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}	
		
		if (sourceIndex != -1){
			alert("Improper function call!!!. Please check SSO_ALL.js file for more details");
			return false;
		}
		
	   if(eventName.indexOf("Login")>=0){	
	   		
			var selectedDomain 	= document.CRYPT.server.options[document.CRYPT.server.selectedIndex].value;
			var user_id 		= document.CRYPT.user_id.value;
			var password 		= document.CRYPT.password.value;
			var city			= document.CRYPT.city.options[document.CRYPT.city.selectedIndex].value;
			
			if (user_id == ""){
					alert ("Please enter your User Name.");
					document.CRYPT.user_id.focus();
					return false;
			}
			
			if (selectedDomain == ""){
					alert ("Please select the Domain/Server of your User Name.");
					document.CRYPT.server.focus();
					return false;
			}
			
			if (password == ""){
					alert ("Please enter your Password.");
					document.CRYPT.password.focus();
					return false;
			} 
			
			if(city == ""){
		            alert("Please select the City.");
					document.CRYPT.city.focus();
					return false;
			}

			//Javascript variabled to form objects
			document.CRYPT.login.value 		= user_id.toLowerCase() +"@" + selectedDomain ; 
			document.CRYPT.service.value	= "ip";
			document.CRYPT.city.value			= city;
			document.CRYPT.page.value			= "validatelogin";
			document.CRYPT.sessionState.value 	= "start";
			document.CRYPT.Component.value 		=  "com.portal.web.comp.NewRenewLogin";
			var v_password	=	document.CRYPT.password.value;
			var v_login		=	document.CRYPT.login.value;
			//base64 encoding
			Javacrypt.displayPassword();
			encStr();
			var i=document.CRYPT.XYZ.value;
			var j=encodeBase64(i);
			document.CRYPT.XYZ.value=j;
			v_server = 	selectedDomain;
			//Development Server URL 
			//document.CRYPT.action = "http://billsrv.vsnl.net/netrenew_dev/PInfranetServlet";
			//Production Server URL 
			document.CRYPT.action = "https://services.vsnl.net/renew/PInfranetServlet";

			if(isEncodeInitialized){
				document.CRYPT.submit();
			}else{
				alert("Error Occured while processing screen Input.Please try again.");
			}	  
			
	   }//end of if - Login
	}//end of function
	
	function validateBBServiceRenew(eventName,sourceIndex){
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}
		
		if (sourceIndex != -1){
			alert("Improper function call!!!. Please check SSO_ALL.js file for more details");
			return false;
		}
		
	  
	   if(eventName.indexOf("Login")>=0){	

			var selectedDomain 	= document.CRYPT.server.options[document.CRYPT.server.selectedIndex].value;
			var user_id 		= document.CRYPT.user_id.value;
			var password 		= document.CRYPT.password.value;
			var city			= document.CRYPT.city.options[document.CRYPT.city.selectedIndex].value;
			

	        if (user_id == ""){
	                alert ("Please enter your User Name.");
	                document.CRYPT.user_id.focus();
	                return false;
	        }
	        
			if (selectedDomain == ""){
	                alert ("Please select the Domain/Server of your User Name.");
	                document.CRYPT.server.focus();
	                return false;
	        }
	        
			if (password == "")
	        {
	                alert ("Please enter your Password.");
					document.CRYPT.server.focus();
	                return false;
	        }
			
			
		   if (city == "" ){
	           alert("Please select the City.");
	            return false;
        	}
	
			//login
			document.CRYPT.login.value 		= user_id.toLowerCase() +"@" + selectedDomain ; 
			document.CRYPT.user_id.value 	= user_id;
			document.CRYPT.password.value 	= password;
			document.CRYPT.service.value	= "broadband";
			document.CRYPT.server.value		= selectedDomain;
			document.CRYPT.city.value		= city;
			
			document.CRYPT.page.value			= "validatelogin_broadband";
			document.CRYPT.sessionState.value 	= "start";
			document.CRYPT.Component.value 		=  "com.portal.web.comp.NewRenewLogin";
		
			var v_password	=	document.CRYPT.password.value;
			var v_login		=	document.CRYPT.login.value;
			
			//Development server url 
			//document.CRYPT.action="http://billsrv.vsnl.net/netrenew_sys/PInfranetServlet";
			//production server url 
			document.CRYPT.action="http://tataindicombroadband.vsnl.com/renew/PInfranetServlet";
			document.CRYPT.submit();
	   }//end of if - Login
	
	}//End of function
	
	
	
	function validateISDNServiceRenew(eventName,sourceIndex){

		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}


		if (sourceIndex != -1){
			alert("Improper function call!!!. Please check SSO_ALL.js file for more details");
			return false;
		}		
	  	   
	   if(eventName.indexOf("Login")>=0){	
			var selectedDomain 	= document.CRYPT.server.options[document.CRYPT.server.selectedIndex].value;
			var user_id 		= document.CRYPT.user_id.value;
			var password 		= document.CRYPT.password.value;
			var city			= "Mumbai";
		
	
			if (user_id == ""){
					alert ("Please enter your User Name.");
					document.CRYPT.user_id.focus();
					return false;
			}
			
			if (selectedDomain == ""){
					alert ("Please select the Domain/Server of your User Name.");
					document.CRYPT.server.focus();
					return false;
			}
			
			if (password == ""){
					alert ("Please enter your Password.");
					document.CRYPT.password.focus();
					return false;
			} 
			
			if(city == ""){
		            alert("Please select the City.");
					return false;
			}

			//Javascript variabled to form objects
			document.CRYPT.login.value 		= user_id.toLowerCase() +"@" + selectedDomain ; 
			document.CRYPT.user_id.value 	= user_id;
			document.CRYPT.password.value 	= password;
			document.CRYPT.service.value	= "isdn";
			document.CRYPT.server.value		= selectedDomain;
			document.CRYPT.city.value			= city;
			document.CRYPT.page.value			= "validatelogin";
			document.CRYPT.sessionState.value 	= "start";
			document.CRYPT.Component.value 		=  "com.portal.web.comp.NewRenewLogin";
		
			var v_password	=	document.CRYPT.password.value;
			var v_login		=	document.CRYPT.login.value;
			//base64 encoding
			Javacrypt.displayPassword();
			encStr();
			var i=document.CRYPT.XYZ.value;
			var j=encodeBase64(i);
			document.CRYPT.XYZ.value=j;
			v_server = 	selectedDomain;
			//Development server URL 
			//document.CRYPT.action = "http://billsrv.vsnl.net/netrenew_dev/PInfranetServlet";
			//Production server URL 
			document.CRYPT.action = "https://services.vsnl.net/renew/PInfranetServlet";
			if(isEncodeInitialized){
				document.CRYPT.submit();
			}else{
				alert("Error Occured while processing screen Input.Please try again.");
			}	  
	   }//end of if - Login
	}//End of function.
		

	
	function initEncodeLogic(){
		var i_ran = Math.round(Math.random()*100);
		var i_ran_char_shift = i_ran%10;
		if(i_ran_char_shift < 0 ){
			i_ran_char_shift=-i_ran_char_shift;
		}else if(i_ran_char_shift == 0){
			i_ran_char_shift=1;
		}
					 
		if(document.CRYPT.Salt != null){
			document.CRYPT.Salt.value=i_ran;
		}else{
			//if Salt form object is not present.Then return false and make sure that form is not submitted.
			return false;
		}
		
		if(document.CRYPT.shif != null){
			document.CRYPT.shif.value=i_ran_char_shift;
		}else{
			//if shif form object is not present.Then return false and make sure that form is not submitted.
			return false;
		}
		return true;
	}//End of fuction
			  
	
		
	function displayErrorMessage(){
		if(document.CRYPT.errorText.value == "true"){
			alert("Error! Either the User Name or Password or Service is incorrect. Please try again.");
			return false;
		}					 
	
		if(document.CRYPT.paraText.value != ""){
			alert("Error! Either the User Name or Password or Service is incorrect. Please try again.");
			return false;
		}
		
		if(document.CRYPT.againText.value != ""){
			alert("Error! Either the User Name or Password or Service is incorrect. Please try again.");
			return false;
		}
	}//end of function
	
	
	function clear(formObject){
		if(formObject != null){
			formObject.value=BLANK_VALUE;
		}
	}//End of function 
	
	
	
	function validateIPServiceSignUpRenew(eventName,sourceIndex){

		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}


		if (sourceIndex != -1){
			alert("Improper function call!!!. Please check SSO_ALL.js file for more details");
			return false;
		}		
		
		if(eventName.indexOf("Submit") >= 0){		
			//Need to read following parameters				
			/*
				seral no
				pin no 
			*/	
		
			var sno = document.CRYPT.sno.value;
			var pin = document.CRYPT.pin.value;
		     
			  if (document.CRYPT.sno.value.length < 7 ){
				alert("The Serial Number entered by you is not valid. It must consist of at least 7 digits. Please enter the correct Serial Number.");
				document.CRYPT.sno.focus();
		        return false;
		      }//End of If
		
		      if ( document.CRYPT.sno.value != "" ){
		          var chars="0123456789";
		          temp1= document.CRYPT.sno.value.substring(0,1);
		
		          for(var i=0; i < document.CRYPT.sno.value.length; i++){
		               temp3= document.CRYPT.sno.value.substring(i,i+1);
		               if((chars.indexOf(temp3) == -1) ){
		                       alert("The Serial Number entered by you is not valid. It must consist of atleast 7 digits. Please enter the correct Serial Number.");
		                       clear(document.CRYPT.sno);
		                       document.CRYPT.sno.focus();
		                       return false;
		               }//End of If
		          }//End of For
		      }//End of If
		
		       if (document.CRYPT.pin.value.length != 16 ){
				   if(document.CRYPT.pin.value.length != 10){
			           alert("The PIN provided by you is invalid. Please re-enter a correct PIN.");
			           document.CRYPT.pin.focus();
			           return false;
				   }//end of if-inner
		   	  }//end of if-outer
			  document.CRYPT.service.value	= "ip";
			 
			  //Development Server URL
			  //document.CRYPT.action = "http://billsrv.vsnl.net/netsignup_dev/check_credentials_SSO.jsp";
			 //Production Server URL 
			 document.CRYPT.action = "https://services.vsnl.net/signup/check_credentials_SSO.jsp";
			 document.CRYPT.submit();
		}//end of Submit-if condition.
	}//End of function 

	
	function validateBBServiceSignUpRenew(eventName,sourceIndex){
	
		
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}


		if (sourceIndex != -1){
			alert("Improper function call!!!. Please check SSO_ALL.js file for more details");
			return false;
		}		

		if(eventName.indexOf("Submit") >= 0){
			//Need to read following parameters				
			/*
				seral no
				pin no 
			*/	
			var sno = document.CRYPT.sno.value;
			var pin = document.CRYPT.pin.value;
			
	      if (document.CRYPT.sno.value.length < 7 ){
			alert("The Serial Number entered by you is not valid. It must consist of at least 7 digits. Please enter the correct Serial Number.");
	        document.CRYPT.sno.focus();
	        return false;
	      }//End of If
	
	      if ( document.CRYPT.sno.value != "" ){
	          var chars="0123456789";
	          temp1= document.CRYPT.sno.value.substring(0,1);
	
	          for(var i=0; i < document.CRYPT.sno.value.length; i++){
	               temp3= document.CRYPT.sno.value.substring(i,i+1);
	               if((chars.indexOf(temp3) == -1) ){
	                       alert("The Serial Number entered by you is not valid. It must consist of atleast 7 digits. Please enter the correct Serial Number.");
	                       clear(document.CRYPT.sno);
	                       document.CRYPT.sno.focus();
	                       return false;
	               }//End of If
	          }//End of For
	      }//End of If
	
	       if (document.CRYPT.pin.value.length != 16 ){
			   if(document.CRYPT.pin.value.length != 10){
		           alert("The PIN provided by you is invalid. Please re-enter a correct PIN.");
		           document.CRYPT.pin.focus();
		           return false;
			   }//end of if-inner
	   	  }//end of if-outer
		  document.CRYPT.service.value	= "broadband";
		  //development server url
		  //document.CRYPT.action = "http://billsrv.vsnl.net/signupbband_dev/check_credentials_SSO.jsp";
		  //Production server URL 
		  document.CRYPT.action = "http://tataindicombroadband.vsnl.com/signup/check_credentials_SSO.jsp";
		  document.CRYPT.submit();
		}//End of if - eventName - Submit 
	}//end of function.
	
	
	function validateISDNServiceSignUpRenew(eventName,sourceIndex){
					  
		//alert(" validateISDNServiceSignUpRenew " + eventName + "   " + sourceIndex);
		
		if(eventName == null || eventName == ""){
			return false;
		}				 
		if(sourceIndex == null || sourceIndex == ""){
			return false;
		}


		if (sourceIndex != -1){
			alert("Improper function call!!!. Please check SSO_ALL.js file for more details");
			return false;
		}		

		if(eventName.indexOf("Submit") >= 0){
			//Need to read following parameters				
			/*
				seral no
				pin no 
			*/	
			var sno = document.CRYPT.sno.value;
			var pin = document.CRYPT.pin.value;
		    
			  if (document.CRYPT.sno.value.length < 7 ){
				alert("The Serial Number entered by you is not valid. It must consist of at least 7 digits. Please enter the correct Serial Number.");
		        document.CRYPT.sno.focus();
		        return false;
		      }//End of If
		
		      if ( document.CRYPT.sno.value != "" ){
		          var chars="0123456789";
		          temp1= document.CRYPT.sno.value.substring(0,1);
		
		          for(var i=0; i < document.CRYPT.sno.value.length; i++){
		               temp3= document.CRYPT.sno.value.substring(i,i+1);
		               if((chars.indexOf(temp3) == -1) ){
		                       alert("The Serial Number entered by you is not valid. It must consist of atleast 7 digits. Please enter the correct Serial Number.");
		                       clear(document.CRYPT.sno);
		                       document.CRYPT.sno.focus();
		                       return false;
		               }//End of If
		          }//End of For
		      }//End of If
		
		       if (document.CRYPT.pin.value.length != 16 ){
				   if(document.CRYPT.pin.value.length != 10){
			           alert("The PIN provided by you is invalid. Please re-enter a correct PIN.");
			           document.CRYPT.pin.focus();
			           return false;
				   }//end of if-inner
		   	  }//end of if-outer
			  document.CRYPT.service.value	= "isdn";
			  //Development server URL 
			  //document.CRYPT.action = "http://billsrv.vsnl.net/netsignup_dev/check_credentials_SSO.jsp";
			  //Production server URL 
			  document.CRYPT.action = " https://services.vsnl.net/signup/check_credentials_SSO.jsp";

			  document.CRYPT.submit();
		}//End of if - Submit 
	
	}//End of function

	/*
		Validating forgot password functionality 
		for TI customer
	*/

	function validateTIForgotPassword(){
   
        if (document.myform.user_id.value == ""){
                alert ("Please enter your User Name.");
                document.myform.user_id.focus();
                return false;
        }
        
		if (document.myform.server.value == ""){
                alert ("Please enter the Domain/Server of your User Name.");
                document.myform.server.focus();
                return false;
 	    }	 
		
        document.myform.login.value = document.myform.user_id.value.toLowerCase() +"@"+ document.myform.server.value;
		//alert("------- login ---------- " + document.myform.login.value);
		
		//development server URL 
		//document.myform.action="http://billsrv.vsnl.net/myaccountpromo_dev/PInfranetServlet";
		//Production server url 
		document.myform.action="http://services.vsnl.net/myaccount/PInfranetServlet";
		document.myform.submit();
		return true; 
	
	}//end of function;
	
	
	function validateBBForgotPassword(){
		
      if (document.myform.user_id.value == ""){
              alert ("Please enter your User Name.");
              document.myform.user_id.focus();
              return false;
      }
    
	 if (document.myform.server.value == ""){
               alert ("Please enter the Domain/Server of your User Name.");
               document.myform.server.focus();
               return false;
       }

		document.myform.login.value = document.myform.user_id.value.toLowerCase() +"@" + document.myform.server.value;
		//alert("---------- login value --------- " + document.myform.login.value);
		//Development Server URL 
		//document.myform.action="http://billsrv.vsnl.net/myaccountbband_prod/PInfranetServlet";
		//Production server URL 
		document.myform.action="http://tataindicombroadband.vsnl.com/myaccount/PInfranetServlet";
		document.myform.submit();
        return true;
	}//End of function.
	
	
	function validateISDNForgotPassword(){
		
      if (document.myform.user_id.value == ""){
              alert ("Please enter your User Name.");
              document.myform.user_id.focus();
              return false;
      }
    
	 if (document.myform.server.value == ""){
               alert ("Please enter the Domain/Server of your User Name.");
               document.myform.server.focus();
               return false;
       }

		document.myform.login.value = document.myform.user_id.value.toLowerCase() +"@" + document.myform.server.value;
		//alert("---------- login value --------- " + document.myform.login.value);
		//development server URL :
		//document.myform.action="http://billsrv.vsnl.net/myaccountpromo_dev/PInfranetServlet";
		//Production server URL 
		document.myform.action="http://services.vsnl.net/myaccount/PInfranetServlet";
		document.myform.submit();
        return true;
	}//End of function.

	/*Code to handle IN CARDS */
	function validateIN(cardno,type){
		
		var regobj
		var T_Desc
		

		regobj = new RegExp(' ','g') 
		T_Desc = cardno.value
		T_nospace = T_Desc.replace(regobj,'')

		if(T_nospace.length!=T_Desc.length)
		{
			alert("You need to register with a 12-digit number. without spaces.");
			cardno.focus();
			return false;
			
		}
		else if((T_nospace.length==0)||(T_nospace.length!=12)||(isNaN(T_Desc)))
		{
				alert("You need to register with a 12-digit number. Register now.");
				cardno.focus();
				return false;		
		}
		
		else
		{
			//alert("In the submit block");
			document.CRYPT.cardno.value=cardno.value;
			document.CRYPT.incardtype.value=type;
			document.CRYPT.method="post";
			//development server url 
			//document.CRYPT.action="https://billsrv.vsnl.net/IN_new_sys/validatecard_IN_sin_sign.jsp";
			//Production server URL 
			document.CRYPT.action="https://services.vsnl.net/new/validatecard_IN_sin_sign.jsp";
			document.CRYPT.submit();
	 }

	}//End of function

	
