var Contacts = {

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

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

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

                if (data.error)
                {
                    jQuery.each(data.items, function(i, val) {
                        $('#'+i).val(val);
                    });
                }
                else
                {

                    Contacts.actualForm.reset();
                    alert(data.message);
                }
            },
		"json"
		);
    }
};

var Contacts = {

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

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

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

                if (data.error)
                {
                    jQuery.each(data.items, function(i, val) {
                        $('#'+i).val(val);
                    });
                }
                else
                {

                    Contacts.actualForm.reset();
                    alert(data.message);
                }
            },
		"json"
		);
    }
};

var actualitem = 1;

var Across = {
		
		
		homepromopage : function(id)
		{
			$('.scrolleritem').hide();
			$('.si_'+id).show();
			
			$('.promopage').removeClass('active');
			$('.p_'+id).addClass('active');
			
			actualitem = id;
		},
		
		homepromo : function()
		{
			
			$('.promopage').removeClass('active');
			$('.p_'+actualitem).addClass('active');
			
			$('.scrolleritem').hide();
			$('.si_'+actualitem).show();
			
			++actualitem;
			
			if(actualitem > homeinit.homecount)
			{
				actualitem = 1;
			}
			
		}
		
}

$(document).ready(function(){

	if(homeinit.homecount > 0)
	{
		setInterval("Across.homepromo()",5000);
	}
	
});


var actualitem = 1;
var stop = 0;

var Dental = {
		
		dentalpromopage : function(id)
		{
			
			actualitem = id;
	
			$('.slideritem').hide();
			$('.si_'+id).show();
			
			$('.promopage').removeClass('active');
			$('.p_'+id).addClass('active');
			
			if(actualitem >= 1)
			{
				$('.promo-next').show();
				$('.promo-next-hider').hide();
			}
			
			if(actualitem == dentalinit.dentalcount)
			{
				$('.promo-next').hide();
				$('.promo-next-hider').show();
			}
			
			if(actualitem > 1)
			{
				$('.promo-back').show();
				$('.promo-back-hider').hide();
			}
			
			if(actualitem <= 1)
			{
				$('.promo-back').hide();
				$('.promo-back-hider').show();
			}
			
		},
		
		dentalpromo : function()
		{
			
			if(stop == 0)
			{
			
				++actualitem;
				
				if(actualitem > dentalinit.dentalcount)
				{
					actualitem = 1;
				}
				
				$('.promopage').removeClass('active');
				$('.p_'+actualitem).addClass('active');
				
				$('.slideritem').hide();
				$('.si_'+actualitem).show();
	
				if(actualitem >= 1)
				{
					$('.promo-next').show();
					$('.promo-next-hider').hide();
				}
				
				if(actualitem == dentalinit.dentalcount)
				{
					$('.promo-next').hide();
					$('.promo-next-hider').show();
				}
				
				if(actualitem > 1)
				{
					$('.promo-back').show();
					$('.promo-back-hider').hide();
				}
				
				if(actualitem <= 1)
				{
					$('.promo-back').hide();
					$('.promo-back-hider').show();
				}
				
				
			}
			
		},
		
		next : function()
		{
			
			
			Dental.dentalpromo();

			
		},
		prev : function()
		{
			
			
			actualitem = actualitem-2;
			
			
			Dental.dentalpromo();
			
			
			
		}
		
		
}

$(document).ready(function(){

	if(dentalinit.dentalcount > 0)
	{
		setInterval("Dental.dentalpromo()",10000);
	}
	
});
