
/*
 * Control code javascript for Soft 
 * Project:      CMS Danneo : Content management system
 * File:         temp/Soft/javascript/soft.js
 * @copyright    Copyright (C) 2004 - 2010 Danneo Team. All rights reserved.
 * @link         http://danneo.com, http://danneo.ru
 * @license      http://www.gnu.org/licenses/gpl-2.0.html   GNU General Public License, version 2
 */

      $('html').addClass('js');
      $(document).ready(function(){
          $('ul.menu').topmenu();          
      });
      $(document).ready(function(w){
          var cont = $('#w1, #w2, #w3, #table-main, #table-bot,');
          if ($.cookie("switch")== 'fix') {
              cont.addClass('w-fix');
              w.zoom1 = 'fix';
              w.zoom2 = 'full';
              $("#switch").css('background-position', '0 0');
          } else {
              cont.addClass('w-full');
              w.zoom1 = 'full';
              w.zoom2 = 'fix';
              $("#switch").css('background-position', '0 -30px');
          }
          function wides (wid1, wid2) {
              $('#switch').css('display', 'none');
              if (wid1 == 'fix') {
                  w.size = '100%';
                  $("#switch").css('background-position', '0 0');
              } else {
                  w.size = '964px';
                  $("#switch").css('background-position', '0 -30px');
              }
              cont.animate({'width': w.size},500,function() {
                  $(this).removeClass('w-'+wid2);
                  $(this).addClass('w-'+wid1);
                  $(this).removeAttr('style');
                  $('#switch').css('display', 'block');
              });
              $.cookie("switch", wid1, { expires: 7, path: "/" });
          };
          $('#switch').toggle(
              function() { wides (w.zoom2,w.zoom1); },
              function() { wides (w.zoom1,w.zoom2); }
          );
      });
      $(window).bind('load', function() {
          $('#something').fadeTo(0, 0.75, function () {
              $('#something').fadeOut(200);
          });
          if ($.browser.msie && $.browser.version == 6){
              $(document.body).append('<iframe id="something" style="display: none"></iframe>');
          };
      });
$(document).ready(function(){
        $("a:has(img)").each(function(index, obj) {
                if ($(obj).attr("class") == 'colorbox-image') {
                        var $boximg = $(obj).children(0);
                        if ($boximg.attr("longdesc").match(/\.(?:jpe?g|gif|png|bmp)/i) || $boximg.attr("longdesc").match(/(image)/i)) {
                                $(obj).colorbox({
                                        scrolling : false,
                                        rel : $(obj).attr("rel"),
                                        href : $boximg.attr("longdesc"),
                                        title : $(obj).attr("title"),
                                        transition : "elastic",
                                        current : "{current} / {total}"
                                });
                        }
                }
        });
});
$(document).ready(function(){
        $('.tooltip').tooltip({ track:true, delay:0, showURL:false, showBody:" || ", fade:250 });
});
