/**
 
 Classic Charms Random Testimonials v1
 Modified: May 26, 2008
 Copyright 2008 Classic Charms, LLC
 
 **/

var ccrt1_gUniqueRandomCache = "-2,-1";

function ccrt1_joinStringArray(ccrt1_arr, ccrt1_glue) {

	var ccrt1_tbr = "";
	var ccrt1_j = 0;
	for (ccrt1_j = 0; ccrt1_j < ccrt1_arr.length; ccrt1_j++) { if (ccrt1_j!=0) { ccrt1_tbr += ccrt1_glue; } ccrt1_tbr += ccrt1_arr[ccrt1_j]; }
	return ccrt1_tbr;
	
}

function ccrt1_searchArray(ccrt1_arr, ccrt1_query) {

	var ccrt1_k = 0;
	for (ccrt1_k = 0; ccrt1_k < ccrt1_arr.length; ccrt1_k++) { if (ccrt1_arr[ccrt1_k]==ccrt1_query) { return true; } }
	return false;
	
}

function ccrt1_uniqueRandom(ccrt1_max) {

	var ccrt1_cache = ccrt1_gUniqueRandomCache.split(",");
	var ccrt1_tbr = Math.round(Math.random()*ccrt1_max);
	while (ccrt1_searchArray(ccrt1_cache, ccrt1_tbr)==true) { ccrt1_tbr = Math.round(Math.random()*ccrt1_max); }
	ccrt1_cache[ccrt1_cache.length] = ccrt1_tbr;
	ccrt1_gUniqueRandomCache = ccrt1_joinStringArray(ccrt1_cache, ",");
	return ccrt1_tbr;
	
}

function ccrt1_init(ccrt1_parent, ccrt1_num) {

	ccrt1_gUniqueRandomCache = "-2,-1";
	
	if ((!ccrt1_num)||(ccrt1_num<=0)||(!ccrt1_parent)||(ccrt1_parent.getElementsByTagName("div").length<ccrt1_num)) { return; }
	var ccrt1_indicies = new Array(ccrt1_num);
	var ccrt1_i = 0;
	for (ccrt1_i = 0; ccrt1_i < ccrt1_num; ccrt1_i++) { ccrt1_indicies[ccrt1_i] = ccrt1_uniqueRandom(ccrt1_parent.getElementsByTagName("div").length - 1); }
	ccrt1_i = 0;
	
	for (ccrt1_i = 0; ccrt1_i < ccrt1_parent.getElementsByTagName("div").length; ccrt1_i++) {
	
		if (ccrt1_searchArray(ccrt1_indicies, ccrt1_i)==true) { ccrt1_parent.getElementsByTagName("div").item(ccrt1_i).style.display = "block"; ccrt1_parent.getElementsByTagName("div").item(ccrt1_i).style.visibility = "visible"; }
		else { ccrt1_parent.getElementsByTagName("div").item(ccrt1_i).style.display = "none"; ccrt1_parent.getElementsByTagName("div").item(ccrt1_i).style.visibility = "hidden"; }
		
	}
	
}