$(document).ready(function(){
  $('.questionAnswer')
    .click(function(e){
      e.stopPropagation();
    })
    .filter(':not(:first)')
    .hide();
    
  $('.questionContainer').click(function(){
    var selfClick = $(this).find('.questionAnswer:first').is(':visible');
    if(!selfClick) {
      $(this)
        .parent()
        .find('> .questionAnswer:visible')
        .slideToggle();
    }
    
    $(this)
      .find('.questionAnswer:first')
      .stop(true, true)
      .slideToggle();
  }).css("cursor","pointer");  
  
  $('#nav').append('<li id="last"><a href="http://www.stm-qrops.com/category/qrops-news/">QROPS News</a></li>');
  $('.white_content .download #li-2-7 input').after('<span>yyyy</span>');
  $('.white_content .download .sendbutton').after('<div id="form-font"><p><strong>Call us today on +350 200 51356</strong></p><p>We may contact you from time to time to inform you of important information in relation to our products. STM Group will never sell, share or allow your data to be utilised by other companies.</p></div>');
  $('.white_content .download #form-font').append('<span id="required">* Required fields</span>');
  
  	//SETTING UP OUR POPUP  
    //0 means disabled; 1 means enabled;  
    var popupStatus = 0;  
	
	//loading popup with jQuery magic!  
    function loadPopup(){  
    //loads popup only if it is disabled  
		if(popupStatus==0){  
			$("#light").fadeIn("slow");  
			$("#light").fadeIn("slow");  
			popupStatus = 1;  
		}  
    } 
	
	//disabling popup with jQuery magic!  
	function disablePopup(){  
	//disables popup only if it is enabled  
		if(popupStatus==1){  
			$("#light").fadeOut("slow");  
			$("#light").fadeOut("slow");  
			popupStatus = 0;  
		}  
	}  
	
	//centering popup  
	function centerPopup(){  
	//request data for centering  
		var windowWidth = document.documentElement.clientWidth;  
		var windowHeight = document.documentElement.clientHeight;  
		var popupHeight = $("#light").height();  
		var popupWidth = $("#light").width();  
		
		//centering  
		$("#light").css({  
			"position": "absolute",  
			"top": windowHeight/2-popupHeight/2
		});  
		//only need force for IE6  
		
	  
	}
  
	//LOADING POPUP  
	//Click the button event!  
	$("#banner a.fauxButton").click(function(){  
		//centering with css  
		centerPopup();  
		//load popup  
		loadPopup();  
	}); 
	
	//CLOSING POPUP  
	//Click the x event!  
	$("#closewindow").click(function(){  
		disablePopup();  
	});  
	
  
});


/* settings toggle code 

$(document).ready(function(){
  $('.answer').hide();
  
  $('.question').click(function(){
    $('.answer').toggle('fast');
	
  });
  
});*/

