// jQuery: Fancybox, Regionmap and Gallery
//--------------------------------------------------------------START
$(document).ready(function() {
		// Fancybox Region Map
			$("#regionpop").fancybox();
			$("a[rel=group1]").fancybox();
		// VALIDATON BELOW
			// FOOTERFORM
			$("#footerform").validate({
				rules: {
				footercomments:"required",
				footeremail: {
					required: true,
					email: true
				}
			  },
			messages: {
			footercomments: "Please fill in comment form.",
			}
			});
			// Newsletter form
			$("#newsletterform").validate({
				rules: {
				nlemail: {
					required: true,
					email: true
				}
			  }
			});
			// Incident report form
			$("#incidentreportform").validate({
				rules: {
				incidtime: "required",
				inciddate: "required",
				email: {
					required: true,
					email: true
				}
			},
			messages: {
			email: "Use a valid email address.",
			}
			});
		
		// Lousises Target blank new_window.js
			$('A[rel="_blank"]').each(function(){
				$(this).attr('target', '_blank');
			});
			
// Donation
//--------------------------------------------------------------START
	// the minimum required value to be entered.
	// in this case PayPal takes $0.35 from a $1
	// donation, hence we ask for at least $1.35
	var minimum_value = 1.35;
 
	// attach this script to the form's submit action
	$('.form_paypal').submit(function()
	{
		// check if there is an amount entered
		if ($('#input_amount').val() > null)
		{
			// is the amount equal to or higher than the minimum_value?
			if ($('#input_amount').val() < minimum_value)
			{
				// need more amount
				// hide messages, show more amount error
				$('#msg_noamount').hide();
				$('#msg_moreamount').fadeIn();
				return false; // prevent the form from submitting
			}
			else
			{
				// amount is more than minimum_value
				// hide messages, show activity
				$('#msg_moreamount').hide();
				$('#msg_noamount').hide();
				$('#msg_activity').fadeIn();
				$(this).children(".submit").val("Thanks!");
				return true; // submit the form
			}
		}
		else
		{
			// no amount entered at all
			// hide messages, show no amount error
			$('#msg_moreamount').hide();
			$('#msg_noamount').fadeIn();
			return false; // prevent the form from submitting
		}
	});
//--------------------------------------------------------------END
		
});
//--------------------------------------------------------------END
// Lousises javascript is here
//--------------------------------------------------------------START
var image1 = new Image();
image1.src = "images/gallery_nav_org.png";
var image2 = new Image();
image2.src = "images/gallery_nav_roll.png";

function roll(img_name, img_src)
   {
   document[img_name].src = img_src;
   }
//--------------------------------------------------------------END
// Newsfeed
//--------------------------------------------------------------START
rssmikle_url="http://theredcard.ie/news/?feed=rss2";
rssmikle_frame_width="310";
rssmikle_frame_height="400";
rssmikle_target="_blank";
rssmikle_font_size="12";
rssmikle_font_family="Trebuchet MS, 'Helvetica', sans-serif";
rssmikle_border="off";
rssmikle_css_url="";
rssmikle_title="off";
rssmikle_title_bgcolor="#FF0000";
rssmikle_title_color="#FFFFFF";
rssmikle_title_bgimage="http://";
rssmikle_item_bgcolor="#FFFFFF";
rssmikle_item_bgimage="http://";
rssmikle_item_title_length="50";
rssmikle_item_title_color="#bf0413";
rssmikle_item_border_bottom="on";
rssmikle_item_description="on";
rssmikle_item_description_length="50";
rssmikle_item_description_color="#000000";
rssmikle_item_description_tag="off";
rssmikle_item_podcast="off";
//--------------------------------------------------------------END
// Region map image switch NOT IN USE
//--------------------------------------------------------------START
if (document.images) {
     button1 = new Image
     button2 = new Image

     button1.src = '../images/map_ire.png'
     button2.src = '../images/map_uk.png'
 }
//--------------------------------------------------------------END

