var opswin;
var top_=10;
var left_=10;
function adm_opwin(a,w,h){
if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && opswin!=null && !opswin.closed)opswin.close();
//tops(w,h);
opswin=window.open(a,'',"height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=yes,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
opswin.focus();
}
function tops(w,h){
if(navigator.appName == "Netscape") {
top_=window.innerHeight/2-h/2;
left_=window.innerWidth/2-w/2;
}
else{
top_=document.body.clientHeight/2-h/2;
left_=document.body.clientWidth/2-w/2;
}
if(top_<0)top=0;
if(left_<0)top=0;
}
var ind=0;
function iframe_href(a){
window.frames['iframe_index'+ind].location.href='iframe_index.php?'+a;
if(++ind>4)ind=0;
}
function iframe_href_select(a,i){
window.frames['iframe_index'+i].location.href='/adm/iframe_index.php?'+a;
}
function popwin(nam,w,h){
var linkk='/popwin.html?link='+nam;
//tops(w,h);
var scrollbars='no';
if(w>1000 || h>800){
w=w+16;
h=h+16;
scrollbars='yes';
}
param = 'top='+top_+',left='+left_+',width='+w+',height='+h;
if(navigator.userAgent.toLowerCase().indexOf("opera")==-1 && opswin!=null && !opswin.closed)opswin.close();
opswin=window.open(linkk,'',param+',status=no,toolbar=no,menubar=no,scrollbars='+scrollbars+',resizable=yes');
opswin.focus();
return false;
}
var edit_layer_id_old='-';
function edit_layer_show(a){
edit_layer_cleartimeout();
if(edit_layer_id_old!='-' && document.getElementById('t'+edit_layer_id_old)){
document.getElementById('t'+edit_layer_id_old).style.display='none';
edit_layer_id_old='-';
}
if(document.getElementById('t'+a)){
document.getElementById('t'+a).style.display='block';
edit_layer_id_old=a;
}
}
function edit_layer_hide(a){
if(document.getElementById('t'+a))document.getElementById('t'+a).style.display='none';
}
var edit_layer_timeout;
function edit_layer_hide_timeout(a){
edit_layer_timeout=setTimeout("edit_layer_hide('"+a+"')",500);
}
function edit_layer_cleartimeout(){
clearTimeout(edit_layer_timeout);
}
var start_div='-';
function show_alt_mouse(nim,t){
if(document.getElementById("div_"+nim) ){
show_alt_cleartimeout();
var d=document.getElementById("div_"+nim).style;
show_alt_hide(start_div);
start_div=nim;
d.display='block';
}
}
function show_alt_hide(a){
if(document.getElementById('div_'+a)){
document.getElementById('div_'+a).style.display='none';
}
}
var show_alt_timeout;
function show_alt_hide_timeout(a){
show_alt_timeout=setTimeout("show_alt_hide('"+a+"')",500);
}
function show_alt_cleartimeout(){
clearTimeout(show_alt_timeout);
}
if(typeof($)!='undefined'){
//if (typeof jQuery == "function" && ('ui' in jQuery) && jQuery.ui && ('version' in jQuery.ui)){
$(function(){
//beautiful otkritie
//$('a.img_middle_beauti').live("click",function () {
$(document).on("click", "a.img_middle_beauti",function(){
var w=$(this).attr('desc_w');
var h=$(this).attr('desc_h');
var a=$(this).attr('desc_a');
//alert(a);
var temp='';
temp+='

';
$('#img_big_beauti').html(temp).fadeIn("slow");
$('#img_big_beauti').width(w*1+120);
$('#img_big_beauti').height(h*1+120);
set_position_beauti(w*1+120,h*1+120);
});
//$('#close_beauti').live("click",function () {
$(document).on("click", "#close_beauti",function(){
$('#img_big_beauti').fadeOut("slow");
return false;
});
//close by ESC
$(document).keydown(function(e) {
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
//alert(key);
switch(key) {
case 27: $('#img_big_beauti').fadeOut("slow"); break;// esc
}
});
//end
$(".spoiler").each(function(){
var obj=$(this);
var first=obj.children(":first");//:not(ul,table).filter("a,b,i,div,span,strong,em,h1,h2,h3,h4");
//alert(first.html());
var head=$("").append(first).html();
first.remove();
var text=obj.html();
//obj.empty();
//alert(spoiler_header_text);
if(typeof(spoiler_header_text)=='undefined')spoiler_header_text='';
head=''+head+' ('+spoiler_header_text+')';
text=''+text+'
';
obj.replaceWith(head+text);
});
$(".spoiler_head").live("click",function(){
//$(document).on("click", ".spoiler_head",function(){
var obj=$(this);
var text_obj=obj.next(".spoiler_text");
if(text_obj.css("display")=="none"){
text_obj.css("display","block");
}
else{
text_obj.css("display","none");
}
return false;
});
//var id_elm=0;
//var id_elm_open=0;
$(".spoilerbutton").each(function(){
var obj=$(this);
var first=obj.children(":first");//:not(ul,table).filter("a,b,i,div,span,strong,em,h1,h2,h3,h4");
//alert(first.html());
var head=$("").append(first).html();
first.remove();
first=obj.children("br:first-child");
first.remove();
var text=obj.html();
//obj.empty();
head=''+head+'';
text='';
obj.replaceWith(''+head+text+'
');
});
$(".spoilerbutton_head").live("click",function(){
//$(document).on("click", ".spoilerbutton_head",function(){
var obj=$(this);
//var ob_id=obj.parent().get(0).id;
$(".spoilerbutton_open").each(function(idn,ob){
//alert(ob.id+' = '+ob_id);
//if(ob.id!=ob_id){
//alert($(ob).html());
$(ob).removeClass("spoilerbutton_open").addClass("spoilerbutton");
$(ob).children(".spoilerbutton_text").css("display","none");
$(ob).children(".spoilerbutton_head").css("display","block");
//}
});
var text_obj=obj.next(".spoilerbutton_text");
if(text_obj.css("display")=="none"){
//var w=text_obj.parent().width();
text_obj.parent().removeClass("spoilerbutton").addClass("spoilerbutton_open");
//text_obj.parent().width(w);
text_obj.css("display","block");
obj.css("display","none");
//id_elm_open=ob_id;
}
else{
text_obj.parent().removeClass("spoilerbutton_open").addClass("spoilerbutton");
text_obj.css("display","none");
obj.css("display","block");
//id_elm_open=0;
}
return false;
});
$(".spoilerbutton_text").live("click",function(){
//$(document).on("click", ".spoilerbutton_text",function(){
//alert($(this).find('ul').is('.links-3g-ul'));
if($(this).find('ul').is('.links-3g-ul'))return true;
$(this).parent().removeClass("spoilerbutton_open").addClass("spoilerbutton");
$(this).css("display","none");
$(this).prev().css("display","block");
return true;
});
});
}
//beautiful otkritie
function set_position_beauti(w,h){
var email_left=($(window).width()-w)/2;
var email_top=($(window).height()-h)/2;
if (email_left<0) email_left=0;
if (email_top<0) email_top=0;
email_top = $(window).scrollTop() + email_top;
email_left = $(window).scrollLeft() + email_left;
$("#img_big_beauti").offset({top:email_top, left:email_left});
}
function array_set_cookie(cookie_name, cookie_value, cookie_expire, cookie_path, cookie_domain, cookie_secure) {
var cookie_string = cookie_name + "=" + cookie_value;
if (cookie_expire) {
var expire_date = new Date();
var ms_from_now = cookie_expire * 24 * 60 * 60 * 1000;
expire_date.setTime(expire_date.getTime() + ms_from_now);
var expire_string = expire_date.toGMTString();
cookie_string += "; expires=" + expire_string;
}
if (cookie_path)cookie_string += "; path=" + cookie_path;
if (cookie_domain)cookie_string += "; domain=" + cookie_domain;
if (cookie_secure)cookie_string += "; true";
document.cookie = cookie_string;
}
//добавляет если нет, и удаляет если есть...........
function array_add_del_cookie_value(cookie_name, cookie_value, cookie_path) {
var cookie_value_old=','+array_get_cookie(cookie_name);
var cookie_value_search=','+cookie_value+',';
var nodel=1;
var out='';
//var i=0;
while(cookie_value_old.indexOf(cookie_value_search)!=-1){
cookie_value_old=cookie_value_old.replace(cookie_value_search,',');
nodel=0;
}
if(nodel==1){
array_add_cookie_value(cookie_name,cookie_value,cookie_path);
}
else{
cookie_value_old=cookie_value_old.replace(',,',',');
var cookie_string=cookie_name + "=" + cookie_value_old.substring(1,cookie_value_old.length);
if (cookie_path)cookie_string += "; path=" + cookie_path;
document.cookie = cookie_string;
}
//посчитать количество в cookie
//var arr_coll=array_get_cookie(cookie_name);
//var kol = arr_coll.substring(0,arr_coll.length-1).split(",").length;
//bag_cookie(cookie_name);
//var cook=array_get_cookie(cookie_name);
//document.getElementById('melody_selected_cookie').innerHTML=cook;//cook.substring(0,cook.length-1).split(",").length;
}
// просто добавляет
function array_add_cookie_value(cookie_name, cookie_value, cookie_path) {
var cookie_value_old=array_get_cookie(cookie_name);
var cookie_string = cookie_name + "=" + cookie_value_old + cookie_value + ',';
if (cookie_path)cookie_string += "; path=" + cookie_path;
document.cookie = cookie_string;
}
//добавляет уникальные
function array_add_cookie_value_uniq(cookie_name, cookie_value, cookie_path) {
var cookie_value_old=array_get_cookie(cookie_name);
//поиск существует ли уже данная запись
if((','+cookie_value_old).indexOf(','+cookie_value+',')!=-1)return false;
var cookie_string = cookie_name + "=" + cookie_value_old + cookie_value + ',';
if (cookie_path)cookie_string += "; path=" + cookie_path;
document.cookie = cookie_string;
}
//удаляет значение
function array_delete_cookie_value(cookie_name, cookie_value, cookie_path) {
//alert(cookie_value);
var cookie_value_old=','+array_get_cookie(cookie_name);
cookie_value=','+cookie_value+',';
while(cookie_value_old.indexOf(cookie_value)!=-1){
cookie_value_old=cookie_value_old.replace(cookie_value,',');
}
var cookie_string = cookie_name + "=" + cookie_value_old.substring(1,cookie_value_old.length);
if (cookie_path)cookie_string += "; path=" + cookie_path;
document.cookie = cookie_string;
//alert(cookie_string);
}
//для js возвращает куки
function array_get_cookie(name_to_get) {
var cookie_pair;
var cookie_name;
var cookie_value;
var cookie_array = document.cookie.split("; ");
var len=cookie_array.length;
for (var counter = 0; counter < len; counter++) {
cookie_pair = cookie_array[counter].split("=");
if(typeof(cookie_pair[1])=='undefined')continue;
cookie_name = cookie_pair[0];
cookie_value = cookie_pair[1];
if (cookie_name == name_to_get) {
return unescape(cookie_value);
}
}
var out='';
return out;
}
//обнуляет
function delete_cookie(cookie_name, cookie_path) {
if (cookie_path)array_set_cookie(cookie_name, "", -1000*60*60*24*5,cookie_path);
else array_set_cookie(cookie_name, "", -1000*60*60*24*5);
}