var i = 0;

var questiontexts = new Array();
questiontexts[0] = "what's the description of your survey?";
questiontexts[1] = "are you doing a routed survey?";
questiontexts[2] = "how many responses do you expect?";

var questionvars = new Array();
questionvars[0] = "var0";
questionvars[1] = "var1";
questionvars[2] = "var2";
questionvars[3] = "var3";

var questionanswers = new Array();


/*if ( isUndefined(questionanswers))
{	
	alert('defining');
	var questionanswers = new Array();
}*/
			   
function open_wizard ()
{	
	w = open("/htmlarea/popups/wizard.html", "wizwin",
			 "width=640,height=480,location" );
}

function wizselect(obj)
{
	if (obj.name=='designwiz')
		location="/htmlarea/popups/designwiz.html";
	if (obj.name=='publishwiz')
		location="/htmlarea/popups/publishwiz.html";
	if (obj.name=='resultswiz')
		location="/htmlarea/popups/resultswiz.html";
}

function enterdata(obj)
{
	// if all data is collected, change to php-site
	if (i == 3)
	{
		//p = open("/htmlarea/popups/wizresults.php?test=1", "echopollwizard",
		//"width=640,height=480,location" );
		
		var loc = "/htmlarea/popups/wizresults.php?";
		for (o = 0; o < 4; o++)
		{
			loc +=questionvars[o];
			loc+="=";
			loc+=questionanswers[o];
			loc+= "&";
		}
		//alert(loc);
		//p = open(loc, "echopollwizard","width=640,height=480,location" );
		//this.close();
		location=loc;
	}
	
	// field cannot be blank...
	if(document.wizardshield.surveyname.value == "")
	{
		alert("this field can't be blank");
		return;
	}
	
	//document.wizardshield.content.value+="***";
	//document.wizardshield.content.value+=document.wizardshield.surveyname.value;
		
	var h1 = document.getElementsByTagName("h4")[0];
	h1.firstChild.nodeValue = questiontexts[i];
	
	questionanswers[i] = document.wizardshield.surveyname.value;
	document.wizardshield.surveyname.value="";
	
	i++;
	//document.wizardshield.loop.value=i;
}

function ColorToString (name,color, obj)
{
	//temp = document.chartparams.hl.value;
	// document.chartparams.hl.value= value;
	//var testobject = 
	//var x = obj.getStyle("backgroundColor");
	
	//alert(obj.field.type);
//var x = obj.field.name;
//var y = obj.field.id;
	//var z = document.getElementById(y);
	//var a = z.parentElement;
	//alert(a);
	//document.chartparams.hl.value= color;
	
	//document.chartparams.testdiv.value = setStyle('backgroundCcolor','blue');
//var test = document.getElementById("titlediv");
	//alert (test.id);
	//if (y == "idct")
//if (x == "ct")
//test.style.backgroundColor=color;
	//document.titlediv.style.setStyle("backgroundColor","#000000");
	//document.chartparams.titlediv.setStyle("backgroundGolor","#000000");
	
//var test2 = document.getElementsByName(x);
	//alert (test2[0].name);
	//alert (document.getElementsByName(x)[0].name);
	//var something = document.getElementsByName(x);
	//something[0].style.backgroundColor=color;
//var va = "lalal";
//va = va + test2[0].name;
	//alert(va);
	
	//var EL = document.getElementsByName(name);
	var IDSTR = "id";
	var ESTR = IDSTR + name;
	//alert (ESTR);
	//ELEMENTSTRING.style.backgroundColor=color;
	var DIVELE = document.getElementById(ESTR);
	//alert(DIVELE.id);
	DIVELE.style.backgroundColor=color;
}

