function add_highlight(obj) 
{
    document.getElementById(obj).style.background="#FFFE9D";

}

function remove_highlight(obj) 
{
    document.getElementById(obj).style.background="white";
}

function answer_check_cbc(qn_form)
{
	var answer_choice = false;

	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < document.forms.qn_form.answer.length; counter++)
	{
		// If a radio button has been selected it will return true
		// (If not it will return false)
		if (document.forms.qn_form.answer[counter].checked)
		{
			answer_choice = true; 
		}
	}
	if (!answer_choice)
	{
		// If no answer was selected ask them to choose an answer. 
		document.getElementById("feedback").innerHTML="<b>Please choose an answer.</b>";
		document.getElementById("feedback").style.color="#ff0000";
		document.getElementById("feedback").style.fontweight="bold";

		return (false);
	}
	else
	{
		if (qn_form.totqn.value == qn_form.qn_no.value)
		{
		    document.getElementById("feedback").innerHTML='<b>You have answered all choice questions. Please wait for the last set of feedback questions.</b>';						    
	        document.getElementById("feedback").style.color="#0000ff";
		    document.getElementById("feedback").style.fontweight="bold";
		}
		else
		{
		    document.getElementById("feedback").innerHTML='<b>Please wait for the next question.</b>';			
	        document.getElementById("feedback").style.color="#0000ff";
		    document.getElementById("feedback").style.fontweight="bold";
        }
		return (true);
	}
	return (false);
}

function answer_check(qn_form)
{
	var answer_choice = false;

	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < document.forms.qn_form.answer.length; counter++)
	{
		// If a radio button has been selected it will return true
		// (If not it will return false)
		if (document.forms.qn_form.answer[counter].checked)
		{
			answer_choice = true; 
		}
	}
	if (!answer_choice)
	{
		// If no answer was selected ask them to choose an answer. 
		document.getElementById("feedback").innerHTML="<b>Please choose an answer.</b>";
		document.getElementById("feedback").style.color="#ff0000";
		document.getElementById("feedback").style.fontweight="bold";

		return (false);
	}
	else
	{
		if (qn_form.totqn.value == qn_form.qn_no.value)
		{
		    document.getElementById("feedback").innerHTML='<b>You have answered all choice questions. Please wait for the feedback questions.</b>';						    
	        document.getElementById("feedback").style.color="#0000ff";
		    document.getElementById("feedback").style.fontweight="bold";
		}
		else
		{
		    document.getElementById("feedback").innerHTML='<b>Please wait for the next question.</b>';			
	        document.getElementById("feedback").style.color="#0000ff";
		    document.getElementById("feedback").style.fontweight="bold";
        }
		return (true);
	}
	return (false);
}

 tooltip=function(){
 var id = 'tt';
 var top = 3;
 var left = 3;
 var maxw = 300;
 var speed = 10;
 var timer = 20;
 var endalpha = 95;
 var alpha = 0;
 var tt,t,c,b,h;
 var ie = document.all ? true : false;
 return{
  show:function(v,w){
   if(tt == null){
    tt = document.createElement('div');
    tt.setAttribute('id',id);
    t = document.createElement('div');
    t.setAttribute('id',id + 'top');
    c = document.createElement('div');
    c.setAttribute('id',id + 'cont');
    b = document.createElement('div');
    b.setAttribute('id',id + 'bot');
    tt.appendChild(t);
    tt.appendChild(c);
    tt.appendChild(b);
    document.body.appendChild(tt);
    tt.style.opacity = 0;
    tt.style.filter = 'alpha(opacity=0)';
    document.onmousemove = this.pos;
   }
   tt.style.display = 'block';
   c.innerHTML = v;
   tt.style.width = w ? w + 'px' : 'auto';
   if(!w && ie){
    t.style.display = 'none';
    b.style.display = 'none';
    tt.style.width = tt.offsetWidth;
    t.style.display = 'block';
    b.style.display = 'block';
   }
  if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
  h = parseInt(tt.offsetHeight) + top;
  clearInterval(tt.timer);
  tt.timer = setInterval(function(){tooltip.fade(1)},timer);
  },
  pos:function(e){
   var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
   var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
   tt.style.top = (u - h) + 'px';
   tt.style.left = (l + left) + 'px';
  },
  fade:function(d){
   var a = alpha;
   if((a != endalpha && d == 1) || (a != 0 && d == -1)){
    var i = speed;
   if(endalpha - a < speed && d == 1){
    i = endalpha - a;
   }else if(alpha < speed && d == -1){
     i = a;
   }
   alpha = a + (i * d);
   tt.style.opacity = alpha * .01;
   tt.style.filter = 'alpha(opacity=' + alpha + ')';
  }else{
    clearInterval(tt.timer);
     if(d == -1){tt.style.display = 'none'}
  }
 },
 hide:function(){
  clearInterval(tt.timer);
   tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
  }
 };
}();



