// JavaScript Document
var forms = {
	init: function( )
	{
		$('.form').each(function(){
			forms.view( this.id.toString().replace('form_',''));
		});
		
	},
	view: function( id ){
		$('#form_' + id).html(
		$('<input/>')
			.attr('type','button')
			.val('Wypelnij formularz zgloszeniowy')
			.css({ color:'#333'})
			.click(function(){ 
//				$.fn.colorbox({ iframe: true, opacity:0.8, 'open':true, 'href':baseUrl+ 'form/' + id, width:700, height:400 });
				$.fancybox({ type:'iframe' , opacity:0.8, 'href':baseUrl+ 'form/' + id, width:700, height:400 });
			 })
		);
		return;
		$.get(baseUrl+ 'form/' + id , {},function(d){
			if( d.error == '0'){
				$('#form_' + id).html(d.content);
				$('#form_' + id).submit( forms.submit());
			}
		},'json');
	},

}

$(document).ready(function(){
	forms.init();
});
// $.fn.colorbox()