// JavaScript Document

// Images RollOver
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

$(document).ready(function(){
	MM_preloadImages('../images/antivirus-over.png','../images/best-over.png','../images/repair-over.png');

 });

						   
//For Brands Menu
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("div");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
					


$(document).ready(function(){
  $("#disclaimer").hide(); 
  
  $("#disclaimer_link").click(function(){
  $("#dis_more").hide();           
  $("#disclaimer").toggle();
  });
  
  $("#disclaimer_link_right").click(function(){
  $("#dis_more").hide();           
  $("#disclaimer").toggle();
  });  
  
  
  $("#dis_hide").click(function(){
                $("#disclaimer").hide();
                $("#dis_more").show();
  });
  
  // compare
	$(".compair_btn").click(function(){
		$(".comparison").show();	
	});

  $('#help_survey_1').show();
  
});




var lastDiv = "";
function showDiv(divName) {
	// hide last div
	if (lastDiv) {
		document.getElementById(lastDiv).className = "hiddenDiv";
	}
	//if value of the box is not nothing and an object with that name exists, then change the class
	if (divName && document.getElementById(divName)) {
		document.getElementById(divName).className = "visibleDiv";
		lastDiv = divName;
	}
}





$(document).ready(function(){						   
						   
// For survey form						   
var fadein= 500;
var fadeout= 300;						   
  $("#survey_question1").show(); 
  $("#survey_question2").hide();
  $("#survey_question3").hide();
  $("#survey_question4").hide();
  $("#survey_question5").hide();
  $("#survey_question6").hide();
  $("#survey_question7").hide();
  $("#survey_question8").hide();
  $("#survey_question9").hide();
  $("#survey_question10").hide();
  $("#survey_question11").hide();
  
    

  $(".survey_skip_1").click(function(){
	  var var_name = $("input[name='question1']:checked").val();
	  if(var_name > 0){
       $("#skip_question").show();
       $("#survey_question1").hide();
       $("#survey_question2").fadeIn(fadein);
	  }
  });

  $(".survey_skip_2").click(function(){
	  var q2=0;
	  	q2 = $("input[name='question2']:checked").length;
	  //alert("checked :"+checked);
	  if(q2 >=1){
	   $("#survey_question2").hide();
	   $("#survey_question3").fadeIn(fadein);
	  }
  });

  $(".survey_skip_3").click(function(){
	  var q3=0;
	  	q3 = $("input[name='question3']:checked").length;
	  //alert("checked :"+checked);
	  if(q3 >=1){
	   $("#survey_question3").hide();
	   $("#survey_question4").fadeIn(fadein);
	  }
  });

  $(".survey_skip_4").click(function(){
	 var q4=0;
	  	q4 = $("input[name='question4']:checked").length;
	  //alert("checked :"+checked);
	  if(q4 >=1){
	   $("#survey_question4").hide();
	   $("#survey_question5").fadeIn(fadein);
	  }
								 
	});

  $(".survey_skip_5").click(function(){
	 var q5=0;
	  	q5 = $("input[name='question5']:checked").length;
	  //alert("checked :"+checked);
	  if(q5 >=1){
	   $("#survey_question5").hide();
	   $("#survey_question6").fadeIn(fadein);
	  }
								 
	});

  $(".survey_skip_6").click(function(){
	 var q6=0;
	  	q6 = $("input[name='question6']:checked").length;
	  //alert("checked :"+checked);
	  if(q6 >=1){
	   $("#survey_question6").hide();
	   $("#survey_question7").fadeIn(fadein);
	  }
								 
	});

  $(".survey_skip_7").click(function(){
	 var q7=0;
	  	q7 = $("input[name='question7']:checked").length;
	  //alert("checked :"+checked);
	  if(q7 >=1){
	   $("#survey_question7").hide();
	   $("#survey_question8").fadeIn(fadein);
	  }
								 
	});

  $(".survey_skip_8").click(function(){
	 var q8=0;
	  	q8 = $("input[name='question8']:checked").length;
		var q8_val=$("input[name='question8']:checked").val();
	  //alert("q8 checked :"+q8_val);
	  if(q8 >=1){
	  	   $("#survey_question8").hide();
		  if(q8_val == 1){
	  		$("#Answer4").fadeIn(fadein);
		  }else if(q8_val == 2){
	   		$("#Answer5").fadeIn(fadein);
		  }else if(q8_val == 3){
  	   		$("#Answer6").fadeIn(fadein);
		  }else{
	  		var q1_val=$("input[name='question1']:checked").val();
			var q2_val=$("input[name='question2']:checked").val();
			var q3_val=$("input[name='question3']:checked").val();
	  		var q4_val=$("input[name='question4']:checked").val();
			var q5_val=$("input[name='question5']:checked").val();
			var q6_val=$("input[name='question6']:checked").val();
	  		var q7_val=$("input[name='question7']:checked").val();
			if((q3_val == 2 && q4_val == 2 && q5_val == 2)&&(q1_val == 1 || q2_val == 1 || q6_val == 1 || q7_val == 1)){
				$("#Answer1").fadeIn(fadein);
			}
			if((q4_val == 1) && (q3_val == 2 && q5_val == 2)){
				$("#Answer2").fadeIn(fadein);
			}
			if(q3_val == 1 || q5_val == 1){
				$("#Answer3").fadeIn(fadein);
			}
			if(q1_val == 2 && q2_val == 2 && q3_val == 2 && q4_val == 2 && q5_val == 2 && q6_val == 2 && q7_val == 2){
				$("#Answer7").fadeIn(fadein);
			}
		  }
	  }
								 
	});
   $(".continue_survey").click(function(){
	   $("#Answer7").hide();
	   $("#survey_question1").fadeIn(fadein);
	});

})


// tooltips
function identity_over(){
	document.getElementById("tool_identity").style.display='';
}

function identity_out(){
	document.getElementById("tool_identity").style.display='none';
}

function privacy_over(){
	document.getElementById("tool_privacy").style.display='';
}

function privacy_out(){
	document.getElementById("tool_privacy").style.display='none';
}	

function changebrand(brand){
	location.href = "http://localhost/av/"+brand;	
}


//  Accodion   
        
        
function initAccodion() {
  $('#accordion div').hide();
  $('#accordion div:first').show();

$('#accordion li a').click(
    function() {
               
      var checkElement = $(this).next();
          if((checkElement.is('div')) && (checkElement.is(':visible'))) {
                       /*$(this).removeClass('collapse');
                       $(this).removeClass('onshow');
                       $(this).addClass('expand');
                       $(this).toggleClass('collapse');*/                    
                 
        return false;
        }
      if((checkElement.is('div')) && (!checkElement.is(':visible'))) {
                 
                 /*    $(this).removeClass('expand');
                       $(this).removeClass('onshow');
                       $(this).addClass('collapse');*/
                 
        $('#accordion div:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }
$(document).ready(function() {initAccodion();});


