/*
	Project:	Bulldog Passport
	Widget:		Code Engine
	Version:	.5
	Author:		Jakob Marsala
	Function:	Create Login & Registration forms and process via Ajax
	Notes:		

*/
	// Create Class Instance -------------------------------------------------------------
	var passport = new bulldogPassport();
    	var bulldogAJAX = new AjaxObject(); 

	// Start Login/Registration Process --------------------------------------------------
	function callBulldog(clientkey,whichform){
		try {
		    var Clientkeyformat = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/	;	
		    if (Clientkeyformat.test(clientkey) == false){
		        passport._processJSError("Error: Invalid BulldogID client configuration.");
		        return false;  		    
		    };
		    passport.clientkey = clientkey;
			if (whichform != '') {
				return passport.start(whichform);
			}else{
				return true;
			}	
		}catch(err){
			passport._processJSError(err.message);
			return false;
		};
	};


	function goLogin(username,pass){
		try{

			return passport.processLogin(username,pass);
		}catch(err){
			passport._processJSError(err.message);
			return false;
		};
	}		

// bulldogPassport Class -----------------------------------------------------------------
	
function bulldogPassport () {
	//create content div
};

// Class Properties

bulldogPassport.prototype.contentdiv;
bulldogPassport.prototype.clientkey;
bulldogPassport.prototype.formname;
bulldogPassport.prototype.languages;
bulldogPassport.prototype.serviceURL = "http://" + location.host + "/api/bulldogid/bulldogProxy.aspx";

	// Passport Values ----------------------------
	bulldogPassport.prototype.username = "";
	bulldogPassport.prototype.password = "";
	bulldogPassport.prototype.lastname = "";
	bulldogPassport.prototype.firstname = "";
	bulldogPassport.prototype.lastname = "";
	bulldogPassport.prototype.email = "";
	bulldogPassport.prototype.company = "";
	bulldogPassport.prototype.industry = "";
	bulldogPassport.prototype.title = "";
	bulldogPassport.prototype.department = "";
	bulldogPassport.prototype.phone = "";
	bulldogPassport.prototype.address = "";
	bulldogPassport.prototype.address2 = "";
	bulldogPassport.prototype.addressline2 = "";
	bulldogPassport.prototype.city = "";
	bulldogPassport.prototype.state = "";
	bulldogPassport.prototype.postalcode = "";
	bulldogPassport.prototype.country = "";
	bulldogPassport.prototype.companyurl = "";
	bulldogPassport.prototype.companysize = "";
	bulldogPassport.prototype.annualrevenue = "";
	bulldogPassport.prototype.postingalias = "";
	bulldogPassport.prototype.optin = "";
	
	
	
	//Form Fields
	bulldogPassport.prototype.fieldusername = "bdid_username";
	bulldogPassport.prototype.fieldpassword = "bdid_password";
	bulldogPassport.prototype.fieldfirstname = "txtFirstName";
	bulldogPassport.prototype.fieldlastname = "txtLastName";
	bulldogPassport.prototype.fieldemail = "txtEmailAddress";
	bulldogPassport.prototype.fieldcompany = "txtCompany";
	bulldogPassport.prototype.fieldindustry = "txtIndustry";
	bulldogPassport.prototype.fieldtitle = "txtTitle";
	bulldogPassport.prototype.fielddepartment = "txtDepartment";
	bulldogPassport.prototype.fieldphone = "txtBusinessPhone";
	bulldogPassport.prototype.fieldaddress = "txtAddress";
	bulldogPassport.prototype.fieldaddress2 = "txtAddressline2";
	bulldogPassport.prototype.fieldaddressline2 = "txtAddressline2";
	bulldogPassport.prototype.fieldcity = "txtCity";
	bulldogPassport.prototype.fieldstate = "txtState";
	bulldogPassport.prototype.fieldpostalcode = "txtPostalCode";
    bulldogPassport.prototype.fieldcountry = "txtCountry";
	bulldogPassport.prototype.fieldcompanyurl = "txtCompanyURL";
	bulldogPassport.prototype.fieldcompanysize = "txtCompanySize";
	bulldogPassport.prototype.fieldannualrevenue = "txtAnnualRevenue";
	bulldogPassport.prototype.fieldpostingalias = "txtPostingAlias";


