# -*- encoding : utf-8 -*-
module Admin::AutoLoadDivHelper
	
	def auto_load_div(url,div=nil)
	    
		r =  ""
		
		
		rand = (rand(99999999999999))
		
		
		
		
		content = content_tag(:div, "", :id => rand.to_s)
	
		
		content += content_tag(:div, "", :class => "loading")
		content += content_tag(:div, "", :class => "ajax_load_content")
		
		javascript = "<script type='text/javascript'>"
		javascript += "\n//<![CDATA["
		javascript += "\n"
		javascript += 'auto_load_div($("#'+rand.to_s+'").parent());'
		
		javascript += "\n //]]>"
		javascript += "\n</script>"
		
		content += raw(javascript)
		
		content_tag(:div, content, :"data-load" => true, :"data-url" => url, :id => div.to_s)
		
		
	
	end
end
