var timeoutholder=null;

function getQuestionImage(question, id, value)
{
    var params = 'q=' + question + '&imagename=' + value;
    options = {method: "get", parameters: params};
    new Ajax.Updater(id, 'image_proc.php', options);
}

function unhideQ11Div(value)
{
    if(value == 'Q11A2') {
        document.getElementById('q11yes').style.visibility = "visible";
    }
    else {
       document.getElementById('q11yes').style.visibility = "hidden"; 
    }
}

function hideQ11Div()
{
    document.getElementById("q11yes").style.visibility = "hidden";
}
function dounhideQ11Div()
{
    document.getElementById("q11yes").style.visibility = "visible";
}

function unhideQ12Div(value)
{
    if(value == 'Q12A2') {
        document.getElementById('q12yes').style.visibility = "visible";
    }
    else {
       document.getElementById('q12yes').style.visibility = "hidden"; 
    }
}

function hideQ12Div()
{
    document.getElementById("q12yes").style.visibility = "hidden";
}
function dounhideQ12Div()
{
    document.getElementById("q12yes").style.visibility = "visible";
}

function unhideQ13Div(value)
{
    if(value == 'Q13A2') {
        document.getElementById('q13yes').style.visibility = "visible";
    }
    else {
       document.getElementById('q13yes').style.visibility = "hidden"; 
    }
}

function hideQ13Div()
{
    document.getElementById("q13yes").style.visibility = "hidden";
}
function dounhideQ13Div()
{
    document.getElementById("q13yes").style.visibility = "visible";
}

function unhideQ14Div(value)
{
    if(value == 'Q14A2') {
        document.getElementById('q14yes').style.visibility = "visible";
    }
    else {
       document.getElementById('q14yes').style.visibility = "hidden"; 
    }
}

function hideQ14Div()
{
    document.getElementById("q14yes").style.visibility = "hidden";
}
function dounhideQ14Div()
{
    document.getElementById("q14yes").style.visibility = "visible";
}



function unhideQ16Div(value)
{
    if(value == 'Q16A2') {
        document.getElementById('q16yes').style.visibility = "visible";
    }
    else {
       document.getElementById('q16yes').style.visibility = "hidden"; 
    }
}

function hideQ16Div()
{
    document.getElementById("q16yes").style.visibility = "hidden";
}
function dounhideQ16Div()
{
    document.getElementById("q16yes").style.visibility = "visible";
}

function hideSendEmailDiv()
{
    document.getElementById("sendemail").style.visibility = "hidden";
}

function unhideSendEmailDiv()
{
    document.getElementById("sendemail").style.visibility = "visible";
}


function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=500,scrollbars=yes');
return false;
}

function getHouseHold()
{
    if(timeoutholder!=null)window.clearTimeout(timeoutholder);
    timeoutholder=window.setTimeout("getQuestionImage('Q2', 'imagebox', document.getElementById('Q2').value);", 300);
}

function sendResultsEmail(){
   var url = 'sendresults.php';
   var pars = 'tips='+escape(document.getElementById("tips").value)+'&email='+escape(document.getElementById("email").value)+'&water_usage='+escape(document.getElementById("water_usage").value)+'&personal_usage='+escape(document.getElementById("personal_usage").value);
   var target = 'sendemailresponse';
   var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars});
}