// Class Methods 

	//startup method
	bulldogPassport.prototype.start = function(whichform) {
		try {
		    switch(whichform){
		        case "registration":
		        	this._getRegistrationForm();
    		        break;
		        
		        case "whatis":
		            this._getWhatIsForm();
		            break;
			
			case "whatisintermec":
		            this._getWhatIsIntermecForm();
		            break;
			
			case "whatisopentext":
		            this._getWhatIsOpenTextForm();
		            break;
			
			
		        case "whatisbizmazing":
		            this._getWhatIsBizmazingForm();
		            break;

		        case "whatiscompasslearning":
		            this._getWhatIsCompassLearningForm();
		            break;


			case "whatishoovers":
		            this._getWhatIsHooversForm();
		            break;
			    
			case "needhelp":
				this._getHelpForm();
				break;
				
			case "forgotpassword":
				this._getPasswordForm();
				break;
				
		        default:
		            this._getLoginForm();
		            break;
		    };
	    	
	    	center(this.contentDiv.firstChild);
		    return true;		

		}catch(err){
			this._processJSError(err.message);
			return false;
		};	
	};

	bulldogPassport.prototype.close = function() {
		try {
			this._destroyContentDiv();
		}catch(err){
		
		};
	};
	
	bulldogPassport.prototype.showRegistration = function() {
		try {
			this._getRegistrationForm();
    		center(this.contentDiv.firstChild);
		    return true;
		}catch(err){
			this._processJSError(err.message);
			return false;
		};	
	};
	
	bulldogPassport.prototype.showPrivacyPolicy = function() {
		try {
			return this._getPrivacyForm();
		}catch(err){
			this._processJSError(err.message);
			return false;
		};	
	};

	bulldogPassport.prototype.showWhatIsThis = function() {
		try {
			return this._getWhatIsForm();
		}catch(err){
			this._processJSError(err.message);
			return false;
		};	
	};

	
	//contentDiv handlers ---------------------------------------------------------------
	bulldogPassport.prototype._createContentDiv = function() {
		try {
			if (this.contentDiv) {
			}else{
				var bulldogDiv =  document.createElement("div");
				bulldogDiv.setAttribute("id","bulldogID");
				document.body.appendChild(bulldogDiv);
				this.contentDiv = bulldogDiv;
				grow(this.contentDiv);	
								
			};
			
			return true;
		
		}catch(err){
			this._processJSError(err.message);
			return false;
		};
	};
	
	bulldogPassport.prototype._destroyContentDiv = function() {
		try {
		
			document.body.removeChild(this.contentDiv);
			this.contentDiv = null;
		
		}catch(err){
			this._processJSError(err.message);
			return false;
		};
	};
	
	bulldogPassport.prototype._postToForm = function() {
	    try {
	    
	     	if (document.getElementsByName(this.fieldfirstname).length > 0) { 
	     	        if(document.getElementsByName(this.fieldfirstname).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldfirstname).item(0).value = this.firstname; 
	     	        };
	     	};
	     	
	     	if (document.getElementsByName(this.fieldlastname).length > 0) { 
	     	        if(document.getElementsByName(this.fieldlastname).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldlastname).item(0).value = this.lastname; 
	     	        };
	     	};
	
	     	if (document.getElementsByName(this.fieldemail).length > 0) { 
	     	        if(document.getElementsByName(this.fieldemail).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldemail).item(0).value = this.email; 
	     	        };
	     	};
	
	    	if (document.getElementsByName(this.fieldcompany).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcompany).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldcompany).item(0).value = this.company; 
	     	        };
	     	};
	
			if (document.getElementsByName(this.fieldindustry).length > 0) { 
	     	        if(document.getElementsByName(this.fieldindustry).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldindustry).item(0).value = this.industry; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldindustry).item(0).tagName.toUpperCase() == "SELECT"){
                        for (var k=0;k<document.getElementsByName(this.fieldindustry).item(0).length;k++) {
	      	                if(document.getElementsByName(this.fieldindustry).item(0).options[k].text.toLowerCase() == this.industry.toLowerCase()) {
     	                        document.getElementsByName(this.fieldindustry).item(0).options[k].selected = true; 
     	                    }
         	            }
	     	         }
	     	        }
	     	};
	
			if (document.getElementsByName(this.fieldtitle).length > 0) { 
	     	        if(document.getElementsByName(this.fieldtitle).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldtitle).item(0).value = this.title; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldtitle).item(0).tagName.toUpperCase() == "SELECT"){
                        for (var k=0;k<document.getElementsByName(this.fieldtitle).item(0).length;k++) {
	      	                if(document.getElementsByName(this.fieldtitle).item(0).options[k].text.toLowerCase() == this.title.toLowerCase()) {
     	                        document.getElementsByName(this.fieldtitle).item(0).options[k].selected = true; 
     	                    }
         	            }
	     	         }
	     	        }
	     	};
			
			if (document.getElementsByName(this.fielddepartment).length > 0) { 
	     	        if(document.getElementsByName(this.fielddepartment).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fielddepartment).item(0).value = this.department; 
	     	        }else{
	     	         if(document.getElementsByName(this.fielddepartment).item(0).tagName.toUpperCase() == "SELECT"){
                        for (var k=0;k<document.getElementsByName(this.fielddepartment).item(0).length;k++) {
	      	                if(document.getElementsByName(this.fielddepartment).item(0).options[k].text.toLowerCase() == this.department.toLowerCase()) {
     	                        document.getElementsByName(this.fielddepartment).item(0).options[k].selected = true; 
     	                    }
         	            }
	     	         }
	     	        }
	     	};
			
			if (document.getElementsByName(this.fieldphone).length > 0) { 
	     	        if(document.getElementsByName(this.fieldphone).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldphone).item(0).value = this.phone; 
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldaddress).length > 0) { 
	     	        if(document.getElementsByName(this.fieldaddress).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldaddress).item(0).value = this.address; 
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldaddress2).length > 0) { 
	     	        if(document.getElementsByName(this.fieldaddress2).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldaddress2).item(0).value = this.address2; 
	     	        };
	     	};
		
		if (document.getElementsByName(this.fieldaddressline2).length > 0) { 
	     	        if(document.getElementsByName(this.fieldaddressline2).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldaddressline2).item(0).value = this.addressline2; 
	     	        };
	     	};
	  
	        if (document.getElementsByName(this.fieldcity).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcity).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldcity).item(0).value = this.city; 
	     	        };
	     	};
			   	
			if (document.getElementsByName(this.fieldstate).length > 0) { 
	     	        if(document.getElementsByName(this.fieldstate).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldstate).item(0).value = this.state; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldstate).item(0).tagName.toUpperCase() == "SELECT"){
                        for (var k=0;k<document.getElementsByName(this.fieldstate).item(0).length;k++) {
	      	                if(document.getElementsByName(this.fieldstate).item(0).options[k].text.toLowerCase() == this.state.toLowerCase()) {
     	                        document.getElementsByName(this.fieldstate).item(0).options[k].selected = true; 
     	                    }
         	            }
	     	         }
	     	        }
	     	};
			
	        if (document.getElementsByName(this.fieldpostalcode).length > 0) { 
	     	        if(document.getElementsByName(this.fieldpostalcode).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldpostalcode).item(0).value = this.postalcode; 
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldcountry).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcountry).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldcountry).item(0).value = this.country; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldcountry).item(0).tagName.toUpperCase() == "SELECT"){
                        for (var k=0;k<document.getElementsByName(this.fieldcountry).item(0).length;k++) {
	      	                if(document.getElementsByName(this.fieldcountry).item(0).options[k].text.toLowerCase() == this.country.toLowerCase()) {
     	                        document.getElementsByName(this.fieldcountry).item(0).options[k].selected = true; 
     	                    }
         	            }
	     	         }
	     	        }
	     	};
			
	        if (document.getElementsByName(this.fieldcompanysize).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcompanysize).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldcompanysize).item(0).value = this.companysize; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldcompanysize).item(0).tagName.toUpperCase() == "SELECT"){
                        for (var k=0;k<document.getElementsByName(this.fieldcompanysize).item(0).length;k++) {
	      	                if(document.getElementsByName(this.fieldcompanysize).item(0).options[k].text.toLowerCase() == this.companysize.toLowerCase()) {
     	                        document.getElementsByName(this.fieldcompanysize).item(0).options[k].selected = true; 
     	                    }
         	            }
	     	         }
	     	        }
	     	};
			
			if (document.getElementsByName(this.fieldannualrevenue).length > 0) { 
	     	        if(document.getElementsByName(this.fieldannualrevenue).item(0).tagName.toUpperCase() == "INPUT") {
	     	           	document.getElementsByName(this.fieldannualrevenue).item(0).value = this.annualrevenue; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldannualrevenue).item(0).tagName.toUpperCase() == "SELECT"){
                        for (var k=0;k<document.getElementsByName(this.fieldannualrevenue).item(0).length;k++) {
	      	                if(document.getElementsByName(this.fieldannualrevenue).item(0).options[k].text.toLowerCase() == this.annualrevenue.toLowerCase()) {
     	                        document.getElementsByName(this.fieldannualrevenue).item(0).options[k].selected = true; 
     	                    }
         	            }
	     	         }
	     	        }
	     	};
			
			
			if (document.getElementsByName(this.fieldcompanyurl).length > 0 && document.getElementsByName(this.fieldcompanyurl).item(0).tagName.toUpperCase() == "INPUT") { document.getElementsByName(this.fieldcompanyurl).item(0).value = this.companyurl; };
			if (document.getElementsByName(this.fieldpostingalias).length > 0 && document.getElementsByName(this.fieldpostingalias).item(0).tagName.toUpperCase() == "INPUT") { document.getElementsByName(this.fieldpostingalias).item(0).value = this.postingalias; };
	        if (document.getElementsByName(this.fieldusername).length > 0 ) { document.getElementsByName(this.fieldusername).item(0).value = this.username; };
			if (document.getElementsByName(this.fieldpassword).length > 0 ) { document.getElementsByName(this.fieldpassword).item(0).value = this.password; };
			
			bulldogCompleted();
	
	    }catch(err){
	        this._processJSError(err.message);	    
	    }
	
	
	};
	
	bulldogPassport.prototype._clearForm = function(){
	
	   try {
	    
	     	if (document.getElementsByName(this.fieldfirstname).length > 0) { 
	     	        if(document.getElementsByName(this.fieldfirstname).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldfirstname).item(0).value = ""; 
	     	        };
	     	};
	     	
	     	if (document.getElementsByName(this.fieldlastname).length > 0) { 
	     	        if(document.getElementsByName(this.fieldlastname).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldlastname).item(0).value = ""; 
	     	        };
	     	};
	
	     	if (document.getElementsByName(this.fieldemail).length > 0) { 
	     	        if(document.getElementsByName(this.fieldemail).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldemail).item(0).value = ""; 
	     	        };
	     	};
	
	    	if (document.getElementsByName(this.fieldcompany).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcompany).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldcompany).item(0).value = ""; 
	     	        };
	     	};
	
	    	if (document.getElementsByName(this.fieldindustry).length > 0) { 
	     	        if(document.getElementsByName(this.fieldindustry).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldindustry).item(0).value = ""; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldindustry).item(0).tagName == "SELECT"){
	     	            document.getElementsByName(this.fieldindustry).item(0).selectedIndex = 0;
	     	         }
	     	        }
	     	};
	
			if (document.getElementsByName(this.fieldtitle).length > 0) { 
	     	        if(document.getElementsByName(this.fieldtitle).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldtitle).item(0).value = ""; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldtitle).item(0).tagName == "SELECT"){
	     	             document.getElementsByName(this.fieldtitle).item(0).selectedIndex = 0;
	     	         }
	     	        }
	     	};
			
			if (document.getElementsByName(this.fielddepartment).length > 0) { 
	     	        if(document.getElementsByName(this.fielddepartment).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fielddepartment).item(0).value = ""; 
	     	        }else{
	     	         if(document.getElementsByName(this.fielddepartment).item(0).tagName == "SELECT"){
	     	           	document.getElementsByName(this.fielddepartment).item(0).selectedIndex = 0;
	     	         };
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldphone).length > 0) { 
	     	        if(document.getElementsByName(this.fieldphone).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldphone).item(0).value = ""; 
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldaddress).length > 0) { 
	     	        if(document.getElementsByName(this.fieldaddress).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldaddress).item(0).value = ""; 
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldaddress2).length > 0) { 
	     	        if(document.getElementsByName(this.fieldaddress2).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldaddress2).item(0).value = ""; 
	     	        };
	     	};
	  
	        if (document.getElementsByName(this.fieldcity).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcity).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldcity).item(0).value = ""; 
	     	        };
	     	};
			   	
			if (document.getElementsByName(this.fieldstate).length > 0) { 
	     	        if(document.getElementsByName(this.fieldstate).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldstate).item(0).value = ""; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldstate).item(0).tagName == "SELECT"){
	     	           	document.getElementsByName(this.fieldstate).item(0).selectedIndex = 0;
	     	         };
	     	        };
	     	};
	        if (document.getElementsByName(this.fieldpostalcode).length > 0) { 
	     	        if(document.getElementsByName(this.fieldpostalcode).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldpostalcode).item(0).value = ""; 
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldcountry).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcountry).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldcountry).item(0).value = ""; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldcountry).item(0).tagName == "SELECT"){
	     	           	document.getElementsByName(this.fieldcountry).item(0).selectedIndex = 0;
	     	         };
	     	        };
	     	};
			
			if (document.getElementsByName(this.fieldcompanysize).length > 0) { 
	     	        if(document.getElementsByName(this.fieldcompanysize).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldcompanysize).item(0).value = ""; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldcompanysize).item(0).tagName == "SELECT"){
	     	           	document.getElementsByName(this.fieldcompanysize).item(0).selectedIndex = 0;
	     	         };
	     	        };
	     	};
	     	
	     				if (document.getElementsByName(this.fieldannualrevenue).length > 0) { 
	     	        if(document.getElementsByName(this.fieldannualrevenue).item(0).tagName == "INPUT") {
	     	           	document.getElementsByName(this.fieldannualrevenue).item(0).value = ""; 
	     	        }else{
	     	         if(document.getElementsByName(this.fieldannualrevenue).item(0).tagName == "SELECT"){
	     	           	document.getElementsByName(this.fieldannualrevenue).item(0).selectedIndex = 0;
	     	         };
	     	        };
	     	};
	        if (document.getElementsByName(this.fieldcompanyurl).length > 0 && document.getElementsByName(this.fieldcompanyurl).item(0).tagName.toUpperCase() == "INPUT") { document.getElementsByName(this.fieldcompanyurl).item(0).value = ""; };
			if (document.getElementsByName(this.fieldpostingalias).length > 0 && document.getElementsByName(this.fieldpostingalias).item(0).tagName.toUpperCase() == "INPUT") { document.getElementsByName(this.fieldpostingalias).item(0).value = ""; };
	        if (document.getElementsByName(this.fieldusername).length > 0 ) { document.getElementsByName(this.fieldusername).item(0).value = ""; };
			if (document.getElementsByName(this.fieldpassword).length > 0) { document.getElementsByName(this.fieldpassword).item(0).value = ""; };
			
	     	bulldogCleared();
	    }catch(err){
	        this._processJSError(err.message);	    
	    }
	
	
	};
	
	// process Login ---------------------------------------------------------------------
	bulldogPassport.prototype.processLogin = function(username,password) {
		try {
				
			//Create Content Div if missing and Assign
			this._createContentDiv();
		    
			//assign form values for cleanup
			username = this._clean(username);
			password = this._clean(password);
						
			if (username == "") {
				this._processFormError("No Username given.");		
				return false;
			};

			if (password == "") {
				this._processFormError("No Password given.");		
				return false;
			};
			
			
			//Check Login
			
			var sendf = "method=getID&clientkey=" + this.clientkey +
            "&username=" + username + 
            "&password=" + password;
            
    	    getAjaxResponse(this.serviceURL,sendf);


			return true;

		} catch(err) {
			this._processJSError(err.message);
	   
		};		

	};
	
	// process Login ---------------------------------------------------------------------
	bulldogPassport.prototype.processRegistration = function() {
		try {
		
			// Assign Field values  to Vars for Cleanup
			var firstname = "";
			var lastname = "";
			var email = "";
			var username = "";
			var password = "";
			var password2 = "";
			var company = "";
			var department = "";
			var industry = "";
			var title = "";
			var optin = "";
			
			try{
			
			firstname = this._clean(document.getElementById("bulldogIDfirstname").value);
			lastname = this._clean(document.getElementById("bulldogIDlastname").value);
			email = this._clean(document.getElementById("bulldogIDemail").value);
			username = this._clean(document.getElementById("bulldogIDusername").value);
			password = this._clean(document.getElementById("bulldogIDuserpass").value);
			password2 = this._clean(document.getElementById("bulldogIDuserpass2").value);
			company = this._clean(document.getElementById("bulldogIDcompany").value);
			department = document.getElementById("bulldogIDdepartment").options[document.getElementById("bulldogIDdepartment").selectedIndex].value;
			industry = document.getElementById("bulldogIDindustry").options[document.getElementById("bulldogIDindustry").selectedIndex].value;
			title = document.getElementById("bulldogIDtitle").options[document.getElementById("bulldogIDtitle").selectedIndex].value;
			optin = document.getElementById("bulldogIDoptin").checked;
			
			}catch(err){
				this._processJSError("Registration Failed (internal error).");	
				return false;
			}
			//Create Content Div if missing and Assign
			this._createContentDiv();
		
			if (username == "") {
				this._processFormError("No Username given.");		
				return false;
			};

			if (password == "") {
				this._processFormError("No Password given.");		
				return false;
			};
			
			if (password2 != password) {
				this._processFormError( "Passwords do not match.");		
				return false;
			};
			
			if (firstname == "") {
				this._processFormError("No First Name given.");		
				return false;
			};
			
			if (lastname == "") {
				this._processFormError("No Last Name given.");		
				return false;
			};
			
			if (email == "") {
				this._processFormError("No Email Address given.");		
				return false;
			};
			
			if (this.verifyEmail(email) == false) {
				this._processFormError("Not a valid email format.");		
				return false;
			};
			
			if (industry == "Unselected") {
				this._processFormError("No Industry selected.");		
				return false;
			};
			if (department == "Unselected") {
				this._processFormError("No Department selected.");		
				return false;
			};

			if (title == "Unselected") {
				this._processFormError("No Title selected.");		
				return false;
			};
			

			var sendf = "method=setID&clientkey=" + this.clientkey +
            "&username=" + getAjaxEncoding(username) + 
            "&password=" + getAjaxEncoding(password) +
            "&firstname=" + getAjaxEncoding(firstname) +
            "&lastname=" + getAjaxEncoding(lastname) +
            "&emailaddress=" + getAjaxEncoding(email) +
            "&company=" + getAjaxEncoding(company) +
            "&industry=" + getAjaxEncoding(industry) +
            "&department=" + getAjaxEncoding(department) +
            "&title=" + getAjaxEncoding(title) +
            "&optin=" + getAjaxEncoding(optin) +
            "";
    	
    	    getAjaxResponse(this.serviceURL,sendf);
		
		
				
			return true;

		} catch(err) {
			this._processJSError(err.message);
			
			//Remove Div from screen
			this._destroyContentDiv();
		    return false;
		
		};		

	};	
	// These are the forms ---------------------------------------------------------------
	bulldogPassport.prototype._getRegistrationForm = function() {
	/* In the non-demo version, these will be pulled from the server via AJAX */
	
		try{
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData =	"<div id=\"bulldogIDRegistrationForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDUserHeader\"><span>Username</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDUserField\"><input type=\"text\" id=\"bulldogIDusername\" /></div>" +
			
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDPassHeader\"><span>Password</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDPassField\"><input type=\"password\" id=\"bulldogIDuserpass\" /></div>" +
			
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDPass2Header\"><span>Confirm Password</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDPass2Field\"><input type=\"password\" id=\"bulldogIDuserpass2\" /></div>" +
			
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDFirstNameHeader\"><span>First Name</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDFirstNameField\"><input type=\"text\" id=\"bulldogIDfirstname\" /></div>" +
			
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDLastNameHeader\"><span>Last Name</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDLastNameField\"><input type=\"text\" id=\"bulldogIDlastname\" /></div>" +
			
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDEmailHeader\"><span>E-mail</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDEmailField\"><input type=\"text\" id=\"bulldogIDemail\" /></div>" +
			
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDCompanyHeader\"><span>Company</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDCompanyField\"><input type=\"text\" id=\"bulldogIDcompany\" /></div>" +
			                
			                "<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDIndustryHeader\"><span>Industry</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDIndustryField\">" +
							"<select id=\"bulldogIDindustry\" >" +
								"<option value=\"Unselected\">Unselected</option>" + 
	                            "<option value=\"Aerospace, Defense\">Aerospace, Defense</option>" + 
	                            "<option value=\"Agriculture\">Agriculture</option>" + 
	                            "<option value=\"Automotive\">Automotive</option>" + 
	                            "<option value=\"Beverages\">Beverages</option>" + 
	                            "<option value=\"Diversified, Conglomerate\">Diversified, Conglomerate</option>" + 
	                            "<option value=\"Education\">Education</option>" + 
	                            "<option value=\"Energy, Chemical, Utilities\">Energy, Chemical, Utilities</option>" + 
	                            "<option value=\"Environmental\">Environmental</option>" + 
	                            "<option value=\"Financial Services - Banking, Securities\">Financial Services - Banking, Securities</option>" + 
	                            "<option value=\"Financial Services - Insurance\">Financial Services - Insurance</option>" + 
	                            "<option value=\"Financial Services - Other\">Financial Services - Other</option>" + 
	                            "<option value=\"Food\">Food</option>" + 
	                            "<option value=\"Government - Federal\">Government - Federal</option>" + 
	                            "<option value=\"Government - State, Local, Other\">Government - State, Local, Other</option>" + 
	                            "<option value=\"Health Care, Medical, Pharma, Biotech\">Health Care, Medical, Pharma, Biotech</option>" + 
	                            "<option value=\"High Tech - Hardware, Equipment\">High Tech - Hardware, Equipment</option>" + 
	                            "<option value=\"High Tech - Other\">High Tech - Other</option>" + 
	                            "<option value=\"High Tech - Software, Services\">High Tech - Software, Services</option>" + 
	                            "<option value=\"Hospitality, Travel, Tourism\">Hospitality, Travel, Tourism</option>" + 
	                            "<option value=\"Human Resources\">Human Resources</option>" + 
	                            "<option value=\"Machinery\">Machinery</option>" + 
	                            "<option value=\"Manufacturing\">Manufacturing</option>" + 
	                            "<option value=\"Marketing\">Marketing</option>" + 
	                            "<option value=\"Media, Advertising, PR\">Media, Advertising, PR</option>" + 
	                            "<option value=\"Other\">Other</option>" + 
	                            "<option value=\"Professional Services - Accounting\">Professional Services - Accounting</option>" + 
	                            "<option value=\"Professional Services - Consulting\">Professional Services - Consulting</option>" + 
	                            "<option value=\"Professional Services - Legal\">Professional Services - Legal</option>" + 
	                            "<option value=\"Publishing\">Publishing</option>" + 
	                            "<option value=\"Real Estate\">Real Estate</option>" + 
	                            "<option value=\"Recreation\">Recreation</option>" + 
	                            "<option value=\"Retail\">Retail</option>" + 
	                            "<option value=\"Security Products &amp; Services\">Security Products & Services</option>" + 
	                            "<option value=\"Shipping, Distribution\">Shipping, Distribution</option>" + 
	                            "<option value=\"Telecommunications\">Telecommunications</option>" + 
	                            "<option value=\"Transportation, Distribution\">Transportation, Distribution</option>" + 
							"</select>" +							
							"</div>" +
			                
			                "<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDDepartmentHeader\"><span>Department</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDDepartmentField\">"+
							"<select id=\"bulldogIDdepartment\" >" +
								"<option value=\"Unselected\">Unselected</option>" +
	                            "<option value=\"Accounting\">Accounting</option>" +
	                            "<option value=\"Administration\">Administration</option>" +
	                            "<option value=\"Business Development\">Business Development</option>" +
	                            "<option value=\"Corporate Communications\">Corporate Communications</option>" +
	                            "<option value=\"Customer Service\">Customer Service</option>" +
	                            "<option value=\"Engineering\">Engineering</option>" +
	                            "<option value=\"Executive\">Executive</option>" +
	                            "<option value=\"Finance\">Finance</option>" +
	                            "<option value=\"Human Resources\">Human Resources</option>" +
	                            "<option value=\"Information Technology\">Information Technology</option>" +
	                            "<option value=\"Legal\">Legal</option>" +
	                            "<option value=\"Manufacturing\">Manufacturing</option>" +
	                            "<option value=\"Marketing\">Marketing</option>" +
	                            "<option value=\"Operations\">Operations</option>" +
	                            "<option value=\"Other\">Other</option>" +
	                            "<option value=\"Research and Development\">Research and Development</option>" +
	                            "<option value=\"Sales\">Sales</option>" +
	                            "<option value=\"Technical Support\">Technical Support</option>" +
	                            "<option value=\"Training\">Training</option>" +
							"</select>"+
							"</div>" +
			                
			                "<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDTitleHeader\"><span>Title</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDTitleField\">"+
							"<select id=\"bulldogIDtitle\" >" +
			                	"<option value=\"Unselected\">Unselected</option>" +
                                "<option value=\"Doctor\">Doctor</option>" +
                                "<option value=\"Nurse\">Nurse</option>" +
                                "<option value=\"Nurse Practitioner\">Nurse Practitioner</option>" +
                                "<option value=\"Pharmacist\">Pharmacist</option>" +
                                "<option value=\"Physician Assistant\">Physician Assistant</option>" +
                                "<option value=\"Paramedic/EMT\">Paramedic/EMT</option>" +
                                "<option value=\"Medical Assistant\">Medical Assistant</option>" +
                                "<option value=\"Laboratory Technician\">Laboratory Technician</option>" +
                                "<option value=\"Medical Records\">Medical Records</option>" +
                                "<option value=\"Administrative Assistant\">Administrative Assistant</option>" +
                                "<option value=\"Analyst\">Analyst</option>" +
                                "<option value=\"Board of Directors\">Board of Directors</option>" +
                                "<option value=\"CEO\">CEO</option>" +
                                "<option value=\"CFO\">CFO</option>" +
                                "<option value=\"Chairman\">Chairman</option>" +
                                "<option value=\"CIO\">CIO</option>" +
                                "<option value=\"CLO\">CLO</option>" +
                                "<option value=\"CMO\">CMO</option>" +
                                "<option value=\"Consultant\">Consultant</option>" +
                                "<option value=\"Contractor\">Contractor</option>" +
                                "<option value=\"Controller/Comptroller\">Controller/Comptroller</option>" +
                                "<option value=\"COO\">COO</option>" +
                                "<option value=\"Coordinator\">Coordinator</option>" +
                                "<option value=\"CSO\">CSO</option>" +
                                "<option value=\"CTO\">CTO</option>" +
                            "</select>" + 
                            "</div>" +
							"<div class=\"bulldogIDFieldCheckbox\" id=\"bulldogIDOptInField\"><input type=\"checkbox\" checked=\"true\" id=\"bulldogIDoptin\" /> <span>Please include me in the Bulldog Community. I understand I may receive invitations to events, news alerts and/or an e-newsletter, based on the interests I've indicated in my BulldogID profile.</span></div>" +
			
							"<div class=\"bulldogIDFormPrimaryButton\" id=\"bulldogIDRegister\" onClick=\"passport.processRegistration();\">" +
								"<span>Register</span>" +
							"</div>" +
							this._getFormFooterHTML() +
							"</div>" ;
		
							//"<div class=\"bulldogIDFormSecondaryButton\" id=\"bulldogIDLogin\" onClick=\"passport.start();\">" +
							//	"<span>Login</span>" +
							//"</div>" +
			this.contentDiv.innerHTML = FormData;
            this._processFormError("All Fields Required");
			document.getElementById("bulldogIDusername").focus;
			return true;
			
		}catch(err){
			this._processJSError(err.message);
			return false;
		}	
	};
	
		
	bulldogPassport.prototype._getLoginForm = function() {
	/* In the non-demo version, these will be pulled from the server via AJAX */
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDLoginForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDUserHeader\"><span>Username</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDUserField\"><input type=\"text\" id=\"bulldogIDusername\" /></div>" +
							"<div class=\"bulldogIDFieldLabel\" id=\"bulldogIDPassHeader\"><span>Password</span></div>" +
							"<div class=\"bulldogIDField\" id=\"bulldogIDPassField\"><input type=\"password\" id=\"bulldogIDuserpass\" /></div>" +
							"<div class=\"bulldogIDFormPrimaryButton\" id=\"bulldogIDLogin\" onClick=\"passport.processLogin(document.getElementById('bulldogIDusername').value,document.getElementById('bulldogIDuserpass').value);\">" +
								"<span>login</span>" +
							"</div>" +
							"<div class=\"bulldogIDFormSecondaryButton\" id=\"bulldogIDRegister\" onClick=\"passport.showRegistration();\">" +
								"<span>Sign up for Bulldog Password.</span>" +
							"</div>" +
							this._getFormFooterHTML() +
							"</div>" ;
		
			this.contentDiv.innerHTML = FormData;
            this._processFormError("All Fields Required");
	 	    document.getElementById("bulldogIDusername").focus();
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};

	bulldogPassport.prototype._getPrivacyForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDPrivacyForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDPrivacyVerbage\"><span>blahblahblah...<i>mumblycakes</i>.</span>" +
							".<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />.<br />" +
							"</div>" +
							this._getFormFooterHTML() +
							"</div>" ;
		
