function aivao_infoform(options){
	aivao_loading({});
	if(options['form'] == 'newsletter'){
	
		options['formvars'] = '';
		$('form').find('input, textarea, select').each(function(){
			if($(this).attr('type') != 'checkbox' && $(this).attr('type') != 'radio'){
				options['formvars'] += $(this).attr('name')+'*#*'+$(this).val()+'._.';
			}
		});
		var checkboxes = [];
		var checkboxes_keys = [];
		$('form').find(':checkbox').each(function(){		
			if($.inArray($(this).attr('name'), checkboxes_keys) == -1){
				//alert($(this).attr('name'));
				checkboxes_keys.push($(this).attr('name'));
				checkboxes[$(this).attr('name')] = [];
			}
			if($(this).is(':checked')){
				checkboxes[$(this).attr('name')].push($(this).attr('value'));
			}
		});
		for(n=0;n<checkboxes_keys.length;n++){
			options['formvars'] += checkboxes_keys[n]+'*#*'+checkboxes[checkboxes_keys[n]].join('.:.')+'._.';
		}
		var radioes = [];
		var radioes_keys = [];
		$('form').find(':radio').each(function(){		
			if($.inArray($(this).attr('name'), radioes_keys) == -1){
				//alert($(this).attr('name'));
				radioes_keys.push($(this).attr('name'));
				radioes[$(this).attr('name')] = [];
			}
			if($(this).is(':checked')){
				radioes[$(this).attr('name')].push($(this).attr('value'));
			}
		});
		for(n=0;n<radioes_keys.length;n++){
			options['formvars'] += radioes_keys[n]+'*#*'+radioes[radioes_keys[n]].join('.:.')+'._.';
		}
		options['formvars'] = options['formvars'].substr(0,(options['formvars'].length-3));
		$.post('/cms/front/ajax/'+options['form']+'.php', options, function(data) {
			aivao_loading_close({});
			if(data['grant'] == 0){
				aivao_alert({html:data['feedback']});
				for(n=0;n<data['highlighted'].length;n++){
					$('label[name="'+data['highlighted'][n]+'"], input[name="'+data['highlighted'][n]+'"], select[name="'+data['highlighted'][n]+'"], textarea[name="'+data['highlighted'][n]+'"]').addClass('highlighted');
					
				}	
			}
			else{
				aivao_alert({html:data['feedback']});
				$('label[name="'+data['highlighted'][n]+'"], input[name="'+data['highlighted'][n]+'"], select[name="'+data['highlighted'][n]+'"], textarea[name="'+data['highlighted'][n]+'"]').removeClass('highlighted');
				$('input[name=subscriber]').val();
			}
			
		
		}, 'json');
	}
	if(options['form'] == 'search'){
		var needle = $.trim($('input[name=needle]').val());
		if(needle == ''){
			
		}
		else{
			var arr = needle.split(' ');
			var newneedle = '';
			for(n=0;n<arr.length;n++){
				if(arr[n] != ''){
					newneedle += arr[n]+'+';
				}
			}
			newneedle = newneedle.substr(0,(newneedle.length-1));
			window.location.href = options['href']+newneedle+'/';
		}	
	}
	
}

function aivao_tellafriend(options){
	aivao_loading({});
	var html = '';
	$.post('/cms/front/ajax/tellafriend_0.php', options, function(data) {
		aivao_loading_close({});
		html = data['html'];
		var temp = {
			state0: {
				html:html,
				buttons: { Cancel: false, Next: true },
				focus: 1,
				submit:function(v,m,f){ 
					if(!v)
						return true;
					else $.prompt.goToState('state1');//go forward
					return false; 
				}
			},
			state1: {
				html:'test 2',
				buttons: { Back: -1, Exit: 0, Next: 1 },
				focus: 2,
				submit:function(v,m,f){ 
					if(v==0)
						$.prompt.close()
					else if(v==1)
						$.prompt.goToState('state2');//go forward
					else if(v=-1)
						$.prompt.goToState('state0');//go back
					return false; 
				}
			},
			state2: {
				html:'This is the next one<br />test 3',
				buttons: { Back: true, Done: false },
				submit:function(v,m,f){ 
					if(!v)
						return true;
					else $.prompt.goToState('state1');//go back
					return false; 
				}
			}
		}
		$.prompt(temp);
		
		
	}, 'json');
	
	
	
}

