var Across = {

    clearField: function(item)
    {
        $(item).attr('value', '');
    },
    
    sendM: function(thisFom)
    {
        Across.actualForm = thisFom;
        
        $.post("/", 'Func=contacts.sendMessage&' + $(thisFom).serialize(), function(data)
        {
        
            if (data.error) 
            {
                jQuery.each(data.items, function(i, val)
                {
                    $('#' + i).val(val);
                });
            }
            else 
            {
            
                Across.actualForm.reset();
                alert(data.message);
            }
        }, "json");
    },
    
	sendSubscription : function (thisFom)
    {
        Across.actualForm = thisFom;

		$.post("/", 
			'Func=contacts.sendSubscription&'+$(thisFom).serialize(), 
			function(data) {

				if (data.error)
				{
					jQuery.each(data.items, function(i, val) {
						$('#newsletter_' + i).val(val);
				    });
				}
				else
				{
					Across.actualForm.reset();
					alert(data.message);
				}
			},
			"json"
		);
    },
	
	sendComment : function (thisForm,newsid)
	{
		
		Across.actualForm = thisForm;
		
		$.post("/",'Func=news.saveMessage&'+$(thisForm).serialize()+'&newsid='+newsid,
		function(data)
		{
			
			if(data.error)
			{
				jQuery.each(data.items, function(i, val) {
					$('#comment_' + i).val(val);
				});
			}
			else
			{
				
				location.reload();
			}
			
			
		},
		"json"
		);
	},
	
	toggleBox : function(boxid)
	{
		
		if($('#'+boxid).is('.right-box-main-selected'))
		{
			$('#'+boxid).removeClass('right-box-main-selected');	
		}
		else{
			$('#'+boxid).addClass('right-box-main-selected');
		}
		
		$("#toggle_"+boxid).toggle("slow");
	}
	
};


