// Bible Version generator 
$(document).ready(function() {

	$('p.bibleversion').click( function() {
		$(this).html(gettext()+'<br/><button type="button">Click</button> to generate again');
		if (!$(this).next().hasClass('copyclick')) {
			$(this).after('<p class="copyclick"><a href="#">Put this on your site</a></p>');

	
			$('p.copyclick').bind('click', function() {
		$(this).html('<textarea readonly="readonly" style="font-size: 12px; display: block; overflow: hidden; margin: 0pt auto 15px; width: 180px; height: 250px;"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script> <script type="text/javascript" src="http://wycliffe.org.uk/jquery/bibleversion.js"></script><h3>Bible Version Generator</h3><p class="bibleversion"><button type="button">Click</button> to generate</p></textarea>');
				});
		}
									
	});
});

function gettext() {
var quality = new Array();
var randomquality=Math.floor(Math.random()*18)
quality[0] = "The New";
quality[1] = "The Original";
quality[2] = "Today's";
quality[3] = "The Authentic";
quality[4] = "The Children's";
quality[5] = "The Women's";
quality[6] = "The Men's";
quality[7] = "Everyone's";
quality[8] = "The Spirit Filled";
quality[9] = "The Genuine";
quality[10] = "The Modern";
quality[11] = "The Simplified";
quality[12] = "The Hallowed";
quality[13] = "The Preacher's";
quality[14] = "The Reader's";
quality[15] = "The Illustrated";
quality[16] = "The English";
quality[17] = "The American";

var type = new Array();
var randomtype=Math.floor(Math.random()*10)
type[0] = "Authorised";
type[1] = "Revised";
type[2] = "Living";
type[3] = "Amplified";
type[4] = "Standard";
type[5] = "Literal";
type[6] = "Dynamic";
type[7] = "Received";
type[8] = "Conservative";
type[9] = "Orthodox";


var bible = new Array();
var randombible=Math.floor(Math.random()*7)
bible[0] = "Bible";
bible[1] = "Study Bible";
bible[2] = "Testament";
bible[3] = "Word";
bible[4] = "Translation";
bible[5] = "Gospel";
bible[6] = "Paraphrase";


randomnumber = Math.floor(Math.random()*5);
if (randomnumber == 0) {
	text="Did you know that there are 2,000 languages in the world without a single word of the Bible? If you would like to know more, click <a href=http://www.wycliffe.org.uk/wycliffe/about/vision-whatwedo.html>here</a>";
}
else {
	text = quality[randomquality] + " " + type[randomtype] + " " + bible[randombible];
}
return text;
}

