
$(document).ready(function(){
	$(".tweet").tweet({
		username: "pMailer_SA",
		join_text: "auto",
		avatar_size: 32,
		count: 1,
		auto_join_text_default: "we said,",
		auto_join_text_ed: "we",
		auto_join_text_ing: "we were",
		auto_join_text_reply: "we replied to",
		auto_join_text_url: "we were checking out",
		loading_text: "loading tweets..."
	});
	$('.swipe').swipe();
	if ($("#related_carousel li").length > 3)
	{
		$("#related_carousel").carousel({ dispItems:3, pagination:true, } );
	}
	$("#template_carousel").carousel({ dispItems:1, pagination:true, autoSlide:true} );
});
	
	
function toggleDisplay()
{
	var box_width = $("#subscription_div").width();
	if (box_width == 0)
	{
		$("#subscription_div").animate({
		width:153,
		}, 200);
	}
	else
	{
		$("#subscription_div").animate({width:0,marginLeft:0}, 200);
	}
}

var disqus_shortname = 'pmailer';
(function() {
	var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
	dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
	(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();


function validate_bottom()
{
    var cellexp = "^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$";

    if (!document.pm_subscription_form.contact_email.value.match(cellexp))
    {
        alert("The email address that was entered is not valid.\nPlease make sure that the email address conforms to this format: name@domain.co.za");
        return false;
    }
    
    return true;
}


function validate_top()
{
    var cellexp = "^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$";

    if (!document.pm_subscription_form.contact_email.value.match(cellexp))
    {
        alert("The email address that was entered is not valid.\nPlease make sure that the email address conforms to this format: name@domain.co.za");
        return false;
    }
    
    return true;
}


