function showComps(branch) { if (!document.getElementById('div-'+branch)) { var div = document.createElement('div'); div.setAttribute('id', 'div-'+branch); div.style.display = 'none'; document.getElementById(branch).appendChild(div); var url = 'http://harborcountrylodging.com//ajax/getComps.php?branch=' +branch; $.ajax({ url: url, type: 'GET', dataType: 'html', timeout: 1000, error: function(){alert('Error loading data');}, success: function(html){ $('#div-'+branch).html(html); $("#div-"+branch).slideToggle("slow"); } }); } else { $("#div-"+branch).slideToggle("slow"); } } function showProps(complex) { if (!document.getElementById('div-'+complex)) { var div = document.createElement('div'); div.setAttribute('id', 'div-'+complex); div.style.display = 'none'; document.getElementById(complex).appendChild(div); var url = 'http://harborcountrylodging.com//ajax/getProps.php?complex=' +complex; $.ajax({ url: url, type: 'GET', dataType: 'html', timeout: 1000, error: function(){alert('Error loading data ' + url);}, success: function(html){ $('#div-'+complex).html(html); $("#div-"+complex).slideToggle("slow"); } }); } else { $("#div-"+complex).slideToggle("slow"); } }