//                    		"<div class=\"bulldogIDFormTertiaryButton\" id=\"bulldogIDReturntoLogin\" onClick=\"passport.start();\">" +
//								"<span>Return to Login Screen</span>" +
//							"</div>" +
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};


	bulldogPassport.prototype._getWhatIsForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDWhatIsForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDWhatIsVerbage\"><span>" +
                                "<h1 class=\"bulldogIDTextHeader\">What is BulldogID?</h1>" +
                                "<span class=\"bulldogIDText\">" +
                                "            BulldogID is a customized profile that allows individuals to register quickly and easily for Webinars, podcasts, white" +
                                "            papers and other content produced by Bulldog Solutions on behalf of Bulldog's business-to-business" +
                                "            clients. Once registrants establish a BulldogID, they can use their username and" +
                                "            password to populate registration fields automatically with information they have" +
                                "            entered in their profile." +
                                "</span>" +
                                "<h2 class=\"bulldogIDTextHeader\">Benefits for Registrants</h2>" +
                                "<ul>" +
                                "    <li>Speeds registration by eliminating the need to re-enter information such as name, e-mail or title.</li>" +
                                "    <li>Can be used to register for events and information on most companies who are part of the Bulldog Solutions universe.</li>" +
                                "</ul>" +
		                    "</span></div>" +

							this._getFormFooterHTML() +
							"</div>" ;
							//"<div class=\"bulldogIDFormTertiaryButton\" id=\"bulldogIDReturntoLogin\" onClick=\"passport.start();\">" +
							//	"<span>Return to Login Screen</span>" +
							//"</div>" +
		
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};

	bulldogPassport.prototype._getWhatIsBizmazingForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDWhatIsForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDWhatIsVerbage\"><span>" +
                                "<h1 class=\"bulldogIDTextHeader\">What is BizmazingID?</h1>" +
                                "<span class=\"bulldogIDText\">" +
                                "            BizmazingID is a customized profile that allows you to register quickly and easily for Webinars, " +
				"free offers and other stuff. Once you sign up for a BizmazingID, you can log in (with only your username and password) to gain " +
				"immediate access to the Bizmazing Community. Once you are signed in, registering for new events and offers is as simple as one click. " +
				"BizmazingID is powered by Bulldog Solutions' OneTimeID." +
                                "</span>" +
                              
		                    "</span></div>" +

							this._getFormFooterHTML() +
							"</div>" ;
							//"<div class=\"bulldogIDFormTertiaryButton\" id=\"bulldogIDReturntoLogin\" onClick=\"passport.start();\">" +
							//	"<span>Return to Login Screen</span>" +
							//"</div>" +
		
				//"<h2 class=\"bulldogIDTextHeader\">Benefits for Registrants</h2>" +
                                //"<ul>" +
                                //"    <li>Speeds registration by eliminating the need to re-enter information such as name, e-mail or title.</li>" +
                                //"    <li>Can be used to register for events and information on most companies who are part of the Bizmazing universe.</li>" +
                                //"</ul>" +
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};