function show_ccbc_ratings(qn_form)
{
	var answer = 0;
	for (counter = 0; counter < document.forms.qn_form.answer.length; counter++)
	{
		// If a radio button has been selected it will return true
		// (If not it will return false)
		if (document.forms.qn_form.answer[counter].checked)
		{
			answer = document.forms.qn_form.answer[counter].value; 
		}
	}

    if(answer == 1)
    {
        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_2").innerHTML='<input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';			
        document.getElementById("ccbc_3").innerHTML='<input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';			
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
    
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know the price points at which alternatives 2 and 3 will be <u>equally attractive</u> to you as alternative 1.';			
        document.getElementById("price_adj_2").focus();

    }
    else if(answer == 2)
    {
        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_1").innerHTML='<input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';			
        document.getElementById("ccbc_2").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        

        document.getElementById("ccbc_3").innerHTML='<input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';			
        
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know the price points at which alternatives 1 and 3 will be <u>equally attractive</u> to you as alternative 2.';			
        document.getElementById("price_adj_1").focus();    
    }
    else if(answer == 3)
    {
        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1").innerHTML='<input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';			
        document.getElementById("ccbc_2").innerHTML='<input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';			
        document.getElementById("ccbc_3").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know the price points at which alternatives 1 and 2 will be <u>equally attractive</u> to you as alternative 3.';			
        document.getElementById("price_adj_1").focus();

    }
    else if(answer == 4)
    {
        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1").innerHTML='<input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';			
        document.getElementById("ccbc_2").innerHTML='<input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';			
        document.getElementById("ccbc_3").innerHTML='<input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';			
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know the price points at which alternatives 1, 2 and 3 will be <u>equally attractive</u> to you.';			
        document.getElementById("price_adj_1").focus();

    }
}



function answered(radio_qn)
{
    var len=radio_qn.length;
    for (var i=0; i<len; i++)
    {
        if (radio_qn[i].checked)
        {
            return (true);
        }
    }
    return (false);
}

function logout_msg(survey_form)
{
    var totq = survey_form.no_of_survey_qns.value;
    var no_answered = 0;
    // Check radio buttons
    for (var q=1; q <=totq; q++)
    {
        var id = "answer"+q+"_row";
        if (!answered(survey_form.elements["answer"+q]))
        {
            document.getElementById(id).style.color="#ff0000";
        }
        else
        {
            no_answered = no_answered + 1; 
            document.getElementById(id).style.color="#000000";
        }
    }
    
    // Check textarea
    var id = "answer11"+"_row";    
    blankRE = /^[\s]*$/;
    if ((survey_form.answer11.value=="") || blankRE.test(survey_form.answer11.value))
    {
        document.getElementById(id).style.color="#ff0000";    
    }
    else
    {
        no_answered = no_answered + 1; 
        document.getElementById(id).style.color="#000000";
    }
    
	if (no_answered == parseInt(totq)+1)
	{
	    document.getElementById("feedback").innerHTML='<b>Thank you for your feedback. Please wait while we log you out.</b>';						    
        document.getElementById("feedback").style.color="#0000ff";
	    document.getElementById("feedback").style.fontweight="bold";
		    
	    return(true);	    
	}
	else
	{
		// If some answer was NOT selected ask them to choose an answer. 
		document.getElementById("feedback").innerHTML = "You have not given us feedback on all items. Please go back and give us your feedback on the statements colored in <font color=\"red\">red</font>. Thank you.";
		document.getElementById("feedback").style.color="#0000ff";
		document.getElementById("feedback").style.fontweight="bold";

		return (false);
    }
}


