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");
    },
    
	pageSend: function(thisform)
	{
		
		Across.actualForm = thisform;
		
		$.post("/", 'Func=pagesend.pageSend&' + $(thisform).serialize(), function(data)
        {
        
            if (data.error) 
            {
                jQuery.each(data.items, function(i, val)
                {
                    $('#' + i).val(val);
                });
            }
            else 
            {
            
                Across.actualForm.reset();
                alert(data.message);
            }
        }, "json");
			
		
	},
	
    sendFirmM: function(thisFom)
    {
        Across.actualForm = thisFom;
        
        $.post("/", 'Func=firm.firmdata.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"
		);
	},

	popwin : function (url,width,height)
	{
		if ( !width ) width = '800';
		if ( !height ) height = '540';

	    var popupWin = window.open(url,'popupWin','width='+width+'px,height='+height+'px,left=100,top=100,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=no,screenX=100,screenY=100,directories=no,location=no');

		popupWin.focus();
        return false;
	},

    printView : function ()
    {
        Across.popwin('?print');
    }
};
