function toggle_contact(id){
	d = $('contact_sub_'+id).getStyle('display');
	if(d == "none"){
		$('contact_sub_'+id).show();
		$('contact_arrow_'+id).src = "/images/arrow_d.gif";
	}else{
		$('contact_sub_'+id).hide();
		$('contact_arrow_'+id).src = "/images/arrow_r.gif";
	}
}


function newcontact(parentcell){
    parentDiv = $(parentcell);
    //make a new item
    id = "id_" + Math.round(Math.random() * 1000);
    
    var objContact = document.createElement("div");
    
	objContact.setAttribute('id',id);
	parentDiv.appendChild(objContact);
		
		
    var url = '/page.php?mode=ajaxcontact&newid='+id;
    // notice the use of a proxy to circumvent the Same Origin Policy.
    new Ajax.Request(url, {
    method: 'get',
    onSuccess: function(transport) {
        var notice = $('notice');
        itext = transport.responseText;
       objContact.innerHTML = itext;
       tooltipObj.initFormFieldTooltip();
    }
});

}

function populateContact(sub, a, a2, c, s, z, p, e){
    keys = Array("address", "address2", "city", "state", "zip", "phone", "email");
    values = Array(a, a2, c, s, z, p, e);
    for(i=0;i<keys.length;i++){
        n = sub + "contact_" + keys[i] + "]";
        if($(n).value == ""){
            $(n).value=values[i];
        }
    }
}