function show_ccbc(qn_form)
{
	var answer = 0;
	for (counter = 0; counter < document.forms.qn_form.answer.length; counter++)
	{
		// If a radio button has been selected it will return true
		// (If not it will return false)
		if (document.forms.qn_form.answer[counter].checked)
		{
			answer = document.forms.qn_form.answer[counter].value; 
		}
	}

    if(answer == 1)
    {
        document.getElementById("alt_1").style.display= "block";
        document.getElementById("alt_2").style.display= "none";
        document.getElementById("alt_3").style.display= "none";
        document.getElementById("alt_4").style.display= "none";


        document.getElementById("price_adj_1_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';
        document.getElementById("price_adj_2_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';
        document.getElementById("price_adj_3_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';


        document.getElementById("price_adj_1_header").style.display= "block";
        document.getElementById("price_adj_2_header").style.display= "block";
        document.getElementById("price_adj_3_header").style.display= "block";

        document.getElementById("price_adj_1").innerHTML= '<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';
        document.getElementById("price_adj_2").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';
        document.getElementById("price_adj_3").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';

        document.getElementById("price_adj_1").style.display= "block";
        document.getElementById("price_adj_2").style.display= "block";
        document.getElementById("price_adj_3").style.display= "block";



/*        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_2").innerHTML='<input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';			
        document.getElementById("ccbc_3").innerHTML='<input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';			
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
    
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know your answer to the following questions:<br><br> 1. What should be the price for alternative 2 for you to choose that instead of alternative 1?<br><br> 2. What should be the price for alternative 3 for you to choose that instead of alternative 1?';			
        document.getElementById("price_adj_2").focus();
        */

    }
    else if(answer == 2)
    {
        document.getElementById("alt_1").style.display= "none";
        document.getElementById("alt_2").style.display= "block";
        document.getElementById("alt_3").style.display= "none";
        document.getElementById("alt_4").style.display= "none";


        document.getElementById("price_adj_1_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';
        document.getElementById("price_adj_2_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';
        document.getElementById("price_adj_3_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';

        document.getElementById("price_adj_1_header").style.display= "block";
        document.getElementById("price_adj_2_header").style.display= "block";
        document.getElementById("price_adj_3_header").style.display= "block";

        document.getElementById("price_adj_1").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';
        document.getElementById("price_adj_2").innerHTML= '<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';
        document.getElementById("price_adj_3").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';


        document.getElementById("price_adj_1").style.display= "block";
        document.getElementById("price_adj_2").style.display= "block";
        document.getElementById("price_adj_3").style.display= "block";

/*        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_1").innerHTML='<input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';			
        document.getElementById("ccbc_2").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        

        document.getElementById("ccbc_3").innerHTML='<input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';			
        
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know your answer to the following questions:<br><br> 1. What should be the price for alternative 1 for you to choose that instead of alternative 2?<br><br> 2. What should be the price for alternative 3 for you to choose that instead of alternative 2?';			
        document.getElementById("price_adj_1").focus();
        
        */
    }
    else if(answer == 3)
    {
        document.getElementById("alt_1").style.display= "none";
        document.getElementById("alt_2").style.display= "none";
        document.getElementById("alt_3").style.display= "block";
        document.getElementById("alt_4").style.display= "none";


        document.getElementById("price_adj_1_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';
        document.getElementById("price_adj_2_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';
        document.getElementById("price_adj_3_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';

        
        document.getElementById("price_adj_1_header").style.display= "block";
        document.getElementById("price_adj_2_header").style.display= "block";
        document.getElementById("price_adj_3_header").style.display= "block";

        document.getElementById("price_adj_1").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';
        document.getElementById("price_adj_2").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';
        document.getElementById("price_adj_3").innerHTML= '<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';



        document.getElementById("price_adj_1").style.display= "block";
        document.getElementById("price_adj_2").style.display= "block";
        document.getElementById("price_adj_3").style.display= "block";

/*
        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1").innerHTML='<input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';			
        document.getElementById("ccbc_2").innerHTML='<input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';			
        document.getElementById("ccbc_3").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know your answer to the following questions:<br><br> 1. What should be the price for alternative 1 for you to choose that instead of alternative 3?<br><br> 2. What should be the price for alternative 2 for you to choose that instead of alternative 3?';			
        document.getElementById("price_adj_1").focus();
*/
    }
    else if(answer == 4)
    {
        document.getElementById("alt_1").style.display= "none";
        document.getElementById("alt_2").style.display= "none";
        document.getElementById("alt_3").style.display= "none";
        document.getElementById("alt_4").style.display= "block";


        document.getElementById("price_adj_1_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';
        document.getElementById("price_adj_2_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';
        document.getElementById("price_adj_3_header").innerHTML= '<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';

        document.getElementById("price_adj_1_header").style.display= "block";
        document.getElementById("price_adj_2_header").style.display= "block";
        document.getElementById("price_adj_3_header").style.display= "block";

        document.getElementById("price_adj_1").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';
        document.getElementById("price_adj_2").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';
        document.getElementById("price_adj_3").innerHTML= ' <input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';



        document.getElementById("price_adj_1").style.display= "block";
        document.getElementById("price_adj_2").style.display= "block";
        document.getElementById("price_adj_3").style.display= "block";

  /*
        document.getElementById("ccbc_0_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 1</td></tr></table>';			
        document.getElementById("ccbc_2_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 2</td></tr></table>';			
        document.getElementById("ccbc_3_header").innerHTML='<table class="choice_qn_no_border"><tr><td>Price for Alternative 3</td></tr></table>';			
        document.getElementById("ccbc_4_header").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			

        document.getElementById("ccbc_0").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_1").innerHTML='<input class="ccbc" type="Text" id="price_adj_1" name="price_adj_1" value="">';			
        document.getElementById("ccbc_2").innerHTML='<input class="ccbc" type="Text" id="price_adj_2" name="price_adj_2" value="">';			
        document.getElementById("ccbc_3").innerHTML='<input class="ccbc" type="Text" id="price_adj_3" name="price_adj_3" value="">';			
        document.getElementById("ccbc_4").innerHTML='<table class="choice_qn_no_border"><tr><td>&nbsp</td></tr></table>';			
        document.getElementById("ccbc_header").innerHTML='Please use the boxes provided to let us know your answer to the following questions:<br><br> 1. What should be the price for alternative 1 for you to choose that instead of alternative 4?<br><br> 2. What should be the price for alternative 2 for you to choose that instead of alternative 4?<br><br>3. What should be the price for alternative 3 for you to choose that instead of alternative 4';			
        document.getElementById("price_adj_1").focus();
*/
    }
    
}


function check_radio(survey_form)
{
    var tot_radio_btns = survey_form.no_of_radio_btns.value;
    var no_answered = 0;
    // Check radio buttons
    for (var btn=1; btn <=tot_radio_btns; btn++)
    {
        var id = "button"+btn+"_row";
        if (!answered(survey_form.elements["button"+btn]))
        {
            document.getElementById(id).style.color="#ff0000";
        }
        else
        {
            no_answered = no_answered + 1; 
            document.getElementById(id).style.color="#000000";
        }
    }
        
	if (no_answered == parseInt(tot_radio_btns))
	{
	    document.getElementById("feedback").innerHTML='<b>Please wait for the next question.</b>';						    
        document.getElementById("feedback").style.color="#0000ff";
	    document.getElementById("feedback").style.fontweight="bold";
		    
	    return(true);	    
	}
	else
	{
		// If some answer was NOT selected ask them to choose an answer. 
		document.getElementById("feedback").innerHTML = "You have not answered all the questions. Please go back and correct the errors in <font color=\"red\">red</font>. Thank you.<br>";
		document.getElementById("feedback").style.color="#0000ff";
		document.getElementById("feedback").style.fontweight="bold";

		return (false);
    }
}

function answer_check_ccbc(qn_form)
{
	var answer_choice = false;
	var answer = -1;
	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < document.forms.qn_form.answer.length; counter++)
	{
		// If a radio button has been selected it will return true
		// (If not it will return false)

		if (document.forms.qn_form.answer[counter].checked)
		{
			answer = document.forms.qn_form.answer[counter].value;
			answer_choice = true; 
		}
	}
	if (!answer_choice)
	{
		// If no answer was selected ask them to choose an answer. 
		document.getElementById("feedback").innerHTML="<b>Please choose an answer.</b>";
		document.getElementById("feedback").style.color="#ff0000";
		document.getElementById("feedback").style.fontweight="bold";

		return (false);
	}
	else
	{
        if (answer==1)
        {
            if( (document.forms.qn_form.price_adj_2.value == "") || (document.forms.qn_form.price_adj_3.value == "") )
            {
                document.getElementById("feedback").innerHTML="<b>Please fill in both the price boxes.</b>";
        		document.getElementById("feedback").style.color="#ff0000";
        		document.getElementById("feedback").style.fontweight="bold";
        		
        		if(document.forms.qn_form.price_adj_2.value == "")
        		{
	        		document.getElementById("price_adj_2").style.color="#ff0000";
        		}
	            return false;
            }
        }
        if (answer==2)
        {
            if( (document.forms.qn_form.price_adj_1.value == "") || (document.forms.qn_form.price_adj_3.value == "") )
            {
                document.getElementById("feedback").innerHTML="<b>Please fill in both the price boxes.</b>";
        		document.getElementById("feedback").style.color="#ff0000";
        		document.getElementById("feedback").style.fontweight="bold";
	            return false;
            }
        }
        if (answer==3)
        {
            if( (document.forms.qn_form.price_adj_1.value == "") || (document.forms.qn_form.price_adj_2.value == "") )
            {
                document.getElementById("feedback").innerHTML="<b>Please fill in both the price boxes.</b>";
        		document.getElementById("feedback").style.color="#ff0000";
        		document.getElementById("feedback").style.fontweight="bold";
	            return false;
            }
        }
        if (answer==4)
        {
            if( (document.forms.qn_form.price_adj_1.value == "") || (document.forms.qn_form.price_adj_2.value == "") || (document.forms.qn_form.price_adj_3.value == ""))
            {
                document.getElementById("feedback").innerHTML="<b>Please fill in both the price boxes.</b>";
        		document.getElementById("feedback").style.color="#ff0000";
        		document.getElementById("feedback").style.fontweight="bold";
	            return false;
            }
        }



		if (qn_form.totqn.value == qn_form.qn_no.value)
		{
		    document.getElementById("feedback").innerHTML="<b>You have answered all choice questions. Please wait for the last set of feedback questions.</b>";						    
	        document.getElementById("feedback").style.color="#0000ff";
		    document.getElementById("feedback").style.fontweight="bold";
		}
		else
		{
		    document.getElementById("feedback").innerHTML="<b>Please wait for the next question.</b>";			
	        document.getElementById("feedback").style.color="#0000ff";
		    document.getElementById("feedback").style.fontweight="bold";
        }
		return (true);
	}
	return (false);
}

function survey_qn_check(survey_form)
{
    var totq = survey_form.no_of_survey_qns.value;
    var no_answered = 0;
    // Check radio buttons
    for (var q=1; q <=totq; q++)
    {
        var id = "answer"+q+"_row";
        if (!answered(survey_form.elements["answer"+q]))
        {
            document.getElementById(id).style.color="#ff0000";
        }
        else
        {
            no_answered = no_answered + 1; 
            document.getElementById(id).style.color="#000000";
        }
    }
    
    // Check textarea
    var id = "answer11"+"_row";    
    blankRE = /^[\s]*$/;
    if ((survey_form.answer11.value=="") || blankRE.test(survey_form.answer11.value))
    {
        document.getElementById(id).style.color="#ff0000";    
    }
    else
    {
        no_answered = no_answered + 1; 
        document.getElementById(id).style.color="#000000";
    }
    
	if (no_answered == parseInt(totq)+1)
	{
	    document.getElementById("feedback").innerHTML='<b>Thank you for your feedback. Please wait for the purchasing question. </b>';						    
        document.getElementById("feedback").style.color="#0000ff";
	    document.getElementById("feedback").style.fontweight="bold";
		    
	    return(true);	    
	}
	else
	{
		// If some answer was NOT selected ask them to choose an answer. 
		document.getElementById("feedback").innerHTML = "You have not given us feedback on all items. Please go back and give us your feedback on the statements colored in <font color=\"red\">red</font>. Thank you.";
		document.getElementById("feedback").style.color="#0000ff";
		document.getElementById("feedback").style.fontweight="bold";

		return (false);
    }
}

function logout_after_check(qn_form)
{
	var answer_choice = false;

	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < document.forms.qn_form.answer.length; counter++)
	{
		// If a radio button has been selected it will return true
		// (If not it will return false)
		if (document.forms.qn_form.answer[counter].checked)
		{
			answer_choice = true; 
		}
	}
	if (!answer_choice)
	{
		// If no answer was selected ask them to choose an answer. 
		document.getElementById("feedback").innerHTML="<b>Please choose an answer.</b>";
		document.getElementById("feedback").style.color="#ff0000";
		document.getElementById("feedback").style.fontweight="bold";

		return (false);
	}
	else
	{
		    document.getElementById("feedback").innerHTML='<b>You have answered all . Please wait we log you out.</b>';						    
	        document.getElementById("feedback").style.color="#0000ff";
		    document.getElementById("feedback").style.fontweight="bold";

		return (true);
	}
	return (false);
}

