var $cycle_on = 'init';

function HomeFeatureInitialize() {
	HomeFeatureCycleStart(1);
}

function HomeFeatureCycleStart($select_index) {
	if($cycle_on!=false) {
		var $new_select_index = $select_index+1;
		if($new_select_index > 3) { $new_select_index = 1; }

		if($cycle_on != 'init') {
			HomeFeatureImageSelect($select_index);
		}
		else {
			$cycle_on = true;
		}

		if($cycle_on==true) {
			var t=setTimeout("HomeFeatureCycleStart("+$new_select_index+")",7000);	 
		}
	}
}


function HomeFeatureSelect($select_index) {
	$cycle_on=false;
	HomeFeatureImageSelect($select_index);
}

function HomeFeatureImageSelect($select_index) {
	$image_set = new Array();
	$image_set[1] ="home_feature1";
	$image_set[2] ="home_feature2";
	$image_set[3] ="home_feature3";
	var $temp_val = "";
	var $interface_obj = "";
	for($i=1;$i<4;$i++) {
		$temp_val = "home_feature"+$i;
		$interface_obj = document.getElementById($temp_val);
		if($temp_val == $image_set[$select_index]) {
			$interface_obj.style.display = "block";
			HomeFeatureButtonSet($i);
		}
		else {
			$interface_obj.style.display = "none";
			HomeFeatureButtonUnset($i);
		}
	}
} 

function HomeFeatureButtonSet($select_index) {
	var $interface_obj = "";
	var $temp_val="";
	$temp_val = "home_feature_button"+$select_index;
	$interface_obj = document.getElementById($temp_val);
	$interface_obj.innerHTML='<a href="javascript:HomeFeatureSelect('+$select_index+');"><img src="wp-content/themes/pure_energy/images/hero-button-off.gif" alt="off"></a>';
}

function HomeFeatureButtonUnset($select_index) {
	var $interface_obj = "";
	var $temp_val="";
	$temp_val = "home_feature_button"+$select_index;
	$interface_obj = document.getElementById($temp_val);
	$interface_obj.innerHTML='<a href="javascript:HomeFeatureSelect('+$select_index+');"><img src="wp-content/themes/pure_energy/images/hero-button-on.gif" alt="on"></a>';
}

