// JavaScript Document
var current_text=-1;
var total_text = 0;
var text_arr = new Array();
function rotate_text() {
	current_text++;
	if(current_text>=total_text) current_text=0; 
	if($("text_1").visible()) { 
		$("text_2").innerHTML=text_arr[current_text];
		$('text_1').morph('font-size:70px;line-height:30%;',{duration:0.5}).fade({duration:0.5,delay:0.0});
		$('text_2').morph('font-size:70px;line-height:80%;',{duration:0.5,delay:1.5}).appear({duration:0.2,delay:1.5});
	} else { 
		$("text_1").innerHTML=text_arr[current_text]; 
		$('text_2').morph('font-size:70px;line-height:30%;',{duration:0.5}).fade({duration:0.5,delay:0.0});
		$('text_1').morph('font-size:70px;line-height:80%;',{duration:0.5,delay:1.5}).appear({duration:0.5,delay:1.5});
		//$('text_2').fade({duration:0.5});
		//$('text_1').appear({duration:0.5});
	}
	if(total_text>1) { 
		setTimeout("rotate_text();",5000);
	}
}


function loadTextData(url) {
	callAjaxActive = true;
	new Ajax.Request(url, {
		method:"GET",
		parameters: "",
		onSuccess: function(retailer){ 
			var responseArray = retailer.responseText.evalJSON();	 
			if(responseArray['response']['status']==true) {
				if(responseArray['response']['valid']) { 
					total_text=responseArray['response']['value'].length;
					text_arr = responseArray['response']['value'];
					rotate_text();
				} else {
					
				}
			}
		},
		onFailure: function(){ 
			
		}
	});
}
