var Across = {

	setMenu : function () 
	{
		var items = $('#main-menu .menuHeader');

		for (var i=0;i < items.length; i++)
		{
			$(items[i]).hover(
				function () 
				{
					$(this).addClass('ShowItems');
				}, 
				function () 
				{
					$(this).removeClass('ShowItems');
				}
			);
		}
	},

	Toggle : function (id)
	{
		$('#'+id).toggle();
	},

	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');
    },

	back : function ()
	{
		history.go(-1);
	},

    sendM : function (thisFom)
    {
        Across.actualForm = thisFom;

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

				if (data.error)
				{
					jQuery.each(data.items, function(i, val) {
						$('#contacts_' +i).val(val);
				    });
				}
				else
				{
					Across.actualForm.reset();
					alert(data.message);
				}
			},
			"json"
		);
    },

	clearField : function (item)
	{
		$(item).attr('value', '');
	},

	reload : function ()
	{
		window.location = window.location.href;
	},

    sendSubscription : function (thisFom)
    {
        Across.actualForm = thisFom;

		$.post("/", 
			'Func=contacts.sendSubscription&'+$(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"
		); 
    }
};

$(window).ready(function () {
	Across.setMenu();
	$(".gallery a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'light_square',slideshow:2000, autoplay_slideshow: false});
});
