function change_selected_photo(inner_html, id_big)
{
if (inner_html != null)
{
var big = document.getElementById(id_big);
//big.innerHTML = htmlspecialchars_decode(inner_html, 1);
inner_html_ = htmlspecialchars_decode(inner_html, 1);
inner_html_ = inner_html.replace('inside', '&#39;inside&#39;');
big.innerHTML = inner_html_;
}
}
function htmlspecialchars_decode (string, quote_style)
{
var optTemp = 0,
i = 0,        noquotes = false;
if (typeof quote_style === 'undefined') {
quote_style = 2;
}
string = string.toString().replace(/&lt;/g, '<').replace(/&gt;/g, '>');    var OPTS = {
'ENT_NOQUOTES': 0,
'ENT_HTML_QUOTE_SINGLE': 1,
'ENT_HTML_QUOTE_DOUBLE': 2,
'ENT_COMPAT': 2,        'ENT_QUOTES': 3,
'ENT_IGNORE': 4
};
if (quote_style === 0) {
noquotes = true;    }
if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags
quote_style = [].concat(quote_style);
for (i = 0; i < quote_style.length; i++)
{
// Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
if (OPTS[quote_style[i]] === 0)
{
noquotes = true;
}
else if (OPTS[quote_style[i]])
{
optTemp = optTemp | OPTS[quote_style[i]];
}
}
quote_style = optTemp;
}
if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
string = string.replace(/&#0*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should        // string = string.replace(/&apos;|&#x0*27;/g, "'"); // This would also be useful here, but not a part of PHP
}
if (!noquotes) {
string = string.replace(/&quot;/g, '"');
}    // Put this in last place to avoid escape being double-decoded
string = string.replace(/&amp;/g, '&');
return string;
}
function DoParamSite(cb, varNum, varNumNext, blockNum)
{
if (cb.checked)
{
row = document.getElementById("row"+blockNum+"_"+varNum);
row.style.display = '';
row.style.opacity = '1';
row.style.filter = 'alpha(opacity: 100)';
if (varNumNext != "")
{
row = document.getElementById("row"+blockNum+"_"+varNumNext);
row.style.display = '';
cb = document.getElementById("enable_var"+blockNum+"_"+varNumNext);
if (!cb.checked)
{
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity: 30)';
}
}
}
else
{
row = document.getElementById("row"+blockNum+"_"+varNum);
row.style.display = '';
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity:30)';
}
}
function SetComboValue(field_id, value, set_txt)
{
var obj = document.getElementById(field_id);
if (obj)
{
var obj_list = document.getElementById("list_"+field_id);
obj_list.style.display = 'none';
var field = obj.getElementsByTagName('input');
field[0].value = value;
obj.innerHTML = "<input type='hidden' name='"+$(field[0]).attr('name')+"' value='"+field[0].value+"'>";
obj.innerHTML = set_txt+obj.innerHTML;
}
}
function HideUserList()
{
HideBlock('UserList');
}
function setReceiver (value)
{
var receiver;
receiver = document.getElementById('message_to');
receiver.value = value;
$("#UserList").css('display', 'none');
}
var abs_mouseX;
var abs_mouseY;
function SaveAbsXY(e)
{
if (!e) e = window.event;
if (e.pageX || e.pageY)
{
abs_mouseX = e.pageX;
abs_mouseY = e.pageY;
}
else if (e.clientX || e.clientY)
{
abs_mouseX = e.clientX - document.documentElement.clientLeft;
abs_mouseY = e.clientY - document.documentElement.clientTop;
}
}
window.onmousemove = function (e) {SaveAbsXY(e);};
document.onmousemove = function (e) {SaveAbsXY(e);};
function CheckOverHover(element_id, delta, visibleLeft)
{
var element = document.getElementById(element_id);
if (!element) return false;
var p = GetAbsolutePos(element);
if (element.style.left==visibleLeft && ((abs_mouseX < p.x - delta) || (abs_mouseX > p.x + element.offsetWidth + delta) || (abs_mouseY < p.y - delta + document.documentElement.scrollTop) || (abs_mouseY > p.y + document.documentElement.scrollTop + element.offsetHeight + delta)))
{
clearInterval(interval);
f2=0;
$('#'+element_id).animate({left:-270}, 500);	
return true;
}
return false;
}
function photo_click(id_img)
{
$.post('/site/PARAM_PHOTO_CLIСK',{id:id_img});
}
function admin_select_row(id, color, row)
{
var cb=document.getElementById('cb_'+id);
if (cb)
{
if (cb.checked)
{
cb.checked = 0;
row.style.backgroundColor = color;
}
else
{
cb.checked = 1;
row.style.backgroundColor = '#FF9999';
}
}
}
function admin_select_row_show(id, color, row_id, show_obj)
{
var fields = document.getElementById(show_obj);
var row = document.getElementById(row_id);
if (fields)
{
if (fields.style.display == '')
{
row.style.backgroundColor = color;
fields.style.display = 'none';
}
else
{
row.style.backgroundColor = '#FF9999';
fields.style.display = '';
}
}
}
function InsertIntoField (field_id, set_value)
{
var field_obj = document.getElementById(field_id);
if (field_obj)
{
field_obj.value = set_value;
}
}
function SelectFlat(product_name, productID, obj_type_num, occupate_date, product_link)
{
document.order_form.obj_type.value = obj_type_num;
document.order_form.objID.value = productID;
document.order_form.ord_par_p1.value = occupate_date;
var obj_name = document.getElementById('obj_name');
obj_name.innerHTML = "Заказ:";
var product_name_obj = document.getElementById('product_name');
product_name_obj.innerHTML = '<a target="_blank" class="param_price" href="'+product_link+'">'+product_name;
var row_title = document.getElementById('row_title');
row_title.style.display = "";
}
var prev_select;
function set_opacity(object, ps_id)
{
if (object.style.opacity == 0.5 || object.style.filter == 'alpha(opacity=50)')
{
object.style.opacity = 1;
object.style.filter='alpha(opacity=100)';
}
else
{
var prev_obj = document.getElementById(prev_select);
if (prev_obj)
{
prev_obj.style.opacity = 1;// восстановим прозрачность предыдущего поля
prev_obj.style.filter='alpha(opacity=100)';
}
object.style.opacity = 0.5;
object.style.filter='alpha(opacity=50)';
prev_select = ps_id; // в буфер запишем id текущего выбранного поля
}
}
function get_calendar(url, mon, year, calendar_id, productID)
{
var adm = 1;
if (calendar_id == "admin_cldr")
{
adm = 1;
}
else if (calendar_id == "order_cldr")
{
adm = 2;
}
else
{
adm = 0;
}
$("#calendar").load(url, {'n': 1, 'mon': mon, 'year': year, 'adm': adm, 'productID':productID});
}
function check_admin_login()
{
$.post("./admin_auth.php", {n:"3"}, function(xml){ 
var res = $(xml).find('to').text();
if (res == 1)
{
$('form:#main_form').submit();
}
else
{
$('#login_form1').show();
$('#login_form2').show();
try {
document.admin_login_form.login.focus();
} catch (e) {}
}
});
}
function do_admin_login(login, pass)
{
$.post("./admin_auth.php", {n:"1", login: login, pass: pass}, function(xml){ 
var res = $(xml).find('auth').text();
if (res == 1)
{
$('#login_form1').hide();
$('#login_form2').hide();
var main_form = document.getElementById('main_form');
if (main_form)
{
main_form.submit();
}
else
{
window.location.reload();
}
}
else
{
$('#login_form1').show();
$('#login_form2').show();
try {
document.admin_login_form.login.focus();
} catch (e) {}
alert("");
}
});
}
function do_admin_logout()
{
$.post("./admin_auth.php", {n:"2"}, function(xml){ 
window.location.reload();
});
}
function wait_banner(banner)
{
var pos = bfx[banner]['pos'];
var count = bfx[banner]['count'];
var bw = bfx[banner]['width'];
var bh = bfx[banner]['height'];
var pos_prev = pos-1;
if (pos_prev < 0)
{
pos_prev = count-1;
}
HideBlock('bbb_'+banner+'_'+pos_prev);
$('div.bbb_'+banner+'_'+pos_prev).css('z-index', 0);
$('div.bbb_'+banner+'_'+pos_prev).animate({left:0, top:0, width: bw, height:bh, opacity:1}, 0);
setTimeout('switch_banner('+banner+')', bfx[banner][pos]['wait']);	
}
function switch_banner(banner)
{
var pos = bfx[banner]['pos'];
switch_banner_to(banner, pos+1);
}
function switch_banner_to(banner, pos_next)
{
var pos = bfx[banner]['pos'];
if (pos == pos_next) return;
var count = bfx[banner]['count'];
if ((pos_next >= count) || (pos_next < 0))
{
pos_next = 0;
}
bfx[banner]['pos'] = pos_next;
$('#banner_link_'+banner+'_'+pos).css('background-color', '');
$('#banner_link_'+banner+'_'+pos).css('color', '');
$('#banner_link_'+banner+'_'+pos_next).css('background-color', 'red');
$('#banner_link_'+banner+'_'+pos_next).css('color', 'white');
if (bfx[banner][pos]['speed'] == 0)
{
HideBlock('bbb_'+banner+'_'+pos);
ShowBlock('bbb_'+banner+'_'+pos_next);
setTimeout('switch_banner('+banner+')', bfx[banner][pos]['wait']);	
}
else
{
$('div.bbb_'+banner+'_'+pos).css('z-index', 2);
$('div.bbb_'+banner+'_'+pos_next).css('z-index', 1);
ShowBlock('bbb_'+banner+'_'+pos_next);
$('div.bbb_'+banner+'_'+pos).animate(bfx[banner][pos]['effects'], bfx[banner][pos]['speed'], 'swing', function(){wait_banner(banner);});
}
}
function show_for_edit(rowID_1, rowID_2, link_id)
{
var i = 1;
while(other_param = document.getElementById("param_group_"+i))
{
other_param.style.display = 'none';
i++;
}
if (rowID_2)
{
row_2 = document.getElementById(rowID_2);
row_2.style.display = '';
}
row = document.getElementById(rowID_1);
row.style.display = '';
var j = 1;
while(other_link = document.getElementById("link_"+j))
{
other_link.style.background = '#DDDDDD';
other_link.style.color = '';
j++;
}
active_part = document.getElementById(link_id);
active_part.style.background = '#999999';
active_part.style.color = '#ffffff';
}
function cloneCombo(place_id, src_combo_id, selected_value, id_value, name_value, combo_filter, childfrom_value, combo_width)
{
var place = document.getElementById(place_id);
var src_combo = document.getElementById(src_combo_id);
if (src_combo && place)
{
var clone = src_combo.cloneNode(true);
clone.setAttribute('id', id_value);
clone.setAttribute('name', name_value);
clone.setAttribute('selvalue', selected_value);
if (childfrom_value)
{
var clone2 = src_combo.cloneNode(true);
clone2.setAttribute('id', id_value);
clone2.setAttribute('name', name_value);
clone2.setAttribute('childfrom', '');
child_values[name_value] = clone2;
clone.setAttribute('childfrom', childfrom_value);
}
clone.selectedIndex = 0;
if (selected_value)
{
for (var i = 0; i < clone.options.length; i++)
{
if (clone.options[i].value == selected_value)
{
try {
clone.focus();
} catch (e) {}
try {
clone.selectedIndex = i;
clone.onchange();
} catch (e) {}
break;
}
}
}
place.appendChild(clone);
clone.style.display = '';
clone.style.width = combo_width;
clone.style.height = '21';
if (combo_filter && 0)
{
clone.style.filter = 'alpha(opacity: 30); opacity: 0.3';
}
return clone;
}
return null;
}
function photo_change2(photoNum)
{
var fileInput = document.getElementById('photo_'+photoNum+'_fi');
var pic = document.getElementById('photo_'+photoNum+'_pi');
var cb = document.getElementById('photo_'+photoNum+'_en');
var i = fileInput.value.lastIndexOf('\\');
if (i < 0) { i = fileInput.value.lastIndexOf('/'); }
var n;
if (i >= 0) { n = fileInput.value.substring(i+1); } else { n = fileInput.value; }
pic.innerHTML = '<br><b>'+n+'</b>';
cb.checked = true;
cb.onchange();
}
function DoPhoto(cb, varNum)
{
varNumNext = Number(varNum) + 1;
if (varNumNext < 10)
varNumNext = String(0) + String(varNumNext);
else
varNumNext = String(varNumNext);
if (cb.checked)
{
row = document.getElementById("rowphoto_"+varNumNext);
if (row)
{
cb = document.getElementById("photo_"+varNumNext+"_en");
row.style.display = '';
if (!cb.checked)
{
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity: 30)';
}
}
row = document.getElementById("rowphoto_"+varNum);
row.style.opacity = '1';
row.style.filter = 'alpha(opacity: 100)';
}
else
{
row = document.getElementById("rowphoto_"+varNum);
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity: 30)';
}
}
function DoCat(combo)
{
varNum = combo.name.substr(10,2);
varNumNext = Number(varNum) + 1;
if (varNumNext < 10)
varNumNext = String(0) + String(varNumNext);
else
varNumNext = String(varNumNext);
if (combo.value > 0)
{
row = document.getElementById("rowcat_"+varNumNext);
if (row && row.style.display)
{
row.style.display = '';
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity: 30)';
}
row = document.getElementById("rowcat_"+varNum);
row.style.opacity = '1';
row.style.filter = 'alpha(opacity: 100)';
}
else
{
row = document.getElementById("rowcat_"+varNum);
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity: 30)';
}
}
function DoParam(cb, varNum, varNumNext, blockNum)
{
var copyFromPrev = 0;
if (cb.checked)
{
if (varNumNext != "")
{
row = document.getElementById("row"+blockNum+"_"+varNumNext);
cb = document.getElementById("par"+blockNum+"_"+varNumNext+"_en");
row.style.display = '';
if (!cb.checked)
{
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity: 30)';
}
}
row = document.getElementById("row"+blockNum+"_"+varNum);
row.style.opacity = '1';
row.style.filter = 'alpha(opacity: 100)';
var varNumPrev = varNum - 1;
if (varNumPrev > 0)
{
if (varNumPrev < 9)
{
varNumPrev = '0'+varNumPrev;
}
// скопировать значения параметров из varNumPrev в varNum
copyFromPrev = 1;
}
}
else
{
row = document.getElementById("row"+blockNum+"_"+varNum);
row.style.opacity = '0.3';
row.style.filter = 'alpha(opacity: 30)';
}
var p;
var p2;
p = document.getElementById("par"+blockNum+"_"+varNum+"_en");
p.style.filter = row.style.filter;
p = document.getElementById("par"+blockNum+"_"+varNum+"_so");
p.style.filter = row.style.filter;
for(var i = 0; i<20; i++)
{
var ii;
if (i < 10) { ii = '0'+i; } else { ii = i; }
p = document.getElementById("par"+blockNum+"_"+varNum+"_"+ii);
if (p)
{
p.style.filter = row.style.filter;
if (copyFromPrev==1)
{
p = document.getElementById("par"+blockNum+"_"+varNum+"_"+ii+"_val");
p2 = document.getElementById("par"+blockNum+"_"+varNumPrev+"_"+ii+"_val");
if (p && p2)
{
try {
p.focus();
} catch (e) {}
try {
p.value = p2.value;
p.onchange();
} catch (e) {}
}
}
}
}
if (copyFromPrev==1)
{
for(var i = 1; i<20; i++)
{
p = document.getElementById("var"+Math.floor(varNum)+"ref"+i);
p2 = document.getElementById("var"+Math.floor(varNumPrev)+"ref"+i);
if (p && p2)
{
try {
p.focus();
} catch (e) {}
try {
p.selectedIndex = p2.selectedIndex;
p.onchange();
} catch (e) {}
}
}
}
}
function EnableAllControls()
{
values = document.getElementsByTagName("input");
for (var i = 0; i < values.length; i++)
{
values[i].removeAttribute("disabled");
}
values = document.getElementsByTagName("select");
for (var i = 0; i < values.length; i++)
{
values[i].removeAttribute("disabled");
}
values = document.getElementsByTagName("textarea");
for (var i = 0; i < values.length; i++)
{
values[i].removeAttribute("disabled");
}
values = document.getElementsByTagName("checkbox");
for (var i = 0; i < values.length; i++)
{
values[i].removeAttribute("disabled");
}
return true;
}
function CopyBlock(from_name, to_name)
{
from_block = document.getElementById(from_name);
to_block = document.getElementById(to_name);
if (from_block && to_block)
to_block.innerHTML = from_block.innerHTML;
}
function MoveBlock(from_name, to_name)
{
from_block = document.getElementById(from_name);
to_block = document.getElementById(to_name);
if (from_block && to_block)
{
to_block.innerHTML = from_block.innerHTML;
from_block.innerHTML = "";
}
}
function OpenBuyMode()
{
var cmp_form = document.getElementById('buy_form');
if (cmp_form)
{
cmp_form.submit();
return false;
}
return true;
}
function OpenCompareMode()
{
var cmp_form = document.getElementById('compare_form');
if (cmp_form)
{
cmp_form.submit();
return false;
}
return true;
}
function SelectColor(div_id)
{
$(document).ready(function(){
$('#'+div_id).ColorPicker({
color: document.getElementById(div_id+'_value').value,
onChange: function (hsb, hex, rgb) {
$('#'+div_id+' div').css('backgroundColor', '#' + hex); 
document.getElementById(div_id+'_value').value = '#' + hex;}
});
});
}
function SelectColorNow(div_id)
{
$('#'+div_id).ColorPicker({
color: document.getElementById(div_id+'_value').value,
onChange: function (hsb, hex, rgb) {
$('#'+div_id+' div').css('backgroundColor', '#' + hex); 
document.getElementById(div_id+'_value').value = '#' + hex;}
});
}
function open_parent(addr)
{
window.opener.location.href = addr;
window.close();
}
function GetAbsolutePos(obj)
{
var x = 0;
var y = 0;
var p = obj;
while (p)
{
x += p.offsetLeft;
y += p.offsetTop;
p = p.offsetParent;
}
return {"x":x,"y":y};
}
var mouseX;
var mouseY;
var menu = null; menu_button = null;
/* direction: 1-left, 2-right, 3-down, 4-up */
function ShowMenu(blockName, btn, direction)
{
if (menu)
{
menu.style.display = 'none';
menu = null;
menu_button = null;
}
var block = document.getElementById(blockName);
if (block && btn)
{
var p = GetAbsolutePos(btn);
block.style.display = '';
if (direction == 1)
{
block.style.left = p.x - btn.offsetWidth;
block.style.top = p.y;
}
if (direction == 2)
{
block.style.left = p.x + btn.offsetWidth;
block.style.top = p.y;
}
if (direction == 3)
{
block.style.left = p.x;
block.style.top = p.y + btn.offsetHeight;
}
if (direction == 4)
{
block.style.left = p.x;
block.style.top = p.y - btn.offsetHeight;
}
menu = block;
menu_button = btn;
}
}
function CheckMenu()
{
if (!menu) return;
var p = GetAbsolutePos(menu);
var d = 50;
if ((mouseX < p.x - d) || (mouseX > p.x + menu.offsetWidth + d) || (mouseY < p.y - d) || (mouseY > p.y + menu.offsetHeight + d))
{
var p = GetAbsolutePos(menu_button);
if ((mouseX < p.x - d) || (mouseX > p.x + menu.offsetWidth + d) || (mouseY < p.y - d) || (mouseY > p.y + menu.offsetHeight + d))
{
menu.style.display = 'none';
menu = null;
}
}
}
function selectSearchWhat(search_form_name, search_what)
{
var search_form;
for(var i=-5; i<10; i++)
{
if (i == search_what)
ShowBlock(search_form_name+"search_form_"+i);
else
HideBlock(search_form_name+"search_form_"+i);
}
var qq = document.getElementById(search_form_name+"search_what_"+search_what);
if (qq)
{
for (i = 0; i<qq.options.length; i++)
{
if (qq.options[i].value == search_what)
{
try {
qq.focus();
} catch (e) {}
try {
qq.selectedIndex = i;
//qq.onchange();
} catch (e) {}
break;
}
}
}
}
function comboCheckChildren(combo)
{
$("select[childfrom^='"+combo.id+"']").each(function (i) {
while (this.options.length)
{
this.remove(0);
}
values = child_values[this.name].getElementsByTagName("option");
this.selectedIndex = 0;
for (var i = 0; i < values.length; i++)
{
if ((values[i].className == "") || (values[i].className == 0) || !values[i].className || (values[i].className == combo.value))
{
this.appendChild(values[i].cloneNode(true));
if (!this.selectedIndex)
{
if (this.getAttribute("selvalue") && (values[i].value == this.getAttribute("selvalue")))
{
try {
this.focus();
} catch (e) {}
try {
this.selectedIndex = this.options.length-1;
this.onchange();
} catch (e) {}
}
if (this.getAttribute("seltext") && (values[i].text == this.getAttribute("seltext")))
{
try {
this.focus();
} catch (e) {}
try {
this.selectedIndex = this.options.length-1;
this.onchange();
} catch (e) {}
}
}
}
}
if (this.options.length > 1)
this.disabled = false;
else
this.disabled = true;
try {
this.onchange(this);
} catch (e) {}
});
}
function comboCheckConditions(combo)
{
for(var i = 0; i < combo.options.length; i++)
{
var v = combo.options[i].value;
var nv = -combo.options[i].value;
if (v)
if (combo.selectedIndex == i)
{
$("[rel^='transpay_"+v+"x']").css("display", "");
$("[rel^='transpay_"+nv+"x']").css("display", "none");
}
else
{
$("[rel^='transpay_"+v+"x']").css("display", "none");
$("[rel^='transpay_"+nv+"x']").css("display", "");
}
}
}
function cbCheckConditions(cb)
{
var v = cb.value;
var nv = -cb.value;
if (v)
if (cb.checked)
{
$("[rel^='transpay_"+v+"x']").css("display", "");
$("[rel^='transpay_"+nv+"x']").css("display", "none");
}
else
{
$("[rel^='transpay_"+v+"x']").css("display", "none");
$("[rel^='transpay_"+nv+"x']").css("display", "");
}
}
function searchReset(search_form_name, product_type)
{
var search_param;
search_param = document.getElementById(search_form_name+"search_category_"+product_type);
if (search_param != null)
{
search_param.value = "";
}
search_param = document.getElementById(search_form_name+"search_text_"+product_type);
if (search_param != null)
{
search_param.value = "";
}
search_param = document.getElementById(search_form_name+"search_stock_"+product_type);
if (search_param != null)
{
search_param.checked = "";
}
search_param = document.getElementById(search_form_name+"search_min_price_"+product_type);
if (search_param != null)
{
search_param.value = "";
}
search_param = document.getElementById(search_form_name+"search_max_price_"+product_type);
if (search_param != null)
{
search_param.value = "";
}
for(var i=0; i<50; i++)
{
search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var0_"+i+"_1");
if (search_param != null)
{
search_param.value = "";
}
search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var0_"+i+"_2");
if (search_param != null)
{
search_param.value = "";
}		
search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var1_"+i+"_1");
if (search_param != null)
{
search_param.value = "";
}
search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var1_"+i+"_2");
if (search_param != null)
{
search_param.value = "";
}		
}
}
var PreloadedImages = new Array();
function PreloadImages()
{
for(i=0; i<PreloadImages.arguments.length; i++)
{
k = PreloadedImages.length-1;
PreloadedImages[k] = new Image();
PreloadedImages[k].src = PreloadImages.arguments[i];
}	
}
function NoAccess()
{
alert('You dont have access to this information');
}
function PlayMP3(ref_num, mp3_num, name, default_name)
{
var player = document.getElementById("mp3_player");
var status = document.getElementById("mp3_status");
if (mp3_num)
{
if (status)
{
status.innerHTML = 'Playback: '+name+' <a href="#" onclick="PlayMP3(0,\'\',\''+default_name+'\'); return false;"><b>STOP</b></a>';
}
player.innerHTML = '<embed allowScriptAccess="never" src="/userfiles/mp3player/mp3player.swf" align="middle" menu="false" quality="high" bgcolor="Transparent" width="2" height="2" name="index" allowScriptAccess="never" type="application/x-shockwave-flash"  wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="playlist=/site/xml/mp3/'+ref_num+'/'+mp3_num+'" />';
}
else
{
if (status)
{
status.innerHTML = default_name;
}
player.innerHTML = '&nbsp;';
}
}
function dynamicSelect(id1, id2)
{
if (document.getElementById && document.getElementsByTagName) {
var sel1 = document.getElementById(id1);
var sel2 = document.getElementById(id2);
var clone = sel2.cloneNode(true);
var clonedOptions = clone.getElementsByTagName("option");
refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
sel1.onchange = function() {
refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
}
}
}
function refreshDynamicSelectOptions(sel1, sel2, clonedOptions)
{
while (sel2.options.length)
{
sel2.remove(0);
}
var pattern1 = /( |^)(select)( |$)/;
var pattern2 = new RegExp("( |^)(" + sel1.options[sel1.selectedIndex].value + ")( |$)");
for (var i = 0; i < clonedOptions.length; i++)
{
if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2))
{
sel2.appendChild(clonedOptions[i].cloneNode(true));
}
}
}
function ShowIfChecked(cb, what)
{
qq = document.getElementById(what);
if (qq)
{
if (cb.checked)
{
qq.style.opacity = '1';
qq.style.filter = 'alpha(opacity: 100)';
}
else
{
qq.style.opacity = '0.3';
qq.style.filter = 'alpha(opacity: 30)';
}
}
}
function setOpacity(element, opacity)
{
var e = document.getElementById(element);
if (e)
{
if (opacity <= 0)
{
e.style.display = 'none';
}
else
{
e.style.opacity = opacity/100;
e.style.filter = 'alpha(opacity: '+opacity+')';
e.style.display = '';
}
}
}
function photo_change(input_name, info_name, cb_name)
{
var fileInput = document.getElementById(input_name);
var info = document.getElementById(info_name);
var cb = document.getElementById(cb_name);
var i = fileInput.value.lastIndexOf('\\');
if (i < 0) { i = fileInput.value.lastIndexOf('/'); }
var n;
if (i >= 0) { n = fileInput.value.substring(i+1); } else { n = fileInput.value; }
info.innerHTML = '<br><b>'+n+'</b>';
cb.checked = true;
cb.onchange();
}
function showTime()
{
var block = document.getElementById("time");
vr=new Date();
block.innerText=vr.getHours()+":"+vr.getMinutes()+":"+vr.getSeconds();
setTimeout("showTime()",1000)
}
function HideBlock(blockName)
{
var block = document.getElementById(blockName);
if (block)
{
block.style.display = 'none';	
}
}
function ShowBlock(blockName)
{
var block = document.getElementById(blockName);
if (block)
{
block.style.display = '';
}
}
function ShowBlocks(propName, propValue)
{
$("["+propName+"^='"+propValue+"']").css("display", "");
}
function HideBlocks(propName, propValue)
{
$("["+propName+"^='"+propValue+"']").css("display", "none");
}
function ShowHideBlock(blockName, plus, selectName)
{
var block = document.getElementById(blockName);
if (block.style.display == 'none')
{
block.style.display = '';
if (plus)
{
block = document.getElementById(blockName+"_expand");
if (block)
{
block.innerHTML = "-";
}
}
if (selectName != "")
{
block = document.getElementById(selectName);
if (block)
{
try {
block.focus();
} catch (e) {}
block.select();
}
}
}
else
{
block.style.display = 'none';
if (plus)
{
block = document.getElementById(blockName+"_expand");
if (block)
{
block.innerHTML = "+";
}
}
}
}
function ShowHideBlock3(blockName, plus, selectName)
{
var block = document.getElementById(blockName);
if (block.style.display == 'none')
{
block.style.display = '';
if (plus)
{
block = document.getElementById(blockName+"_expand1");
if (block)
{
block.style.display = '';
}
block = document.getElementById(blockName+"_expand2");
if (block)
{
block.style.display = 'none';
}
}
if (selectName != "")
{
block = document.getElementById(selectName);
if (block)
{
try {
block.focus();
} catch (e) {}
block.select();
}
}
}
else
{
block.style.display = 'none';
if (plus)
{
block = document.getElementById(blockName+"_expand1");
if (block)
{
block.style.display = 'none';
}
block = document.getElementById(blockName+"_expand2");
if (block)
{
block.style.display = '';
}
}
}
}
function ShowHideBlockAdmin(blockName, link)
{
var new_vis;
var block = document.getElementById(blockName+"_expand");
if (block)
{
if (block.innerHTML == "+")
{
window.location.href = link;
return;
block.innerHTML = "-";
new_vis = "";
}
else
{
block.innerHTML = "+";
new_vis = "none";
}
}
var block = document.getElementById(blockName);
var level = block.getAttribute("level");
if (new_vis == "")
{
do
{
block = next(block);
if (block.getAttribute("level")-1 == level)
{
block.style.display = new_vis;
}
}
while (block.getAttribute("level") != level);
}
else
{
do
{
block = next(block);
if (block.getAttribute("level") != level)
{
block.style.display = new_vis;
var plus = document.getElementById(block.getAttribute("id")+"_expand");
if (plus)
{
plus.innerHTML = "+";
}
}
}
while (block.getAttribute("level") != level);
}
}
var traversal = typeof document
.createElement('div')
.childElementCount != 'undefined';
var next = traversal ? function(node) {
return node.nextElementSibling;
} : function(node) {
while(node = node.nextSibling) if(node.nodeType == 1) break;
return node;
};
var previous = traversal ? function(node) {
return node.previousElementSibling;
} : function(node) {
while(node = node.previousSibling) if(node.nodeType == 1) break;
return node;
};
function ShowHideBlock2(blockName)
{
var new_vis;
var block = document.getElementById(blockName+"_expand");
if (block)
{
if (block.innerHTML == "+")
{
block.innerHTML = "-";
new_vis = "";
}
else
{
block.innerHTML = "+";
new_vis = "none";
}
}
var block = document.getElementById(blockName);
var level = block.getAttribute("level");
if (new_vis == "")
{
do
{
block = next(block);
if (block.getAttribute("level")-1 == level)
{
block.style.display = new_vis;
}
}
while (block.getAttribute("level") != level);
}
else
{
do
{
block = next(block);
if (block.getAttribute("level") != level)
{
block.style.display = new_vis;
var plus = document.getElementById(block.getAttribute("id")+"_expand");
if (plus)
{
plus.innerHTML = "+";
}
}
}
while (block.getAttribute("level") != level);
}
}
var bfx = Array();
var price = Array();
var colors = Array();
var old_price = Array();
var stock = Array();
var link = Array();
var child_values = Array();
var compare = Array();
var compare2 = Array();
function SetValue(name, value, def)
{
if (value == undefined)
{
value = def;
}
x = document.getElementById(name);
if (x)
x.innerHTML = value;
}
function UpdatePrice(productID)
{
var x;
var values = '';
x = document.getElementById('sel_'+productID);
SetValue('stock_'+productID, stock[productID+'_'+x.value], '');
SetValue('price_'+productID, price[productID+'_'+x.value], '0');
SetValue('old_price_'+productID, old_price[productID+'_'+x.value], ' ');
SetValue('link_'+productID, link[productID+'_'+x.value], ' ');
SetValue('compare_link_'+productID, compare[productID+'_'+x.value], '');
SetValue('compare2_link_'+productID, compare2[productID+'_'+x.value], '');
var color_div = document.getElementById('color_'+productID);
if (color_div)
{
color_div.style.background=colors[productID+'_'+x.value];
}
}
function UpdatePrice2(productID, paramCount)
{
var x;
var values = '';
for(var i=0; i<paramCount; i++)
{
x = document.getElementById('sel_'+productID+'_'+i);
values = values + '_' + x.value;
}
SetValue('stock_'+productID, stock[productID+values], '');
SetValue('price_'+productID, price[productID+values], '');
SetValue('old_price_'+productID, old_price[productID+values], ' ');
SetValue('link_'+productID, link[productID+values], ' ');
SetValue('compare_link_'+productID, compare[productID+values], '');
SetValue('compare2_link_'+productID, compare2[productID+values], '');
var color_div = document.getElementById('color_'+productID);
x = document.getElementById('sel_'+productID+'_color');
if (color_div && x)
{
x = document.getElementById(x.value);
color_div.style.background=colors[productID+'_'+x.value];
}
}
function keydown(D)
{
D=D||window.event;
var A=D.keyCode;
if (D.ctrlKey)
{
var C;
if (A==37)
{
C=document.getElementById("key_left")
}
if(A==39)
{
C=document.getElementById("key_right")
}
if (C)
{
location.href=C.href
}
}
}
function ClearSelectectionIfExists(D)
{
var X=(D.target||D.srcElement);
if (X)
{
var E=X.tagName;
if (E=="INPUT" || E=="TEXTAREA") return;
C=document.getElementById("invisible_edit");
if (C)
{	
try {
C.focus();
} catch (e) {}
C.select();
}
}
}
document.onkeydown=keydown;
function selectFirst()
{
var x = document.getElementById('focus');
if (x)
{
try {
x.focus();
} catch (e) {}
x.select();
}
}
function selectById(id)
{
var x = document.getElementById(id);
if (x)
{
try {
x.focus();
} catch (e) {}
x.select();
}
}
function str_replace(search, replace, subject) {
return subject.split(search).join(replace);
}
function open_link_in_parent(addr)
{
window.opener.location.href = addr;
window.close();
}
function open_msg(url)
{
x = (screen.availWidth-300)/2;
y = (screen.availHeight-100)/2-20;
if (x < 0) x = 0;
if (y < 0) y = 0;
newWin = window.open(url,'msg','left='+x+',top='+y+',width=300,height=200,location="no",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="no"');
newWin.focus();
}
function ShowHelp(helpID)
{
var w = screen.availWidth*0.8;
var h = screen.availHeight*0.8;
var x = (screen.availWidth-w)/2;
var y = (screen.availHeight-h)/2.1;
if (x < 0) x = 0;
if (y < 0) y = 0;
newWin = window.open('/site/article/'+helpID,'help','left='+x+',top='+y+',width='+w+',height='+h+',location="no",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="no"');
newWin.focus();
return false;
}
function open_pic(pic, width, height)
{
height = height + 80;
x = (screen.availWidth-width)/2;
y = (screen.availHeight-height)/2;
if (x < 0) x = 0;
if (y < 0) y = 0;
newWin = window.open("",'picture','left='+x+',top='+y+',width='+width+',height='+height+',location="yes",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="yes"');
newWin.moveTo(x,y);
newWin.resizeTo(width,height);
newWin.document.writeln("<html><head><title>"+pic+"</title>");
newWin.document.writeln("<style>");
newWin.document.writeln("<!--");
newWin.document.writeln(".no_border  { border: 0px solid white }");
newWin.document.writeln("-->");
newWin.document.writeln("</style></head>");
newWin.document.writeln("<body bgcolor=#FFFFFF leftMargin=0 topMargin=0 marginheight=0 marginwidth=0>");
newWin.document.writeln("<table border=0 width='100%' height='100%'><tr><td valign='center' align='center'>");
newWin.document.writeln("<a href='#' class='no_border' title='Click to close window' onClick='self.close()'><img class='no_border' src='"+pic+"'></a>");
newWin.document.writeln("</td></tr></table>");
newWin.document.writeln("</body></html>");
newWin.document.close();
newWin.focus();
}
function open_admin_print(title, config_url)
{
var width = 800;//screen.availWidth-200;
var height = 600;//screen.availHeight-100;
x = (screen.availWidth-width)/2;
y = (screen.availHeight-height)/2;
if (x < 0) x = 0;
if (y < 0) y = 0;
newWin = window.open("",'admin_print','left='+x+',top='+y+',width='+width+',height='+height+',location="yes",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="yes"');
newWin.moveTo(x,y);
newWin.resizeTo(width,height);
newWin.document.writeln("<html><head><title>"+title+"</title>");
newWin.document.writeln("<link rel=STYLESHEET href='http://"+config_url+"/images/backend/style-backend.css' type='text/css'>");
newWin.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
newWin.document.writeln("</head>");
newWin.document.writeln("<body bgcolor=#FFFFFF leftMargin=0 topMargin=0 marginheight=0 marginwidth=0>");
newWin.document.writeln(document.getElementById('main_div').innerHTML);
newWin.document.writeln("</body></html>");
newWin.document.close();
newWin.focus();
newWin.print();
}
function open_picture_print(picture)
{
var width = 800;
var height = 600;
x = (screen.availWidth-width)/2;
y = (screen.availHeight-height)/2;
if (x < 0) x = 0;
if (y < 0) y = 0;
newWin = window.open("",'admin_print','left='+x+',top='+y+',width='+width+',height='+height+',location="yes",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="yes"');
newWin.moveTo(x,y);
newWin.resizeTo(width,height);
newWin.document.writeln("<html><head><title>Print</title>");
newWin.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
newWin.document.writeln("</head>");
newWin.document.writeln("<body bgcolor=#FFFFFF leftMargin=0 topMargin=0 marginheight=0 marginwidth=0>");
newWin.document.writeln("<img src='"+picture+"'/>");
newWin.document.writeln("</body></html>");
newWin.document.close();
newWin.focus();
newWin.print();
}
function open_map(addr, toolbars)
{
var map = new YMaps.Map(document.getElementById("YMapsID"));
var gc = new YMaps.Geocoder(addr);
YMaps.Events.observe(gc, gc.Events.Load, function () {
if (this.length()) {
map.setBounds(this.get(0).getBounds());
var geoResult = this.get(0).getBounds().getCenter();
var content = document.createElement('span');
content.innerHTML = addr;
map.openBalloon(geoResult, content);
}
});
if (toolbars == 1)
{
var topLeftPos = new YMaps.ControlPosition(YMaps.ControlPosition.TOP_LEFT, new YMaps.Size(150, 15)),
topRightPos = new YMaps.ControlPosition(YMaps.ControlPosition.TOP_RIGHT, new YMaps.Size(170, 15)),
scaleLine = new YMaps.ScaleLine(),
curPos = topLeftPos;
map.addControl(scaleLine, curPos);
map.addControl(new YMaps.TypeControl(), new YMaps.ControlPosition(YMaps.ControlPosition.TOP_LEFT));
map.addControl(new YMaps.Zoom());
map.addControl(new YMaps.MiniMap(), new YMaps.ControlPosition(YMaps.ControlPosition.TOP_RIGHT));
}
}
function popup_map(addr)
{
var width = screen.availWidth;
var height = screen.availHeight;
x = 0;
y = 0;
newWin = window.open("",'map','left='+x+',top='+y+',width='+width+',height='+height+',location="yes",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="yes"');
newWin.moveTo(x,y);
newWin.resizeTo(width,height);
newWin.document.writeln("<html><head><title>"+addr+"</title>");
newWin.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
newWin.document.writeln("<script type='text/javascript' src='http://api-maps.yandex.ru/1.1/index.xml?key="+yandex_map_key+"'></script>");
newWin.document.writeln("<script type='text/javascript' src='/1js.php'></script></head>");
newWin.document.writeln("<body onload='open_map(\""+addr+"\", 1);' bgcolor=#FFFFFF leftMargin=0 topMargin=0 marginheight=0 marginwidth=0>");
newWin.document.writeln("<div id='YMapsID' style='height:100%; width:100%;'></div>");
newWin.document.writeln("</body></html>");
newWin.document.close();
newWin.focus();
}
function confirmDelete(question, where)
{
temp = window.confirm(question);
if (temp)
{
window.location=where;
}
}
function WordCount(text)
{
words=text.split(" ");
var count= words.length;
if ((count > 1) && (words[count-1]=="")) count--;
if ((count > 0) && (words[0]=="")) count--;
return count;
}var tooltip = {
options: {
attr_name: "tooltip",
blank_text: "<br>(open in new window)",
newline_entity: "<br>",
max_width: 0,
delay: 100,
skip_tags: ["link", "style"]
},
t: document.createElement("DIV"),
c: null,
g: false,
canvas: null,
m: function(e){
var x = window.event ? event.clientX + tooltip.canvas.scrollLeft : e.pageX;
var y = window.event ? event.clientY + tooltip.canvas.scrollTop : e.pageY;
mouseX = x;
mouseY = y;
CheckMenu();
if (tooltip.g){
tooltip.t.style.zIndex = 10000;
tooltip.a(x, y);
}
},
d: function(){
tooltip.canvas = document.getElementsByTagName(document.compatMode && document.compatMode == "CSS1Compat" ? "HTML" : "BODY")[0];
tooltip.t.setAttribute("id", "tooltip");
document.body.appendChild(tooltip.t);
if (tooltip.options.max_width) tooltip.t.style.maxWidth = tooltip.options.max_width + "px"; /* all but ie */
var a = document.all && !window.opera ? document.all : document.getElementsByTagName("*"); /* in opera 9 document.all produces type mismatch error */
var l = a.length;
for (var i = 0; i < l; i++){
if (!a[i] || tooltip.options.skip_tags.in_array(a[i].tagName.toLowerCase())) continue;
var tooltip_title = a[i].getAttribute("title"); /* returns form object if IE & name="title"; then IE crashes; so... */
if (tooltip_title && typeof tooltip_title != "string") tooltip_title = "";
var tooltip_alt = a[i].getAttribute("alt");
var tooltip_blank = a[i].getAttribute("target") && a[i].getAttribute("target") == "_blank" && tooltip.options.blank_text;
if (tooltip_title){
a[i].setAttribute(tooltip.options.attr_name, tooltip_blank ? (tooltip_title ? tooltip_title + " " + tooltip.options.blank_text : tooltip.options.blank_text) : tooltip_title);
if (a[i].getAttribute(tooltip.options.attr_name)){
a[i].removeAttribute("title");
if (tooltip_alt && a[i].complete) a[i].removeAttribute("alt");
tooltip.l(a[i], "mouseover", tooltip.s);
tooltip.l(a[i], "mouseout", tooltip.h);
}
}else if (tooltip_alt && a[i].complete){
a[i].setAttribute(tooltip.options.attr_name, tooltip_alt);
if (a[i].getAttribute(tooltip.options.attr_name)){
a[i].removeAttribute("alt");
tooltip.l(a[i], "mouseover", tooltip.s);
tooltip.l(a[i], "mouseout", tooltip.h);
}
}
if (!a[i].getAttribute(tooltip.options.attr_name) && tooltip_blank){
/* */
}
}
document.onmousemove = tooltip.m;
window.onscroll = tooltip.h;
tooltip.a(-99, -99);
},
_: function(s){
s = s.replace(/\&/g,"&amp;");
s = s.replace(/\</g,"&lt;");
s = s.replace(/\>/g,"&gt;");
return s;
},
s: function(e){
if (typeof tooltip == "undefined") return;
var d = window.event ? window.event.srcElement : e.target;
if (!d.getAttribute(tooltip.options.attr_name)) return;
var s = d.getAttribute(tooltip.options.attr_name);
if (tooltip.options.newline_entity){
var s = tooltip._(s);
s = s.replace(eval("/" + tooltip._(tooltip.options.newline_entity) + "/g"), "<br />");
tooltip.t.innerHTML = s;
}else{
if (tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
tooltip.t.appendChild(document.createTextNode(s));
}
tooltip.c = setTimeout(function(){
tooltip.t.style.visibility = 'visible';
}, tooltip.options.delay);
tooltip.g = true;
},
h: function(e){
if (typeof tooltip == "undefined") return;
tooltip.t.style.visibility = "hidden";
if (!tooltip.options.newline_entity && tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
clearTimeout(tooltip.c);
tooltip.g = false;
tooltip.a(-99, -99);
},
l: function(o, e, a){
if (o.addEventListener) o.addEventListener(e, a, false); /* was true--Opera 7b workaround! */
else if (o.attachEvent) o.attachEvent("on" + e, a);
else return null;
},
a: function(x, y){
var w_width = tooltip.canvas.clientWidth ? tooltip.canvas.clientWidth + tooltip.canvas.scrollLeft : window.innerWidth + window.pageXOffset;
var w_height = window.innerHeight ? window.innerHeight + window.pageYOffset : tooltip.canvas.clientHeight + tooltip.canvas.scrollTop; /* should be vice verca since Opera 7 is crazy! */
if (document.all && document.all.item && !window.opera) tooltip.t.style.width = tooltip.options.max_width && tooltip.t.offsetWidth > tooltip.options.max_width ? tooltip.options.max_width + "px" : "auto";
var t_width = tooltip.t.offsetWidth;
var t_height = tooltip.t.offsetHeight;
tooltip.t.style.left = x + 0 + "px";
tooltip.t.style.top = y + 20 + "px";
if (x + t_width > w_width) tooltip.t.style.left = w_width - t_width + "px";
if (y + t_height > w_height) tooltip.t.style.top = w_height - t_height + "px";
}
}
Array.prototype.in_array = function(value){
var l = this.length;
for (var i = 0; i < l; i++)
if (this[i] === value) return true;
return false;
};
var root = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null;
if (root){
if (root.addEventListener) root.addEventListener("load", tooltip.d, false);
else if (root.attachEvent) root.attachEvent("onload", tooltip.d);
}