﻿function showAnswer()
{
 //var input = $(":radio option:selected").find("#answer");

 var input = $(":radio[name='answer']:checked");

 if (input.length == 1)
 {
   var selectedVal = input[0].value;
    var messageId = "message" + selectedVal;
    $(".message").css("display","none");
    $(".curvetop").css("display","none"); //used for some non answer related questions
    
    $("#" + messageId).css("display","block");
 }
}    

function showCheckAnswer()
{
   if(checkTwoAnswers())
{
//continue;
$(".error").text(' ');


$(".message").css("display","none");

 $('input:checkbox').each( function() {

if(this.checked)
{
$("#message"+this.value).css("display","block");
}

});

}
else
{

	$(".error").text('You must select TWO options!');
}
}

function checkTwoAnswers()
{

if($(":checkbox:checked").size() != 2)
{
	return false;
}
else
{
	return true;
}


}


function showAllRadio()
{
     $(".showradio").css("display","block");

}


function imageShowAnswer()
{
 //var input = $(":radio option:selected").find("#answer");
var id = "";




if(($("#settings1").attr("style").toLowerCase() == "display: block") || ($("#settings1").attr("style").toLowerCase() == "display: block;"))
{

   id="1";
}
else if (($("#settings2").attr("style").toLowerCase() == "display: block") || ($("#settings2").attr("style").toLowerCase() == "display: block;"))
{

 id="2";
}
else if (($("#settings3").attr("style").toLowerCase() == "display: block") || ($("#settings3").attr("style").toLowerCase() == "display: block;"))
{

 id="3";
}
else if (($("#settings4").attr("style").toLowerCase() == "display: block") || ($("#settings4").attr("style").toLowerCase() == "display: block;"))
{

id="4";
}
$(".message").css("display","none");

$("#message"+id).css("display","block");

}    


$(document).ready(function() {

if($(".floatline"))
{
    $(".floatline").click(function(){
        //get the id of the current selected class
        //because there is a few .floatline elements
        var id = $(this).attr('id');
        
        //remove any items with floatactive first
         RemoveCurrentSelected();
        //assign selected class for item
        
        $("#"+id).addClass("floatactive");      
        $("#"+id+" .imgcontainer").addClass("photoactive-right");
        $("#"+id).removeClass("floatline");
        
        //now need to set the info text in setting# div tags
        //get the last char
        
        var lastpos = id.charAt(id.length-1);
       // alert(lastpos);
        //show the setting number, limited to 9 containers
        $(".highlight").css("display","none");
        $("#settings"+lastpos).css("display","block");

    });

}

if($(".floatline3"))
{
    $(".floatline3").click(function(){

        //get the id of the current selected class
        //because there is a few .floatline elements
        var id = $(this).attr('id');
        
        //remove any items with floatactive first
         RemoveCurrentSelected();
        //assign selected class for item
        
        $("#"+id).addClass("floatactive3");      
        $("#"+id+" .imgcontainer").addClass("photoactive-right");
        $("#"+id).removeClass("floatline3");
        
        //now need to set the info text in setting# div tags
        //get the last char
        
        var lastpos = id.charAt(id.length-1);
       // alert(lastpos);
        //show the setting number, limited to 9 containers
        $(".highlight").css("display","none");
        $("#settings"+lastpos).css("display","block");
        
    });

}

if($(".floatactive3"))
{
    $(".floatactive3").click(function(){

        //get the id of the current selected class
        //because there is a few .floatline elements
        var id = $(this).attr('id');
        
        //remove any items with floatactive first
         RemoveCurrentSelected();
        //assign selected class for item
        
        $("#"+id).addClass("floatactive3");      
        $("#"+id+" .imgcontainer").addClass("photoactive-right");
        $("#"+id).removeClass("floatline3");
        
        //now need to set the info text in setting# div tags
        //get the last char
        
        var lastpos = id.charAt(id.length-1);
       // alert(lastpos);
        //show the setting number, limited to 9 containers
        $(".highlight").css("display","none");
        $("#settings"+lastpos).css("display","block");
        
    });

}


function RemoveCurrentSelected()
{
    if($(".floatactive"))
    {
        $(".floatactive").addClass("floatline");
    
        $(".floatactive").removeClass("floatactive");
    }
    if($(".floatactive3"))
    {
        $(".floatactive3").addClass("floatline3");
    
        $(".floatactive3").removeClass("floatactive3");
    }
    
    if($(".photoactive-right"))
    {
        $(".photoactive-right").removeClass("photoactive-right");
    }
    
    
}


//$(".NextButton").hover(
//    function() {$(this).addClass("NextButtonHover");}, 
//    function() {$(this).removeClass("NextButtonHover");}
//    );

});
