$(document).ready(function(){
/*#########################################################################
#  CMS Self!Service lite
#  (c) 2010 by Peter Garstenauer & Reynhard Boegl for www.kick-image.at
#  Free Download: www.cms-self-service-lite.at
#########################################################################*/

/*#########################################################################
#  jQuery Script for Snippet "FAQ"
#  Nothing to Change!
#########################################################################*/
 $.get("self_service_lite/customized/ssl_snippets/faq/style.css", function(css) {
  $("head").append("<style type='text/css'>"+css+"</style>");
 }); 
 $("div.ssl_faq div:first-child").each(function() {/* wrap inner content except headline */
		$(this).siblings().wrapAll("<div class='ssl_faq_inner'></div>");
 });  
 $("div.ssl_faq div.sslheadline").nextAll().hide(); /* hide all */
 $("p.ssl_faq_open_close strong").hover(function () { /* show cursor */
		$(this).css({'cursor' : 'pointer'});
 }); 
 $("div.ssl_faq div.sslheadline > *").prepend("<img class='ssl_open_close ssl_open' src='self_service_lite/customized/ssl_snippets/faq/ssl_faq_open.gif' alt='' /><img class='ssl_open_close ssl_close' src='self_service_lite/customized/ssl_snippets/faq/ssl_faq_close.gif' alt='' style='display:none' />");/* add arrow */  
 $("img.ssl_open_close").fadeTo(0.1, 0.4);
 $("img.ssl_open_close").hover(function() { /* hover arrow */
		$(this).fadeTo(100, 1);
		$(this).css({'cursor' : 'pointer'});
			}, function() {
		$(this).fadeTo(0.1, 0.4);
 }); 
 $("div.ssl_faq div.sslheadline").click(function() { /* open single */
		$(this).nextAll().slideToggle("fast");
		$(this).find("img.ssl_open_close").toggle();
 }); 
 $("strong.ssl_faq_open_all").click(function () { /* open all */
  $("div.ssl_faq div.sslheadline").nextAll().slideDown("fast");
  $("div.ssl_faq div.sslheadline").find("img.ssl_close").show();
  $("div.ssl_faq div.sslheadline").find("img.ssl_open").hide();
 });
 $("strong.ssl_faq_close_all").click(function () { /* close all */
  $("div.ssl_faq div.sslheadline").nextAll().slideUp("fast");
  $("div.ssl_faq div.sslheadline").find("img.ssl_close").hide();
  $("div.ssl_faq div.sslheadline").find("img.ssl_open").show();
 });

 /* show all in admin mode */
 $("body.ssl_admin div.ssl_faq div.sslheadline").nextAll().show("fast"); 
 $("body.ssl_admin div.ssl_faq div.sslheadline").find("img.ssl_close").show();
 $("body.ssl_admin div.ssl_faq div.sslheadline").find("img.ssl_open").hide();
 $("body.ssl_admin p.ssl_faq_open_close").append("<span class='ssl_faq_admin_descr'>Im Admin- Modus sind alle mit punktierten Linien markierten Elemente vorerst ausgeklappt bzw. sichtbar!</span>");/* write admin message */
 
if (show_first != 'no') { /* show first */
 $("div.ssl_faq div.sslheadline:first").nextAll().slideDown("fast"); 
 $("div.ssl_faq div.sslheadline:first").find("img.ssl_close").show();
 $("div.ssl_faq div.sslheadline:first").find("img.ssl_open").hide();
};
});
/* write open all - close all links */
if (open_close_all != 'no') { 
 document.write('<p class="ssl_faq_open_close"><strong class="ssl_faq_open_all">');
 document.write(open_all);
 document.write('<img class="ssl_open_close" src="self_service_lite/customized/ssl_snippets/faq/ssl_faq_open.gif" alt="" /></strong><strong class="ssl_faq_close_all"><img class="ssl_open_close" src="self_service_lite/customized/ssl_snippets/faq/ssl_faq_close.gif" alt="" />');
 document.write(close_all)
 document.write('</strong></p>');
};

