//if (jQuery.browser.msie6 == false) {

    jQuery.noConflict();

    jQuery(document).ready(function(){
        var user = 0;
        if(jQuery.cookie("voting_user")) user = jQuery.cookie("voting_user");

        jQuery.getJSON("http://voting.devstyle.ru/voting.php?callback=?&start="+user, function(data){
            if(data.error != -1){
                jQuery("#show_voting").html(data.output)
                jQuery("#show_voting").slideToggle("slow");
            }
        });
        jQuery("#voting_form").live("submit",function(){
            var options = {
              url: "http://voting.devstyle.ru/voting.php?callback=?&voting",
              dataType: "json",
              type: "GET",
              crossDomain:true,
              success: function(data) {
                    if(data.error == -1)
                    {
                        alert(data.error_message);
                    }
                    else
                    {
                        jQuery("#show_voting").html(data.output);
                        jQuery.cookie("voting_user",data.id, {expires: 30});
                    }
              }
            };
            jQuery(this).ajaxSubmit(options);
            return false;
        });

        jQuery("#get_result").live("click",function(){
            var id = jQuery(this).attr("rel");
    //        alert(id);
            jQuery.getJSON("http://voting.devstyle.ru/voting.php?callback=?&start="+id, function(data){
                if(data.error != -1){
    //                alert(data.output);
                    jQuery("#show_voting").html(data.output)
                    jQuery("#show_voting").css("display","none");
                    jQuery("#show_voting").fadeIn("slow");
                }
            });

            var timeout = setTimeout(function(){
                jQuery.getJSON("http://voting.devstyle.ru/voting.php?callback=?&start="+0, function(data){
                    if(data.error != -1){
                        jQuery("#show_voting").html(data.output)
                        jQuery("#show_voting").css("display","none");
                        jQuery("#show_voting").fadeIn("slow");
                    }
                });
            }, 3000)

            return false;
        });

    });


//}
