function AddressEntryComponent(id, htmlElement, xml) {

    this.id = id;
    this.htmlElement = htmlElement;
    this.xml = xml;
    
    this.mAddressType = 'common';
    this.mCountryXml = null;
    this.mSelected = null;
    this.mSelectedCountry = null;
    this.mSelectedState = null;
    this.mRegionsXml = null;
    this.mMachineCalled = false;
	
    this.init = function _init() {	}
    
    this.reinitialize =  function _reinitialize() {
		this.mAddressType = 'common';
	    this.mCountryXml = null;
    	this.mSelected = null;
	    this.mSelectedCountry = null;
    	this.mSelectedState = null;
	    this.mRegionsXml = null;
	    this.mMachineCalled = false;
	}
    
    this.repaint = function _repaint(){
    	this.htmlElement.innerHTML = this.componentHtml();
    	if(this.mSelected=="country")	{
    		getDocElementById("country").focus();
		 	getDocElementById("country").focus();
		} else if(this.mSelected=="state")	{
			getDocElementById("state").focus();
		 	getDocElementById("state").focus();
		}
    }
    
    this.componentHtml = function _componentHtml() {
    	if(!this.mMachineCalled)	{
    		if(this.mCountryXml==null && this.mRegionsXml==null)	{	
	    		this.initialize();
	    		return "";
	   		}
	   	}
	   	if(!this.mMachineCalled)	{
	   	//alert("regions"+XML.toString(this.mRegionsXml));
  		var htmlStr ='';
  		if(XML.getText(this.xml,"type")=="add-card")	{
  			htmlStr= this.addCardType(this.mAddressType);
	    	this.mTableSpec = "cellpadding=0 cellspacing=0  border=0";
	    } else if(XML.getText(this.xml,"type")=="client-details")	{
	    	this.mTableSpec = "cellpadding=0 cellspacing=0  border=0";
	    	this.mandatory = "";
	    	htmlStr= this.ClientDetailsType(this.mAddressType);
	    }
	    else if(XML.getText(this.xml,"type")=="update-card"){
	    	this.mTableSpec = "cellSpacing=0 cellPadding=0  border=0";
	    	this.mandatory = "<B>*</B>";
	       	htmlStr= this.addCardType(this.mAddressType);	
	    }else if(XML.getText(this.xml,"type")=="delete-card"){
	    	this.mTableSpec = "cellSpacing=0 cellPadding=0  border=0";
	    	this.mandatory = "<B>*</B>";
	       	htmlStr= this.deleteCardType(this.mAddressType);	
	    }else if(XML.getText(this.xml,"type")=="bank-check"){
	      	this.mTableSpec = "cellpadding=0 cellspacing=0  border=0";
	    	this.mandatory = "<B>*</B>";
	       	htmlStr= this.bankCheckType(this.mAddressType);	
	    }else if(XML.getText(this.xml,"type")=="bank-wire-withdrawal"){
	    	htmlStr= this.bankWireWithDrawalType(this.mAddressType);	
	    } else {
	    	if(this.xml!=null)
	    		this.mAddressType = 'ErrorDisplay';	
	    	htmlStr= this.registrationType(this.mAddressType);
	    	
	    }
	 	}
    	return htmlStr	
    }
    
    this.initialize = function _initialize()	{
    	this.mMachineCalled = true;
    	MB.getCashCountriesList(this.id,MBFactory.getCashCountriesListTemplate(),handleMachineResponse_CountriesList);
	    
	}
	
	/*
    this.handleBlur = function _handleBlur(pElement,pExtra) {
		eval(pExtra + "()");
		return true;
	}
    */
    
    this.handleInputChange = function _handleInputChange(pElement) {
    	if(this.mMachineCalled)	{
    		return true;
    	}
		this.mSelected = pElement.id;
		if("country"==pElement.id)	{
	   		var country = getDocElementById("country").value;
	   		this.mSelectedState = "";
	   		this.mSelectedCountry = XML.selectById(this.mCountryXml,country);
	        var lRequest = MBFactory.getCashRegionsOfCountryTemplate();
	        XML.setAttribute(XML.selectOne(lRequest,"region"),"country-id",country);
	        MB.getCashRegionsOfCountry(this.id,lRequest,handleMachineResponse_RegionsOfSelected);
	        this.mMachineCalled = true;
	        
	    } else if("state"==pElement.id)	{ 
	   		var lState = getDocElementById("state").value;
	   		var lValues = lState.split(':');
	   		this.mSelectedState = lValues[1];
		   	this.repaint();
	   		return true;
	    }
	}
  
	this.registrationType = function _registrationType(pAddressType)	{
    
    	var htmlStr = '';
    	switch(pAddressType)	{
        
        	case 'common':
        		htmlStr = '<TABLE cellSpacing=0 cellPadding=0 width=450  border=0 class="mbCss-form"><TBODY><TR><TH width=153>Country</TH><TD width=10>&nbsp;</TD><TD width=287>'
						+ '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" name="country" id="country" tabindex=12 onChange="doChange(this)">';
				var lCountries = XML.select(this.mCountryXml,"country")		
				for(var i=0;i<lCountries.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lCountries[i],"id")+'">'+XML.getText(lCountries[i],"name")+'</OPTION>';
				}
				htmlStr += '</SELECT>'
					    + '</TD></TR>' 
        				+ '<TR><TH>State</TH><TD></TD><TD><SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide"  name="state" id="state" tabindex=13 onChange="doChange(this)">';
       			var lRegions = XML.select(XML.selectOne(this.mRegionsXml,"regions"),"region")		
				for(var i=0;i<lRegions.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lRegions[i],"id")+":"+XML.getText(lRegions[i],"name")+'" '+(XML.getText(lRegions[i],"name")==this.mSelectedState?"selected":"")+'>'+XML.getText(lRegions[i],"name")+'</OPTION>';
				}
				htmlStr	+= '</SELECT>';
				if(this.mSelectedState=="Other")
					htmlStr += ' <INPUT class="medium"  name="stateother" id="stateother" tabindex=14  value="enter state">';
				
				htmlStr += '</TD></TR>'
	       				+ '<TR><TH>City</TH><TD></TD><TD><INPUT class="medium"  name="city" id="city" tabindex=15  value="'+(getDocElementById("city")!=null?document.joinnow1.city.value:"")+'" ></TD>'
				    	+ '</TR><TR><TH>Zip Code</TH><TD></TD><TD><INPUT class="medium"  name="zipcode" id="zipcode" tabindex=16  value="'+(getDocElementById("zipcode")!=null?document.joinnow1.zipcode.value:"")+'" ></TD>'
				    	+ '<TR><TH>Street Address</TH><TD></TD>'
				    	+ '<TD><TEXTAREA style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" rows="3"  name="address" id="address" tabindex=17>'+(getDocElementById("address")!=null?document.joinnow1.address.value:"")+'</TEXTAREA></TD></TR>'
				       	+ '</TBODY> </TABLE>';

        		return htmlStr;
        	
        	case 'ErrorDisplay':
        		var countryid = '';
				var countryother = '';
        		var state = ''; 
        		var prevstate = '';
        		var zipcode = '';
        		var city = '';
        		var address = '';
        		
        		if(XML.getText(XML.selectOne(this.xml,"user-address"),"country-other")!=null)		{
        			countryother = XML.getText(XML.selectOne(this.xml,"user-address"),"country-other");	
        			countryid = XML.getAttribute(XML.selectOne(XML.selectOne(this.xml,"user-address"),"country"),"id");	
        			this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
        		}
        		if((XML.getText(XML.selectOne(this.xml,"user-address"),"country")!=null)||(XML.getAttribute(XML.selectOne(XML.selectOne(this.xml,"user-address"),"country"),"id")!=null))	{
					countryid = XML.getAttribute(XML.selectOne(XML.selectOne(this.xml,"user-address"),"country"),"id");
					this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
					if(XML.getText(XML.selectOne(this.xml,"user-address"),"country-other")!=null)
        				countryother = XML.getText(XML.selectOne(this.xml,"user-address"),"country-other");	
        			else
						countryother = '';
					var lRequest = MB.getRegionsOfCountryTemplate();
	        		XML.setAttribute(XML.selectOne(lRequest,"region"),"country-id",countryid);
	        		//alert("lreqeust\n"+XML.toString(lRequest))
	        		var lResponse = MB.getRegionsOfCountry(lRequest);
	        		//alert("lresponse\n"+XML.toString(lResponse))
	        		if(MB.isSuccess(lResponse))	{
	        			this.mRegionsXml = MB.getResponseDetails(lResponse);
					}else	{
						alert(MB.ERROR_ADDRESS_ENTRY_REGIONLIST);
					}
				} 
        		if(XML.getText(XML.selectOne(this.xml,"user-address"),"region-other")!=null)	{ 
        			state = XML.getText(XML.selectOne(this.xml,"user-address"),"region-other");	
        			prevstate = XML.getText(XML.selectOne(this.xml,"user-address"),"region");
        			if(this.mSelectedState == null)
	        			this.mSelectedState = XML.getText(XML.selectOne(this.xml,"user-address"),"region");
        		}else if(XML.getText(XML.selectOne(this.xml,"user-address"),"region")!=null) {
        			prevstate = XML.getText(XML.selectOne(this.xml,"user-address"),"region");
        			if(this.mSelectedState == null)
     		   			this.mSelectedState = XML.getText(XML.selectOne(this.xml,"user-address"),"region");	
        		}
        		if(XML.getText(XML.selectOne(this.xml,"user-address"),"postal-code")!=null) 
        			zipcode = XML.getText(XML.selectOne(this.xml,"user-address"),"postal-code");	
        		else
        			zipcode = '';
        		if(XML.getText(XML.selectOne(this.xml,"user-address"),"city")!=null) 
        			city = XML.getText(XML.selectOne(this.xml,"user-address"),"city");	
        		else
        			city = '';
        		if(XML.getText(XML.selectOne(this.xml,"user-address"),"address-1")!=null) 
        			address = XML.getText(XML.selectOne(this.xml,"user-address"),"address-1");	
        		else
        			address = '';
        		
        		htmlStr = '<TABLE cellpadding=0 cellspacing=0  border=0 width=450 class="mbCss-form"><TBODY><TR><TH width=153>Country</TH><TD width=10></TD><TD width=287>';
        		if(XML.getText(this.xml,"country-other")!=null)
						htmlStr += '<DIV style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 10px; PADDING-BOTTOM: 3px; BORDER-LEFT: 1px solid; COLOR: #cc0000; PADDING-TOP: 3px; BORDER-BOTTOM: 1px solid; width=470px">';
						
				htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" name="country" id="country" tabindex=12 onChange="doChange(this)">';
				var lCountries = XML.select(this.mCountryXml,"country")		
				for(var i=0;i<lCountries.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lCountries[i],"id")+'" '+(XML.getAttribute(lCountries[i],"id")==XML.getAttribute(this.mSelectedCountry,"id")?"selected":"")+'>'+XML.getText(lCountries[i],"name")+'</OPTION>';
				}
				htmlStr += '</SELECT>';
				
				if(XML.getText(this.mSelectedCountry,"name")=="Other")
					htmlStr += ' <INPUT class="medium"  name="countryother" id="countryother" tabindex=13 value="'+countryother+'">';
				if(XML.getText(this.xml,"country-other")!=null)
					htmlStr += '<BR>'+XML.getText(this.xml,"country-other")+'</DIV>';	
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+'</TH><TD></TD><TD>'
					if(XML.getText(this.xml,"region-other")!=null)
								htmlStr += '<DIV style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 10px; PADDING-BOTTOM: 3px; BORDER-LEFT: 1px solid; COLOR: #cc0000; PADDING-TOP: 3px; BORDER-BOTTOM: 1px solid; width=470px">';
					if(XML.getText(this.mSelectedCountry,"name")!="Other")	{
						var lRegions = XML.select(XML.selectOne(this.mRegionsXml,"regions"),"region")		
        				if(XML.getText(lRegions[0],"name")!=null)	{
        					htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide"  name="state" id="state" tabindex=14 onChange="doChange(this)">'
							for(var i=0;i<lRegions.length;i++)	{
								htmlStr += '<OPTION value="'+XML.getAttribute(lRegions[i],"id")+":"+XML.getText(lRegions[i],"name")+'" '+(XML.getText(lRegions[i],"name")==this.mSelectedState?"selected":"")+'>'+XML.getText(lRegions[i],"name")+'</OPTION>';
							}
							htmlStr	+= '</SELECT>';
						}
					}
					if((this.mSelectedState=="Other")||(XML.getText(this.mSelectedCountry,"name")=="Other")||(XML.getAttribute(lRegions[0],"id")==null))	{
						if(this.mSelectedState=="Other")	{
							htmlStr += ' ';
						}
						htmlStr += '<INPUT class="medium"  name="stateother" id="stateother" tabindex=15 value="'+state+'">';	
					}
					if(XML.getText(this.xml,"region-other")!=null)
							htmlStr += '<BR>'+XML.getText(this.xml,"region-other")+'</DIV>';
						
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City </TH><TD></TD><TD>';
	       		if(XML.getText(this.xml,"city")!=null)
					htmlStr += '<DIV class="mbCss-error"><INPUT class="medium"  name="city" id="city" tabindex=16  value="'+city+'"> <BR>'+XML.getText(this.xml,"city")+'</DIV>';
				else
					htmlStr += '<INPUT class="medium"  name="city" id="city" tabindex=16  value="'+city+'">'
				htmlStr += '</TD></TR>';
	       		htmlStr	+= '<TR><TH>Street Address</TH><TD></TD><TD>';
	       		if(XML.getText(this.xml,"address-1")!=null)
					htmlStr += '<DIV class="mbCss-error">';
				htmlStr	+= '<TEXTAREA style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" rows="3"  name="address" id="address" tabindex=17>'+address+'</TEXTAREA>';
				if(XML.getText(this.xml,"address-1")!=null)
					htmlStr += '<BR>'+XML.getText(this.xml,"address-1")+'</DIV>';
				htmlStr	+= '</TD></TR>';			       	
				if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+'</TH><TD></TD><TD>';
	       		    if(XML.getText(this.xml,"postal-code")!=null)
	       		    	htmlStr += '<DIV class="mbCss-error"><INPUT class="medium"  name="zipcode" id="zipcode" tabindex=18  value="'+zipcode+'"><BR>'+XML.getText(this.xml,"postal-code")+'</DIV>'
	       		    else
	       		    	htmlStr += '<INPUT class="medium"  name="zipcode" id="zipcode" tabindex=18  value="'+zipcode+'">'
	       		    htmlStr += '</TD></TR>';
				}
				htmlStr += '</TBODY></TABLE>';
				
				this.xml = null;
				return htmlStr;
        	      	
        	case 'SelectedCountry':
        		htmlStr = '<TABLE cellSpacing=0 cellPadding=0 width=450  border=0 class="mbCss-form"><TBODY><TR><TH width=153>Country</TH><TD width=10></TD><TD width=287>'
						+ '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" name="country" id="country" tabindex=12 onChange="doChange(this)">';
				var lCountries = XML.select(this.mCountryXml,"country")		
				for(var i=0;i<lCountries.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lCountries[i],"id")+'" '+(XML.getAttribute(lCountries[i],"id")==XML.getAttribute(this.mSelectedCountry,"id")?"selected":"")+'>'+XML.getText(lCountries[i],"name")+'</OPTION>';
				}
				htmlStr += '</SELECT>';
				
				if(XML.getText(this.mSelectedCountry,"name")=="Other")
					htmlStr += ' <INPUT class="medium"  name="countryother" id="countryother" tabindex=13 value="enter country">';
					
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+'</TH><TD></TD><TD>'
					if(XML.getText(this.mSelectedCountry,"name")!="Other")	{
						var lRegions = XML.select(XML.selectOne(this.mRegionsXml,"regions"),"region")		
        				if(XML.getText(lRegions[0],"name")!=null)	{
	        				htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide"  name="state" id="state" tabindex=14 onChange="doChange(this)">'
							for(var i=0;i<lRegions.length;i++)	{
								htmlStr += '<OPTION value="'+XML.getAttribute(lRegions[i],"id")+":"+XML.getText(lRegions[i],"name")+'" '+(XML.getText(lRegions[i],"name")==this.mSelectedState?"selected":"")+'>'+XML.getText(lRegions[i],"name")+'</OPTION>';
							}
							htmlStr	+= '</SELECT>';
						}
					}
					if((this.mSelectedState=="Other")||(XML.getText(this.mSelectedCountry,"name")=="Other")||(XML.getAttribute(lRegions[0],"id")==null))	{
						if(this.mSelectedState=="Other")	{
							htmlStr += ' ';
						}
						htmlStr += '<INPUT class="medium"  name="stateother" id="stateother" tabindex=15 value="enter '+XML.getText(this.mSelectedCountry,"region-label")+'">';
					}
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City</TH><TD></TD><TD><INPUT class="medium"  name="city" id="city" tabindex=16 value="'+(getDocElementById("city")!=null?document.joinnow1.city.value:"")+'" ></TD></TR>';
	       		if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    	htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+'</TH><TD></TD><TD><INPUT class="medium"  name="zipcode" id="zipcode" tabindex=17  value="'+(getDocElementById("zipcode")!=null?document.joinnow1.zipcode.value:"")+'" ></TD>';
				}
				htmlStr	+= '<TR><TH>Street Address</TH><TD></TD>'
				    	+ '<TD><TEXTAREA style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" rows="3"  name="address" id="address" tabindex=18>'+(getDocElementById("address")!=null?document.joinnow1.address.value:"")+'</TEXTAREA></TD></TR>'			       	
				    	+ '</TBODY> </TABLE>';

				return htmlStr;
        }
    }
    
	    
    this.addCardType = function _addCardType(pAddressType)	{	
		var htmlStr = '';
    	switch(pAddressType)	{
		
			case 'common':
				var countryid = '';
				var countryother = '';
        		var state = ''; 
        		var zipcode = '';
        		var city = '';
        		var address = '';
        		
        		if(XML.getText(this.xml,"country-other")!=null)		{
        			countryother = XML.getText(this.xml,"country-other");	
        			countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");	
        			this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
        			
        		}else if((XML.getText(this.xml,"country")!=null)||(XML.getAttribute(XML.selectOne(this.xml,"country"),"id")!=null))	{
					countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");
					this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
					countryother = '';
				} 
        		if(XML.getText(this.xml,"region-other")!=null)	{ 
        			state = XML.getText(this.xml,"region-other");	
        			if(this.mSelectedState == null)
	        			this.mSelectedState = XML.getText(this.xml,"region");
        		}else if(XML.getText(this.xml,"region")!=null) {
        			if(this.mSelectedState == null)
     		   			this.mSelectedState = XML.getText(this.xml,"region");	
        		}
        		if(XML.getText(this.xml,"postal-code")!=null) 
        			zipcode = XML.getText(this.xml,"postal-code");	
        		else
        			zipcode = '';
        		if(XML.getText(this.xml,"city")!=null) 
        			city = XML.getText(this.xml,"city");	
        		else
        			city = '';
        		if(XML.getText(this.xml,"address-1")!=null) 
        			address = XML.getText(this.xml,"address-1");	
        		else
        			address = '';
        		
        		htmlStr = '<TABLE cellpadding=0 cellspacing=0  border=0 width=450><TBODY><TR><TH>Country <SPAN class="mbCss-ast">*</SPAN></TH><TD>';
        		if(XML.getText(XML.selectOne(this.xml,"error-xml"),"country-other")!=null)
						htmlStr += '<DIV style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 11px; PADDING-BOTTOM: 3px; BORDER-LEFT: 1px solid; COLOR: #cc0000; PADDING-TOP: 3px; BORDER-BOTTOM: 1px solid; width=470px">';
				htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" name="country" id="country" tabindex=12 onChange="doChange(this)">';
				var lCountries = XML.select(this.mCountryXml,"country")		
				for(var i=0;i<lCountries.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lCountries[i],"id")+'" '+(XML.getAttribute(lCountries[i],"id")==XML.getAttribute(this.mSelectedCountry,"id")?"selected":"")+'>'+XML.getText(lCountries[i],"name")+'</OPTION>';
				}
				htmlStr += '</SELECT>';
				
				if(XML.getText(this.mSelectedCountry,"name")=="Other")
					htmlStr += ' <INPUT class="medium"  name="countryother" id="countryother" tabindex=13 value="'+countryother+'">';
				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"country-other")!=null)
					htmlStr += '<BR>'+XML.getText(XML.selectOne(this.xml,"error-xml"),"country-other")+'</DIV>';	
					
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+' <SPAN class="mbCss-ast">*</SPAN></TH><TD>'
					if(XML.getText(XML.selectOne(this.xml,"error-xml"),"region-other")!=null)
						htmlStr += '<DIV style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 11px; PADDING-BOTTOM: 3px; BORDER-LEFT: 1px solid; COLOR: #cc0000; PADDING-TOP: 3px; BORDER-BOTTOM: 1px solid; width=470px">';
					if(XML.getText(this.mSelectedCountry,"name")!="Other")	{
						var lRegions = XML.select(XML.selectOne(this.mRegionsXml,"regions"),"region")		
        				if(XML.getText(lRegions[0],"name")!=null)	{
	        				htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide"  name="state" id="state" tabindex=14 onChange="doChange(this)">'
							for(var i=0;i<lRegions.length;i++)	{
								htmlStr += '<OPTION value="'+XML.getAttribute(lRegions[i],"id")+":"+XML.getText(lRegions[i],"name")+'" '+(XML.getText(lRegions[i],"name")==this.mSelectedState?"selected":"")+'>'+XML.getText(lRegions[i],"name")+'</OPTION>';
							}
							htmlStr	+= '</SELECT>';
						}
					}
					if((this.mSelectedState=="Other")||(XML.getText(this.mSelectedCountry,"name")=="Other")||(XML.getAttribute(lRegions[0],"id")==null))	{
						if(this.mSelectedState=="Other")	{
							htmlStr += ' ';
						}
						htmlStr += '<INPUT class="medium"  name="stateother" id="stateother" tabindex=15 value="'+state+'">';
					}
					if(XML.getText(XML.selectOne(this.xml,"error-xml"),"region-other")!=null)
						htmlStr += '<BR>'+XML.getText(XML.selectOne(this.xml,"error-xml"),"region-other")+'</DIV>';
					
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City '+(XML.getText(this.xml,"type")=="add-card"?"<SPAN class=\"mbCss-ast\">*</SPAN>":"")+'</TH><TD>';
	       		if(XML.getText(XML.selectOne(this.xml,"error-xml"),"city")!=null)
					htmlStr += '<DIV class="mbCss-error">';
				htmlStr += '<INPUT class="medium"  name="city" id="city" tabindex=16  value="'+city+'">';
				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"city")!=null)
					htmlStr += ''+XML.getText(XML.selectOne(this.xml,"error-xml"),"city")+'</DIV>';
	       		htmlStr += '</TD></TR>';
	       		htmlStr	+= '<TR><TH>Street Address '+(XML.getText(this.xml,"type")=="add-card"?"<SPAN class=\"mbCss-ast\">*</SPAN>":"")+'</TH><TD>';
	       		if(XML.getText(XML.selectOne(this.xml,"error-xml"),"address-1")!=null)
					htmlStr += '<DIV class="mbCss-error">';
				htmlStr += '<TEXTAREA style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" rows="3"  name="address" id="address" tabindex=17>'+address+'</TEXTAREA>';
				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"address-1")!=null)
					htmlStr += ''+XML.getText(XML.selectOne(this.xml,"error-xml"),"address-1")+'</DIV>';
				htmlStr += '</TD></TR>';			       	
				if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    	htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+'</TH><TD>'
	       				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"postal-code")!=null)
							htmlStr += '<DIV class="mbCss-error">';
				    	htmlStr += '<INPUT class="medium"  name="zipcode" id="zipcode" tabindex=18  value="'+zipcode+'">';
				    	if(XML.getText(XML.selectOne(this.xml,"error-xml"),"postal-code")!=null)
							htmlStr += ''+XML.getText(XML.selectOne(this.xml,"error-xml"),"postal-code")+'</DIV>';
				    	htmlStr += '</TD></TR>';
				}
				htmlStr += '</TBODY></TABLE>';
				return htmlStr;
        	
        	
        	case 'SelectedCountry':
        	
        		htmlStr = '<TABLE cellpadding=3 cellspacing=0  border=0 width=700><TBODY><TR><TH>Country <SPAN class="mbCss-ast">*</SPAN></TH><TD>'
						+ '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" name="country" id="country" tabindex=12 onChange="doChange(this)">';
				var lCountries = XML.select(this.mCountryXml,"country")		
				for(var i=0;i<lCountries.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lCountries[i],"id")+'" '+(XML.getAttribute(lCountries[i],"id")==XML.getAttribute(this.mSelectedCountry,"id")?"selected":"")+'>'+XML.getText(lCountries[i],"name")+'</OPTION>';
				}
				htmlStr += '</SELECT>';
				
				if(XML.getText(this.mSelectedCountry,"name")=="Other")
					htmlStr += ' <INPUT class="medium"  name="countryother" id="countryother" tabindex=13 value="enter country">';
					
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+' <SPAN class="mbCss-ast">*</SPAN></TH><TD>'
					if(XML.getText(this.mSelectedCountry,"name")!="Other")	{
						var lRegions = XML.select(XML.selectOne(this.mRegionsXml,"regions"),"region")		
        				if(XML.getText(lRegions[0],"name")!=null)	{
	        				htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide"  name="state" id="state" tabindex=14 onChange="doChange(this)">'
							for(var i=0;i<lRegions.length;i++)	{
								htmlStr += '<OPTION value="'+XML.getAttribute(lRegions[i],"id")+":"+XML.getText(lRegions[i],"name")+'" '+(XML.getText(lRegions[i],"name")==this.mSelectedState?"selected":"")+'>'+XML.getText(lRegions[i],"name")+'</OPTION>';
							}
							htmlStr	+= '</SELECT>';
						}
					}
					if((this.mSelectedState=="Other")||(XML.getText(this.mSelectedCountry,"name")=="Other")||(XML.getAttribute(lRegions[0],"id")==null))	{
						if(this.mSelectedState=="Other")	{
							htmlStr += ' ';
						}
						htmlStr += '<INPUT class="medium"  name="stateother" id="stateother" tabindex=15 value="enter '+XML.getText(this.mSelectedCountry,"region-label")+'">';
					}
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City '+(XML.getText(this.xml,"type")=="add-card"?"<SPAN class=\"mbCss-ast\">*</SPAN>":"")+'</TH><TD><INPUT class="medium"  name="city" id="city" tabindex=16 ></TD></TR>';
	       		htmlStr	+= '<TR><TH>Street Address '+(XML.getText(this.xml,"type")=="add-card"?"<SPAN class=\"mbCss-ast\">*</SPAN>":"")+'</TH>'
				    	+ '<TD><TEXTAREA style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" rows="3"  name="address" id="address" tabindex=17></TEXTAREA></TD></TR>';			       	
				if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    	htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+'</TH><TD><INPUT class="medium"  name="zipcode" id="zipcode" tabindex=18 ></TD></TR>';
				}
				htmlStr += '</TBODY> </TABLE>';

				return htmlStr;
    	}
    }
	this.bankWireWithDrawalType = function _bankWireWithDrawalType(pAddressType)	{	
		var htmlStr = '';
    	switch(pAddressType)	{
		
			case 'common':
				var countryid = '';
				var countryother = '';
        		var state = ''; 
        		var zipcode = '';
        		var city = '';
        		var address = '';
        		
        		if(XML.getText(this.xml,"country-other")!=null)		{
        			countryother = XML.getText(this.xml,"country-other");	
        			countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");	
        			this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
        			
        		}else if((XML.getText(this.xml,"country")!=null)||(XML.getAttribute(XML.selectOne(this.xml,"country"),"id")!=null))	{
					countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");
					this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
					countryother = '';
				} 
        		if(XML.getText(this.xml,"region-other")!=null)	{ 
        			state = XML.getText(this.xml,"region-other");	
        			if(this.mSelectedState == null)
	        			this.mSelectedState = XML.getText(this.xml,"region");
        		}else if(XML.getText(this.xml,"region")!=null) {
        			if(this.mSelectedState == null)
     		   			this.mSelectedState = XML.getText(this.xml,"region");	
        		}
        		if(XML.getText(this.xml,"postal-code")!=null) 
        			zipcode = XML.getText(this.xml,"postal-code");	
        		else
        			zipcode = '';
        		if(XML.getText(this.xml,"city")!=null) 
        			city = XML.getText(this.xml,"city");	
        		else
        			city = '';
        		if(XML.getText(this.xml,"address-1")!=null) 
        			address = XML.getText(this.xml,"address-1");	
        		else
        			address = '';
        		
        		htmlStr = '<TABLE cellpadding=0 cellspacing=0  border=0 width=450><TBODY><TR><TH width=153>Country</TH><TD width=10></TD><TD width=287>';
        		if(XML.getText(XML.selectOne(this.xml,"error-xml"),"country-other")!=null)
						htmlStr += '<DIV style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 11px; PADDING-BOTTOM: 3px; BORDER-LEFT: 1px solid; COLOR: #cc0000; PADDING-TOP: 3px; BORDER-BOTTOM: 1px solid; width=470px">';
        		htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" name="country" id="country" tabindex=12 onChange="doChange(this)">';
				var lCountries = XML.select(this.mCountryXml,"country")		
				for(var i=0;i<lCountries.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lCountries[i],"id")+'" '+(XML.getAttribute(lCountries[i],"id")==XML.getAttribute(this.mSelectedCountry,"id")?"selected":"")+'>'+XML.getText(lCountries[i],"name")+'</OPTION>';
				}
				htmlStr += '</SELECT>';
				
				if(XML.getText(this.mSelectedCountry,"name")=="Other")
					htmlStr += ' <INPUT class="medium"  name="countryother" id="countryother" tabindex=13 value="'+countryother+'">';
				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"country-other")!=null)
					htmlStr += '<BR>'+XML.getText(XML.selectOne(this.xml,"error-xml"),"country-other")+'</DIV>';	
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+'</TH><TD></TD><TD>';
					if(XML.getText(XML.selectOne(this.xml,"error-xml"),"region-other")!=null)
						htmlStr += '<DIV style="BORDER-RIGHT: 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 11px; PADDING-BOTTOM: 3px; BORDER-LEFT: 1px solid; COLOR: #cc0000; PADDING-TOP: 3px; BORDER-BOTTOM: 1px solid; width=470px">';
					if(XML.getText(this.mSelectedCountry,"name")!="Other")	{
						var lRegions = XML.select(XML.selectOne(this.mRegionsXml,"regions"),"region")		
        				if(XML.getText(lRegions[0],"name")!=null)	{
	        				htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide"  name="state" id="state" tabindex=14 onChange="doChange(this)">'
							for(var i=0;i<lRegions.length;i++)	{
								htmlStr += '<OPTION value="'+XML.getAttribute(lRegions[i],"id")+":"+XML.getText(lRegions[i],"name")+'" '+(XML.getText(lRegions[i],"name")==this.mSelectedState?"selected":"")+'>'+XML.getText(lRegions[i],"name")+'</OPTION>';
							}
							htmlStr	+= '</SELECT>';
						}
						
					}
					if((this.mSelectedState=="Other")||(XML.getText(this.mSelectedCountry,"name")=="Other")||(XML.getAttribute(lRegions[0],"id")==null))	{
						if(this.mSelectedState=="Other")	{
							htmlStr += ' ';
						}
						htmlStr += '<INPUT class="medium"  name="stateother" id="stateother" tabindex=15 value="'+state+'">';
					}
					if(XML.getText(XML.selectOne(this.xml,"error-xml"),"region-other")!=null)
						htmlStr += '<BR>'+XML.getText(XML.selectOne(this.xml,"error-xml"),"region-other")+'</DIV>';
					
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City</TH><TD></TD><TD>';
	       		if(XML.getText(XML.selectOne(this.xml,"error-xml"),"city")!=null)
					htmlStr += '<DIV class="mbCss-error">';
				htmlStr += '<INPUT class="medium"  name="city" id="city" tabindex=16  value="'+city+'">';
				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"city")!=null)
					htmlStr += ' '+XML.getText(XML.selectOne(this.xml,"error-xml"),"city")+'</DIV>';
	       		htmlStr += '</TD></TR>';
	       		htmlStr	+= '<TR><TH>Street Address</TH><TD></TD><TD>'
	       		if(XML.getText(XML.selectOne(this.xml,"error-xml"),"address-1")!=null)
					htmlStr += '<DIV class="mbCss-error">';
				htmlStr	+= '<TEXTAREA style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" rows="3"  name="address" id="address" tabindex=17>'+address+'</TEXTAREA>';
				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"address-1")!=null)
					htmlStr += ' '+XML.getText(XML.selectOne(this.xml,"error-xml"),"address-1")+'</DIV>';
				htmlStr	+= '</TD></TR>';			       	
				if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    	htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+'</TH><TD></TD><TD>'
	       				if(XML.getText(XML.selectOne(this.xml,"error-xml"),"postal-code")!=null)
							htmlStr += '<DIV class="mbCss-error">';
				    	htmlStr += '<INPUT class="medium" name="zipcode" id="zipcode" tabindex=18  value="'+zipcode+'">';
				    	if(XML.getText(XML.selectOne(this.xml,"error-xml"),"postal-code")!=null)
							htmlStr += ' '+XML.getText(XML.selectOne(this.xml,"error-xml"),"postal-code")+'</DIV>';
				    	htmlStr += '</TD></TR>';
				}
				htmlStr += '</TBODY></TABLE>';
				return htmlStr;
        		
        	case 'SelectedCountry':
        	
        		htmlStr = '<TABLE cellpadding=0 cellspacing=0  border=0 width=450><TBODY><TR><TH width=153>Country</TH><TD width=10></TD><TD width=287>'
						+ '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" name="country" id="country" tabindex=12 onChange="doChange(this)">';
				var lCountries = XML.select(this.mCountryXml,"country")		
				for(var i=0;i<lCountries.length;i++)	{
					htmlStr += '<OPTION value="'+XML.getAttribute(lCountries[i],"id")+'" '+(XML.getAttribute(lCountries[i],"id")==XML.getAttribute(this.mSelectedCountry,"id")?"selected":"")+'>'+XML.getText(lCountries[i],"name")+'</OPTION>';
				}
				htmlStr += '</SELECT>';
				
				if(XML.getText(this.mSelectedCountry,"name")=="Other")
					htmlStr += ' <INPUT class="medium"  name="countryother" id="countryother" tabindex=13 value="enter country">';
					
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+'</TH><TD></TD><TD>'
					if(XML.getText(this.mSelectedCountry,"name")!="Other")	{
						var lRegions = XML.select(XML.selectOne(this.mRegionsXml,"regions"),"region")		
        				if(XML.getText(lRegions[0],"name")!=null)	{
	        				htmlStr += '<SELECT style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide"  name="state" id="state" tabindex=14 onChange="doChange(this)">'
							for(var i=0;i<lRegions.length;i++)	{
								htmlStr += '<OPTION value="'+XML.getAttribute(lRegions[i],"id")+":"+XML.getText(lRegions[i],"name")+'" '+(XML.getText(lRegions[i],"name")==this.mSelectedState?"selected":"")+'>'+XML.getText(lRegions[i],"name")+'</OPTION>';
							}
							htmlStr	+= '</SELECT>';
						}
					}
					if((this.mSelectedState=="Other")||(XML.getText(this.mSelectedCountry,"name")=="Other")||(XML.getAttribute(lRegions[0],"id")==null))	{
						if(this.mSelectedState=="Other")	{
							htmlStr += ' ';
						}
						htmlStr += '<INPUT class="medium"  name="stateother" id="stateother" tabindex=15 value="enter '+XML.getText(this.mSelectedCountry,"region-label")+'">';
					}
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City</TH><TD></TD><TD><INPUT class="medium"  name="city" id="city" tabindex=16 ></TD></TR>';
	       		htmlStr	+= '<TR><TH>Street Address</TH><TD></TD>'
				    	+ '<TD><TEXTAREA style="font-family: Arial,Verdana, sans-serif; font-size: 11px;" class="wide" rows="3"  name="address" id="address" tabindex=17></TEXTAREA></TD></TR>';			       	
				if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    	htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+'</TH><TD></TD><TD><INPUT class="medium"  name="zipcode" id="zipcode" tabindex=18 ></TD></TR>';
				}
				htmlStr += '</TBODY> </TABLE>';

				return htmlStr;
    	}
    }
    
    this.deleteCardType = function _deleteCardType(pAddressType)	{
		var htmlStr = '';
    	switch(pAddressType)	{
		
			case 'common':
				var countryid = '';
				var countryother = '';
        		var state = ''; 
        		var zipcode = '';
        		var city = '';
        		var address = '';
        		
        		if(XML.getText(this.xml,"country-other")!=null)		{
        			countryother = XML.getText(this.xml,"country-other");	
        			countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");	
        			this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
        			
        		}else if((XML.getText(this.xml,"country")!=null)||(XML.getAttribute(XML.selectOne(this.xml,"country"),"id")!=null))	{
					countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");
					this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
					countryother = XML.getText(this.mSelectedCountry,"name");
				} 
        		if(XML.getText(this.xml,"region-other")!=null)	{ 
        			state = XML.getText(this.xml,"region-other");	
        			if(this.mSelectedState == null)
	        			this.mSelectedState = XML.getText(this.xml,"region");
        		}else if(XML.getText(this.xml,"region")!=null) {
        			state = XML.getText(this.xml,"region");
        		}
        		if(XML.getText(this.xml,"postal-code")!=null) 
        			zipcode = XML.getText(this.xml,"postal-code");	
        		else
        			zipcode = '';
        		if(XML.getText(this.xml,"city")!=null) 
        			city = XML.getText(this.xml,"city");	
        		else
        			city = '';
        		if(XML.getText(this.xml,"address-1")!=null) 
        			address = XML.getText(this.xml,"address-1");	
        		else
        			address = '';
        		
        		htmlStr = '<TABLE '+this.mableSpec+'><TBODY><TR><TH width=153>Country</TH><TD width=10></TD><TD width=287 class="mbcss-text">';
				if(countryother!="")	
					htmlStr += countryother;
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+(XML.getText(this.mSelectedCountry,"is-region-required")=="Y"?"*":"")+'</TH><TD class="mbcss-text">'
							+ state;
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City</TH><TD class="mbcss-text">'+city+'</TD></TR>';
	       		if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    	htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+(XML.getText(this.mSelectedCountry,"is-postal-code-required")=="Y"?"*":"")+'</TH><TD class="mbcss-text">'+zipcode+'</TD>';
				}
				htmlStr	+= '<TR><TH>Street Address</TH>'
				    	+ '<TD class="mbcss-text">'+address+'</TD></TR>'			       	+ '</TBODY> </TABLE>';
				return htmlStr;
        	
   		}
   	}
   	this.bankCheckType = function _bankCheckType(pAddressType)	{
		var htmlStr = '';
    	switch(pAddressType)	{
		
			case 'common':
				var countryid = '';
				var countryother = '';
        		var state = ''; 
        		var zipcode = '';
        		var city = '';
        		var address = '';
        		
        		if(XML.getText(this.xml,"country-other")!=null)		{
        			countryother = XML.getText(this.xml,"country-other");	
        			countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");	
        			this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
        			
        		}else if((XML.getText(this.xml,"country")!=null)||(XML.getAttribute(XML.selectOne(this.xml,"country"),"id")!=null))	{
					countryid = XML.getAttribute(XML.selectOne(this.xml,"country"),"id");
					this.mSelectedCountry = XML.selectById(this.mCountryXml,countryid);
					countryother = XML.getText(this.mSelectedCountry,"name");
				} 
        		if(XML.getText(this.xml,"region-other")!=null)	{ 
        			state = XML.getText(this.xml,"region-other");	
        			if(this.mSelectedState == null)
	        			this.mSelectedState = XML.getText(this.xml,"region");
        		}else if(XML.getText(this.xml,"region")!=null) {
        			state = XML.getText(this.xml,"region");
        		}
        		if(XML.getText(this.xml,"postal-code")!=null) 
        			zipcode = XML.getText(this.xml,"postal-code");	
        		else
        			zipcode = '';
        		if(XML.getText(this.xml,"city")!=null) 
        			city = XML.getText(this.xml,"city");	
        		else
        			city = '';
        		if(XML.getText(this.xml,"address-1")!=null) 
        			address = XML.getText(this.xml,"address-1");	
        		else
        			address = '';
        		
        		htmlStr = '<TABLE '+this.mTableSpec+'><TBODY><TR><TH width=153>Country</TH><TD width=10></TD><TD width=287>';
				if(countryother!="")	
					htmlStr += countryother;
				htmlStr += '</TD></TR>';
				if(XML.getText(this.mSelectedCountry,"region-label")!=null)	{
					htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"region-label")+(XML.getText(this.mSelectedCountry,"is-region-required")=="Y"?"*":"")+'</TH><TD></TD><TD>'
							+ state;
				}
				htmlStr	+= '</TD></TR>';
	       		htmlStr += '<TR><TH>City</TH><TD></TD><TD>'+city+'</TD></TR>';
	       		if(XML.getText(this.mSelectedCountry,"postal-code-label")!=null)	{
	       		    	htmlStr += '<TR><TH>'+XML.getText(this.mSelectedCountry,"postal-code-label")+(XML.getText(this.mSelectedCountry,"is-postal-code-required")=="Y"?"*":"")+'</TH><TD></TD><TD>'+zipcode+'</TD>';
				}
				htmlStr	+= '<TR><TH>Street Address</TH><TD></TD>'
				    	+ '<TD>'+address+'</TD></TR>'			       	+ '</TBODY> </TABLE>';
				return htmlStr;
        	
   		}
   		
    }
    
