var first_resize=!0,Tests_table,Results_table,InfoBoxSplitter; $(document).ready(function(){document.location.href.slice(0,4)=="file"?$("body").html('

'+_("error_copying_is_forbidden")+""):($("#auth-tabs").length&&$("#auth-tabs").tabs({show:function(a,b){$.post("modules/status.php",{status:b.index});$('#auth-tabs a[href="#reg-tab"][disabled="disabled"]').length&&$("#auth-tabs").tabs("disable",1)}}),$("#user-tabs").length&&$("#user-tabs").tabs({show:function(a,b){b.tab.hash=="#info-tab"&&InfoBoxSplitter&&InfoBoxSplitter.refresh(); b.tab.hash=="#tests-tab"&&Tests_table?Tests_table.fnAdjustColumnSizing():b.tab.hash=="#results-tab"&&Results_table&&Results_table.fnAdjustColumnSizing();$('#user-tabs a[href="#results-tab"][disabled="disabled"]').length&&$("#user-tabs").tabs("disable",$('[href="#results-tab"]').parent().index())},select:function(a,b){if(b.tab.hash!="#ShowProfile"&&!$("#t_content").length){var c;switch(b.tab.hash){case "#info-tab":c=7;break;case "#tests-tab":c=2;break;case "#results-tab":c=3}$.post("modules/status.php", {status:c})}},selected:$("body").attr("status")!=5&&$("body").attr("status")!=6?0:$('[href="#tests-tab"]').parent().index()}),$("#cb_language").length&&$("#cb_language").change(function(){$.ajax({async:!1,type:"POST",url:"modules/l10n/localization.php",data:{lang_code:$(this).val()},dataType:"text",cache:!1,success:function(){document.location.href="/"},error:function(){alert(_("error_contact_developers"))}})}),$(window).bind("resize",OnResize),$("button").button(),$("body *").disableSelection(), $("form *").enableSelection(),OnResize(),OnConnectionTimer(),$("#page").fadeIn(1E3),$("#InfoBoxContainer").length&&LoadInfoBox())});function GetHeight(){var a=document.body.clientHeight-120;a<450&&(a=450);return a} function OnResize(){var a=GetHeight();$("#auth-tabs").height(a);$("#user-tabs").height(a+6);$("#auth-tab").height(a-80);$("#reg-tab").height(a-80);$("#info-tab").height(a-38);$(".dataTables_scrollBody").height(a-92);$("#InfoBoxContainer").height(a-35);$("#InfoBoxTree").height(a-53);$("#InfoBoxContent").height(a-63);first_resize||(Tests_table&&Tests_table.fnAdjustColumnSizing(),Results_table&&Results_table.fnAdjustColumnSizing());$("div .ddetails").width($(document).width()-100);first_resize=!1;$("#t_content").height(a- 106);a=$("#end_testing_button").width()+16;$("#progressbar").css("margin-left",a);$("#progressbar").width($("#t_footer").width()-$("#time_available").width()-$("#buttons_panel").width()-a);$(".question_panel, .message_panel").each(function(){var a=$("#t_content").width()-30;$(this).height(1);var c=Math.round(a*0.5),d=$(this).height()/c;d>0.5&&(c=Math.round(a*d));$("#questions_list").length&&(a=a-$("#questions_list").width()-30);c>a&&(c=a);$(this).width(c)})} jQuery.fn.extend({disableSelection:function(){this.each(function(){this.onselectstart=function(){return!1};this.unselectable="on";$(this).css("-moz-user-select","-moz-none")})},enableSelection:function(){this.each(function(){this.onselectstart=function(){};this.unselectable="off";$(this).css("-moz-user-select","text")})}}); function Close(){$.ajax({async:!1,type:"POST",url:"modules/authorization.php",data:{action:"close"},dataType:"text",cache:!1,success:function(){document.location.href="/"},error:function(){}});return!1}function QuestionElementsStylization(){$(".answer_form input").uniform();cuSel({changedEl:".match",visRows:11,scrollArrows:!0})} function FileLinksStylization(){$("div.file_container").each(function(){var a=$(this).attr("type");if(a==0)$(this).html(str_truncate($(this).attr("name"),70,10)+" ("+get_size_string($(this).attr("size"))+")"),$(this).addClass("file_attach_panel"),$(this).click(function(){$("#download_frame").attr("src",document.location.href+"modules/file.php?code="+a.toString()+$(this).attr("key")+"&name="+$(this).attr("name"))});else if(a==1||a==2)if($(this).css("width","100%"),$(this).css("text-align","center"), swfobject.getFlashPlayerVersion().major<10)$(this).addClass("file_container_error"),$(this).html("["+_("error")+"] "+_("testing_error_required_flash_player")+" "+_("testing_install_flash_player")+"").click(function(){window.open("http://get.adobe.com/ru/flashplayer/")});else{var b=GUID(),c=a==2?"360":"37",d=document.location.href+"modules/file.php?code="+a.toString()+$(this).attr("key")+(a==2?"":".mp3"),e="modules/lib/player/"+(a==2?"v.style":"a.style");$(this).css("height",c+"px");$(this).html('

');new swfobject.embedSWF("modules/lib/player/player.swf",b,"640",c,"10.0.0.0",!1,{file:d,st:e},{bgcolor:"#fff",wmode:"window",allowFullScreen:"true",allowScriptAccess:"always"});OnResize()}})}function DialogAlert(a){$("#dialog").html(a).dialog({modal:!0,resizable:!1,width:400,title:_("message_window_caption"),buttons:{OK:function(){$(this).dialog("close")}}})} function OnConnectionTimer(){$.ajax({url:"modules/confirm.php",timeout:1E4,success:function(a){a=="update_full"?location.reload(!0):a=="update_tests"&&Tests_table&&Tests_table.fnReloadAjax()},complete:function(){setTimeout("OnConnectionTimer()",5E3)}})}function OpenRegTab(){$("#auth-tabs").tabs("option","selected",1)} function ShowLicenseInfo(){$.post("modules/license.php",{},function(a){$("#dialog").html(a).dialog({modal:!0,resizable:!1,width:454,title:_("about_window_caption"),buttons:{OK:function(){$(this).dialog("close")}}})})}function s4(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}function GUID(){return s4()+s4()+"-"+s4()+"-"+s4()+"-"+s4()+"-"+s4()+s4()+s4()} function get_size_string(a){if(a<1024)return a.toString()+" "+_("file_size_byte");else if(a<1048576)return(a/1024).toFixed(1).toString()+" "+_("file_size_kb");else if(a<1073741824)return(a/1048576).toFixed(1).toString()+" "+_("file_size_mb");return(a/1073741824).toFixed(1).toString()+" "+_("file_size_gb")}function str_truncate(a,b,c){a.length>b+c&&(a=a.substring(0,b)+"..."+a.substring(a.length-c,a.length));return a} function LoadInfoBox(){InfoBoxSplitter=$("#InfoBoxContainer").split({orientation:"vertical",limit:150,position:"250px"});var a=null;if($("#InfoBoxTree").is(":not(:empty)"))var b=$("#InfoBoxTree").jstree({ui:{select_limit:1,initially_select:['[selected="true"]']},plugins:["themes","html_data","ui","types"]}).bind("select_node.jstree",function(b,d){if(d&&d.rslt&&d.rslt.obj.length){var e=d.rslt.obj.attr("page_id");a!=e&&(a==null?a=e:(a=e,$("#InfoBoxTree").stopTime("Timer"),$("#InfoBoxTree").oneTime(1E3, "Timer",function(){$("#InfoBoxContent").html('')}),$.ajax({type:"POST",url:"modules/infobox/page.php",data:{page_id:a},dataType:"text",timeout:3E4,cache:!1,success:function(a){$("#InfoBoxContent").html(a);FileLinksStylization()},error:function(){$("#InfoBoxContent").html(_("error"))},complete:function(){$("#InfoBoxTree").stopTime("Timer")}})))}}).delegate("a","dblclick",function(){b.jstree(b.jstree("is_closed",$(this))?"open_node":"close_node",$(this))});FileLinksStylization()} ;