/* Start of Filter functionality*/
  	var splChar = [ '<' , '>', ':' , '^','{','}','(',')'];
	function filterChars(){
		var charFound = false;
		var tempQueryString = location.search;
		for(var i = 0 ;  i < splChar.length ; i++)  {
			var regex = new RegExp("\\"+splChar[i],"gi");		
			if (tempQueryString.search(regex) != -1){
				charFound = true;
				tempQueryString = tempQueryString.replace(regex,"");
			}
		}
		if(charFound){
			location.search = tempQueryString;
		}
	}
	filterChars();
	/* Start of Filter functionality*/
                /* Used for creating infolayers in backbase */    
	var infoLayerNum=0;
	/* Start of Sessiondata */
	var seqNum = -1;		
	var arrKeyValues = new Array();	
	var arrKeyNames = new Array(); 	
	
	function isBoolean(strValue){
		return (strValue == "true" || strValue == "false");	
	}
	
	function toBoolean(strValue){
		return (strValue == "true");	
	}
	
	function getVal(intVeldIndex) {
		if (isBoolean(this.values[intVeldIndex])){
			return toBoolean(this.values[intVeldIndex]);
		} else {
			return this.values[intVeldIndex];
		}
	}
	
	
	function setVal(intVeldIndex,inputValue){
		this.values[intVeldIndex] = inputValue;
	}
	
	function initVal(intVeldIndex,inputValue) {
		if (this.values[intVeldIndex] == undefined){
			this.values[intVeldIndex] = inputValue;
		}
		return this.getVal(intVeldIndex);
	}
	
	function delVal(intVeldIndex){
		this.setVal(intVeldIndex,undefined);
	}
	
	function hasVal(intVeldIndex){
		return (this.values[intVeldIndex] != undefined && this.values[intVeldIndex] != "");
	}
	
	function paramString(blnExpanded) {
		var strParams = "";
		var j = 0;
		for (var i = 0 ; i < this.values.length ; i++) {
			if(this.values[i] != undefined){		
				j += 1;
				if (j>1){
					strParams += "&";
				}			
				strParams += "" + i + "=" + this.values[i];
			}
		}  	
		return strParams;
	}
	
	function expandedParamString() {
		var strParams = "";
		var j = 0;
		for (var i=0; i<this.values.length; i++) {
			if(this.names[i] != undefined && this.values[i] != undefined){		
				j += 1;
				if (j>1){
					strParams += "&";
				}			
				strParams += "" + this.names[i] + "=" + this.values[i];
			}
		}  	
		return strParams;
	}
	
	function removePos(str){
		var index = str.indexOf('&');
		posName = str.substr(4,index-4);
		strWithOutPos =str.substr(index+1);
		return strWithOutPos;
	}
	
	function SessionData() {
		var strQuery = unescape(window.location.search.substring(1));	
			if (strQuery.substr(0,3)=='pos')
		strQuery = removePos(strQuery);
		var arrTmpParams = strQuery.split('&');
		var intPos = 0;
		for (var i=0; i<arrTmpParams.length; i++) {
			intPos = arrTmpParams[i].indexOf('=');
			if (intPos > 0){
			  arrKeyValues[arrTmpParams[i].substring(0,intPos)] = arrTmpParams[i].substring(intPos+1);
		   }
		}
	
		this.values = arrKeyValues;  
		this.names = arrKeyNames;  	
		this.getVal = getVal;	
		this.setVal = setVal;
		this.initVal = initVal;
		this.delVal = delVal;
		this.hasVal = hasVal;
		this.paramString = paramString;  
		this.expandedParamString = expandedParamString;
	}
	/* End of Sessiondata */
	
	/* Start of Forms functions*/	
	
	var fo;
	var fo2;
	function setFocus(focusField){ 
		fo[focusField].focus();
	}
	
	function setFO(formname){
		if (formname != ""){
			fo = document.getElementById(formname);
		}		
	}
	
	function populatelist(objID,arrayOfValues){
		var obj = getObj(objID);
		for(i = 0 ; i < arrayOfValues.length ; i++){
			obj.options[i] = new Option(arrayOfValues[i][1],arrayOfValues[i][0]);
		}
	}	
	
	function activateSubmit(){
        if (document.all){ 
            if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)){  
                return true;
            }
        }
        return false;
	}
	
	function updateComponent(strComponentID,strHTML) {
		var obj = getObj(strComponentID);
		if (obj) {
			obj.innerHTML = strHTML;
		}
	}
	
	function updateClassName(objID,classname) {
		var obj = getObj(objID);
		if (obj) {
			obj.className = classname;
		}
	}

	function hideComponent(strComponentID) { 
		var obj = getObj(strComponentID);
		if (obj) {
			obj.style.display = "none";
		}
	}

	function unhideComponent(strComponentID) { 
		var obj = getObj(strComponentID);
		if (obj) {
			obj.style.display = "";
		}
	}

	function IsHiddenComponent(strComponentID) {
		var obj = getObj(strComponentID); 
		var blnResult = false;
		if (obj) {
			if (obj.style.display=="none") {
				blnResult = true;
			}
		}
		return blnResult;
	}

	function getObj(strID){
		var objReturnValue = null;
    	if (document.layers){//NN4+    
       		objReturnValue = document.layers[strID];
    	}else{
    		if (document.getElementById){ //gecko(NN6) + IE 5+
    	    	objReturnValue = document.getElementById(strID);
    		}else{
    			if (document.all){ // IE 4
    				objReturnValue = document.all[strID];
        		}
        	}
    	}
    	return objReturnValue;
	}
	
	function stripPeriodsFromAmount(fieldobj){
		var newValue = "";
		var oneChar  = "";
		var amount   = fieldobj.value;
		for (i = 0; i < amount.length; i++){
			oneChar = amount.substring(i,i+1);
			if (oneChar!='.')
			newValue = newValue + oneChar;
		}
		return newValue;	
	}

	function getRadioValue(obj)
	{
		for(var a=0; a<obj.length; a++){
			if(obj[a].checked){
				return obj[a].value;
			}
		}
		return "";
	}

	function onlineApplication(url,isAutomaticSavingSelected, initialDepositAmount, periodicDepositAmount){
		var targetUrl = url;		
		targetUrl += "form_automaticSavingSelected=" + isAutomaticSavingSelected;
		targetUrl += "&form_initialDepositAmount=" + initialDepositAmount;
		targetUrl += "&form_periodicDepositAmount=" + periodicDepositAmount;
		location.href=targetUrl;
		return false;	
	}
	
	function giveFormatRound(amount) {
		 var roundAmount = Math.round(amount);
		 return formatAsCurrency(roundAmount);
	}
	
	function formatAsCurrency(fltAmount) { 	
		// string in Europees financieel formaat ("12.324,56")
		var strTemp = "";
		var strResult = "";
		var strSign = "";
		if (fltAmount < 0) {
			fltAmount = (fltAmount * -1);
			strSign = "-";
		}
		var intUnits = Math.floor(fltAmount);
		var intCents = Math.round((fltAmount-intUnits)*100);
		if (intCents == 100) {
			intUnits += 1;
			intCents = 0;
		}
		var strUnits = intUnits.toString();
		for(i = strUnits.length - 3 ; i >- 3 ; i = i-3) {
			strTemp = "." + strUnits.substring(i,i+3) + strTemp;
		}
		strResult = strSign + strTemp.substring(1,strTemp.length);
		if (intCents == 0)
			strResult += ",-";
		else if (intCents < 10)
			strResult += ",0" + intCents.toString();
		else 
			strResult += ","  + intCents.toString();
		return strResult;
	}
	
	function formatAsCurrency2(fltAmount) { 	
		// string in Europees financieel formaat ("12.324,56")
		var strTemp = "";
		var strResult = "";
		var strSign = "";
		if (fltAmount < 0) {
			fltAmount = (fltAmount * -1);
			strSign = "-";
		}
		var intUnits = Math.floor(fltAmount);
		var intCents = Math.round((fltAmount-intUnits)*100);
		if (intCents == 100) {
			intUnits += 1;
			intCents = 0;
		}
	
		var strUnits = intUnits.toString();
		for ( i=strUnits.length-3; i>-3; i=i-3 ) {
			strTemp = "." + strUnits.substring(i,i+3) + strTemp;
		}
		strResult = strSign + strTemp.substring(1,strTemp.length);
	
		if (intCents == 0)
			strResult += ",00";
		else if (intCents < 10)
			strResult += ",0" + intCents.toString();
		else 
			strResult += ","  + intCents.toString();
		return strResult;
	}
	
	function formatAsPercentage(fltAmount) { 	
		// string in Europees financieel formaat ("124,56%")
		var strTemp = "";
		strResult = fltAmount.toString(); 
		strResult = strResult.replace(".",",");
		strResult += "%";
		return strResult;
	}
	
	
	function formatAsPerc(fltAmount, intNumDecs) { 	
		var fltRetVal = fltAmount.toPrecision(intNumDecs);
		var strRetVal = fltRetVal.toString();
		if (strRetVal.indexOf(".") == -1){
			strRetVal += "."; 
			for (var i = 0 ; i < intNumDecs ; i++){	
				strRetVal += "0";
			}
		}
		strRetVal = strRetVal.replace(".",",");
		strRetVal += "%";
		return strRetVal;
	}
	
	// Formatting for percentage field
	function formatPercField(obj) {
		var amount = obj.value;
		var newValue = "";
		var newValue1 = "";
		var newValue2 = "";
		var newValue3 = "";
		var oneChar1  = "";
		var oneChar2 = "";
		var oneChar3 = "";
		var result = "";
		for(var i = 0; i < amount.length; i++){
		  oneChar1 = amount.substring(i,i+1);
		  if(oneChar1 == '.')
			oneChar1 =",";  
		  newValue = newValue + oneChar1;
		}
		for(var j = 0; j < newValue.length; j++){
			oneChar2 =newValue.substring(j,j+1);
			if(oneChar2 != ',')
				newValue1 = newValue1+ oneChar2;
			else{
				newValue1 = newValue1+ oneChar2; 
				break;
			}
		}
		newValue2 = newValue.substring(newValue1.length,newValue.length);
		for(var k=0 ; k < newValue2.length; k++){
			oneChar3 = newValue2.substring(k,k+1);
			if(oneChar3!=',')
				newValue3 = newValue3 +oneChar3;
		}
		result = newValue1 + newValue3.substring(0,2);
		return result;
	}

 	// Background color for the text boxes in case of errors
	var error_backgroundColor="#f0e8ee";
	
	function ShwErr(errObj,errorDivID,ErrTxt){  
		unhideComponent(errorDivID);
		updateComponent(errorDivID,ErrTxt);
		if(errObj.type=='text'){
			errObj.style.backgroundColor = error_backgroundColor;	
		}
		return false;
	}
	
	function IsTxt(txt){
		result=((txt!="")&&!HasSpaces(txt));
		var j = 0;
		while (!result&&( j < txt.length))
			result=(txt.charAt(j++) != " ");
		return result;
	}
	
	function HasSpaces(txt){
		return (txt.indexOf(" ") >= 0);
	}
	
	function ReqFieldEmpty(obj,errorDivID,errorMessage){   
		if (!IsTxt(obj.value)){
			ShwErr(obj,errorDivID,errorMessage);		
			return false;
		}		
		return true;
	}
	
	function IsDigitsOnly(obj,errorDivID,errorMessage){
		exp = /(^-?\d*\.\d*$)|(^-?\d*$)|(^-?\.\d*$)/;
		if (exp.test(obj.value) != true){
			ShwErr(obj,errorDivID,errorMessage);
			return false;
		} 
		return true;
	}
	
	function IsDecimal(obj,errorDivID,errorMessage){
		if (obj.value.indexOf(",")>=0){	
			ShwErr(obj,errorDivID,errorMessage);
			return false;
		}
		return true;
	}
	
	function ReqRadioEmpty(obj,errorDivID,errorMessage){
		if (getRadioValue(obj)==""){
			 ShwErr(obj,errorDivID,errorMessage);
			return false;
		}
		return true;
	}
	
	
	/*  Start of Right navigation function */
		function showContent_rightNav_oneStep()
	{
		updateComponent('txtStep1_RightHeading',strStep1_rightHeading);
		updateComponent('txtRight_StepContact',strText_rightContact);
		if(strText_rightPlain == "")
			hideComponent('txtRight_Plain');
		else updateComponent('txtRight_Plain',strText_rightPlain);
		if(strText_rightHyperlink_1 == "")
			hideComponent('txtHyperLink1');
		else {	
			updateComponent('txtHyperLink1',strText_rightHyperlink_1);
			document.getElementById('txtHyperLink1').href=strURL_rightHyperlink_1;
		}
		if(strText_rightHyperlink_2 == "")
			hideComponent('txtHyperLink2');
		else {	
			updateComponent('txtHyperLink2',strText_rightHyperlink_2);
			document.getElementById('txtHyperLink2').href=strURL_rightHyperlink_2;
		}
		if(strText_rightHyperlink_3 == "")
		hideComponent('txtHyperLink3');
		else {	
			updateComponent('txtHyperLink3',strText_rightHyperlink_3);
			document.getElementById('txtHyperLink3').href=strURL_rightHyperlink_3;
		}
		if(strText_rightHyperlink_4 == "")
		hideComponent('txtHyperLink4');
		else {	
			updateComponent('txtHyperLink4',strText_rightHyperlink_4);
			document.getElementById('txtHyperLink4').href=strURL_rightHyperlink_4;
		}
		if(strText_rightHyperlink_5 == "")
		hideComponent('txtHyperLink5');
		else {	
			updateComponent('txtHyperLink5',strText_rightHyperlink_5);
			document.getElementById('txtHyperLink5').href=strURL_rightHyperlink_5;
		}if(strText_rightHyperlink_6 == "")
		hideComponent('txtHyperLink6');
		else {	
			updateComponent('txtHyperLink6',strText_rightHyperlink_6);
			document.getElementById('txtHyperLink6').href=strURL_rightHyperlink_6;
		}
		if(currentStep ==1){
		updateComponent('txtStep1_rightCurrentInfo',strStep1_rightCurrentInfo);
		if(strStep1_rightCurrentInfo != "")
		updateClassName('txtStep1_rightCurrentInfo','');
		updateClassName('liStep1_RightHead','active');	
		updateClassName('txtStep1_RightHeading','step_active');
		updateClassName('txtStep2_RightHeading','step_inactive');
		}
		
	}

	function showContent_rightNav_twoSteps(){
		updateComponent('txtStep1_RightHeading',strStep1_rightHeading);
		updateComponent('txtStep2_RightHeading',strStep2_rightHeading);	
		updateComponent('txtRight_StepContact1',strText_rightContact_1);
		updateComponent('txtRight_StepContact2',strText_rightContact_2);
		if(strText_rightPlain == ""){
			hideComponent('txtRight_Plain');
		}else{
			updateComponent('txtRight_Plain',strText_rightPlain);		
		}
		if(strText_rightHyperlink_1 == ""){
			hideComponent('txtHyperLink1');
		}else{	
			updateComponent('txtHyperLink1',strText_rightHyperlink_1);
			document.getElementById('txtHyperLink1').href=strURL_rightHyperlink_1;
		}
		if(strText_rightHyperlink_2 == ""){
			hideComponent('txtHyperLink2');
		}else{	
			updateComponent('txtHyperLink2',strText_rightHyperlink_2);
			document.getElementById('txtHyperLink2').href=strURL_rightHyperlink_2;
		}
		if(strText_rightHyperlink_3 == ""){
			hideComponent('txtHyperLink3');
		}else{	
			updateComponent('txtHyperLink3',strText_rightHyperlink_3);
			document.getElementById('txtHyperLink3').href=strURL_rightHyperlink_3;
		}
		if(currentStep == 1){
			updateComponent('txtStep1_rightCurrentInfo',strStep1_rightCurrentInfo);
			updateClassName('txtStep1_rightCurrentInfo','');
			updateClassName('liStep1_RightHead','active');	
			updateClassName('txtStep1_RightHeading','step_active');
			updateClassName('txtStep2_RightHeading','step_inactive');	
		}
		else if(currentStep == 2){
			updateComponent('txtStep2_rightCurrentInfo',strStep2_rightCurrentInfo);
			updateClassName('txtStep2_rightCurrentInfo','');	
			updateClassName('liStep2_RightHead','active');	
		    updateClassName('liStep1_RightHead','visited');
			updateClassName('txtStep2_RightHeading','step_active');
			updateClassName('txtStep1_RightHeading','step_inactive');	
			updateComponent('txtStep1_RightHeading','<a href="'+strURL_step1+'?'+sessionData.paramString()+'">'+strStep1_rightHeading+'</a>');
		}
	}
	
	function showContent_rightNav_threeSteps(){
		updateComponent('txtStep1_RightHeading',strStep1_StepHeading);
		updateComponent('txtStep2_RightHeading',strStep2_StepHeading);
		updateComponent('txtStep3_RightHeading',strStep3_StepHeading);
		updateComponent('txtRight_StepContact1',strText_rightContact_1);
		updateComponent('txtRight_StepContact2',strText_rightContact_2);
		if(strText_rightPlain == ""){
			hideComponent('txtRight_Plain');
		}else{
			updateComponent('txtRight_Plain',strText_rightPlain);		
		}
	
		if(strText_rightHyperlink_1 == "")
			hideComponent('txtHyperLink1');
		else {	
			updateComponent('txtHyperLink1',strText_rightHyperlink_1);
			document.getElementById('txtHyperLink1').href=strURL_rightHyperlink_1;
		}
		if(strText_rightHyperlink_2 == "")
			hideComponent('txtHyperLink2');
		else {	
			updateComponent('txtHyperLink2',strText_rightHyperlink_2);
			document.getElementById('txtHyperLink2').href=strURL_rightHyperlink_2;
		}
		if(strText_rightHyperlink_3 == "")
			hideComponent('txtHyperLink3');
		else {	
			updateComponent('txtHyperLink3',strText_rightHyperlink_3);
			document.getElementById('txtHyperLink3').href=strURL_rightHyperlink_3;
		}	
		
		if(currentStep == 1){
			updateComponent('txtStep1_rightCurrentInfo',strStep1_rightCurrentInfo);
			updateClassName('txtStep1_rightCurrentInfo','');
			updateClassName('liStep1_RightHead','active');	
			updateClassName('txtStep1_RightHeading','step_active');
			updateClassName('txtStep2_RightHeading','step_inactive');
			updateClassName('txtStep3_RightHeading','step_inactive');
		}
		else if(currentStep == 2){
			updateComponent('txtStep1_RightHeading','<a href="'+strURL_step1+'?'+sessionData.paramString() +'">'+strStep1_rightHeading+'</a>');
			updateComponent('txtStep2_rightCurrentInfo',strStep2_rightCurrentInfo);
			updateClassName('txtStep2_rightCurrentInfo','');
			updateClassName('liStep2_RightHead','active');	
			updateClassName('liStep1_RightHead','visited');
			updateClassName('txtStep2_RightHeading','step_active');
			updateClassName('txtStep1_RightHeading','step_inactive');
			updateClassName('txtStep3_RightHeading','step_inactive');
		}	
		else if(currentStep == 3){
			updateComponent('txtStep1_RightHeading','<a href="'+strURL_step1+'?'+sessionData.paramString() +'">'+strStep1_rightHeading+'</a>');
			updateComponent('txtStep2_RightHeading','<a href="'+strURL_step2+'?'+sessionData.paramString() +'">'+strStep2_rightHeading+'</a>');
			updateComponent('txtStep3_rightCurrentInfo',strStep3_rightCurrentInfo);
			updateClassName('txtStep3_rightCurrentInfo','');
			updateClassName('liStep3_RightHead','active');	
			updateClassName('liStep2_RightHead','visited');
			updateClassName('liStep1_RightHead','visited');
			updateClassName('txtStep3_RightHeading','step_active');
			updateClassName('txtStep2_RightHeading','step_inactive');
			updateClassName('txtStep1_RightHeading','step_inactive');		
		}
				
	}
	
	function showContent_rightNav_fourSteps(){
		updateComponent('txtStep1_RightHeading',strStep1_StepHeading);
		updateComponent('txtStep2_RightHeading',strStep2_StepHeading);
		updateComponent('txtStep3_RightHeading',strStep3_StepHeading);
		updateComponent('txtStep4_RightHeading',strStep4_StepHeading);
		updateComponent('txtRight_StepContact1',strText_rightContact_1);
		updateComponent('txtRight_StepContact2',strText_rightContact_2);
		if(strText_rightPlain == ""){
			hideComponent('txtRight_Plain');
		}else{
			updateComponent('txtRight_Plain',strText_rightPlain);		
		}
	
		if(strText_rightHyperlink_1 == "")
			hideComponent('txtHyperLink1');
		else {	
			updateComponent('txtHyperLink1',strText_rightHyperlink_1);
			document.getElementById('txtHyperLink1').href=strURL_rightHyperlink_1;
		}
		if(strText_rightHyperlink_2 == "")
			hideComponent('txtHyperLink2');
		else {	
			updateComponent('txtHyperLink2',strText_rightHyperlink_2);
			document.getElementById('txtHyperLink2').href=strURL_rightHyperlink_2;
		}
		if(strText_rightHyperlink_3 == "")
			hideComponent('txtHyperLink3');
		else {	
			updateComponent('txtHyperLink3',strText_rightHyperlink_3);
			document.getElementById('txtHyperLink3').href=strURL_rightHyperlink_3;
		}
        if(strText_rightHyperlink_4 == "")
			hideComponent('txtHyperLink4');
		else {	
			updateComponent('txtHyperLink4',strText_rightHyperlink_4);
			document.getElementById('txtHyperLink4').href=strURL_rightHyperlink_4;
		}		
		
		if(currentStep == 1){
			updateComponent('txtStep1_rightCurrentInfo',strStep1_rightCurrentInfo);
			updateClassName('txtStep1_rightCurrentInfo','');	
			updateClassName('liStep1_RightHead','active');	
			updateClassName('txtStep1_RightHeading','step_active');
			updateClassName('txtStep2_RightHeading','step_inactive');
			updateClassName('txtStep3_RightHeading','step_inactive');
			updateClassName('txtStep4_RightHeading','step_inactive');
		}
		else if(currentStep == 2){
			updateComponent('txtStep1_RightHeading','<a href="'+strURL_step1+'?'+sessionData.paramString() +'">'+strStep1_StepHeading+'</a>');
			updateComponent('txtStep2_rightCurrentInfo',strStep2_rightCurrentInfo);
			updateClassName('txtStep2_rightCurrentInfo','');	
			updateClassName('liStep2_RightHead','active');	
			updateClassName('liStep1_RightHead','visited');
			updateClassName('txtStep1_RightHeading','step_inactive');
			updateClassName('txtStep2_RightHeading','step_active');
			updateClassName('txtStep3_RightHeading','step_inactive');
			updateClassName('txtStep4_RightHeading','step_inactive');
		}	
		else if(currentStep == 3){
			updateComponent('txtStep1_RightHeading','<a href="'+strURL_step1+'?'+sessionData.paramString() +'">'+strStep1_StepHeading+'</a>');
			updateComponent('txtStep2_RightHeading','<a href="'+strURL_step2+'?'+sessionData.paramString() +'">'+strStep2_StepHeading+'</a>');
			updateComponent('txtStep3_rightCurrentInfo',strStep3_rightCurrentInfo);
			updateClassName('txtStep3_rightCurrentInfo','');	
			updateClassName('liStep3_RightHead','active');	
			updateClassName('liStep2_RightHead','visited');
			updateClassName('liStep1_RightHead','visited');
			updateClassName('txtStep1_RightHeading','step_inactive');
			updateClassName('txtStep3_RightHeading','step_active');
			updateClassName('txtStep2_RightHeading','step_inactive');
			updateClassName('txtStep4_RightHeading','step_inactive');		
		}
		else if(currentStep == 4 || currentStep == 5){
			updateComponent('txtStep1_RightHeading','<a href="'+strURL_step1+'?'+sessionData.paramString() +'">'+strStep1_StepHeading+'</a>');
			updateComponent('txtStep2_RightHeading','<a href="'+strURL_step2+'?'+sessionData.paramString() +'">'+strStep2_StepHeading+'</a>');
			updateComponent('txtStep3_RightHeading','<a href="'+strURL_step3+'?'+sessionData.paramString() +'">'+strStep3_StepHeading+'</a>');
			updateComponent('txtStep4_rightCurrentInfo',strStep4_rightCurrentInfo);
			updateClassName('txtStep4_rightCurrentInfo','');	
			updateClassName('liStep4_RightHead','active');	
			updateClassName('liStep3_RightHead','visited');
			updateClassName('liStep2_RightHead','visited');
			updateClassName('liStep1_RightHead','visited');
			updateClassName('txtStep4_RightHeading','step_active');
			updateClassName('txtStep3_RightHeading','step_inactive');
			updateClassName('txtStep2_RightHeading','step_inactive');
			updateClassName('txtStep1_RightHeading','step_inactive');		
		}
				
	}
	
	function removeCommas(val){
		var temp = val.toString(); 
		temp = temp.replace(",","");	
		return temp;
	}
	
	//Functions for navigation in text boxes		
	function KeyHandlerIE(objInput,keyVal,formId){
	
		KeyHandlerCommon(objInput,keyVal, objInput.maxLength,formId);
	}

 function stripAlphabatesFromAmount(fieldobj){

		var newValue = "";
		var oneChar  = "";
		var amount   = fieldobj.value;
		for (i = 0; i < amount.length; i++){
			oneChar = amount.substring(i,i+1);
			if (!isNaN(oneChar))
			newValue = newValue + oneChar;
		}
		// alert("om gan in func : " +newValue) ;
		return newValue;	
	}
	function KeyHandlerCommon(objInput,keyVal,maxLen,formId){
		if ((keyVal>47)||(keyVal==32))
        if (objInput.value.length==maxLen){
			var temp1=nextField(objInput,formId);
			temp1.focus();
			}
	}

	function nextField(objField,formId){
		if(formId != null){
		var temp=eval('document.'+formId+'.elements');		
			for (i=0;i<temp.length;i++){
				if (temp[i].name==objField.name){
					if (++i>temp.length-1) i=0;
					return temp[i];
				}
			}		
		}
		else{
			for (i=0;i<fo.elements.length;i++){
				if (fo.elements[i].name==objField.name){
					if (++i>fo.elements.length-1) i=0;
						return fo.elements[i];
				}
			}
		  }
	}

	//For IAM Privepakket
	var intTrue = 1;
	var intFalse = 0;
	
	function formatParamString(strParams) {
		if (strParams.length > 0) {	
			while (strParams.indexOf("true")!=-1)
				strParams=strParams.replace(/true/, intTrue.toString());
			while (strParams.indexOf("false")!=-1)
				strParams=strParams.replace(/false/, intFalse.toString());
		}
	return strParams;
	}
	
	function createParamArray(strParams) {
		var strParamData = formatParamString(strParams);
		var arrParams = strParamData.split("&");
		return arrParams;
	}
	
	function createParamString(arrParams) {
		var strParams = arrParams.toString();
		if (strParams.length > 0) {	
			while (strParams.indexOf(",")!=-1)
				strParams=strParams.replace(/,/, "&");
		}
		return strParams;
	}
	
	function showBGColor(fieldId, color){
		var obj = getObj(fieldId);
		obj.style.backgroundColor = color;  
	}
    //Creating Simple AJAX request
	function makeSimpleAJAXRequest(sServletUrl, sData){		
		try{  // Firefox, Opera 8.0+, Safari, IE7
			xmlHttp = new XMLHttpRequest();
		}
		catch(e){ // for  IE5 and IE6 
			try{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				alert ("Your browser does not support XMLHTTP!");
			return;  
			}
		}		
		var requestURL = sServletUrl +'?'+sData;
		xmlHttp.onreadystatechange =processAJAXRequest;
		xmlHttp.open("GET", requestURL, true); 
		xmlHttp.send(null);
	}
    //Creating Backbase AJAX request
    function makeBackbaseAjaxRequest(sServletUrl, sData){
		bb.command.load(sServletUrl,"GET",sData,null,null,"replaceChildren",function(oReq,oRes){
		sForwardRequest(oReq,oRes);
		},function(oReq,oRes){
			sCallBack(oReq,oRes);
		});
	}
	
	function openFromPopup(url) {
		obj = window.opener.top;
		if (obj && !obj.closed){
			obj.location.href=url;
			obj.focus();
		}else{
			window.open(url);
		}
	}
              // format currency removes values after decimail (eg : input--300,34  ouput 300,-
	function formatValue(amount)
	{
		var negative = "";
		if (amount < 0)
		{
			amount = Math.abs(amount);
			negative = "-";
		}
	
		var units = Math.floor(amount);
		amountstr=units.toString();   
	
		var temp="";
		iArray = new Array();
		var j=0;
		for(i=amountstr.length-3;i>-3;i=i-3)
		{
		  iArray[j] = amountstr.substring(i,i+3);
		  j++;
		  temp = "." + iArray[j-1]+ temp;
		}
		units = negative + temp.substring(1,temp.length);
	
		return units+",-";
	}
	
	// to check leap year
