
if (THC == undefined) 
{
		var THC = {}; 
} 

//see http://javascript.crockford.com/private.html for description of javascript
//public, private and privileged functions
THC.RegistrationController = function () 
{ 	

//============================================================================
	//							CONSTRUCTOR 
	//============================================================================
	//			(must be declared after all functions to be used)
	var that = this;
	
	
	//============================================================================
	//							END CONSTRUCTOR
	//============================================================================
	//============================================================================
	//							PRIVATE FUNCTIONS 
    //============================================================================    	
	
	//============================================================================
	//							END PRIVATE FUNCTIONS 
    //============================================================================  	

	//============================================================================
	//							PRIVILEGED (PUBLIC) FUNCTIONS 
    //============================================================================	

    this.shippingCheckClicked = function(chkBox)
    {
    
    	var form = dojo.byId("registrationForm");
    	
    	var shipDiv = dojo.byId("shippingAddressDiv");
    	if(chkBox.checked)
    	{
	    	if(shipDiv)
    		{
    			shipDiv.style.display="none";
    		}
	    	
    	}
    	else
    	{
    		
    		if(shipDiv)
    		{
    			shipDiv.style.display="block";
    		}
    		that.copyBillingToShipping();
    	}
    };
    this.copyBillingToShipping = function()
    {
    	var form = dojo.byId("registrationForm");
    	form.shipFirstName.value = form.firstName.value;
    	form.shipMiddleName.value = form.middleName.value;
    	form.shipLastName.value = form.lastName.value;
    	form.shipAddress1.value = form.address1.value;
    	form.shipAddress2.value = form.address2.value;
    	form.shipCity.value = form.city.value;
    	form.shipCountry.value = form.country.value;
    	form.shipFirstName.value = form.firstName.value;
    	form.shipFirstName.value = form.firstName.value;
    	form.shipPhone.value = form.phone.value;
    	form.shipZipCode.value = form.zipCode.value;
    };
     this.copyOnSubmit = function()
    {
    	var form = dojo.byId("registrationForm");
    	var chkBox = form.chkShipping;
    	if(chkBox.checked)
    	{
	   		form.shipFirstName.value = form.firstName.value;
	    	form.shipMiddleName.value = form.middleName.value;
	    	form.shipLastName.value = form.lastName.value;
	    	form.shipAddress1.value = form.address1.value;
	    	form.shipAddress2.value = form.address2.value;
	    	form.shipCity.value = form.city.value;
	    	form.shipCountry.value = form.country.value;
	    	form.shipFirstName.value = form.firstName.value;
	    	form.shipFirstName.value = form.firstName.value;
	    	form.shipPhone.value = form.phone.value;
	    	form.shipZipCode.value = form.zipCode.value;
    	}
    };
    this.copyState = function()
    {
  		if(dijit.byId('shipState') && dijit.byId('state') && dijit.byId('state').item)
    	{
    		dijit.byId('shipState').attr('value', (dijit.byId('state').item).abbreviation);
    	}
   		
    };
    //============================================================================
	//							END PRIVILEGED (PUBLIC) FUNCTIONS 
    //============================================================================	
    
	
};

//============================================================================
//							PUBLIC FUNCTIONS 
//============================================================================	
//The prototype mechanism is used for inheritance. It also conserves memory
//as all objects use one definition of the function.
THC.RegistrationController.prototype =
{	

};
//============================================================================
//							END PUBLIC FUNCTIONS 
//============================================================================	