$(document).ready(function(){ //console.log(curr); $("body").click(function(event){ if ($(event.target).parents(".login-content-wrap").size() == 0) { $(".login-content-wrap").hide(); } }); $('#u-name, #u-pass') .focus(function() { $("label[for='" + this.id + "']").hide(); }) .blur(function() { if(this.value == '') { $("label[for='" + this.id + "']").show(); } }) .focus().blur(); $("#login-link").click(function() { $(".login-content-wrap").show(); return false; }); //$(".dtab .chbk input:checkbox").each(function(){ $(".chbk input:checkbox").each(function(){ //this.checked = !this.checked && !this.disabled; //this.checked = !this.checked; //$(this).attr("checked", ""); $(this).css("display", "none"); }); /*$(".chbk a").hover( function(){ str = $(this).css("backgroundImage"); //if ($(this).css("backgroundImage") != "url(/i/checkbox_bg3.png)"){ if (str.indexOf("checkbox_bg3.png") == -1){ $(this).css({ color: "#ff4400", backgroundImage: "url(/i/ico/ico_checkbox_bg2.png)" }); } }, function(){ str = $(this).css("backgroundImage"); if (str.indexOf("checkbox_bg3.png") == -1){ $(this).css({ color: "#666", backgroundImage: "url(/i/ico/ico_checkbox_bg.png)" }); } } );*/ $(".cmp-link a").toggle( function(){ var item = $(this); var curr = $(this).parent(); var curr2 = $(curr).prev(); //var id = $("a", curr2).attr("href").match(/(\d+)\/*$/)[1]; var id = $("a", curr2).attr("id").match(/(\d+)\/*$/)[1]; //var catalog_id = $("#commpp ul li a:first").attr("href").match(/(\d+)\/*$/)[1]; if( $("input:checkbox", curr).attr("checked") == false ) { $.getJSON("/ajax.php", { option: "catalog", item: id}, function(data){//, catalog: catalog_id , name: $("a", curr2).text() if(data != 1){ //alert('Error'); return false; } $("input:checkbox", curr).attr("checked", "checked"); item.addClass("checked"); if (!$("#commpp ul li ul").size()){ $("#commpp ul li").append('
' + data.error + '
' + data.data.ansver[r].name + ' — ' + data.data.ansver[r].cnt + '%
' + 'Всего ' + data.data.ansver_count + ' голосов
'; $("h2", item).prev().text("Спасибо за участие в нашем опросе"); $("h2", item).after(text); var nHeight = item.height(); var diffHeight = Math.round(nHeight - cHeight); $("#pwModalWindow ,#pwModalContent").animate({ "height": "+=" + diffHeight + "px" }, 200); } } }); return false; }); });