﻿function complaint(admin) {
new _uWnd('u_complaint','Жалоба на материал',300,100,{align:0,shadow:0,close:1,autosize:1,maxh:500,minh:100,resize:0,oncontent:function() {
$('.theme').change(function() {
if($('.theme option:selected').attr('value')=='Битая ссылка'){$('#upComlaint').html('<fieldset><legend>Рабочая ссылка:</legend><input id="actLink" type="text" style="width:80%"><br><span style="font-size:9px;">Если у вас есть рабочая ссылка на файл, то укажите её.</span></fieldset></fieldset><fieldset><legend>Сообщение:</legend><textarea id="badM" style="width:80%;height:45px">Просьба исправить ссылку в материале, либо удалить его</textarea></fieldset>')}
else if($('.theme option:selected').attr('value')=='Нарушение авторских прав'){$('#upComlaint').html('<fieldset><legend>Исходный файл:</legend><input id="actIst" type="text" style="width:80%"><br><span style="font-size:9px;">Файл доказывающий авторство(<b>.psd</b>,<b>.js</b> и т.п)</span></fieldset><fieldset><legend>Настоящий автор [<b>Имя</b>]:</legend><input id="actIstA" type="text" style="width:80%"></fieldset><fieldset><legend>Ссылка на сайт автора:</legend><input id="actIstL" type="text" style="width:80%"></fieldset><fieldset><legend>Ваше сообщение:</legend><textarea id="actIstM" style="width:80%;height:30px;"></textarea></fieldset>');$('#rP').val('Ссылка на файл: [url='+location.href+']'+location.href+'[/url]\nИсходный файл: [b]'+$('#actIst').val()+'[/b]\nИмя автора:[b] '+$('#actIstA').val()+'[/b]\nСайт автора:[b] '+$('#actIstL').val()+'[/b]\nСообщение:[b] '+$('#actIstM').val()+'[/b]');}
else if($('.theme option:selected').attr('value')=='Жалоба на материал'){$('#upComlaint').html('<fieldset><legend>Причина жалобы:</legend><textarea id="otherM" style="width:80%;height:100px"></textarea></fieldset>');$('#rP').val('Ссылка на файл: [url='+location.href+']'+location.href+'[/url]\nСообщение: [b]'+$('#otherM').val()+'[/b]\nИмя автора:[b] '+$('#actIstA').val()+'[/b]\nСайт автора:[b] '+$('#actIstL').val()+'[/b]\nСообщение:[b] '+$('#actIstM').val()+'[/b]');}
_uWnd.getbyname('u_complaint').checksize()
});
$('.nButton').click(function() {
if($('.theme option:selected').attr('value')=='Битая ссылка'){if($('#badM').val().length=='0'){_uWnd.alert('<center><font color="red">Не заполнено поле <b>Сообщение</b></font></center>', 'Ошибка',{w:300, h:70});$('#upReload').html('<img src="/.s/img/icon/er.png">')}else{$('.strClick').click();$('#rP').val('Ссылка на файл: [url='+location.href+']'+location.href+'[/url]\nРабочая ссылка: [b]'+$('#actLink').val()+'[/b]\nСообщение: [b]'+$('#badM').val()+'[/b]');}}
if($('.theme option:selected').attr('value')=='Жалоба на материал'){if($('#otherM').val().length<'5'){_uWnd.alert('<center><font color="red">Причина должна содержать более <b>5-и</b> символов</font></center>', 'Ошибка',{w:300, h:70});$('#upReload').html('<img src="/.s/img/icon/er.png">')}else{$('.strClick').click();$('#rP').val('Ссылка на файл: [url='+location.href+']'+location.href+'[/url]\nСообщение: [b]'+$('#otherM').val()+'[/b]');}}
if($('.theme option:selected').attr('value')=='Нарушение авторских прав'){if($('#actIst').val().length=='0'){_uWnd.alert('<center><font color="red">Не заполнено поле <b>Исходный файл</b></font></center>', 'Ошибка',{w:300, h:70});$('#upReload').html('<img src="/.s/img/icon/er.png">');return;}
if($('#actIstL').val().length=='0'){_uWnd.alert('<center><font color="red">Не заполнено поле <b>Ссылка на сайт автора</b></font></center>', 'Ошибка',{w:300, h:70});$('#upReload').html('<img src="/.s/img/icon/er.png">');return;}
if($('#actIstA').val().length=='0'){_uWnd.alert('<center><font color="red">Не заполнено поле <b>Настоящий автор [Имя]</b></font></center>', 'Ошибка',{w:300, h:70});$('#upReload').html('<img src="/.s/img/icon/er.png">');return;}
else{$('.strClick').click();$('#rP').val('Ссылка на файл: [url='+location.href+']'+location.href+'[/url]\nИсходный файл: [b]'+$('#actIst').val()+'[/b]\nИмя автора:[b] '+$('#actIstA').val()+'[/b]\nСайт автора:[b] '+$('#actIstL').val()+'[/b]\nСообщение:[b] '+$('#actIstM').val()+'[/b]')}}
});
$.get('/index/14-0-0-1/',function(data){
$('.caphaIMG').html('<img src='+$('#secuImg',data).attr('src')+' style="cursor:pointer;" class="reloaded" align="absmiddle" title="Обновить код безопасности">');
$('.seCap').val($('input[name="seckey"]',data).val())
reloaded = $('#secuImg',data).attr('onclick');
$('.reloaded').click(reloaded)
if($('#secuImg',data).attr('src')==undefined){$('#CF').hide()}
else{}
});
$('.strClick').click(function() {
$('#upReload').html('<img src="http://unasvse.com/images/loadgen.gif">')
$.get('/index/14-0-0-1/', function(data){var ssid = $('input[name="ssid"]', data).val();$.post('/index/', {a: '18',s: admin,subject: $('.theme option:selected').attr('value'),message: $('#rP').val(),seckey:$('.seCap').val(),code:$('.onCode').val(),ssid: ssid},
function(s){
response = $(s).text();
if(response.indexOf('успешно')!=-1){$('#upReload').html('<img src="/.s/img/icon/ok.png">');_uWnd.alert('<center><font color="blue">Жалоба отправлена на рассмотрение</font></center>', 'Успешно',{w:300, h:70});$('.reloaded').click();_uWnd.close('u_complaint')}
else if(response.indexOf('безопасности')!=-1){$('#upReload').html('<img src="/.s/img/icon/er.png">');_uWnd.alert('<center><font color="red">Неверно введён <b>Код безопасности</b></font></center>', 'Ошибка',{w:300, h:70});$('.reloaded').click()}
else if(response.indexOf('самому')!=-1){$('#upReload').html('<img src="/.s/img/icon/er.png">');_uWnd.alert('<center><font color="red">Отправлять сообщение самому себе - <b>бред</b></font></center>', 'Капитан Очевидность',{w:300, h:70});$('.reloaded').click()}
else if(response.indexOf('запретил')!=-1){$('#upReload').html('<img src="/.s/img/icon/er.png">');_uWnd.alert('<center><font color="red">Админ запретил отправлять себе сообщения</font></center>', 'Ошибка',{w:300, h:70});$('.reloaded').click()}
else if(response.indexOf('запрещён')!=-1){$('#upReload').html('<img src="/.s/img/icon/er.png">');_uWnd.alert('<center><font color="red">Доступ заперещён</font></center>', 'Ошибка',{w:300, h:70});$('.reloaded').click()}
});  
});
});

}}, '<div class="strClick"></div><fieldset><legend>Причина жалобы:</legend><select class="theme"><option value="Битая ссылка">Битая ссылка</option><option value="Нарушение авторских прав">Нарушение авторских прав</option><option value="Жалоба на материал">Другая причина</option></select></fieldset><div id="upComlaint"><fieldset><legend>Рабочая ссылка:</legend><input id="actLink" type="text" style="width:80%"><br><span style="font-size:9px;">Если у вас есть рабочая ссылка на файл, то укажите её.</span></fieldset><fieldset><legend>Сообщение:</legend><textarea id="badM" style="width:80%;height:45px">Просьба исправить ссылку в материале, либо удалить его</textarea></fieldset></div><fieldset id="CF"><legend>Код безопасности:</legend><input class="onCode" type="text" autocomplete="off" name="code" style="font-size:20px;padding:4px;width:60px;margin-right:3px;" size="5" maxlength="4"><span class="caphaIMG"></span></fieldset><fieldset><table width="100%"><tr><td align="left" valign="top"><table border="0" cellpadding="0" cellspacing="0" onmousedown="this.className=\'downBtn\'" onmouseover="this.className=\'overBtn\'" onmouseout="this.className=\'outBtn\'"><tr><td class="myBtnLeft"><img alt="" border="0" src="http://s1.ucoz.net/img/1px.gif"/></td><td class="myBtnCenter"><div class="myBtnCont x-unselectable" unselectable="on"><a href="javascript://" class="nButton" id="cButton">Оповестить</a> </div> </td><td class="myBtnRight"><img alt="" border="0" src="http://s1.ucoz.net/img/1px.gif"/></td></tr></table></td><td width="35%" align="right" valign="top"><span id="upReload"></span></td></tr></table></fieldset><input type="hidden" id="rP"><input type="hidden" class="seCap">' )
}; 