function ChartparamsEnabler () //(obj)
{
	$t = document.getElementById("idgtype");
	
		//$selector = obj.value;
		$selector = $t.value;
		//alert (obj.value);
	
		// ******* x-axis title *********
		if ($selector == 1 || $selector == 4 || $selector == 5)
		{
			document.chartparams.xt.disabled=false;				
			document.chartparams.xsize.disabled=false;
			var DIVELE = document.getElementById("idcxtext");	
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("idcx");			
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";					
			DIVELE = document.getElementById("ximg");
			//DIVELE.src="/imgages/sel.gif";
			DIVELE.width="15";									
			DIVELE.height="13";
		}
		else
		{
			document.chartparams.xt.disabled=true;
			document.chartparams.xsize.disabled=true;
			var DIVELE = document.getElementById("idcxtext");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("idcx");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
			DIVELE = document.getElementById("ximg");
			DIVELE.width="0";
			DIVELE.height="0";
		}
		
		// ******* y-axis title *********
		if ($selector == 1 || $selector == 4 || $selector == 5)
		{	
			document.chartparams.yt.disabled=false;
			document.chartparams.ysize.disabled=false;
			DIVELE = document.getElementById("idcytext");
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("idcy");
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";
			DIVELE = document.getElementById("yimg");
			DIVELE.width="15";
			DIVELE.height="13";	
		}
		else
		{	
			document.chartparams.yt.disabled=true;
			document.chartparams.ysize.disabled=true;
			DIVELE = document.getElementById("idcytext");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("idcy");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
			DIVELE = document.getElementById("yimg");
			DIVELE.width="0";
			DIVELE.height="0";
		}
		
		// ******** 3d bar ********
		if ($selector == 1 ||  $selector == 4 || $selector == 5)
		{	
			DIVELE = document.getElementById("threedimtext");
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("threedim1");
			DIVELE.disabled=false;
			DIVELE = document.getElementById("threedim2");
			DIVELE.disabled=false;
		}
		else
		{		
			DIVELE = document.getElementById("threedimtext");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("threedim1");
			DIVELE.disabled=true;
			DIVELE = document.getElementById("threedim2");
			DIVELE.disabled=true
		}
		
		
		// ******** bar color ********
		if ($selector == 1 || $selector == 4)
		{	
			DIVELE = document.getElementById("textbarcolor");
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("idbarcolor");
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";
			DIVELE = document.getElementById("barcolorimg");
			DIVELE.width="15";
			DIVELE.height="13";	
		}
		else
		{
			DIVELE = document.getElementById("textbarcolor");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("idbarcolor");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
			DIVELE = document.getElementById("barcolorimg");
			DIVELE.width="0";
			DIVELE.height="0";
		}
		
			// ******** shadow color ********
		if ($selector == 1 || $selector == 4)
		{	
			DIVELE = document.getElementById("textbarshadow");
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("idbarshadow");
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";
			DIVELE = document.getElementById("shadowcolorimg");
			DIVELE.width="15";
			DIVELE.height="13";	
		}
		else
		{
			DIVELE = document.getElementById("textbarshadow");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("idbarshadow");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
			DIVELE = document.getElementById("shadowcolorimg");
			DIVELE.width="0";
			DIVELE.height="0";
		}
	
		// ******** filled grid layout ********
		if ($selector == 1 || $selector == 5)
		{	
			DIVELE = document.getElementById("idgridtext1");
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("idgridtext2");
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("grid1");
			DIVELE.disabled=false;
			DIVELE = document.getElementById("grid2");
			DIVELE.disabled=false;
			DIVELE = document.getElementById("idgridc1");
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";
			DIVELE = document.getElementById("idgridc2");
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";
			DIVELE = document.getElementById("idgridimg1");
			DIVELE.width="15";
			DIVELE.height="13";
			DIVELE = document.getElementById("idgridimg2");
			DIVELE.width="15";
			DIVELE.height="13";
		}
		else
		{		
			DIVELE = document.getElementById("idgridtext1");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("idgridtext2");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("grid1");
			DIVELE.disabled=true;
			DIVELE = document.getElementById("grid2");
			DIVELE.disabled=true;
			DIVELE = document.getElementById("idgridc1");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
			DIVELE = document.getElementById("idgridimg1");
			DIVELE.width="0";
			DIVELE.height="0";
			DIVELE = document.getElementById("idgridc2");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
			DIVELE = document.getElementById("idgridimg2");
			DIVELE.width="0";
			DIVELE.height="0";
		}
		
		// ******** axis colors ********
		if ($selector == 1 || $selector == 4 || $selector == 5)
		{	
			DIVELE = document.getElementById("idaxiscolorstext");
			DIVELE.style.color="midnightblue";
			DIVELE = document.getElementById("axisimg1");
			DIVELE.width="15";
			DIVELE.height="13";
			DIVELE = document.getElementById("axisimg2");
			DIVELE.width="15";
			DIVELE.height="13";
			DIVELE = document.getElementById("idcxaxis");
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";
			DIVELE = document.getElementById("idcyaxis");
			DIVELE.style.backgroundColor="#B2B2B2";
			DIVELE.style.borderColor="#000000";
			
		}
		else
		{			
			DIVELE = document.getElementById("idaxiscolorstext");
			DIVELE.style.color="#959595";
			DIVELE = document.getElementById("axisimg1");
			DIVELE.width="0";
			DIVELE.height="0";
			DIVELE = document.getElementById("axisimg2");
			DIVELE.width="0";
			DIVELE.height="0";
			DIVELE = document.getElementById("idcxaxis");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
			DIVELE = document.getElementById("idcyaxis");
			DIVELE.style.backgroundColor="#CCCCCC";
			DIVELE.style.borderColor="#CCCCCC";
		}
}

function disableLeft()
{
	alert ("test");
}
function refresh() {
	form = document.echo_response;
	document.echo_response.sec.value=0;
	form.submit();
}

