
  var ocontainer;
  var ocontent;
  var ocontainer1;
  var ocontent1;
  var spaceToScroll;
  var spaceToScroll1;
  $(document).ready(
    function () {
        ocontainer = $('div.container1');
        ocontent = $('div.content1');
        
        containerSize = jQuery.iUtil.getSize(ocontainer.get(0));

        containerPosition = jQuery.iUtil.getPosition(ocontainer.get(0));
        containerInner = jQuery.iUtil.getClient(ocontainer.get(0));
        
        contentSize = jQuery.iUtil.getSize(ocontent.get(0));
        
        if(contentSize.hb < containerInner.h) {
          $('div.slider1').css('display', 'none');
        } else {
          $('div.slider1')
            .css('top', containerPosition.y + 'px')
            .css('left', containerPosition.x + containerSize.wb + 'px')
            .css('height', containerSize.hb + 'px');
          
          spaceToScroll = contentSize.hb - containerInner.h;
          
          $('div.indicator1')
            .css('height', containerInner.h * containerSize.hb / contentSize.hb + 'px')
          
          $('.slider1').Slider(
            {
              accept : '.indicator1',
              onSlide : function( cordx, cordy, x , y)
              {
                $('#content1')
                  .css('top', - spaceToScroll * cordy / 100 + 'px');
              }
            }
          );
        }
        
        ocontainer1 = $('div.container2');
        ocontent1 = $('div.content2');
        
        containerSize1 = jQuery.iUtil.getSize(ocontainer1.get(0));
        containerPosition1 = jQuery.iUtil.getPosition(ocontainer1.get(0));
        containerInner1 = jQuery.iUtil.getClient(ocontainer1.get(0));
        
        contentSize1 = jQuery.iUtil.getSize(ocontent1.get(0));

        if(contentSize1.hb < containerInner1.h) {
          $('div.slider2').css('display', 'none');
        } else {
          $('div.slider2')
            .css('top', containerPosition1.y + 'px')
            .css('left', containerPosition1.x + containerSize1.wb + 'px')
            .css('height', containerSize1.hb + 'px');
          
          spaceToScroll1 = contentSize1.hb - containerInner1.h;
          
          $('div.indicator2')
            .css('height', containerInner1.h * containerSize1.hb / contentSize1.hb + 'px')
          
          $('.slider2').Slider(
            {
              accept : '.indicator2',
              onSlide : function( cordx1, cordy1, x1 , y1)
              { 
                $('#content2')
                  .css('top', - spaceToScroll1 * cordy1 / 100 + 'px');
              }
            }
          );
        }
    }
  );

function Select_item(what, item, clicked, desc, val, empty){
   if(window["services_check_status"] == 1)
    window["services_check_status"] = 2;
   if(document.getElementById(clicked).checked == true){ window[val] = window[val] + 1;}
   else {window[val] = window[val] - 1;}

    if(empty == 'All' &&  window[val] == 0)
      document.getElementById(what).value = 'All';
    else {
      if(empty == '-' &&  window[val] == 0)
        document.getElementById(what).value = '';
      else {
        if(desc == "" && window[val] == 0)
          document.getElementById(what).value = "";
        else
        document.getElementById(what).value = window[val] + ' '+desc+' selected';
      }
    }
}

function Listbox(name1){

  if(name1 != 'services_check'){
   if(window["services_check_status"] == 1)
    window["services_check_status"] = 2;
  }

  if(document.getElementById(name1).style.visibility != "visible")
    { document.getElementById(name1).style.visibility = "visible";
      window[name1+"_status"] = 2; }
  else {document.getElementById(name1).style.visibility = "hidden";window[name1+"_status"] = 0; }

  if(document.getElementById(name1).style.display != "block")
    { document.getElementById(name1).style.display = "block"; }
  else {document.getElementById(name1).style.display = "none";}


}
 
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Mr J | http://www.huntingground.net/ */

scrollStep=1

timerLeft=""
timerRight=""
timerTop=""
timerBottom=""


function toLeft(id){
  document.getElementById(id).scrollLeft=0
}

function scrollDivLeft(id){
  clearTimeout(timerRight) 
  document.getElementById(id).scrollLeft+=scrollStep
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
}

function scrollDivRight(id){

  clearTimeout(timerLeft)
  document.getElementById(id).scrollLeft-=scrollStep
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
}

function toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
}

function scrollDivBottom(id){
  clearTimeout(timerTop) 
  document.getElementById(id).scrollTop+=scrollStep
  timerRight=setTimeout("scrollDivBottom('"+id+"')",10)
}

function scrollDivTop(id){
  clearTimeout(timerTop) 
  document.getElementById(id).scrollTop-=scrollStep
  timerRight=setTimeout("scrollDivTop('"+id+"')",10)
}

function toTop(id){
  document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
}
function toBottom(id){
  document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
}

function stopMe(){
  clearTimeout(timerRight) 
  clearTimeout(timerLeft)
  clearTimeout(timerBottom) 
  clearTimeout(timerTop)
}
// PRODUCT_DIVS
function ShowDiv(id){
  document.getElementById(id).style.display = 'block';
}
function HidesDiv(id){
  document.getElementById(id).style.display = 'none';
}




  var semail =  "Enter your emaill";

function make_blank(name1){

  if(document.getElementById(name1).value != window[name1]) { }
  else { document.getElementById(name1).value =""; }
}
function refill(name1){
  if(document.getElementById(name1).value != "") { }
  else { document.getElementById(name1).value = window[name1]; }
}

function PrintVersion(div_id) {
  new_window = null;
  aw = 800;
  ah = 600;

  w=800;
  h=606;

  if (new_window==null || new_window.closed) {
    settings=
    "left=" + (aw-w)/2 + ","
    +"top=" + (ah-h)/2 + ","
    +"screenX=" + (aw-w)/2 + ","
    +"screenY=" + (ah-h)/2 + ","
    +"width=" + w + ","
    +"height=" + h + ","
    +"innerWidth=" + w + ","
    +"innerHeight=" + h + ","
    +"toolbar=no,"
    +"location=no,"
    +"directories=no,"
    +"status=yes,"
    +"menubar=no,"
    +"scrollbars=yes,"
    +"resizable=no"
    new_window = window.open("", '_blank', settings);
  }
  new_window.document.open();
  new_window.document.clear();
  new_window.document.write(
  '<html><head><meta http-equiv="Content-Language" content="ru"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>woodymichleb</title></head><BODY leftMargin=0 topMargin=0 border="0" marginheight="0" marginwidth="0" bgcolor="#AFAFAE"><!-- 100% height TABLE --><!-- /100% height TABLE --><div align="center"><table border="0" style="border-collapse: collapse" width="650" cellpadding="0" id="table21" bgcolor="#FFFFFF"><tr><td rowspan="11" width="50">&nbsp;</td><td height="32" width="586" colspan="2">&nbsp;</td><td rowspan="11" width="50">&nbsp;</td></tr><tr><td valign="top" width="586" colspan="2"><img border="0" src="http://192.168.0.1/woody/images/logo_light.png"></td></tr><tr><td valign="top" height="32" width="586" colspan="2">&nbsp;</td></tr><tr><td valign="top" width="586" colspan="2"><table border="0" style="border-collapse: collapse" cellpadding="0" id="table26"><tr><td class="icon" valign="top"><a onClick="window.print(); return false;" href="#">Print</a>&nbsp;&nbsp;|&nbsp; &nbsp;<a href="javascript:window.close()">Close</a>&nbsp; </td></tr></table></td></tr><tr><td valign="top" height="32" width="586" colspan="2">&nbsp;</td></tr><tr><td valign="top" width="586" colspan="2" style="font-family:Arial, Helvetica, sans-serif;">'
  + document.getElementById(div_id).innerHTML+
'</td></tr><tr><td valign="top" height="32" width="586" colspan="2">&nbsp;</td></tr><tr><td valign="top" width="586" colspan="2"><table border="0" style="border-collapse: collapse" cellpadding="0" id="table25"><tr><td class="icon" valign="top"><span lang="en-us"><a href="http://www.woodymichleb.com/">www.woodymichleb.com</a><br /><br /></span></td></tr></table></td></tr></table></div></body></html>'  );

  new_window.document.close();
  new_window.focus();
}

function HideDivs(){

  if(window["services_check_status"] == 1){
    document.getElementById("services_check").style.visibility = "hidden";
    document.getElementById("services_check").style.display = "none";
  }
  if(window["services_check_status"] == 2){
    window["services_check_status"] = 1;
  }

}

