$(document).ready(
function() 
{
	$("a.comments").click(function (){
		$(this).next().slideToggle("fast");
		return false;
	});
	
	$(function() {
	$(".contact_submit").hide();
	});
		
	var pointer = 0;
	
	var params = {
	  movie: videos[0],
	  allowFullScreen: "true",
	  allowscriptaccess: "always"
	};
	
	swfobject.embedSWF(videos[0], "mainContainer", "159", "137", "9.0.0", "", "", params, "");
	
	$(".next").live("click", function() {
	
		if (pointer < videos.length-1)
		{
			pointer++;
		}
		else
		{
			pointer=0;
		}
		
		var video_url = videos[pointer];
		
		var params = {
		  movie: video_url,
		  allowFullScreen: "true",
		  allowscriptaccess: "always"
		};
		
		swfobject.embedSWF(video_url, "mainContainer", "159", "137", "9.0.0", "", "", params, "");
		return false;
	});


	$(".previous").live("click", function() {
		
		if (pointer == 0)
		{
			pointer=videos.length-1;
		}
		else
		{
			pointer--;
		}
		
	    video_url = videos[pointer];
	
		var params = {
		  movie: video_url,
		  allowFullScreen: "true",
		  allowscriptaccess: "always"
		};
		
		swfobject.embedSWF(video_url, "mainContainer", "159", "137", "9.0.0", "", "", params, "");
		return false;
	});
});

function showRecaptcha(element, submitButton, recaptchaButton, themeName) 
{
  Recaptcha.destroy();
  Recaptcha.create("6Lf6MwsAAAAAAD61L09W35-lsiQNYHJDcTKGnoTI", element, {
        theme: themeName,
        tabindex: 0,
        callback: Recaptcha.focus_response_field
  });
  $(".contact_submit").hide();
  $(".recaptcha_required").show();
  $("#"+recaptchaButton).hide();
  $("#"+submitButton).show();
}

// fix the iframe url issue
if (top.location!= self.location) 
{
	if (self.location != "http://www.savedarfur.org/page/s/sudanwatch" && self.location != "http://www.savedarfur.org/page/s/sudan365organize" && self.location != "http://www.savedarfur.org/page/s/365organizefr" && self.location != "http://www.savedarfur.org/page/s/sudanwatchfr")
	{
		top.location = self.location.href;
	}
	
}
