var blendOut = false;
var blendText = new Array();

blendText[0] = "<strong>Fragrance Evaluation</strong><br><br>Partner with CSS/datatelligence, a company that can help focus your time, your energy and your investment for maximum actionable results ...";
blendText[1] = "<strong>Food and Beverage Evaluation</strong><br><br>Everything you require to conduct professional food and beverage evaluations ...";
blendText[2] = "<strong>Why Test in Las Vegas?</strong><br><br>National Geographical and Ethnic  Representation, Naive Consumers, Accelerated Fielding ...";
blendText[3] = "<strong>VISUAL EMOTIONAL RESPONSE TESTING</strong><br><br>VERT uses Emotion Tool™, the only software that objectively and non-intrusively measures Emotional Response and Visual Attention ...";

blendText[4] = "<strong>CSS / DATATELLIGENCE</strong><br><br>CSS/Datatelligence offers full service sensory research and consumer insights to support your business initiatives. We have experience in food and beverages, personal care, household products and fragrance research.";
blendText[5] = "<strong>EVALUATIVE CRITERIA, INC. </strong><br><br>ECI provides full service custom Quantitative market research services, including study design, questionnaire development, execution of surveys, coding, data tabulation and analysis.";
blendText[6] = "<strong>DATATELLIGENCE ONLINE </strong><br><br>Datatelligence is an online community of individuals who agree to voice their opinions regarding products and services they use on a daily basis.";
blendText[7] = "<strong>CUNNINGHAM FIELD AND RESEARCH SERVICES, INC.</strong><br><br>With locations in over 30 of America's most popular malls, we are equipped to provide a comprehensive sample of respondents to meet all of your research needs.";

/* Blend Class*/
function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		// fade out
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "',true)",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		// fade in
		gettingLighter = false;
		for(i = opacStart; i <= opacEnd; i++) {
			setTimeout("changeOpac(" + i + ",'" + id + "',false)",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id, getLighter) {
	var object = document.getElementById(id).style; 
	
	if( getLighter == blendOut )
	{
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
	}
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}



/* Private methods */
function Fadeout(index)
{
	blendOut = true;
	color = "#fffae5";
	girlFrame = document.getElementById("backframe");
	
	if(index<=3) 
		color ="#fffae5";
		
	if(index == 4)
		color = "#fff6c9";
		
	if(index == 5)
		color = "#d6e1c8";
	
	if(index == 6)
		color = "#c8e0f0";
	
	if(index == 7)
		color = "#f2dbb5";
		
	//vert = c6e0df
	
	girlFrame.style.backgroundColor = color;
	textDiv = document.getElementById("backframeText");
	textDiv.style.display = "block";
	textDiv.innerHTML = "<span class=\"smallText\">" + blendText[index] + "</span>";
	
	currentOpac('bgirl',0, 300);
}

function FadeIn()
{
	blendOut = false;
	girlFrame = document.getElementById("backframe");
	girlFrame.style.backgroundColor ="#fffae5";
	
	textDiv = document.getElementById("backframeText");
	textDiv.style.display = "none";
	
	currentOpac('bgirl',100, 100);
}