        function leaveStar()
        {
            value = $j('#frmcommentadd-rating').val();
    
            if(value>=2)
                $j('#a_star_2').html('<img src="./images/red_star_ico.gif" width="13" height="12" alt="img" />');
            else
                $j('#a_star_2').html('<img src="./images/grey_star_ico.gif" width="13" height="12" alt="img" />');
            if(value>=3)
                $j('#a_star_3').html('<img src="./images/red_star_ico.gif" width="13" height="12" alt="img" />');
            else
                $j('#a_star_3').html('<img src="./images/grey_star_ico.gif" width="13" height="12" alt="img" />');
            if(value>=4)
                $j('#a_star_4').html('<img src="./images/red_star_ico.gif" width="13" height="12" alt="img" />');
            else
                $j('#a_star_4').html('<img src="./images/grey_star_ico.gif" width="13" height="12" alt="img" />');
            if(value>=5)
                $j('#a_star_5').html('<img src="./images/red_star_ico.gif" width="13" height="12" alt="img" />');
            else
                $j('#a_star_5').html('<img src="./images/grey_star_ico.gif" width="13" height="12" alt="img" />');
            
            setStarName(value);
        }
        
        function enterStar(number)
        {
            for(j = 1; j<(number+1); j++)
            {
                $j('#a_star_'+j).html('<img src="./images/red_star_ico.gif" width="13" height="12" alt="img" />');
            }
            for(j = (number+1); j<6; j++)
            {
                $j('#a_star_'+j).html('<img src="./images/grey_star_ico.gif" width="13" height="12" alt="img" />');
            }
        }
        
        function setStarName(number)
        {
//            for(i = 1; i< 6; i++)
//            {
//                $j('#result'+i).css('display','none');
//            }
            $j('#result1').css('display','none');
            $j('#result2').css('display','none');
            $j('#result3').css('display','none');
            $j('#result4').css('display','none');
            $j('#result5').css('display','none');
            
            $j('#result'+number).css('display','inline');
        }
        
        function selectBox(element)
        {
            $j(element+' .items_wrapper').mouseleave(function()
            {
                $j(element+' .items_wrapper').css('display','none');
            });
            
            $j(element+' .items_wrapper ul').click(function()
            {
                $j(element+' .items_wrapper').css('display','none');
            });

            $j(element+' .select_arrow, '+element+' .text_input').click(function()
            {
                if($j(element+' .items_wrapper').css('display')=='none')
                    $j(element+' .items_wrapper').css('display','inline');
                else
                    $j(element+' .items_wrapper').css('display','none');
            });
            
            $j(element+' .items_wrapper').click(function()
            {
                    $j(element+' .items_wrapper').css('display','none');
            });
        }
        
        function IsNumeric(sText)
        {
          var ValidChars = "0123456789";
          var IsNumber=true;
          var Char;
          var i;

          for (i = 0; i < sText.length && IsNumber == true; i++) 
          { 
             Char = sText.charAt(i); 
             if (ValidChars.indexOf(Char) == -1) 
             {
             IsNumber = false;
             }
          }
          if(sText == '')
          {
             IsNumber = false;
          }
          return IsNumber;

        }
        
//        function theRotator(interval,mode)
//        {
//              var inmode = mode;
//
//              $j('div#rotator ul li').css({opacity: 0.0});
//              $j('div#rotator ul li:first').css({opacity: 1.0});
//
//              setInterval('rotate('+inmode+')',interval);
//
//        }
//
//        var citac = 0;
//
//        function rotate(mmode) 
//        {
//
//            var noo = $j('div#rotator ul li').length;
//
//            if(citac!==noo || mmode!==2)
//            {
//
//                var current = ($j('div#rotator ul li.show')?  $j('div#rotator ul li.show') : $j('div#rotator ul li:first'));
//                var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $j('div#rotator ul li:first') :current.next()) : $j('div#rotator ul li:first')); 
//
//                next.css({opacity: 0.0})
//                .addClass('show')
//                .animate({opacity: 1.0}, 1000);
//
//                current.animate({opacity: 0.0}, 1000)
//                .removeClass('show');
//
//                citac++;
//              }
//        }

        var citac = 0;
        var intervalpointer = 0;
        var intervalsize = 0;
        var globmode = 0;

        function theRotator(interval,mode)
        {
              if(intervalpointer == 0)
              {
                  intervalsize = interval;
                  globmode = mode;

                  $j('div#rotator .hp_banners > li').hide(0); 
                  $j('div#rotator .hp_banners > li:first').show(0);

                  intervalpointer = setInterval('rotate('+globmode+')',intervalsize);
              }
        }

        function rotate(mmode) 
        {

            var noo = $j('div#rotator .hp_banners > li').length;

            if(citac!==noo || mmode!==2)
            {

                var current = ($j('div#rotator .hp_banners > li.show')?  $j('div#rotator .hp_banners > li.show') : $j('div#rotator .hp_banners > li:first'));
                var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $j('div#rotator .hp_banners > li:first') :current.next()) : $j('div#rotator .hp_banners > li:first')); 

                next.hide(0); 
                next.addClass('show');
                next.fadeIn(1000);

                current.fadeOut(1000);
                current.removeClass('show');

                citac++;
              }
        }
        
        function setBg(index, interval, mode)
        {
              if(intervalpointer != 0)
                clearInterval(intervalpointer);
            
              intervalsize = interval;
              globmode = mode;
            
              var current = ($j('div#rotator .hp_banners > li.show')?  $j('div#rotator .hp_banners > li.show') : $j('div#rotator .hp_banners > li:first'));
              var next = $j('div#rotator .hp_banners > li').eq(index-1);

              next.hide(0); 
              next.addClass('show');
              next.fadeIn(1000);

              current.fadeOut(1000);
              current.removeClass('show');
              
              intervalpointer = setInterval('rotate('+globmode+')',intervalsize);

        }
