
var defaultAgentProfile;
var defaultEmployeeProfile;

function AgentProfile(){

	this.id=0;
	this.customerId="";
	this.firstName="";
	this.lastName="";
	this.email="";
	this.password="";
	this.phone="";
	this.detail="";
	
	this.status=0;
	
	this.phone2="";
	this.fax="";
	this.cell="";
	this.title="";
	this.broker="";
	this.website="";
	this.location="";
	this.address1="";
	this.address2="";
	this.city="";
	this.state="";
	this.zip="";
	this.propertyAddress="";

	this.proofEmail="";
	
	this.active=0; 

	
	//fields for business cards

	 this.bcLocation="";	
	 this.bcName="";
	 this.bcTitle="";
	 this.bcAddress1="";
	 this.bcAddress2="";
	 this.bcCity="";
	 this.bcPhone1="";
	 this.bcPhone2="";
	 this.bcPhone3="";
	 this.bcCellphone="";
	 this.bcFax="";
	 this.bcEmail="";
	 this.bcWeb="";
	 this.bcSlogan="";
}	  


function fetchDefaultValue(profile){
	
	if (!profile){
		return;
	}
	
	setObjValue("broker",profile.broker);
	setObjValue("phone",profile.phone);
	setObjValue("phone2",profile.phone2);
	setObjValue("fax",profile.fax);
	setObjValue("cell",profile.cell);
	setObjValue("title",profile.title);
	setObjValue("website",profile.website);
	setObjValue("titleLocation",profile.location);
	setObjValue("address1",profile.address1);
	setObjValue("address2",profile.address2);
	setObjValue("city",profile.city);
	setObjValue("zip",profile.zip);
	setObjValue("detail",profile.detail);
	
	setObjValue("bcLocation",profile.bcLocation);
	setObjValue("bcName",profile.bcName);
	setObjValue("bcTitle",profile.bcTitle);
	setObjValue("bcAddress1",profile.bcAddress1);
	setObjValue("bcAddress2",profile.bcAddress2);
	setObjValue("bcCity",profile.bcCity);
	setObjValue("bcPhone1",profile.bcPhone1);
	setObjValue("bcPhone2",profile.bcPhone2);
	setObjValue("bcPhone3",profile.bcPhone3);

	setObjValue("bcCellphone",profile.bcCellphone);
	setObjValue("bcFax",profile.bcFax);
	setObjValue("bcEmail",profile.bcEmail);
	setObjValue("bcWeb",profile.bcWeb);
	setObjValue("bcSlogan",profile.bcSlogan);


}

function setObjValue(objId,objVal){
	var obj = document.getElementById(objId);
	if (!obj){
		return;
	}
	obj.value = unescape(objVal);
}


/******************************

   Property Profile

 ******************************/

var propertyProfileListing=new Array();  
function PropertyProfile(){

	var id=0;
	var agentId=0;
	var itemNumber="";
	var title="";
	var price="";
	var briefDesc="";
	var detailedDesc="";
	var briefBenefit="";
	var productLocation="";
}

function initMyProperties(){
	var mpObj =document.getElementById("myProperties");
	if (!mpObj){
		return;
	}
	
	
	//select_addOption(mpObj, "Select Item",0);
	
	for (var i=0; i<propertyProfileListing.length; i++){
		var pp = propertyProfileListing[i];
		select_addOption(mpObj, unescape(pp.productLocation),pp.id); 
		//select_addOption(mpObj,itemNumber+" - " + unescape(pp.title),pp.id);
	}
	
}

function changeMyProperties(){
	var mpObj =document.getElementById("myProperties");
	if (!mpObj){
		return;
	}
	
	var mpVal =mpObj.value;
	
	var ppFound =null;	
	for (var i=0; i<propertyProfileListing.length; i++){
		var pp = propertyProfileListing[i];
		if (pp.id==mpVal){
			ppFound =pp;
		}
	}	
	
	if (!ppFound){
		return;
	}
	
	setPropertyValue("propertyAddress",ppFound.productLocation);
	setPropertyValue("propertyPrice",ppFound.price);
	setPropertyValue("propertyTitle",ppFound.briefDesc);
	setPropertyValue("briefBenefit",ppFound.briefBenefit);
	setPropertyValue("briefDesc",ppFound.briefDesc);
	setPropertyValue("detailedDesc",ppFound.detailedDesc);
	
}


function setPropertyValue(objName, objValue){
	objValue = unescape(objValue);
	var obj = document.getElementById(objName);
	if (obj){
		obj.value = objValue;
	}
}



 
 