function checkCity()	{
	textvalue = getDocElementById("city").value;
	//alert("textvalue : "+textvalue)
	if(citySpace(textvalue))	{
		alert(MB.MESSAGE_INVALID_WHITE_CHARCTERS);
		getDocElementById("zipcode").focus();
		getDocElementById("city").focus();
	}
}  

function checkZipCode()	{
	textvalue = getDocElementById("zipcode").value;
	if(numberCode(textvalue))	{
		alert(MB.MESSAGE_INVALID_ZIP_CODE);
		getDocElementById("city").focus();
		getDocElementById("zipcode").focus();
	}
}

function numberCode(check)	{
	var space = ".,/<>?!`';:@#$%^&*()=+|[]{}_~" + '"' + "\\";
	for(var i=0;i<check.length;i++)	{
		for(var j=0;j<space.length;j++)	{
			if(check.charAt(i) == space.charAt(j)) return true;
		}
	}
	return false;		
}//function
  
function citySpace(check)	{
	var space = ".,/<>?!`';:@#$%^&*()=-+|[]{}_~0123456789" + '"' + "\\";
	for(var i=0;i<check.length;i++)	{
		for(var j=0;j<space.length;j++)	{
			if(check.charAt(i) == space.charAt(j)) return true;
		}
	}
	return false;	
}//function    

}




