/* This is the file that controls the elements placed into the rotator.  Text in the item text can be HTML, but any single or double quotes MUST be escaped with a \ first.
   For example, if you want the text to be:
		I said, "She said, 'Hello'."
	You need to enter it as:
		var itemText1 = "I said, \"She said, \'Hello\'.\""
	Most problems you will run into are going to be a result of typos, so if something isn't working check your typing carefully.  
	Remember that filenames and URLs are often case sensitive.	
	
	Javascript (c)2009 Mint Condition Studios - Brian Wood
	http://www.mintconditionstudios.com
	
*/		
// This path defines the absolute path to the images.  It shouldn't need to change but if the images start to break, check to be sure this is still accurate.
var libPath = "/clientimages/27353/template/homepagerotator/"

//Item 1 info
var itemText1 = "<b>Conflict Resolution Seminar</b> - Come learn how to deal with conflict whether at home, in our workplace, or even at church...";
var itemURL1 = "/templates/System/details.asp?id=27353&PG=Events&CID=1208831&rDate=2012-02-12";
var itemImage1 = libPath + "pe1.jpg";


//Item 2 info
var itemText2 = "<b>Card Game Fun Night</b> - Join us for a fun night of playing cards-this is a great way to meet new people...";
var itemURL2 = "/templates/System/details.asp?id=27353&PG=Events&CID=1239880&rDate=2012-02-11";
var itemImage2 = libPath + "pe2.jpg";

//Item3 info
var itemText3 = "<b>Planet Praise</b> - Join us for an interactive family seminar with Jeff Smith...";
var itemURL3 = "/templates/System/details.asp?id=27353&PG=Events&CID=1239862&rDate=2012-02-25";
var itemImage3 = libPath + "pe3.jpg";

//Item4 info
var itemText4 = "<b>New to Grace?</b> - Here you can find out about us, our beliefs, and much more...";
var itemURL4 = "/templates/default.asp?id=27353&PID=734290";
var itemImage4 = libPath + "pe4.jpg";

//You Probably don't need to change these

truncLen = 125; //this is the max char length of the items 


// Do not modify below this line unless you REALLY know what you're doing

if (itemText1.length > truncLen) {
	itemText1 = truncate(itemText1,truncLen);
}

if (itemText2.length > truncLen) {
	itemText2 = truncate(itemText2,truncLen);
}
if (itemText3.length > truncLen) {
	itemText3 = truncate(itemText3,truncLen);
}
if (itemText4.length > truncLen) {
	itemText4 = truncate(itemText4,truncLen);
}

function truncate (str, limit) {
	if (str) {
		var result = str;
  		
  		if (result.length > limit) {

										/* Truncate the content of the str, then go back to the end of the
										   previous word to ensure that we don't truncate in the middle of
										   a word */
	    	
			result = result.substring(0, limit);
    		
			result = result.replace(/\w+$/, '');
		
				/* Add an ellipses to the end and make it a link that expands
				   the paragraph back to its original size */
				/*trunc += '<a href="#" ' +
				  'onclick="this.parentNode.innerHTML=' +
				  'unescape(\''+escape(str.innerHTML)+'\');return false;">' +
				  '...<\/a>';*/
  			  str = result + "...";
			  return (str);
 		}
	}
}