bulldogPassport.prototype._getWhatIsHooversForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDWhatIsForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDWhatIsVerbage\"><span>" +
                                "<h1 class=\"bulldogIDTextHeader\">What is Hoover's Event ID?</h1>" +
                                "<span class=\"bulldogIDText\">" +
                                "            Hoover's Event ID is a customized profile that allows you to register quickly and easily for Webinars, " +
				"free offers and other stuff. Once you sign up for a Hoover's Event ID, you can log in (with only your username and password) to gain " +
				"immediate access to the Hoover's Community. Once you are signed in, registering for new events and offers is as simple as one click. " +
				"Hoover's Event ID is powered by Bulldog Solutions' OneTimeID." +
                                "</span>" +
                              
		                    "</span></div>" +

							this._getFormFooterHTML() +
							"</div>" ;
							//"<div class=\"bulldogIDFormTertiaryButton\" id=\"bulldogIDReturntoLogin\" onClick=\"passport.start();\">" +
							//	"<span>Return to Login Screen</span>" +
							//"</div>" +
		
				//"<h2 class=\"bulldogIDTextHeader\">Benefits for Registrants</h2>" +
                                //"<ul>" +
                                //"    <li>Speeds registration by eliminating the need to re-enter information such as name, e-mail or title.</li>" +
                                //"    <li>Can be used to register for events and information on most companies who are part of the Bizmazing universe.</li>" +
                                //"</ul>" +
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};
	
	bulldogPassport.prototype._getWhatIsIntermecForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDWhatIsForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDWhatIsVerbage\"><span>" +
                                "<h1 class=\"bulldogIDTextHeader\">What is Intermect ID?</h1>" +
                                "<span class=\"bulldogIDText\">" +
                                "            Intermec ID is a customized profile that allows you to register quickly and easily for Webinars, " +
				"free offers and other stuff. Once you sign up for an Intermec ID, you can log in (with only your username and password) to gain " +
				"immediate access to the Intermec Community. Once you are signed in, registering for new events and offers is as simple as one click. " +
				"Intermec ID is powered by Bulldog Solutions' OneTimeID." +
                                "</span>" +
                              
		                    "</span></div>" +

							this._getFormFooterHTML() +
							"</div>" ;
							//"<div class=\"bulldogIDFormTertiaryButton\" id=\"bulldogIDReturntoLogin\" onClick=\"passport.start();\">" +
							//	"<span>Return to Login Screen</span>" +
							//"</div>" +
		
				//"<h2 class=\"bulldogIDTextHeader\">Benefits for Registrants</h2>" +
                                //"<ul>" +
                                //"    <li>Speeds registration by eliminating the need to re-enter information such as name, e-mail or title.</li>" +
                                //"    <li>Can be used to register for events and information on most companies who are part of the Bizmazing universe.</li>" +
                                //"</ul>" +
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};
	
	bulldogPassport.prototype._getWhatIsCompassLearningForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDWhatIsForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDWhatIsVerbage\"><span>" +
                                "<h1 class=\"bulldogIDTextHeader\">What is Compass Learning ID?</h1>" +
                                "<span class=\"bulldogIDText\">" +
                                "            CompassLearning ID is a customized profile that allows you to register quickly and easily for Webinars, " +
				"free offers and other stuff. Once you sign up for a Compass Learning ID, you can log in (with only your username and password) to gain " +
				"immediate access to the Compass Learning Community. Once you are signed in, registering for new events and offers is as simple as one click. " +
				"Compass Learning ID is powered by Bulldog Solutions' OneTimeID." +
                                "</span>" +
                              
		                    "</span></div>" +

							this._getFormFooterHTML() +
							"</div>" ;
							
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};
	
	
	bulldogPassport.prototype._getWhatIsOpenTextForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDWhatIsForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDWhatIsVerbage\"><span>" +
                                "<h1 class=\"bulldogIDTextHeader\">What is Open Text ID?</h1>" +
                                "<span class=\"bulldogIDText\">" +
                                "            Open Text ID is a customized profile that allows you to register quickly and easily for Webinars, " +
				"free offers and other stuff. Once you sign up for a Open Text ID, you can log in (with only your username and password) to gain " +
				"immediate access to the Open Text Community. Once you are signed in, registering for new events and offers is as simple as one click. " +
				"Open Text ID is powered by Bulldog Solutions' OneTimeID." +
                                "</span>" +
                              
		                    "</span></div>" +

							this._getFormFooterHTML() +
							"</div>" ;
							//"<div class=\"bulldogIDFormTertiaryButton\" id=\"bulldogIDReturntoLogin\" onClick=\"passport.start();\">" +
							//	"<span>Return to Login Screen</span>" +
							//"</div>" +
		
				//"<h2 class=\"bulldogIDTextHeader\">Benefits for Registrants</h2>" +
                                //"<ul>" +
                                //"    <li>Speeds registration by eliminating the need to re-enter information such as name, e-mail or title.</li>" +
                                //"    <li>Can be used to register for events and information on most companies who are part of the Bizmazing universe.</li>" +
                                //"</ul>" +
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};
	
	bulldogPassport.prototype._getHelpForm = function() {
	
		try{
		 
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData = "<div id=\"bulldogIDHelpForm\"> " +
							this._getFormHeaderHTML() +
							"<div class=\"bulldogIDVerbage\" id=\"bulldogIDWhatIsVerbage\"><span>" +
                                "<h1 class=\"bulldogIDTextHeader\">Need Help?</h1>" +
                                "<span class=\"bulldogIDText\">" +
                                "	<strong>Step 1</strong>: Fill in your username and password, then click the Login button.<br><br>" +
                                "       <strong>Step 2</strong>: Scroll through the registration fields below to ensure your information is correct." +
                                "       You will also need to respond to the question marked in red.<br><br>" +
                                "       <strong>Step 3</strong>: Click the Submit button at the bottom to register.<br><br>" +
                                "</span>" +
		                "</div>" +

							this._getFormFooterHTML() +
							"</div>" ;
							//"<div class=\"bulldogIDFormTertiaryButton\" id=\"bulldogIDReturntoLogin\" onClick=\"passport.start();\">" +
							//	"<span>Return to Login Screen</span>" +
							//"</div>" +
		
			this.contentDiv.innerHTML = FormData;
			return true;
		
		}catch(err){
				this._processJSError(err.message);
				return false;
		}

	};
	
	bulldogPassport.prototype._getPasswordForm = function() {
	
		try{
			//Create Content Div if missing and Assign
			this._createContentDiv();
			
			var FormData =	"<div id=\"PasswordForm\"> " +
					"<div class=\"bulldogIDFormButton\" id=\"bulldogIDCloseButton_Wide\" onClick=\"passport.close();\"><span>Close</span></div>" +
					"<iframe src=\"http://bulldogsolutions.com/api/bulldogid/forgotpassword.aspx\" width=\"810\" height=\"485\" frameborder=\"0\" allowtransparency=\"false\">" +
					"</div>";
		
			this.contentDiv.innerHTML = FormData;
            //this._processFormError("All Fields Required");
			//document.getElementById("bulldogIDusername").focus;
			return true;
			
		}catch(err){
			this._processJSError(err.message);
			return false;
		}	
	};
	
	/// garbage Functions to speed up form generation ----------
	bulldogPassport.prototype._getFormHeaderHTML = function() {
			try {
			var xText  =	"<iframe src=\"\" frameborder=\"0\" style=\"filter:alpha(opacity=0);z-index:-1;position:absolute;width:100%;height:100%;top:0;left:0\"></iframe>" +
					"<div id=\"bulldogIDHeader\"><span>Bulldog Solutions Passport System</span></div>" +
							"<div class=\"bulldogIDError\" id=\"bulldogIDFormError\"></div>" ;
							
			return xText;
	
		}catch(err){
			this._processJSError(err.message);
		};	
	};

	bulldogPassport.prototype._getFormFooterHTML = function() {
	
		try {
			var xText  =	"<div class=\"bulldogIDFormStatus\" id=\"bulldogIDStatus\" >" +
							"<span>&nbsp;</span>" +
							"</div>" +
							"<div class=\"bulldogIDFormButton\" id=\"bulldogIDCloseButton\" onClick=\"passport.close();\"><span>Close</span></div>" +
							"<div class=\"bulldogIDFormButton\" id=\"bulldogIDPrivacyPolicy\" >" +
							"</div>" +
							"<div class=\"bulldogIDFooter\" id=\"bulldogIDFooter\">" +
							"<a href=\"http://www.bulldogsolutions.com/privacy.htm\" target=\"_new\" oldonclik=\"passport.showPrivacyPolicy(); return false;\"><span>View Our Privacy Policy</span></a>" + " | " +
							"<a href=\"http://bulldogsolutions.com\" target=\"_new\">About Bulldog Solutions</a>" +
							"</div>" +
							"<div id=\"bulldogIDSecurity\"><span></span></div>" +
							"<div id=\"bulldogIDBlank1\"></div>" +
							"<div id=\"bulldogIDBlank2\"></div>" +
							"<div id=\"bulldogIDBlank3\"></div>" ;
							
							//"<a href=\"http://bulldogsolutions.net/api/bulldogid/forgotpassword.aspx\" target=\"_new\">I forgot my password</a>" + " | " +
							//"<a href=\"#\" onClick=\"passport.showWhatIsThis(); return false;\" id=\"bulldogIDWhatIs\">What is this?</a>" + " | " +
							
			return xText;
	
		}catch(err){
			this._processJSError(err.message);
		};		
	};
	
	//Class Utilities
	bulldogPassport.prototype._processFormError = function(errmsg){
		try{
			document.getElementById("bulldogIDFormError").innerHTML = errmsg;
			return true;
		}catch(err){
			alert(errmsg);
			this.close();
			return true;
		};
	};
	
	bulldogPassport.prototype._processJSError = function(errmsg){
		try{
			alert(errmsg);
			return true;
		}catch(err){
		    alert(err.message);
		    
		};
	};
	
	bulldogPassport.prototype._clean = function(stringToTrim) {
		if (stringToTrim == null) {
			return "" ;
		}else{
			return stringToTrim.replace(/^\s+|\s+$/g,"");
		}
	};
	
	bulldogPassport.prototype.verifyEmail = function(stringValidate) {
		if (stringValidate == null) {
			return false ;
		}else{
    		var emailFormat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
			return emailFormat.test(stringValidate);
		}
	};

	bulldogPassport.prototype.verifyPhone = function(stringValidate) {
		if (stringValidate == null) {
			return false ;
		}else{
		    var PhoneFormat = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;
			return PhoneFormat.test(stringValidate);
		}
	};

	bulldogPassport.prototype.verifyPostalCode = function(stringValidate) {
		if (stringValidate == null) {
			return false ;
		}else{
		    var PostalCodeFormat = /^\d{5}$/;
			return PostalCodeFormat.test(stringValidate);
		}
	};

	
