FI=0; direction='none'; function SliderConstructor() { $.ajax({ type: "POST", url: "UScript.php", data: {data:1, SLink: 'CreateSlider'}, success: PlaceSlider, }); } function PlaceBlock(data) { $("#MainPart").html(data); $("#UpBtn").bind({ click: function(){ $.ajax({ type: "POST", url: "BlockScript/KI.php", data: {FI: $(this).attr("CP")-1}, success: function(data) { $("#BlockKIWP").html(data); if ($("#UpBtn").attr("CP") > 1) { $("#UpBtn").attr("CP", $("#UpBtn").attr("CP")*1-1); $("#DownBtn").attr("CP", $("#DownBtn").attr("CP")*1-1); } } }); }, mouseenter: function(){ $(this).attr('src', 'KI/Up_h.png'); }, mouseleave: function(){ $(this).attr('src', 'KI/Up.png'); } }) $("#DownBtn").bind({ click: function(){ $.ajax({ type: "POST", url: "BlockScript/KI.php", data: {FI: $(this).attr("CP")}, success: function(data) { $("#BlockKIWP").html(data); if ($("#DownBtn").attr("CP") < MaxPage-1) { $("#DownBtn").attr("CP", $("#DownBtn").attr("CP")*1+1); $("#UpBtn").attr("CP", $("#UpBtn").attr("CP")*1+1); } } }); }, mouseenter: function() { $(this).attr('src', 'KI/Down_h.png'); }, mouseleave: function(){ $(this).attr('src', 'KI/Down.png'); } }) if ($("#DownBtn").attr('cp')==1) { $("#UpBtn").hide(); } else { $("#UpBtn").show(); } if ($("#DownBtn").attr('cp')==MaxPage-1) { $("#DownBtn").hide(); } else { $("#DownBtn").show(); } $("img.Approve").bind({ mouseenter: function(){ $(this).attr('src', 'KI/APPROVE_H.png'); }, mouseleave: function(){ $(this).attr('src', 'KI/APPROVE.png'); }, click: function(){ if (Logined=='yes'){ $(this).attr('src', 'KI/approved.png'); NuM=$(this).attr('picnum'); Count=$(this).attr('apprnum'); $.ajax({ type: "POST", url: "UScript.php", data: {id:NuM, SLink: 'ApproveIdea'}, success: function(){ PageConstructor('Main'); } }); } else { alert('Зарегистрируйтесь, прежде чем оценивать идеи'); } } }); $("#TFAbtn").bind({ }); $("#AddBtn").bind({ mouseenter: function(){ $(this).attr('src', 'KI/add_h.png'); }, mouseleave: function(){ $(this).attr('src', 'KI/add.png'); }, click: function(event){ alert('Для того, чтобы оставлять свои идеи необходимо зарегистрироваться'); event.stopImmediatePropagation(); } }); $(".RedactBtn").bind({ mouseenter: function(){ $(this).attr('src', 'KI/redact_h.png'); }, mouseleave: function(){ $(this).attr('src', 'KI/Redact.png'); }, click: function(){ } }); $("#TFAbtn").bind({ mouseenter: function(){ $(this).css({'backgroundImage': 'url(KI/Ok_h.png)'}); }, mouseleave: function(){ $(this).css({'backgroundImage': 'url(KI/Ok.png)'}); }, click: function(){ $("#Idea").submit(); } }); $("#TFNbtn").bind({ mouseenter: function(){ $(this).css({'backgroundImage': 'url(KI/NONE_h.png)'}); }, mouseleave: function(){ $(this).css({'backgroundImage': 'url(KI/NONE.png)'}); }, click: function(){ $("#TextField").hide(); } }); $(".AdmCom").bind({ mouseenter: function(){ $(this).attr('src','KI/AdComent_h.png') }, mouseleave: function(){ $(this).attr('src','KI/AdComent.png') }, click: function(event){ NuM=$(this).attr('Num'); $("#bodyD").css({"opacity": 0.3}); $("body").css({"overflow": "hidden"}); $("body").append('
'); $("#comment").focus(); setTimeout(function(){ $("#AddAdmCom").bind("click", function(event){ SendComment=strget($("#comment").attr('value')); $.ajax({ type: "POST", url: "UScript.php", data: {id:NuM, Comment: SendComment, SLink: 'CommentIdea'}, success: function() { $("#CommentField").remove(), PageConstructor('Main'); } }); $("#bodyD").css({"opacity": 1}); $("body").css({"overflow": "auto"}); event.stopImmediatePropagation(); }); } ,100); event.stopImmediatePropagation(); } }); } function PlaceSlider(data) { $("#NewsScrollPicture").html(data); } function MenuMove(direction, act) { if (direction=='down') { $("#LoginBody").animate({ height: "301px" },500); $("#MenuLine").animate({ top: "301px" },500); if (act=='reg') { $(".LoginText[type='FSP']").remove(); $("#MenuLine").append("
Закрыть
"); $.ajax({ type: "POST", url: "UScript.php", data: {data:1, SLink: 'Registration'}, success: PlaceReg, }); } if (act == 'Profile') { $.ajax({ type: "POST", url: "UScript.php", data: {data:1, SLink: 'TakeInfo'}, success: function(data){ $("#LoginBody").html(data); $(".ProfMenuItem").bind("click", function(){ $(".ProfMenuItemSE").toggleClass("ProfMenuItemSE"); $(this).toggleClass("ProfMenuItemSE"); SetPage=$(this).attr("settings"); $.ajax({ type: "POST", url: "SettUniScript.php", data: {page: SetPage}, success: function(data){ $("#MenuWork").html(data); var button = $('#uploadButton'), interval; $.ajax_upload(button, { action : 'AvaUpload.php', name : 'myfile', onSubmit : function(file, ext) { // показываем картинку загрузки файла $("img#load").attr("src", "Profile/loading_03.png"); /* * Выключаем кнопку на время загрузки файла */ this.disable(); }, onComplete : function(file, response) { // убираем картинку загрузки файла $("img#load").attr("src", "Profile/load_03.png"); // снова включаем кнопку this.enable(); ava=$("#Avatar").attr("src"); $("#Avatar").attr("src",ava+"?1"); } }); } }); }); $("#settings").bind({ click: function(){ left=$("#MenuLine").width()-632; if ($("#Profile").css("left") != "15px"){ $("#Profile").css({"left" : left}); $("#Profile").animate({ left:"15Px" }, 800); } } }) }, }); } } else { $("#LoginBody").animate({ height: "0px" },500); $("#MenuLine").animate({ top: "0px" },500); $("#LoginBody").html(''); } } function PlaceReg(data){ $("#LoginBody").html(data); var pictures={}; $(".regfield").bind({ keyup:function(){ PressedBtn=$(this).attr('name'); if (PressedBtn == 'pwdR'){ Valu=new Array(strget($("input[name='pwd']").attr('value')), strget($(this).attr('value'))); } else { Valu=strget($(this).attr('value')); } $.ajax({ type: "POST", url: "check.php", data: {field: $(this).attr('name'), Val:Valu}, success: function(data){ data=data.split("|"); $("#"+PressedBtn+"res").attr("src", "Profile/"+data[0]+".png"); pictures[PressedBtn]=''+data[0]; if (data[1]){ SavedValue=data[1];} else {SavedValue='nope';} } }); }, blur: function(){ var check='YES'; var i=0; $.each(pictures, function(key, val) { i++; if (val == 'NO') {check='NO';} }); if (SavedValue != 'nope') { $("input[name='"+PressedBtn+"']").attr("value",SavedValue); } if ((i == 4) && (check == 'YES')) { $("#Register").show(); } } }); } function ltrim(Word) { var ptrn = /\s*((\S+\s*)*)/; return Word.replace(ptrn, "$1"); } function rtrim(Word) { var ptrn = /((\s*\S+)*)\s*/; return Word.replace(ptrn, "$1"); } function trim(Word) { return ltrim(rtrim(Word)); } function SendForm() { LoginVar=trim(document.Registration.login.value); Pass=trim(document.Registration.pwd.value); PassR=trim(document.Registration.pwdR.value); email=trim(document.Registration.email.value); for (i=0; i3 && LoginVar.length<16 && Pass != '' && email != '') { LoginVar=strget(LoginVar); $.ajax({ type: "POST", url: "UScript.php", data: {login: LoginVar, pwd: Pass, pwdR: PassR, gender: Gender, email: email, SLink:'Register'}, success: RegisterEnd, }); } else { alert('Допущенна ошибка при заполнении полей'); } } function RegisterEnd(data) { if (!data=='') { alert(data); } else { alert('На Ваш E-Mail было отправлено письмо с ссылкой для завершения регистрации.'); MenuMove('Down'); $("#LoginBody").html(''); $(".LoginText[type='FSP']").remove(); } } function Login() { $("#LGFRM").submit(); } function LogOut() { top.location.href='logout.php'; }