		 var ContentLoader = function(url, id, options){
		 this.url = url;
		 this.id = id;
		 this.init = false;
		 this.xmlHttp = false;
		 this.xml = false;
		 this.text = '';
		 this.method = 'get'; //'get' or 'post'
		 this.query = null;
		 this.done = false;
		 this.browser = '';
		 this.responseType = 'text'; //'text' or 'xml'
		 this.callback1 = function(){};
		 this.callback2 = function(){};
		 this.callback3 = function(){};
		 this.callback4 = function(){
		document.getElementById(this.id).innerHTML = this.text;
                loadSelection();   
                toggleStateProvince('main');
                loadGAInfo();
                if(document.getElementById('registrationSegment')){
                	document.getElementById('registrationSegment').value='GCU';
                }  
	 };
	 if (typeof options != 'undefined' ){
		if (typeof options.method != 'undefined' ){
			this.method = options.method;
		}
		if (typeof options.query != 'undefined' ){
			this.query = options.query;
		}
		if (typeof options.responseType != 'undefined' ){
			this.responseType = options.responseType;
		}
		if (typeof options.callback1 != 'undefined' ){
			this.callback1 = options.callback1;
		}
		if (typeof options.callback2 != 'undefined' ){
			this.callback2 = options.callback2;
		}
        if (typeof options.callback3 != 'undefined' ){
			this.callback3 = options.callback3;
		}
         if (typeof options.callback4 != 'undefined' ){
			this.callback4 = options.callback4;
		}
	 }
	 this.setup();
   };
	ContentLoader.prototype.isIe = function(){
		if( this.browser.indexOf("ie") >= 0 ){
			return true;
		}else{
			return false;
		}
	};
	ContentLoader.prototype.setup = function(){
		if (typeof XMLHttpRequest!='undefined')
		{
		     this.xmlHttp = new XMLHttpRequest();
		     if(document.all){
		       this.browser = 'ie'+parseFloat(navigator.appVersion.split('MSIE')[1]);
		     }else{
		       this.browser = 'mozilla';
		     }
		}
		if (!this.xmlHttp && window.ActiveXObject)
		{
		    this.browser = 'ie'+parseFloat(navigator.appVersion.split('MSIE')[1]);
		    try
		    {
			this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		    } catch (e) {
			try
			{
				this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) { this.xmlHttp = false; }
		    }
		}
		var str = this.url;
       if (this.xmlHttp) this.init = true;
	};
	ContentLoader.handler = function( o ){
		var obj = o;
		
		if (obj.xmlHttp.readyState == 1)
		{obj.callback1();
		}else if (obj.xmlHttp.readyState == 2)
		{obj.callback2();
		}else if (obj.xmlHttp.readyState == 3)
		{obj.callback3();
		}else if (obj.xmlHttp.readyState == 4)
		{	
			
			if (obj.xmlHttp.status == 200 || obj.xmlHttp.status == 0) {
				if( obj.responseType == 'text' ){
					obj.text = obj.xmlHttp.responseText;
					
				}else if( obj.responseType == 'xml' ){
					obj.xml = obj.xmlHttp.responseXML;
				}
				
				obj.done = true;
				if(obj.id != '')
				{
					
					var content = document.getElementById(obj.id);
					content.appendChild(toDOM(obj.text));
				}
			    
			}else{ 
				obj.text = obj.xmlHttp.status; 
			}
			
			obj.callback4();
			
		}
		
	};
	ContentLoader.prototype.start = function(){
		if (!this.init) return false;
		
		var me = this;
		try{
			this.xmlHttp.onreadystatechange = function() { ContentLoader.handler(me); }
			if( this.method == 'get' ){
			   this.xmlHttp.open( 'GET', this.url, true );
			   this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-1");
			   this.xmlHttp.send(null);
			}else if( this.method == 'post' ){
			   this.xmlHttp.open( 'POST', this.url, true );
			   this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-1");
               this.xmlHttp.setRequestHeader("Content-length", this.query.length);
               this.xmlHttp.send(this.query);
			  
			}
			
		//retry	
		if( this.xmlHttp.status == 12030 ){
			if( this.method == 'get' ){
			   this.xmlHttp.open( 'GET', this.url, true );
			   this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-1");
			   this.xmlHttp.send(null);
			}else if( this.method == 'post' ){
			   this.xmlHttp.open( 'POST', this.url, true );
			   this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-1");
	       		   this.xmlHttp.setRequestHeader("Content-length", this.query.length);
	       		   this.xmlHttp.send(this.query);			  
			}
		}
		}catch(e){
			
			this.init = false;
		}
};
	function paramsQuery( form ,excluded, excludeBlankValues ){

	   if( typeof excluded == "undefined" ) {
	       excluded = new Array();
	   } 
	
	   if( typeof excludeBlankValues == "undefined" ) {
	       excludeBlankValues = true;
	   } 
	
	   var wArray = paramsQueryArray( form, excluded, excludeBlankValues );
	   var value = '';
	   for ( i = 0; i < wArray.length; i++ ) {
	   		if ( i > 0 ) {
	   			value += '&';
	   		}
	   		// When and if one day we support UTF-8, we should call encodeURIComponent function instead of escape...
	   		if( document.all && !window.opera ){
	   			value += escape(wArray[i][0])+'='+escape(wArray[i][1]);
	   		}else{
	   			value += encodeURIComponent(wArray[i][0])+'='+encodeURIComponent(wArray[i][1]);
	   		}
	   }
	   return value;
   
	}
	
	function createHtml(elementId, html){
		 var content = document.getElementById(elementId);
		 content.appendChild(toDOM(html));
	}
	
	function toDOM(HTMLstring){
	 var d = document.createElement('div');
	 d.innerHTML = HTMLstring.replace(/\r|\n|\r\n/g, "");
	 var docFrag = document.createDocumentFragment();
	 while (d.firstChild) {
	  docFrag.appendChild(d.firstChild)
	 };
 	return docFrag;
	}

	function paramsQueryArray( form ,excluded, excludeBlankValues ){
   

	   if( typeof excludeBlankValues == "undefined" ) {
	       excludeBlankValues = true;
	   } 
	   
	   var elems = form.elements;
	   var params = new Array();
	   for ( i = 0; i < elems.length; i++ ) {
	   		if( !elems[i].disabled ){
			    if ( elems[i].type == 'textarea' ) {
					if ( elems[i].value.length > 0 || !excludeBlankValues ){
						params.push([elems[i].name,elems[i].value]);
					}
		   		} else if ( elems[i].type == 'text' || elems[i].type == 'hidden' || elems[i].type == 'password' ) {
		   			var isAParam = true;
		   			if( excluded != null ) {
		   				for ( j = 0; j < excluded.length; j++ ) {
		   					if ( elems[i].value == excluded[j] ) {
		   						isAParam = false;
		   					}
		   				}
		   			}
		   			if ( isAParam && ( elems[i].value.length > 0 || !excludeBlankValues ) ) {
		   				params.push([elems[i].name,elems[i].value]);
		   			}
		   		} else if ( elems[i].type == 'radio' || elems[i].type == 'checkbox' ) {
		   			if ( elems[i].checked ) {
				   		params.push([elems[i].name,elems[i].value]);
				   	}
		   		} else if ( elems[i].type == 'select-one'  ){
		   			if ( elems[i].value.length > 0 || !excludeBlankValues ) {
						params.push([elems[i].name,elems[i].value]);
					}
		   		} else if ( elems[i].type == 'select-multiple' ) {
					var opts = elems[i].options;
					for ( j = 0; j < opts.length; j++ ) {
						if ( opts[j].selected ) {
							if ( opts[j].value.length > 0 || !excludeBlankValues ) {
								params.push([elems[i].name,opts[j].value]);
							}
						}
					}
		   		}
	   		}
	   }
	   return params;
	}
	
	
	
		function loadform(url) {
		   cleanup('FormAsyncContentFields'); 
		   var service  =  new ContentLoader(url , 'FormAsyncContentFields' ) ; 
		   service.start();
		   enabledSubmitButton('subbtn'); 
		}
				
		function enabledSubmitButton()
		{
			document.getElementById('subbtn').style.display = 'block';
		}
		
		function submitForm(url, confirmationPage )
		{
			var sendInfos  ;  			
		        document.getElementById('subbtn').style.display = 'none';
                        document.getElementById('processingIndicator').style.display = 'block';
			sendInfos  = new ContentLoader(url,'',{  method:'post', query: paramsQuery( document.mainForm ), responseType : 'text',
				callback4: function(){				
					var response = String(this.text);
					if( response.indexOf('success') != -1 )
					{     
						window.location = confirmationPage;									   
					}
					else{
						cleanup('FormAsyncContentFields');
						createHtml('FormAsyncContentFields', response);
                                                document.getElementById('subbtn').style.display = 'block';
                                                document.getElementById('processingIndicator').style.display = 'none';
						window.location = '#';loadSelection();prepSpecifyText('specifyBox');
						if(document.getElementById('registrationSegment')){
                	                            document.getElementById('registrationSegment').value='GCU';
                                                 }  
					}
				}} );
		   sendInfos.start();
		}
		
		function submitFormWithEmptyFields(url, confirmationPage )
		{
                        toggleStateProvince('main');
			var sendInfos  ;
var wExcluded = new Array();  			
		        document.getElementById('subbtn').style.display = 'none';
                        document.getElementById('processingIndicator').style.display = 'block';
			sendInfos  = new ContentLoader(url,'',{  method:'post', query: paramsQuery( document.mainForm,wExcluded, false ), responseType : 'text',
				callback4: function(){	                                       
					var response = String(this.text);

					if( response.indexOf('success') != -1 )
					{    						
						window.location = confirmationPage;									   
					}
					else{					
						cleanup('FormAsyncContentFields');
						createHtml('FormAsyncContentFields', response);
                                                document.getElementById('subbtn').style.display = 'block';
                                                document.getElementById('processingIndicator').style.display = 'none';
						window.location = '#';
                                                toggleStateProvince('main');loadSelection();
                                                if(document.getElementById('registrationSegment')){
                	                           document.getElementById('registrationSegment').value='GCU';
                                                }  
					}
				}} );
		   sendInfos.start();		
		}
		
		function cleanup(elementId){
			var content = document.getElementById(elementId);
			var child = content.firstChild;
 			while( child != null ){
  				content.removeChild(child);
  				child = content.firstChild;
 			}
		}
		
		function setPhoneNumber() {
	
			var phone1 = document.getElementById('phonePartial1').value;
			var phone2 = document.getElementById('phonePartial2').value;
			var phone3 = document.getElementById('phonePartial3').value;	
			var phoneCompleteFld = document.getElementById('phoneComplete');	
			
			phoneCompleteFld.value = phone1 + phone2 + phone3;
		}
		