function switch_divs(div_to_hide, div_to_show) {
  $('#'+div_to_hide).BlindUp(500);
  $('#'+div_to_hide).hide();
  $('#'+div_to_show).BlindDown(500, null, 'easeout');
  $('#'+div_to_show).show();
}

function GetOptions(this_id, change_next, sections){
  $.ajax({
      url: _base_url + "get_select.php?id="+$(this_id).val()+"&section="+sections,
      cache: false,
      success: function(html){
      $(change_next).empty();
    $(change_next).html(html);
    }
});
}


//solutiob ajax content
function GET_SOL_DATA(get_vals) {
  $('#content').DropOutRight(500);
  GetContent(get_vals);
  return false;
}

function Reinit_Thikbox() {
  tb_init('a.thickbox, area.thickbox, input.thickbox');
    imgLoader = new Image();// preload image
    imgLoader.src = tb_pathToImage;
}

function GetContent(get_vals) {
  $.ajax({
      url: _base_url + "get_content.php"+get_vals,
      cache: false,
      success: function(html){
        $("#content").empty();
        $("#content").append(html);
        $("#breadcrumb").empty();
        $("#breadcrumb").append($("#breadcrumb_backup").html());
        $('#content').DropInRight(500, null, 'easeout');
    Reinit_Thikbox();
    $(function() {
        $('a[@rel*=gallery]').lightBox();
        $('a.gallery').lightBox();
    });

    }
  });
}




 function isInteger (s)
   {
      var i;

      if (isEmpty(s)) return false;

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
   }

   function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }

   function isDigit (c)
   {
      return ((c >= 0) && (c <= 9))
   }



//     function CustomCheckForm(c_form, c_mandatory_fields) {
// 
//       var error = 0;
//       for(i=0;i<c_mandatory_fields.length;i++) {
//         if($("#"+c_form+"_"+c_mandatory_fields[i]).val() == "") {
//           error = 1;
//           $("#check_"+c_form+"_"+c_mandatory_fields[i]).addClass(class);
//         } else {
//           $("#check_"+c_form+"_"+c_mandatory_fields[i]).removeClass(class);
//         }
//         if(c_mandatory_fields[i] == 'confirm_password') {
// 
//           if($("#"+c_form+"_confirm_password").val() != $("#"+c_form+"_password").val()) {
//             error = 1;
//             $("#check_"+c_form+"_"+c_mandatory_fields[i]).addClass(class);
//           }
//         }
//         if(c_mandatory_fields[i] == 'email') {
//           if(CheckEMail($("#"+c_form+"_email").val()) == false) {
//             error = 1;
//             $("#check_"+c_form+"_"+c_mandatory_fields[i]).addClass(class);
//           }
//         }
//         if(c_mandatory_fields[i] == 'mail') {
//           if(CheckEMail($("#"+c_form+"_mail").val()) == false) {
//             error = 1;
//             $("#check_"+c_form+"_"+c_mandatory_fields[i]).addClass(class);
//           }
//         }
//       }      
//       if(error == 1) {
//         return false;
//      } else  {
// 
//         return true;
//       }
//     }

function CheckEMail(str_email) {
          
        t = str_email.indexOf("@");
        if ((str_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > str_email.length - 5) || (str_email.charAt(t - 1) == '.') || (str_email.charAt(t + 1) == '.'))  {
        alert('Enter Valid Email Adress!');
        return false;
        }
        return true;
    }

function CheckEMail2(str_email) {
          
        t = str_email.indexOf("@");
        if ((str_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > str_email.length - 5) || (str_email.charAt(t - 1) == '.') || (str_email.charAt(t + 1) == '.'))  {
//         alert('Enter Valid Email Adress!');
        return false;
        }
        return true;
    }