// End of Class ---------------------------------------------------------------------------



/* Garbage Code for the Demo */



/*
// 'processing' timer
function fakeProcessing(containerdiv,statusdiv) {
	
	containerdiv.style.cursor = "busy";
	statusdiv.innerText = "Processing.";
	var date = new Date();
	var curDate = null;
	do { curDate = new Date(); } while(curDate-date < 3500);
	containerdiv.style.cursor = "";
	statusdiv.innerText = "";
} ;
*/


function AjaxObject() {
};

//Class Properties
AjaxObject.prototype.f = false;
AjaxObject.prototype.http;

AjaxObject.prototype.createHTTP = function() {

    try{
    
   var xmlhttp;
	if (window.ActiveXObject) {
    // Instantiate the latest Microsoft ActiveX Objects
    if (_XML_ActiveX) {
       xmlhttp = new ActiveXObject(_XML_ActiveX);
     } else {
     // loops through the various versions of XMLHTTP to ensure we're using the latest
     var versions = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0"];
     for (var i = 0; i < versions.length ; i++) {
       try {
        // Try and create the ActiveXObject for Internet Explorer, if it doesn't work, try again.
        xmlhttp = new ActiveXObject(versions[i]);
         if (xmlhttp) {
          var _XML_ActiveX = versions[i];
          break;
        }
      }
      catch (e) {
         // TRAP
       } ;
     }
   ;
   }
  } // Well if there is no ActiveXObject available it must be firefox, opera, or something else
   if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
       xmlhttp = false;
     }
   }
   
  xmlhttp.onreadystatechange = function() {
      try {
           if (xmlhttp.readyState == 4) {
              if(xmlhttp.status == 200){
                   
                 var results =  xmlhttp.responseXML.documentElement;
                                    
                 if (results.firstChild.nodeName == "user") {
                      
                     for (var i=0;i<results.firstChild.childNodes.length; i++){
                           eval('passport.' +  results.firstChild.childNodes[i].nodeName + '= \"' + getText(results.firstChild.childNodes[i])  + '\"');
                       };
                     passport._postToForm();
                     passport._destroyContentDiv();
                                     			    
                 } else { 
                        if (results.firstChild.nodeName == "error") {
                            clearForm();
                            //var errormess = results.firstChild.childNodes[0].text;
			    var errormess = results.getElementsByTagName('message')[0].childNodes[0].nodeValue;
                            passport._processFormError(errormess);
                        };
                  };
              } else {
                    var mess = "The BulldogID System is currently unavailable. Please try again later.";
                    passport._processJSError(mess);
                    passport._destroyContentDiv();

              };
            };
          
        } catch(err) {
           alert(err.message);
        };
    };
  
  return xmlhttp;
  
  } catch(err) {
    alert(err.message);
  }
  
  
 };

