﻿// if javascript is supported set display='none' ul elements
var isSupported = document.getElementById && document.getElementsByTagName;
if (isSupported) { 
    document.documentElement.className = "js";
}
// onload
$(document).ready(function(){
  //$(this).parents('h3').next('div').attr("id");
  //init
  $('p.js').css('display','none');
  $('#ec').css('display','block');
  $('.toog').click(function () {
    $eb = $(this).next('div');
    if ($eb.css('display')=='none') {
      $eb.slideDown('slow');
      $(this).find('>img').attr('src','../images/content/collapse.gif');
    } else {
      $eb.slideUp('slow');
      $(this).find('>img').attr('src','../images/content/expand.gif');
    }
  });
  $('.toog').mouseover(function ()	{
    $(this).find('>img').css('backgroundColor','#fbdb6e');
  });
  $('.toog').mouseout(function ()	{
    $(this).find('>img').css('backgroundColor','#ffffff');
  });
  // switch
  $('.switch > span.op2').addClass('current');
  $('.switch > span.op1').click(function ()	{
    $e_ul = $(this).parents('div.conbox').find('>ul');
    $e_p = $(this).parents('div.conbox').find('>p.js');
    $e_ul.css('display','block');
    $e_p.css('display','none');
    $(this).removeClass('current');
    $(this).next('span.op2').addClass('current');
  });
  $('.switch > span.op2').click(function ()	{
    $e_ul = $(this).parents('div.conbox').find('>ul');
    $e_p = $(this).parents('div.conbox').find('>p.js');
    $e_ul.css('display','none');
    $e_p.css('display','block');
    $(this).removeClass('current');
    $(this).prev('span.op1').addClass('current');
  });
  // ALL
  $('#ec > img:eq(0)').click(function () { 
    $('.conbox').css('display','block');
    $('.toog').find('>img').attr('src','../images/content/collapse.gif');
  });
  $('#ec > img:eq(1)').click(function () { 
    $('.conbox').css('display','none');
    $('.toog').find('>img').attr('src','../images/content/expand.gif');
  });
  $('#ec > img:eq(0), #ec > img:eq(1)').mouseover(function ()	{ $(this).css('backgroundColor','#fbdb6e'); });
  $('#ec > img:eq(0), #ec > img:eq(1)').mouseout(function () { $(this).css('backgroundColor','#ffffff'); });
});