//Main page effects
 /*   $(function() {
        $('a[@rel*=gallery]').lightBox();
    });

    $(function() {
        $('a.gallery').lightBox();
    }); */



    function CheckFormInput(ref) {

      var _error = 0;
      var _message = "Будь-ласка заповніть наступні поля:\n";
      var _add = "";
      var _class = "";
      if(ref == 1){
        _add = "#";
        _class = "font_red_color";
      }
      else{
        if(ref == 2){
          _add = "#check_";
          _class = "font_red_color_file";
        }
        else{
          _add = "#check_";
          _class = "font_red_color";
        }
      }

      for(i=0;i<mandatory_fields.length;i++) {
        if($("#"+mandatory_fields[i]).val() == ""
           && mandatory_fields[i] != 'email'
           && mandatory_fields[i] != 'smail'
           && mandatory_fields[i] != 'agree'
           && mandatory_fields[i] != 'mail' ) {

          _error = 1
          if(mandatory_fields[i] == 'file')
            $("#check_"+mandatory_fields[i]).addClass('font_red_color_file');
          else
            $(_add+mandatory_fields[i]).addClass(_class);

            _message += ' - '+window[mandatory_fields[i]]+'\n';


        } else {
          if(mandatory_fields[i] == 'file')
            $("#check_"+mandatory_fields[i]).removeClass('font_red_color_file');
          else
            $(_add+mandatory_fields[i]).removeClass(_class);
        }

        if(mandatory_fields[i] == 'email' || mandatory_fields[i] == 'smail' || mandatory_fields[i] == 'mail') {

          if(CheckEMail2($("#"+"email").val()) == false) {
            _error = 1;

            _message += ' - '+window[mandatory_fields[i]]+'\n';

            $(_add+mandatory_fields[i]).addClass(_class);
          } else {
            $(_add+mandatory_fields[i]).removeClass(_class);
          }
        }
        if(mandatory_fields[i] == 'agree') {
          if(document.getElementById('agree').checked != true) {
            _error = 1;

            _message += ' - '+window[mandatory_fields[i]]+'\n';

            $(_add+"check_"+mandatory_fields[i]).addClass(_class+"2");
          } else {
            $(_add+"check_"+mandatory_fields[i]).removeClass(_class+"2");
          }
        }

      }

 
      if(_error == 1) {
            alert(_message+"Ці поля є обовє'язковими для заповнення!");
        if(ref == 1)
          RefillAll();

        return false;
      } else
        return true;

    }

 
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
 
    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            chngOpc1=setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            chngOpc2=setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }

    }
}
 
//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
 
curr_promotion = 0;
 
// goto next news
function nextNews(p_name, p_precent, p_id, p_count) {
curr_promotion++;

  some_timer=setTimeout("document.getElementById('newsHeadline').innerHTML = '" + p_name[curr_promotion] + "'; document.getElementById('newsBody').innerHTML = '" + p_precent[curr_promotion] + "'; document.getElementById('promotion_link').href = 'get_content.php?spage=book&p_id=" + p_id[curr_promotion] + "'; opacity('newsHeadline', 0, 100, 1000);opacity('newsBody', 0, 100, 1000);", 1000);

  opacity('newsHeadline', 100, 0, 1000);
  opacity('newsBody', 100, 0, 1000);
if(curr_promotion == (p_count - 1))
  curr_promotion = -1;
}

function GetCustomBunnerBackground(banner_id, frame_id) {

  $.ajax({
      url: _base_url + "js_content.php?id="+banner_id+"&frame="+frame_id,
      cache: false,
      success: function(html){
        $('#CustomBannerContentDiv').html();
        $('#CustomBannerContentDiv').html(html);
    }
  });

}

function Check_Img(banner_id, frame_id, time_out) {

  if (document.getElementById('CustomBannerBackgroundImg').complete && document.getElementById('CustomBannerBackgroundImg').src == _base_url +"js_banner.php?id="+banner_id+"&frame="+frame_id) {
  clearInterval(img_timer)
  ChangeBannerFrame(banner_id, frame_id, 1, time_out);
  }
} 


function ChangeBannerFrame(banner_id, frame_id, banner_action, time_out) {


  if(banner_action == 0){

    opacity('CustomBannerContentDiv', 100, 0, 1000);
    opacity('CustomBannerBackgroundDiv', 100, 0, 1000);
some_timer2=setTimeout("document.getElementById('CustomBannerBackgroundImg').src= \"js_banner.php?id="+banner_id+"&frame="+frame_id+"\"", time_out);

    img_timer = setInterval('Check_Img('+banner_id+', '+frame_id+','+time_out+')', 100);

  }

  if(banner_action == 1){

    some_timer=setTimeout("GetCustomBunnerBackground("+banner_id+", "+frame_id+"); opacity('CustomBannerBackgroundDiv', 0, 100, 1000); opacity('CustomBannerContentDiv', 0, 100, 1000);", time_out);

  }


}