handleMachineResponse_CountriesList = function(response) {
	var comp = componentRegistry.getComponent("AddressComponent");

	if(MB.isSuccess(response))	{
		comp.mCountryXml = XML.selectOne(MB.getResponseDetails(response),"countries");
	} else	{
		alert(MB.ERROR_ADDRESS_ENTRY_COUNTRYLIST + ":" + XML.getText(response,"message"));
	}
	var lRequest = MBFactory.getCashRegionsOfCountryTemplate();
	var countryid = XML.getAttribute(XML.selectOne(comp.xml,"country"),"id");
	if(countryid==null) countryid = "1";
	XML.setAttribute(XML.selectOne(lRequest,"region"),"country-id",countryid);
	MB.getCashRegionsOfCountry(comp.id,lRequest,handleMachineResponse_RegionList);
}

handleMachineResponse_RegionList = function(response) {
	var comp = componentRegistry.getComponent("AddressComponent");

	if(MB.isSuccess(response))	{
		comp.mRegionsXml = MB.getResponseDetails(response);
	}else	{
		alert(MB.ERROR_ADDRESS_ENTRY_REGIONLIST);
	}
	comp.mMachineCalled = false;
	comp.repaint();
}

handleMachineResponse_RegionsOfSelected = function(response) {
	var comp = componentRegistry.getComponent("AddressComponent");

	if(MB.isSuccess(response))	{
		comp.mRegionsXml = MB.getResponseDetails(response);
		comp.mAddressType = 'SelectedCountry';
		comp.mMachineCalled = false;
		comp.repaint();
	} else	{
		comp.mRegionsXml = null;
		alert(MB.ERROR_ADDRESS_ENTRY_REGIONLIST + ":" + XML.getText(response,"message"));
		comp.mMachineCalled = false;
	}
}