function getText(oNode){
	var sText = "";
	var sTemp = "";
	
	for (var i = 0; i< oNode.childNodes.length;i++){
		if (oNode.childNodes[i].hasChildNodes()){
			sText += getText(oNode.childNodes[i]);
		} else {
	       sTemp = oNode.childNodes[i].nodeValue;
		    sTemp = sTemp.replace(/#amp#/g,"&");
		    sText += sTemp.replace(/#lt#/g,"<");
		}
	}

	return sText;

};

AjaxObject.prototype.postURL = function(url, postrefs) {
   	if (!this.f) {
//   	    var olddomain = location.hostname;
//   	    alert(olddomain);
//   	    document.domain = "bulldogsolutions.net";
//        olddomain = document.domain;
//        alert(olddomain);
//      
        postrefs = "url=" + encodeURIComponent(postrefs);
   	    this.http.open("POST", url, true);
	    this.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	    this.http.send(postrefs);

        

	};

};

AjaxObject.prototype.start = function(url,sendref){
    this.f = false;
    this.http = this.createHTTP();
    this.postURL(url,sendref);
};


function clearForm() {
              
            passport._clearForm();
            return true;
}

function parser(text) {   
     if (typeof DOMParser != "undefined") {   
         // Mozilla, Firefox, and related browsers   
         return (new DOMParser()).parseFromString(text, "application/xml");   
     }   
     else if (typeof ActiveXObject != "undefined") {   
         // Internet Explorer.   
         var doc = XML.newDocument();  // Create an empty document   
         doc.loadXML(text);            // Parse text into it   
        return doc;                   // Return it   
     }   
     else {   
         // As a last resort, try loading the document from a data: URL   
         // This is supposed to work in Safari. Thanks to Manos Batsis and   
         // his Sarissa library (sarissa.sourceforge.net) for this technique.   
         var url = "data:text/xml;charset=utf-8," + encodeURIComponent(text);   
         var request = new XMLHttpRequest();   
         request.open("GET", url, false);   
         request.send(null);   
         return request.responseXML;   
     }   
 };   



function getAjaxResponse(url,text){

		try {
			return bulldogAJAX.start(url,text);
		}catch(err){
			alert(err.message);
			return false;
		};

}

function getAjaxEncoding(text){
       try{
        s = text + "";
            s = s.replace(/&/g,"%26");
       
        return s;
       }catch (exception){
        alert("wouldn't replace:" + exception.message);
       }    
      
}

/*These get fired off when events are done */

function bulldogCompleted() {
    return true;
}
function bulldogCleared() {
    return true;
}


/*FORMATTING FUNCTIONALITY */
function grow(element){
    var my_width = 0;
    var my_height = 0;

	if (window.innerHeight && window.scrollMaxY) {// Firefox
		my_height = window.innerHeight + window.scrollMaxY;
		my_width = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		my_height = document.body.scrollHeight;
		my_width = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		my_height = document.body.offsetHeight;
		my_width = document.body.offsetWidth;
  	}
    
    element.style.position = 'absolute';

    element.style.width = my_width + "px";
    element.style.height  =  my_height + "px";    
    
}

function center(element){
//    try{
//        element = $(element);
//    }catch(e){
//        return;
 //   }

    var my_width  = 0;
    var my_height = 0;

    if ( typeof( window.innerWidth ) == 'number' ){
        my_width  = window.innerWidth;
        my_height = window.innerHeight;
    }else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ){
        my_width  = document.documentElement.clientWidth;
        my_height = document.documentElement.clientHeight;
    }
    else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ){
        my_width  = document.body.clientWidth;
        my_height = document.body.clientHeight;
    }

    element.style.position = 'absolute';

    var scrollY = 0;

    if ( document.documentElement && document.documentElement.scrollTop ){
        scrollY = document.documentElement.scrollTop;
    }else if ( document.body && document.body.scrollTop ){
        scrollY = document.body.scrollTop;
    }else if ( window.pageYOffset ){
        scrollY = window.pageYOffset;
    }else if ( window.scrollY ){
        scrollY = window.scrollY;
    }
    
    
    var setX = ( my_width  - element.offsetWidth  ) / 2;
    var setY = ( my_height - element.offsetHeight ) / 2 + scrollY;
    
    element.style.left = setX + "px";
    element.style.top  = setY + "px";

    element.style.display  = 'block';
}
