function callbackfordata(data)
{
	jQuery.getJSON(siteurl+"fundraiser/get_shop_url/"+data[0],
	function(arr){
		window.location.href=arr['url']+"?join=join";	
	});
}
function showgroup(data)
{
	if(document.getElementById("group").options.length>1)
		{
			jQuery("#grouplabel").show();
			jQuery("#group").attr("class","element required").attr("min","1");
		}
		else
		{
			jQuery("#grouplabel").hide();
			jQuery("#group").attr("class","element").attr("min","0");;			
		}
}		
jQuery(document).ready(function(){
	jQuery('a.login').bind('click',function() {
		jQuery("#login").slideToggle("slow");
		jQuery('#txt_user').focus();
	});
 		open_dialog('#dialog_participant_registration');
		open_dialog('#dialog_shop');
		jQuery("#frm_login").validate();
	
	
	
		var url=autocompleteurl;
		
		show_autocomplete('#txt_fundraisername',url);	
		
		jQuery('#dialog_participant_registration').dialog({
			autoOpen: false,
			width: 300,
			buttons:{
				"Cancel": function() {
				jQuery(this).dialog('close');
			}
			}				
		});	
		
		show_autocomplete('#txt_lookup',url);
		
		jQuery('#dialog_shop').dialog({
			autoOpen: false,
			width: 515,
			buttons:{
				"Cancel": function() {
				jQuery(this).dialog('close');
			}
			}				
		});	
});

/*function participant_registration()
{  
	var fid=jQuery('#fid').val();
	if(fid>0)
	{
		
		jQuery('#frid').val(fid);
		
		var url=dialogurl;	
		var params = {"id":fid};
		//jQuery("#group").removeOption('all');
		jQuery("#group").ajaxAddOption(url,params,function(data){});
		
		var fname=jQuery('#txt_fundraisername').val();	
		jQuery('#lbl_fundraisername').html(fname);
		
		jQuery('#email').focus();	
		open_dialog('#dialog_participant_registration');
		jQuery('#email').focus();	
	}
	else
	{
		alert("Please choose Fundraiser");
		jQuery('#txt_fundraisername').focus();
	}
}*/

function participant_registration()
{  

	var fid=jQuery('#fid').val();
	if(fid>0)
	{
		
		jQuery('#frid').val(fid);
		
		var url=dialogurl;	
		var params = {"id":fid};
		//jQuery("#group").removeOption('all');
		jQuery("#group").ajaxAddOption(url,params,function(data){});
		
		var fname=jQuery('#txt_fundraisername').val();	
		jQuery('#lbl_fundraisername').html(fname);
		
		jQuery('#email').focus();	
		
		jQuery('#email').focus();	
	}
	else
	{
		alert("Please choose Fundraiser");
		jQuery('#txt_fundraisername').focus();
	}
}

function show_response(data)
{
	if(data==2)
	{
		//window.location.href="<? echo url::site('login/selectpanel');?>";
	}
	close_dialog('#dialog_participant_registration');
}