function leapYear(year) {
	if(year%400 ==0 )
	return true;
	else if( year%100 ==0) return false;
	else if(year%4 ==0) return true;
	else return false; 
	}
	
function CheckDate(bday,bmonth,byear,errorDivID,errorMessage) {
	month = parseInt(parseFloat(bmonth.value));
	day  = parseInt(parseFloat(bday.value));
	year = parseInt(byear.value);
	year_length = byear.value.length ;
	if (month <1 || month>12 || year_length<4){ 
	   if(year_length<4)
	    ShwDateErr(bday,bmonth,byear,errorDivID,errorMessage);
	   else
		ShwDateErr(bday,bmonth,byear,errorDivID,errorMessage);
		return false;
	}
	
	else {
		if( month ==2) {						
			if( day ==29 && !leapYear(year)) {	
			ShwDateErr(bday,bmonth,byear,errorDivID,errorMessage);
			return false;
		}
			else if(day<1 || day>29) {	
			ShwDateErr(bday,bmonth,byear,errorDivID,errorMessage);
			return false;
			}
		}
		else if(month ==1 || month ==3 || month ==5 || month ==7 || month ==8 || month ==10 || month ==12){
			if (day<1 || day>31  ) { 	
			ShwDateErr(bday,bmonth,byear,errorDivID,errorMessage);
			return false;
			}
		}	
		else {
			if (day<1 || day>30  ) { 	
			ShwDateErr(bday,bmonth,byear,errorDivID,errorMessage);
			return false;
			}
			}	
		}
                                if( month >0 && month <10)
		bmonth.value = '0'+month;
	                 if( day >0 && day <10)
		bday.value = '0'+day;
		return true;
	}

	function ShwDateErr(errObj1,errObj2,errObj3,errorDivID,ErrTxt){
	   unhideComponent(errorDivID);
		updateComponent(errorDivID,ErrTxt);
		if(errObj1.type=='text'){
			errObj1.style.backgroundColor = error_backgroundColor;	
		}
		if(errObj2.type=='text'){
			errObj2.style.backgroundColor = error_backgroundColor;	
		}
		if(errObj3.type=='text'){
			errObj3.style.backgroundColor = error_backgroundColor;	
		}
		
		return false;
	}
	
	function truncate(objVal,decVal)
	{
	var numStr=objVal.toString();
	var decPos = numStr.indexOf(".");
	objVal = numStr.substring(0,decPos+decVal);
	return objVal;
	}0