		//This is the Javascript file for the Business Profile for use by all users

		function add_fan(vid){
			get_ajax('http://www.mycity.com/venue_mgmt/a_add_fan.php?v_id='+vid,'none');
		}

		function get_box(div_id,p_id,v_id){
			get_ajax('http://www.mycity.com/bus_profile/a_gen_textbox.php?p_id='+p_id+'&v_id='+v_id,div_id);
		}

		function create_q(v_id,text_id){
		
			var el = document.getElementById(text_id);
			var sub = el.value;
			get_ajax('http://www.mycity.com/bus_profile/a_create_q.php?&v_id='+v_id+'&sub='+sub,'none');
			var parent = document.getElementById('qa_parent');

			setTimeout('refreshQA(\''+v_id+'\')',500);

		}
		function create_text_box(parent_id,p_c_id,v_id){
			//creates the containing div to be appended to the parent div
			//the parent div's id is passed as the first argument
			
			var d = document.createElement('div');
			d.setAttribute('id',parent_id+'_'+p_c_id+'_div');

			var d_s = document.createElement('span');
			d_s.setAttribute('id',parent_id+'_'+p_c_id+'_div_space');
			d_s.innerHTML = '&nbsp;&nbsp;&nbsp;';

			//creates the textarea 
			var t = document.createElement('textarea');
			t.setAttribute('rows','3');
			t.setAttribute('cols','25');
			t.setAttribute('id','text_'+v_id+'_'+p_c_id);

			//the end of this function puts focus on the textarea.  After the focus is lost or cancelled the textarea disappears
			//this makes sure the corrent comments are posted to the correct parents by reseting the comment / parent ids 
			//the onblur code is what makes this work
			t.setAttribute('onblur','time_rem(\''+parent_id+'_'+p_c_id+'_div'+'\')');

			//creates the submit button
			var b = document.createElement('input');
			b.setAttribute('type','button');
			b.setAttribute('onclick','create_r(\''+p_c_id+'\',\''+v_id+'\',\'text_'+v_id+'_'+p_c_id+'\');');
			b.setAttribute('value','Submit');
			b.setAttribute('id','btn_'+v_id+'_'+p_c_id);
			b.style.width = '90px';

			var c = document.createElement('input');
			c.setAttribute('type','button');
			c.setAttribute('onclick','remove_box(\''+parent_id+'_'+p_c_id+'_div'+'\')');
			c.setAttribute('value','Cancel');
			c.setAttribute('id','ccl_'+v_id+'_'+p_c_id);
			c.style.width = '90px';

			var br = document.createElement('br');


			var parent = document.getElementById('qa_parent');
			d.appendChild(br)
			d.appendChild(t);
			d.appendChild(b);
			d.appendChild(d_s);
			d.appendChild(c);
			parent.appendChild(d);
			t.focus();

		}

		function create_text_box_gen(parent_id,v_id){

			var d = document.createElement('div');
			d.setAttribute('id',parent_id+'_div');

			var d_s = document.createElement('span');
			d_s.setAttribute('id',parent_id+'__div_space');
			d_s.innerHTML = '&nbsp;&nbsp;&nbsp;';

			var t = document.createElement('textarea');
			t.setAttribute('rows','3');
			t.setAttribute('cols','25');
			t.setAttribute('id','text_'+v_id);
			t.setAttribute('onblur','time_rem(\''+parent_id+'_div'+'\')');

			var b = document.createElement('input');
			b.setAttribute('type','button');
			b.setAttribute('onclick','create_q(\''+v_id+'\',\'text_'+v_id+'\');');
			b.setAttribute('value','Submit');
			b.setAttribute('id','btn_'+v_id);
			b.style.width = '90px';

			var c = document.createElement('input');
			c.setAttribute('type','button');
			c.setAttribute('onclick','remove_box(\''+parent_id+'_div'+'\')');
			c.setAttribute('value','Cancel');
			c.setAttribute('id','ccl_'+v_id);
			c.style.width = '90px';

			var br = document.createElement('br');


			var parent = document.getElementById('qa_parent');
			d.appendChild(br)
			d.appendChild(t);
			d.appendChild(b);
			d.appendChild(d_s);
			d.appendChild(c);
			parent.appendChild(d);
			t.focus();

		}
		
		function remove_cmt(v_id,c_id){
			get_ajax('http://www.mycity.com/bus_profile/a_del_q.php?v_id='+v_id+'&c_id='+c_id,'none');
			//the timeout is used to allow the PHP on the other end to run and slow browsers can catch up
			setTimeout('refreshQA(\''+v_id+'\')',500);
		}
		
		function remove_box(id){
			var parent = document.getElementById('qa_parent');
			var b = document.getElementById(id);
			parent.removeChild(b);
		}
		function time_rem(id){
			setTimeout('remove_box(\''+id+'\')', 1000);
			
		}
		function create_r(p_id,v_id,text_id){
		
			var el = document.getElementById(text_id);
			var sub = el.value;
		
			get_ajax('http://www.mycity.com/bus_profile/a_create_r.php?p_id='+p_id+'&v_id='+v_id+'&sub='+sub,'none');
			var parent = document.getElementById('qa_parent');
			//the timeout is used to allow the PHP on the other end to run and slow browsers can catch up
			setTimeout('refreshQA(\''+v_id+'\')',500);

		}
		function refreshQA(id){
			get_ajax('http://www.mycity.com/bus_profile/a_refresh_qa.php?v_id='+id,'qa_parent');

		}
		function getHTTPObjectSearch(){
		
		      if (window.ActiveXObject) { 
			return new ActiveXObject("Microsoft.XMLHTTP");
	 	      }else if (window.XMLHttpRequest) { 
			return new XMLHttpRequest();
		          if (http_request.overrideMimeType) {
				http_request.overrideMimeType('text/xml');
			   }
      		      }else{
	 		alert("Your browser does not support AJAX.");
	       	return null;
	      	      }
  
   	      }
  
       
  
	      function captureReturn(div){
	     	 if(httpObjectSearch.readyState == 4){
			    var markup=httpObjectSearch.responseText; 
			    document.getElementById(div).innerHTML = markup;

			}
     	      }
  
       
  
 
   		   function get_ajax(url,div){
			
		       httpObjectSearch = getHTTPObjectSearch();  
			 if (httpObjectSearch != null) {

				httpObjectSearch.open("GET", url+'&rvar='+Math.random(), true);
				httpObjectSearch.send(null);
				httpObjectSearch.onreadystatechange = function(){captureReturn(div)};
			       httpObjectSearch.close;
		         } 
  		      }
  
       
  
  		    var httpObjectSearch = null;