var niftyOk=(document.getElementById&&document.createElement&&Array.prototype.push);
var niftyCss=false;
String.prototype.find=function(a){
    return(this.indexOf(a)>=0?true:false)
    };
    
var oldonload=window.onload;
if(typeof(NiftyLoad)!="function"){
    NiftyLoad=function(){}
    }
    if(typeof(oldonload)=="function"){
    window.onload=function(){
        oldonload();
        AddCss();
        NiftyLoad()
        }
    }else{
    window.onload=function(){
        AddCss();
        NiftyLoad()
        }
    }
    function AddCss(){
    niftyCss=true;
    var a=CreateEl("link");
    a.setAttribute("type","text/css");
    a.setAttribute("rel","stylesheet");
    var b=new String(((window.WAROOT_URL!=null)?window.WAROOT_URL:"")+((window.CONF_ON_WEBASYST!=null&&window.CONF_ON_WEBASYST)?"":"published/")+"common/html/cssbased/geometry/rounded/niftyCorners.css");
    a.setAttribute("href",b);
    a.setAttribute("media","screen");
    document.getElementsByTagName("head")[0].appendChild(a)
    }
    function Nifty(a,c){
    if(niftyOk==false){
        return
    }
    if(niftyCss==false){
        AddCss()
        }
        var d,b=a.split(","),k=0;
    if(c==null){
        c=""
        }
        if(c.find("fixed-height")){
        try{
            k=getElementsBySelector(b[0])[0].offsetHeight
        }catch(l){
            k=0
            }
        }
    for(d=0;d<b.length;d++){
    Rounded(b[d],c)
    }
    if(c.find("height")){
    SameHeight(a,k)
    }
}
function Rounded(a,d){
    var k,l="",c="",b=new Array();
    if(d!=""){
        d=d.replace("left","tl bl");
        d=d.replace("right","tr br");
        d=d.replace("top","tr tl");
        d=d.replace("bottom","br bl");
        d=d.replace("transparent","alias");
        if(d.find("tl")){
            l="both";
            if(!d.find("tr")){
                l="left"
                }
            }else{
        if(d.find("tr")){
            l="right"
            }
        }
    if(d.find("bl")){
    c="both";
    if(!d.find("br")){
        c="left"
        }
    }else{
    if(d.find("br")){
        c="right"
        }
    }
}
if(l==""&&c==""&&!d.find("none")){
    l="both";
    c="both"
    }
    b=getElementsBySelector(a);
for(k=0;k<b.length;k++){
    FixIE(b[k]);
    if(l!=""){
        AddTop(b[k],l,d)
        }
        if(c!=""){
        AddBottom(b[k],c,d)
        }
    }
}
// brain territory begin -------------------------------------------------------------------------------------------------------------------------------------------


function changeCity(num_city) {
if (document.getElementById("table_shipping_met")){
    document.getElementById("table_shipping_met").style.display="inline"; 
    if(num_city=='304' || num_city=='305') {
        document.getElementById("tr_shipping-method-16").style.display="inline"; 
        document.getElementById("tr_shipping-method-17").style.display="inline"; 
        document.getElementById("tr_shipping-method-15").style.display="none"; 
        document.MainForm.shippingMethodID[0].click();
        if(num_city==304){
            document.getElementById("tr_td_div_shipping-method-16").innerHTML="200 руб."    
        }else{
            document.getElementById("tr_td_div_shipping-method-16").innerHTML="300 руб."  
        }
    }else{
        document.getElementById("tr_shipping-method-16").style.display="none"; 
        document.getElementById("tr_shipping-method-17").style.display="none"; 
        document.getElementById("tr_shipping-method-15").style.display="inline"; 
        
        document.MainForm.shippingMethodID[2].click();
    }
    return false;
}
}


// for auto cleaning standart adress
function cleaning_adress(theText) {
    if (theText.value == theText.defaultValue) {
        theText.value = ""
        }
    };

function default_adress(theText) {
    if (theText.value == "" || theText.value == "например, м. Маяковская, ул. Жуковского, д.51, кв.40") {
        document.getElementById("check_adr_yes").style.display="none"; 
        document.getElementById("check_adr_no").style.display="inline"; 
        }
    if (theText.value != "например, м. Маяковская, ул. Жуковского, д.51, кв.40") {
        document.getElementById("check_adr_yes").style.display="inline"; 
        document.getElementById("check_adr_no").style.display="none"; 
    }
};

// for email check
function checkEmail(value) { 
    //
    //reg = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
    reg = /^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i;
    if (!value.match(reg)) {
        //  alert("Пожалуйста, введите свой настоящий e-mail");
        document.getElementById("alert_check_Email_no").style.display="inline"; 
        document.getElementById("alert_check_Email_yes").style.display="none"; 
        return false;
    }else{
        document.getElementById("alert_check_Email_yes").style.display="inline"; 
        document.getElementById("alert_check_Email_no").style.display="none"; 
    }
}; 

//check phone number

function check_phonenumber(input) {
    var numberStr = String(document.getElementById("customer_info[_custom_fields][14]").value);

    var reg = /^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/ ;
    if (reg.test(numberStr)) {
        document.getElementById("customer_info[_custom_fields][14]"+"_no").style.display="none"; 
        document.getElementById("customer_info[_custom_fields][14]"+"_yes").style.display="inline"; 
        return false;
    }else{
        document.getElementById("customer_info[_custom_fields][14]"+"_no").style.display="inline"; 
        document.getElementById("customer_info[_custom_fields][14]"+"_yes").style.display="none"; 
        return true;
    }
}

function check_phonenumber1(input) {
    var numberStr = String(document.getElementById("additional_field_14").value);

    var reg = /^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/ ;
    if (reg.test(numberStr)) {
        document.getElementById("additional_field_14"+"_no").style.display="none"; 
        document.getElementById("additional_field_14"+"_yes").style.display="inline"; 
        return false;
    }else{
        document.getElementById("additional_field_14"+"_no").style.display="inline"; 
        document.getElementById("additional_field_14"+"_yes").style.display="none"; 
        return true;
    }
}

//If_empty function (for shipping)
function ifempty(value,id) {
    var dlin= value.length;
    if (value=="" || value==" " || dlin<3){
        document.getElementById(id+"_no").style.display="inline"; 
        document.getElementById(id+"_yes").style.display="none"; 
    }else{
        document.getElementById(id+"_yes").style.display="inline"; 
        document.getElementById(id+"_no").style.display="none";
    }
};

function check_passwords() {
if (document.getElementById("customer_info[cust_password]").value==document.getElementById("customer_info[cust_password1]").value) {
        document.getElementById("customer_info[cust_password1]"+"_yes").style.display="inline"; 
        document.getElementById("customer_info[cust_password1]"+"_no").style.display="none"; 
}else {
        document.getElementById("customer_info[cust_password1]"+"_no").style.display="inline"; 
        document.getElementById("customer_info[cust_password1]"+"_yes").style.display="none"; 

}
}
//Function for checking fields before registration.
//check - registration with shipping
//check1 - check shipping address
//check2 - simple registration
//Mne stidno :(
function check_all_fields(f) {
var IE='\v'=='v'

var element = document.getElementById('customer_info[_custom_fields][14]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}

var element = document.getElementById('customer_info[Login]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}

var element = document.getElementById('chk_first_name');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}


var element = document.getElementById('chk_last_name');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}

var element = document.getElementById('customer_info[cust_password]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}

var element = document.getElementById('customer_info[cust_password1]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}

    all_fields=0
if (document.getElementById("customer_info[cust_password]_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("customer_info[_custom_fields][14]_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("customer_info[cust_password1]_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("chk_first_name_yes").style.display=="inline") {
    all_fields++;
}
if (document.getElementById("chk_last_name_yes").style.display=="inline") {
    all_fields++;
}
if (document.getElementById("alert_check_Email_yes").style.display=="inline") {
    all_fields++;
}

if (all_fields<6) {

if (document.getElementById("customer_info[cust_password]_yes").style.display!="inline" ) {
document.getElementById("customer_info[cust_password]_no").style.display="inline";
}
if (document.getElementById("customer_info[_custom_fields][14]_yes").style.display!="inline" ) {
document.getElementById("customer_info[_custom_fields][14]_no").style.display="inline";
}
if (document.getElementById("chk_first_name_yes").style.display!="inline") {
document.getElementById("chk_first_name_no").style.display="inline";
}
if (document.getElementById("chk_last_name_yes").style.display!="inline") {
document.getElementById("chk_last_name_no").style.display="inline";
}
if (document.getElementById("alert_check_Email_yes").style.display!="inline") {
document.getElementById("alert_check_Email_no").style.display="inline";
}
if (document.getElementById("alert_check_Email_yes").style.display!="inline") {
document.getElementById("alert_check_Email_no").style.display="inline";
}
return false;
}else{
return true;

}
};


//Mne stidno snova :(
function check_all_fields1(f) {

var IE='\v'=='v'

var element = document.getElementById('shipping_address[first_name]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}

    all_fields=0

if (document.getElementById("shipping_address[first_name]_yes").style.display=="inline" ) {
    all_fields++;
}

if (all_fields<1) {
if (document.getElementById("shipping_address[first_name]_yes").style.display!="inline" ) {
document.getElementById("shipping_address[first_name]_no").style.display="inline";
}
return false;
}else{
return true;
}
};


function check_all_fields2(f) {

var IE='\v'=='v'

var element = document.getElementById('additional_field_14');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}


var element = document.getElementById('chk_first_name');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}
var element = document.getElementById('chk_last_name');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}

var element = document.getElementById('customer_info[Login]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}
var element = document.getElementById('customer_info[cust_password]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}
var element = document.getElementById('customer_info[cust_password1]');
if (IE){
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        var psX = findPosX(a);
        var psY = findPosY(a);
        evObj.initMouseEvent('blur', true, true, window, 1, psX, psY, 1, 1, false, false, true, false, 0, null );
        element.dispatchEvent(evObj);
    } else {
        element.fireEvent('onblur');
    }
}else{
//Для человеческих браузеров
var o = document.createEvent('MouseEvents');
o.initMouseEvent( 'blur', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null );
element.dispatchEvent(o);
}


    all_fields=0
if (document.getElementById("additional_field_14_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("chk_first_name_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("chk_last_name_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("alert_check_Email_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("customer_info[cust_password]_yes").style.display=="inline" ) {
    all_fields++;
}
if (document.getElementById("customer_info[cust_password1]_yes").style.display=="inline" ) {
    all_fields++;
}
if (all_fields<6) {
    if (document.getElementById("additional_field_14_yes").style.display!="inline" ) {
document.getElementById("additional_field_14_no").style.display="inline";
}
if (document.getElementById("chk_first_name_yes").style.display!="inline" ) {
document.getElementById("chk_first_name_no").style.display="inline";
}
if (document.getElementById("chk_last_name_yes").style.display!="inline" ) {
document.getElementById("chk_last_name_no").style.display="inline";
}
if (document.getElementById("alert_check_Email_yes").style.display!="inline" ) {
document.getElementById("alert_check_Email_no").style.display="inline";
}
if (document.getElementById("customer_info[cust_password]_yes").style.display!="inline" ) {
document.getElementById("customer_info[cust_password]_no").style.display="inline";
}
if (document.getElementById("customer_info[cust_password1]_yes").style.display!="inline" ) {
document.getElementById("customer_info[cust_password1]_no").style.display="inline";
}
    return false;
}else{
return true;
}
};



// brain territory end :( -------------------------------------------------------------------------------------------------------------------------------------------


function AddTop(c,r,s){
    var q=CreateEl("b"),k=4,n="",a,o,b="r",l,m;
    q.style.marginLeft="-"+getPadding(c,"Left")+"px";
    q.style.marginRight="-"+getPadding(c,"Right")+"px";
    if(s.find("alias")||(m=getBk(c))=="transparent"){
        m="transparent";
        l="transparent";
        n=getParentBk(c);
        b="t"
        }else{
        l=getParentBk(c);
        n=Mix(m,l)
        }
        q.style.background=l;
    q.className="niftycorners";
    a=getPadding(c,"Top");
    if(s.find("small")){
        q.style.marginBottom=(a-2)+"px";
        b+="s";
        k=2
        }else{
        if(s.find("big")){
            q.style.marginBottom=(a-10)+"px";
            b+="b";
            k=8
            }else{
            q.style.marginBottom=(a-5)+"px"
            }
        }
    for(o=1;o<=k;o++){
    q.appendChild(CreateStrip(o,r,m,n,b))
    }
    c.style.paddingTop="0";
c.insertBefore(q,c.firstChild)
}
function AddBottom(c,r,s){
    var q=CreateEl("b"),k=4,n="",a,o,b="r",l,m;
    q.style.marginLeft="-"+getPadding(c,"Left")+"px";
    q.style.marginRight="-"+getPadding(c,"Right")+"px";
    if(s.find("alias")||(m=getBk(c))=="transparent"){
        m="transparent";
        l="transparent";
        n=getParentBk(c);
        b="t"
        }else{
        l=getParentBk(c);
        n=Mix(m,l)
        }
        q.style.background=l;
    q.className="niftycorners";
    a=getPadding(c,"Bottom");
    if(s.find("small")){
        q.style.marginTop=(a-2)+"px";
        b+="s";
        k=2
        }else{
        if(s.find("big")){
            q.style.marginTop=(a-10)+"px";
            b+="b";
            k=8
            }else{
            q.style.marginTop=(a-5)+"px"
            }
        }
    for(o=k;o>0;o--){
    q.appendChild(CreateStrip(o,r,m,n,b))
    }
    c.style.paddingBottom=0;
c.appendChild(q)
}
function CreateStrip(d,k,b,c,l){
    var a=CreateEl("b");
    a.className=l+d;
    a.style.backgroundColor=b;
    a.style.borderColor=c;
    if(k=="left"){
        a.style.borderRightWidth="0";
        a.style.marginRight="0"
        }else{
        if(k=="right"){
            a.style.borderLeftWidth="0";
            a.style.marginLeft="0"
            }
        }
    return(a)
}
function CreateEl(a){
    return(document.createElement(a))
    }
    function FixIE(a){
    if(a.currentStyle!=null&&a.currentStyle.hasLayout!=null&&a.currentStyle.hasLayout==false){
        a.style.display="inline-block"
        }
    }
function SameHeight(a,d){
    var m,b=a.split(","),l,c,k=[],n;
    for(m=0;m<b.length;m++){
        l=getElementsBySelector(b[m]);
        k=k.concat(l)
        }
        for(m=0;m<k.length;m++){
        if(k[m].offsetHeight>d){
            d=k[m].offsetHeight
            }
            k[m].style.height="auto"
        }
        for(m=0;m<k.length;m++){
        n=d-k[m].offsetHeight;
        if(n>0){
            l=CreateEl("b");
            l.className="niftyfill";
            l.style.height=n+"px";
            nc=k[m].lastChild;
            if(nc.className=="niftycorners"){
                k[m].insertBefore(l,nc)
                }else{
                k[m].appendChild(l)
                }
            }
    }
}
function getElementsBySelector(d){
    var n,m,b="",q="",A=d,x="",w,l,p,u,z=[],t=[],r;
    if(d.find("#")){
        if(d.find(" ")){
            z=d.split(" ");
            var o=z[0].split("#");
            if(o.length==1){
                return(t)
            }
            p=document.getElementById(o[1]);
            if(p){
                y=p.getElementsByTagName(z[1]);
                for(n=0;n<y.length;n++){
                    t.push(y[n])
                    }
                }
                return(t)
        }else{
        z=d.split("#");
        A=z[0];
        b=z[1];
        if(b!=""){
            p=document.getElementById(b);
            if(p){
                t.push(p)
                }
                return(t)
            }
        }
}
if(d.find(".")){
    z=d.split(".");
    A=z[0];
    q=z[1];
    if(q.find(" ")){
        z=q.split(" ");
        q=z[0];
        x=z[1]
        }
    }
var y=document.getElementsByTagName(A);
if(q==""){
    for(n=0;n<y.length;n++){
        t.push(y[n])
        }
        return(t)
    }
    for(n=0;n<y.length;n++){
    r=y[n].className.split(" ");
    for(m=0;m<r.length;m++){
        if(r[m]==q){
            if(x==""){
                t.push(y[n])
                }else{
                w=y[n].getElementsByTagName(x);
                for(l=0;l<w.length;l++){
                    t.push(w[l])
                    }
                }
            }
    }
}
return(t)
}
function getParentBk(a){
    var b=a.parentNode,d;
    while(b.tagName.toUpperCase()!="HTML"&&(d=getBk(b))=="transparent"){
        b=b.parentNode
        }
        if(d=="transparent"){
        d="#FFFFFF"
        }
        if(d=="white"){
        d="#FFFFFF"
        }
        return(d)
    }
    function getBk(a){
    var b=getStyleProp(a,"backgroundColor");
    if(b==null||b=="transparent"||b.find("rgba(0, 0, 0, 0)")){
        return("transparent")
        }
        if(b.find("rgb")){
        b=rgb2hex(b)
        }
        return(b)
    }
    function getPadding(a,b){
    var c=getStyleProp(a,"padding"+b);
    if(c==null||!c.find("px")){
        return(0)
        }
        return(parseInt(c))
    }
    function getStyleProp(a,b){
    if(a.currentStyle){
        return(a.currentStyle[b])
        }
        if(document.defaultView.getComputedStyle){
        return(document.defaultView.getComputedStyle(a,"")[b])
        }
        return(null)
    }
    function rgb2hex(l){
    var d="",a,c,b;
    var k=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;
    var c=k.exec(l);
    for(b=1;b<4;b++){
        a=parseInt(c[b]).toString(16);
        if(a.length==1){
            d+="0"+a
            }else{
            d+=a
            }
        }
    return("#"+d)
}
function Mix(l,k){
    var d,c,b,a,n,m=new Array(3);
    if(l.length==4){
        c=1
        }else{
        c=2
        }
        if(k.length==4){
        b=1
        }else{
        b=2
        }
        for(d=0;d<3;d++){
        a=parseInt(l.substr(1+c*d,c),16);
        if(c==1){
            a=16*a+a
            }
            n=parseInt(k.substr(1+b*d,b),16);
        if(b==1){
            n=16*n+n
            }
            m[d]=Math.floor((a*50+n*50)/100);
        m[d]=m[d].toString(16);
        if(m[d].length==1){
            m[d]="0"+m[d]
            }
        }
    if(m[0]=="NaN"){}
return("#"+m[0]+m[1]+m[2])
}
var A_TCALDEF={
    months:["January","February","March","April","May","June","July","August","September","October","November","December"],
    weekdays:["Su","Mo","Tu","We","Th","Fr","Sa"],
    yearscroll:true,
    weekstart:0,
    centyear:70,
    imgpath:"img/"
};
function f_tcalParseDate(l){
    var b=/^\s*(\d{1,2})\/(\d{1,2})\/(\d{2,4})\s*$/;
    if(!b.exec(l)){
        return alert("Invalid date: '"+l+"'.\nAccepted format is mm/dd/yyyy.")
        }
        var a=Number(RegExp.$2),d=Number(RegExp.$1),c=Number(RegExp.$3);
    if(c<100){
        c+=(c<this.a_tpl.centyear?2000:1900)
        }
        if(d<1||d>12){
        return alert("Invalid month value: '"+d+"'.\nAllowed range is 01-12.")
        }
        var k=new Date(c,d,0);
    if(a>k.getDate()){
        return alert("Invalid day of month value: '"+a+"'.\nAllowed range for selected month is 01 - "+k.getDate()+".")
        }
        return new Date(c,d-1,a)
    }
    function f_tcalGenerDate(a){
    return((a.getMonth()<9?"0":"")+(a.getMonth()+1)+"/"+(a.getDate()<10?"0":"")+a.getDate()+"/"+a.getFullYear())
    }
    function tcal(a,b){
    if(!b){
        b=A_TCALDEF
        }
        if(!window.A_TCALS){
        window.A_TCALS=[]
        }
        if(!window.A_TCALSIDX){
        window.A_TCALSIDX=[]
        }
        this.s_id=a.id?a.id:A_TCALS.length;
    window.A_TCALS[this.s_id]=this;
    window.A_TCALSIDX[window.A_TCALSIDX.length]=this;
    this.f_show=f_tcalShow;
    this.f_hide=f_tcalHide;
    this.f_toggle=f_tcalToggle;
    this.f_update=f_tcalUpdate;
    this.f_relDate=f_tcalRelDate;
    this.f_parseDate=f_tcalParseDate;
    this.f_generDate=f_tcalGenerDate;
    this.s_iconId="tcalico_"+this.s_id;
    this.e_icon=f_getElement(this.s_iconId);
    if(!this.e_icon){
        document.write('<img src="'+b.imgpath+'cal.gif" id="'+this.s_iconId+'" onclick="A_TCALS[\''+this.s_id+'\'].f_toggle()" class="tcalIcon" alt="Open Calendar" />');
        this.e_icon=f_getElement(this.s_iconId)
        }
        this.a_cfg=a;
    this.a_tpl=b
    }
    function f_tcalShow(a){
    if(!this.a_cfg.controlname){
        throw ("TC: control name is not specified")
        }
        if(this.a_cfg.formname){
        var b=document.forms[this.a_cfg.formname];
        if(!b){
            throw ("TC: form '"+this.a_cfg.formname+"' can not be found")
            }
            this.e_input=b.elements[this.a_cfg.controlname]
        }else{
        this.e_input=f_getElement(this.a_cfg.controlname)
        }
        if(!this.e_input||!this.e_input.tagName||this.e_input.tagName!="INPUT"){
        throw ("TC: element '"+this.a_cfg.controlname+"' does not exist in "+(this.a_cfg.formname?"form '"+this.a_cfg.controlname+"'":"this document"))
        }
        this.e_div=f_getElement("tcal");
    if(!this.e_div){
        this.e_div=document.createElement("DIV");
        this.e_div.id="tcal";
        document.body.appendChild(this.e_div)
        }
        this.e_shade=f_getElement("tcalShade");
    if(!this.e_shade){
        this.e_shade=document.createElement("DIV");
        this.e_shade.id="tcalShade";
        document.body.appendChild(this.e_shade)
        }
        this.e_iframe=f_getElement("tcalIF");
    if(b_ieFix&&!this.e_iframe){
        this.e_iframe=document.createElement("IFRAME");
        this.e_iframe.style.filter="alpha(opacity=0)";
        this.e_iframe.id="tcalIF";
        this.e_iframe.src=this.a_tpl.imgpath+"pixel.gif";
        document.body.appendChild(this.e_iframe)
        }
        f_tcalHideAll();
    this.e_icon=f_getElement(this.s_iconId);
    if(!this.f_update()){
        return
    }
    this.e_div.style.visibility="visible";
    this.e_shade.style.visibility="visible";
    if(this.e_iframe){
        this.e_iframe.style.visibility="visible"
        }
        this.e_icon.src=this.a_tpl.imgpath+"no_cal.gif";
    this.e_icon.title="Close Calendar";
    this.b_visible=true
    }
    function f_tcalHide(a){
    if(a){
        this.e_input.value=this.f_generDate(new Date(a))
        }
        if(!this.b_visible){
        return
    }
    if(this.e_iframe){
        this.e_iframe.style.visibility="hidden"
        }
        if(this.e_shade){
        this.e_shade.style.visibility="hidden"
    }
    this.e_div.style.visibility="hidden";
    this.e_icon=f_getElement(this.s_iconId);
    this.e_icon.src=this.a_tpl.imgpath+"cal.gif";
    this.e_icon.title="Open Calendar";
    this.b_visible=false
    }
    function f_tcalToggle(){
    return this.b_visible?this.f_hide():this.f_show()
    }
    function f_tcalUpdate(q){
    var a=this.a_cfg.today?this.f_parseDate(this.a_cfg.today):f_tcalResetTime(new Date());
    var p=this.e_input.value==""?(this.a_cfg.selected?this.f_parseDate(this.a_cfg.selected):a):this.f_parseDate(this.e_input.value);
    if(!q){
        q=p
        }else{
        if(typeof(q)=="number"){
            q=f_tcalResetTime(new Date(q))
            }else{
            if(typeof(q)=="string"){
                this.f_parseDate(q)
                }
            }
    }
if(!q){
    return false
    }
    var d=new Date(q);
d.setDate(1);
d.setDate(1-(7+d.getDay()-this.a_tpl.weekstart)%7);
var b,n='<table class="ctrl"><tbody><tr>'+(this.a_tpl.yearscroll?"<td"+this.f_relDate(q,-1,"y")+' title="Previous Year"><img src="'+this.a_tpl.imgpath+'prev_year.gif" /></td>':"")+"<td"+this.f_relDate(q,-1)+' title="Previous Month"><img src="'+this.a_tpl.imgpath+'prev_mon.gif" /></td><th>'+this.a_tpl.months[q.getMonth()]+" "+q.getFullYear()+"</th><td"+this.f_relDate(q,1)+' title="Next Month"><img src="'+this.a_tpl.imgpath+'next_mon.gif" /></td>'+(this.a_tpl.yearscroll?"<td"+this.f_relDate(q,1,"y")+' title="Next Year"><img src="'+this.a_tpl.imgpath+'next_year.gif" /></td></td>':"")+'</tr></tbody></table><table><tbody><tr class="wd">';
for(var m=0;m<7;m++){
    n+="<th>"+this.a_tpl.weekdays[(this.a_tpl.weekstart+m)%7]+"</th>"
    }
    n+="</tr>";
var s,k,t=new Date(d);
while(t.getMonth()==q.getMonth()||t.getMonth()==d.getMonth()){
    n+="<tr>";
    for(var c=0;c<7;c++){
        b=[];
        s=t.getDate();
        k=t.getMonth();
        if(t.getMonth()!=q.getMonth()){
            b[b.length]="othermonth"
            }
            if(t.getDay()==0||t.getDay()==6){
            b[b.length]="weekend"
            }
            if(t.valueOf()==a.valueOf()){
            b[b.length]="today"
            }
            if(t.valueOf()==p.valueOf()){
            b[b.length]="selected"
            }
            n+="<td onclick=\"A_TCALS['"+this.s_id+"'].f_hide("+t.valueOf()+')"'+(b.length?' class="'+b.join(" ")+'">':">")+s+"</td>";
        t.setDate(++s);
        while(t.getDate()!=s&&t.getMonth()==k){
            t.setHours(t.getHours+1);
            t=f_tcalResetTime(t)
            }
        }
    n+="</tr>"
}
n+="</tbody></table>";
this.e_div.innerHTML=n;
var u=this.e_div.offsetWidth;
var o=this.e_div.offsetHeight;
var l=f_getPosition(this.e_icon,"Top")+this.e_icon.offsetHeight;
var r=f_getPosition(this.e_icon,"Left")-u+this.e_icon.offsetWidth;
if(r<0){
    r=0
    }
    this.e_div.style.left=r+"px";
this.e_div.style.top=l+"px";
this.e_shade.style.width=(u+8)+"px";
this.e_shade.style.left=(r-1)+"px";
this.e_shade.style.top=(l-1)+"px";
this.e_shade.innerHTML=b_ieFix?'<table><tbody><tr><td rowspan="2" colspan="2" width="6"><img src="'+this.a_tpl.imgpath+'pixel.gif"></td><td width="7" height="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this.a_tpl.imgpath+"shade_tr.png', sizingMethod='scale');\"><img src=\""+this.a_tpl.imgpath+'pixel.gif"></td></tr><tr><td height="'+(o-7)+'" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this.a_tpl.imgpath+"shade_mr.png', sizingMethod='scale');\"><img src=\""+this.a_tpl.imgpath+'pixel.gif"></td></tr><tr><td width="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this.a_tpl.imgpath+"shade_bl.png', sizingMethod='scale');\"><img src=\""+this.a_tpl.imgpath+'pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this.a_tpl.imgpath+'shade_bm.png\', sizingMethod=\'scale\');" height="7" align="left"><img src="'+this.a_tpl.imgpath+'pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this.a_tpl.imgpath+"shade_br.png', sizingMethod='scale');\"><img src=\""+this.a_tpl.imgpath+'pixel.gif"></td></tr><tbody></table>':'<table><tbody><tr><td rowspan="2" width="6"><img src="'+this.a_tpl.imgpath+'pixel.gif"></td><td rowspan="2"><img src="'+this.a_tpl.imgpath+'pixel.gif"></td><td width="7" height="7"><img src="'+this.a_tpl.imgpath+'shade_tr.png"></td></tr><tr><td background="'+this.a_tpl.imgpath+'shade_mr.png" height="'+(o-7)+'"><img src="'+this.a_tpl.imgpath+'pixel.gif"></td></tr><tr><td><img src="'+this.a_tpl.imgpath+'shade_bl.png"></td><td background="'+this.a_tpl.imgpath+'shade_bm.png" height="7" align="left"><img src="'+this.a_tpl.imgpath+'pixel.gif"></td><td><img src="'+this.a_tpl.imgpath+'shade_br.png"></td></tr><tbody></table>';
if(this.e_iframe){
    this.e_iframe.style.left=r+"px";
    this.e_iframe.style.top=l+"px";
    this.e_iframe.style.width=(u+6)+"px";
    this.e_iframe.style.height=(o+6)+"px"
    }
    return true
}
function f_getPosition(c,k){
    var a=0,d,b=c;
    while(b){
        d=b["offset"+k];
        a+=d;
        b=b.offsetParent
        }
        if(b_ieMac){
        a+=parseInt(document.body[k.toLowerCase()+"Margin"])
        }else{
        if(b_safari){
            a-=d
            }
        }
    b=c;
while(b!=document.body){
    d=b["scroll"+k];
    if(d&&b.style.overflow=="scroll"){
        a-=d
        }
        b=b.parentNode
    }
    return a
}
function f_tcalRelDate(b,c,a){
    var a=(a=="y"?"FullYear":"Month");
    var d=new Date(b);
    d["set"+a](b["get"+a]()+c);
    if(d.getDate()!=b.getDate()){
        d.setDate(0)
        }
        return" onclick=\"A_TCALS['"+this.s_id+"'].f_update("+d.valueOf()+')"'
    }
    function f_tcalHideAll(){
    if(window.A_TCALSIDX){
        for(var a=0;a<window.A_TCALSIDX.length;a++){
            window.A_TCALSIDX[a].f_hide()
            }
        }
    }
function f_tcalResetTime(a){
    a.setHours(0);
    a.setMinutes(0);
    a.setSeconds(0);
    a.setMilliseconds(0);
    return a
    }
    f_getElement=document.all?function(a){
    return document.all[a]
    }:function(a){
    return document.getElementById(a)
};

if(document.addEventListener){
    window.addEventListener("scroll",f_tcalHideAll,false)
        }
        if(window.attachEvent){
    window.attachEvent("onscroll",f_tcalHideAll)
        }
        var s_userAgent=navigator.userAgent.toLowerCase(),re_webkit=/WebKit\/(\d+)/i;
var b_mac=s_userAgent.indexOf("mac")!=-1,b_ie5=s_userAgent.indexOf("msie 5")!=-1,b_ie6=s_userAgent.indexOf("msie 6")!=-1&&s_userAgent.indexOf("opera")==-1;
var b_ieFix=b_ie5||b_ie6,b_ieMac=b_mac&&b_ie5,b_safari=b_mac&&re_webkit.exec(s_userAgent)&&Number(RegExp.$1)<500;
var A_CALTPL={
    months:["Январь","Февраль","Март","Апрель","Май","�?юнь","�?юль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],
    weekdays:["вс","пн","вт","ср","чт","пн","сб"],
    yearscroll:true,
    weekstart:0,
    centyear:70,
    imgpath:"/defaultshop_data/calendar/img/"
};

function clearWordInput(a,c){
    var b=document.getElementById(a);
    if(typeof(b)!="undefined"){
        if(b.value==c){
            b.value=""
            }
        }
}
function setWordInput(a,c){
    var b=document.getElementById(a);
    if(typeof(b)!="undefined"){
        if(b.value==""){
            b.value=c
            }
        }
}
var BrowserDetect={
    init:function(){
        this.browser=this.searchString(this.dataBrowser)||"An unknown browser";
        this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";
        this.OS=this.searchString(this.dataOS)||"an unknown OS"
        },
    searchString:function(d){
        for(var a=0;a<d.length;a++){
            var b=d[a].string;
            var c=d[a].prop;
            this.versionSearchString=d[a].versionSearch||d[a].identity;
            if(b){
                if(b.indexOf(d[a].subString)!=-1){
                    return d[a].identity
                    }
                }else{
            if(c){
                return d[a].identity
                }
            }
        }
},
searchVersion:function(b){
    var a=b.indexOf(this.versionSearchString);
    if(a==-1){
        return
    }
    return parseFloat(b.substring(a+this.versionSearchString.length+1))
    },
dataBrowser:[{
    string:navigator.vendor,
    subString:"Apple",
    identity:"Safari"
}],
dataOS:[]
};

function roundElems(){
    BrowserDetect.init();
    if(BrowserDetect.browser=="Safari"){
        var a=window.onload;
        window.onload=function(){
            if(a){
                a()
                }
                Nifty("a.ocn_logo","bl");
            Nifty("div.ocn_blueline a","");
            Nifty("div.cpt_logo","top");
            Nifty("div.ocn_whiteline div","left transparent fixed-height");
            Nifty("div.ocn_right_wh","right");
            Nifty("div.ocn_rightrel","right fixed-height");
            Nifty("div.ocn_left_wh","top");
            Nifty("div.bluebg","top");
            Nifty("div.orangebg","top");
            Nifty("div.greenbg","transparent top");
            Nifty("div.ocn_left_bott_wh","bottom");
            Nifty("div.cpt_category_tree","bottom");
            Nifty("div.cpt_currency_selection","bottom height");
            Nifty("div.cpt_maincontent","");
            Nifty("div.cpt_product_search","bottom");
            Nifty("div.cpt_shopping_cart_info","");
            Nifty("div.ocn_left_full_wh","");
            Nifty("div#container_footer div","transparent");
            Nifty("div.cpt_news_short_list","bottom transparent");
            Nifty("div#cat_advproduct_search","");
            Nifty("div.cpt_language_selection","bottom")
            }
        }else{
    Nifty("a.ocn_logo","bl");
    Nifty("div.ocn_blueline a","");
    Nifty("div.cpt_logo","top");
    Nifty("div.ocn_whiteline div","left transparent fixed-height");
    Nifty("div.ocn_right_wh","right");
    Nifty("div.ocn_rightrel","right fixed-height");
    Nifty("div.ocn_left_wh","top");
    Nifty("div.bluebg","top");
    Nifty("div.orangebg","top");
    Nifty("div.greenbg","transparent top");
    Nifty("div.ocn_left_bott_wh","bottom");
    Nifty("div.cpt_category_tree","bottom");
    Nifty("div.cpt_currency_selection","bottom height");
    Nifty("div.cpt_maincontent","");
    Nifty("div.cpt_product_search","bottom");
    Nifty("div.cpt_shopping_cart_info","");
    Nifty("div.ocn_left_full_wh","");
    Nifty("div#container_footer div","transparent");
    Nifty("div.cpt_news_short_list","bottom transparent");
    Nifty("div#cat_advproduct_search","");
    Nifty("div.cpt_language_selection","bottom");
    Nifty("div.cpt_survey","bottom")
    }
}
function getElementComputedStyle(b,c){
    if(typeof b!="object"){
        b=document.getElementById(b)
        }
        if(document.defaultView&&document.defaultView.getComputedStyle){
        if(c.match(/[A-Z]/)){
            c=c.replace(/([A-Z])/g,"-$1").toLowerCase()
            }
            return document.defaultView.getComputedStyle(b,"").getPropertyValue(c)
        }
        if(b.currentStyle){
        var a;
        while((a=c.indexOf("-"))!=-1){
            c=c.substr(0,a)+c.substr(a+1,1).toUpperCase()+c.substr(a+2)
            }
            return b.currentStyle[c]
    }
    return""
    }
    function getWindowSize(b){
    var a,c;
    if(b.innerHeight){
        if(b.document.documentElement.clientWidth){
            a=b.document.documentElement.clientWidth
            }else{
            b.windowWidth=b.innerWidth
            }
            c=b.innerHeight
        }else{
        if(b.document.documentElement&&b.document.documentElement.clientHeight){
            a=b.document.documentElement.clientWidth;
            c=b.document.documentElement.clientHeight
            }else{
            if(b.document.body){
                a=b.document.body.clientWidth;
                c=b.document.body.clientHeight
                }
            }
    }
return[a,c]
}
function number_format(l,k,n,m){
    l=Math.round(l*Math.pow(10,k))/Math.pow(10,k);
    e=l+"";
    f=e.split(".");
    if(!f[0]){
        f[0]="0"
        }
        if(!f[1]){
        f[1]=""
        }
        if(f[1].length<k){
        g=f[1];
        for(i=f[1].length+1;i<=k;i++){
            g+="0"
            }
            f[1]=g
        }
        if(m!=""&&f[0].length>3){
        h=f[0];
        f[0]="";
        for(j=3;j<h.length;j+=3){
            i=h.slice(h.length-j,h.length-j+3);
            f[0]=m+i+f[0]+""
            }
            j=h.substr(0,(h.length%3==0)?3:(h.length%3));
        f[0]=j+f[0]
        }
        n=(k<=0)?"":n;
    return f[0]+n+f[1]
    }
    function getLayer(b,a){
    if(!a){
        a=window
        }
        if(a.document.getElementById){
        return a.document.getElementById(b)
        }
        if(a.document.all){
        return a.document.all[b]
    }
    if(a.document.layers){
        return a.document.layers[b]
        }
        return null
    }
    function changeState(a,c){
    var b=getLayer(a);
    if(is_null(b)){
        return
    }
    if(is_null(c)?b.style.display!="block":c){
        b.style.display="block"
        }else{
        b.style.display="none"
        }
    }
function is_null(a){
    if(typeof(a)=="undefined"){
        return true
        }
        if(a==null){
        return true
        }
        return false
    }
    function getAbsolutePos(k){
    var a=0,d=0;
    var c=/^div$/i.test(k.tagName);
    if(c&&k.scrollLeft){
        a=k.scrollLeft
        }
        if(c&&k.scrollTop){
        d=k.scrollTop
        }
        var l={
        x:k.offsetLeft-a,
        y:k.offsetTop-d
        };
        
    if(k.offsetParent){
        var b=this.getAbsolutePos(k.offsetParent);
        l.x+=b.x;
        l.y+=b.y
        }
        return l
    }
    function getElementsByClass(l,b,o){
    var n=new Array();
    if(b==null){
        b=document
        }
        if(o==null){
        o="*"
        }
        var d=b.getElementsByTagName(o);
    var a=d.length;
    var m=new RegExp("(^|\\s)"+l+"(\\s|$)");
    for(var k=0,c=0;k<a;k++){
        if(m.test(d[k].className)){
            n[c]=d[k];
            c++
        }
    }
    return n
}
function getElementByClass(d,c,a){
    var b=getElementsByClass(d,c,a);
    if(!b.length){
        return null
        }
        return b[0]
    }
    function createTag(a,c,b){
    if(!b){
        b=window
        }
        if(!c){
        c=b.document.body
    }
    el=b.document.createElement(a);
    c.appendChild(el);
    return el
    }
    function deleteTag(a,b){
    if(!b){
        b=a.parentNode
        }
        b.removeChild(a)
    }
    function open_window(d,a,c){
    var k="width="+a+",height="+c+",menubar=no,location=no,resizable=yes,scrollbars=yes";
    var b=window.open(d,"newWin",k);
    if(b){
        b.focus()
        }
        return b
    }
    function select_getCurrValue(b){
    for(var a=0;a<b.options.length;a++){
        if(b.options[a].selected){
            return b.options[a].value
            }
        }
    return null
}
function select_getCurrOption(b){
    for(var a=0;a<b.options.length;a++){
        if(b.options[a].selected){
            return b.options[a]
            }
        }
    return null
}
function select_selectOptionByValue(b,c){
    for(var a=0;a<b.options.length;a++){
        b.options[a].selected=(c==b.options[a].value)
        }
    }
    function select_getOptionByValue(b,c){
    for(var a=0;a<b.options.length;a++){
        if(b.options[a].value==c){
            return b.options[a]
            }
        }
    return null
}
function findSelectedIndex(a){
    for(i=0;i<a.length;i++){
        if(a[i].selected){
            return i
            }
        }
    return -1
}
function select_addOption(l,k,b,d,a){
    var c=document.createElement("option");
    c.appendChild(document.createTextNode(k));
    c.setAttribute("value",b);
    if(d){
        c.defaultSelected=true
        }else{
        if(a){
            c.selected=true
            }
        }
    l.appendChild(c)
}
function confirmDelete(c,b,a){
    if(window.confirm(b)){
        window.location=a+c
        }
    }
function formatPrice(a){
    return defaultCurrency.getView(a)
    }
    function allowInsertAtCarret(a){
    return document.selection||(a.selectionStart||a.selectionStart=="0")||false
    }
    function insertAtCarret(l,d){
    if(document.selection){
        l.focus();
        sel=document.selection.createRange();
        sel.text=d
        }else{
        if(l.selectionStart||l.selectionStart=="0"){
            var b=l.selectionStart;
            var a=l.selectionEnd;
            var k=l.scrollTop;
            l.value=l.value.substring(0,b)+d+l.value.substring(a,l.value.length);
            l.focus();
            var c=b+(d.length);
            l.selectionStart=c;
            l.selectionEnd=c;
            l.scrollTop=k
            }else{
            l.value+="\n"+d
            }
        }
    if(l.createTextRange){
    l.caretPos=document.selection.createRange().duplicate()
    }
}
FadeSteps=["ff","ee","dd","cc","bb","aa","99"];
FadeTimeout=600;
function fadeBlock(a){
    DoFade(FadeSteps.length-1,a)
    }
    function DoFade(b,a){
    if(b>=0&&document.getElementById(a)){
        document.getElementById(a).style.backgroundColor="#ffff"+FadeSteps[b];
        b--;
        setTimeout("DoFade("+b+",'"+a+"')",FadeTimeout)
        }else{
        if(document.getElementById(a).getAttribute("obj_wnd")){
            document.getElementById(a).getAttribute("obj_wnd").close()
            }
        }
}
function __alert(a){
    var b=new Message();
    b.__type=MSGTYPE_SUCCESS;
    b.__message=a;
    b.showMessage()
    }
    var MSGTYPE_SUCCESS=1;
var MSGTYPE_ERROR=2;
var Message=function(){
    this.__type=null;
    this.__code=null;
    this.__message=null;
    this.__params=null;
    this.init=function(a){
        if(a.type){
            this.__type=a.type
            }
            if(a.code){
            this.__code=a.code
            }
            if(a.message){
            this.__message=a.message
            }
            if(a.params){
            this.__params=a.params
            }
        };
    
this.isError=function(){
    return this.__type==MSGTYPE_ERROR
    };
    
this.isSuccess=function(){
    return this.__type==MSGTYPE_SUCCESS
    };
    
this.getMessage=function(){
    return this.__message
    };
    
this.getParams=function(){
    return this.__params
    };
    
this.showMessage=function(){
    var a=new wnd();
    a.move(100,100);
    a.setWidth(400);
    var b=a.getContentObj();
    b.className=this.isSuccess()?"success_block":"error_block";
    b.innerHTML=this.getMessage();
    b.id="wnd-msg-block";
    b.style.position="fixed";
    w_size=getWindowSize(window);
    w1_size=a.getSize();
    a.move((w_size[0]-w1_size[0])/2,(w_size[1]-w1_size[1])/4);
    a.show();
    a.fade()
    }
};

var wnd=function(){
    if(getLayer("wnd-init")){
        this.__objDiv=getLayer("wnd-init");
        this.__objDiv.parentNode.removeChild(this.__objDiv)
        }
        this.__objDiv=createTag("div");
    this.__objDiv.id="wnd-init";
    this.__objDiv.className="wnd_init";
    this.__objDiv.setAttribute("obj_wnd",this);
    var a=this;
    this.__objContent=createTag("div",this.__objDiv);
    this.fade=function(){
        setTimeout("getLayer('"+this.__objDiv.id+"').style.display = 'none'",5000)
        };
        
    this.getSize=function(){
        return[this.__objDiv.offsetWidth,this.__objDiv.offsetHeight]
        };
        
    this.getContentObj=function(){
        return this.__objContent
        };
        
    this.setWidth=function(b){
        this.__objDiv.style.width=b+"px"
        };
        
    this.setHeight=function(b){
        this.__objDiv.style.height=b+"px"
        };
        
    this.show=function(){
        this.__objDiv.style.visibility="visible"
        };
        
    this.hide=function(){
        this.__objDiv.style.visibility="hidden"
        };
        
    this.close=function(){
        this.hide();
        this.__objDiv.parentNode.removeChild(this.__objDiv)
    };
    
    this.move=function(b,c){
        this.__objDiv.style.left=b+"px";
        this.__objDiv.style.top=c+"px"
        }
    };

function getFormByElem(b){
    var a=50;
    var c=b.parentNode;
    while(c&&c.tagName&&!(/^form$/i.test(c.tagName))&&0<a--){
        c=c.parentNode
        }
        if(c&&c.tagName&&/^form$/i.test(c.tagName)){
        return c
        }
        return null
    }
    function getCookie(c){
    var d=document.cookie.indexOf(c+"=");
    var a=d+c.length+1;
    if((!d)&&(c!=document.cookie.substring(0,c.length))){
        return null
        }
        if(d==-1){
        return null
        }
        var b=document.cookie.indexOf(";",a);
    if(b==-1){
        b=document.cookie.length
        }
        return unescape(document.cookie.substring(a,b))
    }
    function setCookie(c,k,a,n,d,m){
    var b=new Date();
    b.setTime(b.getTime());
    if(a){
        a=a*1000*60*60*24
        }
        var l=new Date(b.getTime()+(a));
    document.cookie=c+"="+escape(k)+((a)?";expires="+l.toGMTString():"")+((n)?";path="+n:"")+((d)?";domain="+d:"")+((m)?";secure":"")
    }
    function deleteCookie(a,c,b){
    if(getCookie(a)){
        document.cookie=a+"="+((c)?";path="+c:"")+((b)?";domain="+b:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"
        }
    }
function catchResult(a){
    alert(a)
}
function openFadeIFrame(b,a){
//Proverka na Explorer

    if (window.navigator.userAgent.indexOf("MSIE") > (-1)){
var IE=true;
        window.scroll(0,0); 
    }
    sswgt_CartManager.shop_url=(window.WAROOT_URL!=null)?window.WAROOT_URL:ORIG_URL;
    sizes=getPageSize();
    sswgt_CartManager.show(b,sizes[0]*0.7,sizes[1]*1.7)
    
    }
    function resizeFadeIFrame(b,a){
    sswgt_CartManager.resizeFrame(b,a)
    }
    function closeFadeIFrame(){
//brain
//For closing iFrame in Google Chrome
    //sswgt_CartManager.hide()

    parent.sswgt_CartManager.hide()
    }
    function split_query(d){
    var k=d.split(/\&/);
    var a={};
    
    var c=null;
    for(var b=k.length-1;b>=0;b--){
        c=k[b].split(/\=/);
        if(c[0]!=null){
            a[c[0]]=c[1]?c[1]:""
            }
        }
    return a
}
function set_query(p,a){
    if(!a){
        a=document.location.href
        }
        var c=/([^\?]*)\?([^\#]*)(|\#.*)$/;
    var m=a.match(c);
    var q=m&&m[1]?m[1]:"";
    var r=m&&m[2]?m[2]:"";
    var b=m&&m[3]?m[3]:"";
    var n=p.search(/^\?/)==-1?"update":"new";
    p=p.replace(/^\?|^\&/,"");
    var o=split_query(p);
    var d=split_query(r);
    var s="";
    if(n=="update"){
        for(var l in o){
            d[l]=o[l]?o[l]:null
            }
        }else{
    for(var l in o){
        if(!o[l]){
            o[l]=d[l]?d[l]:null
            }
        }
    d=o
}
for(var l in d){
    if(l&&(d[l]!=null)){
        s+="&"+l+"="+d[l]
        }
    }
return"?"+s.replace(/^\&/,"")+b
}
var AjaxCptHndls={
    __handlers:{},
    register:function(c,a,b){
        if(is_null(this.__handlers[a])){
            this.__handlers[a]={}
        }
        this.__handlers[a][c]=b
        },
    call:function(c,a,b){
        if(is_null(this.__handlers[a][c])){
            return
        }
        return this.__handlers[a][c](b)
        }
    };

function getEventObject(b){
    var a={};
    
    b=b?b:window.event;
    if(b.srcElement){
        a.target=b.srcElement
        }else{
        a.target=b.target
        }
        a.ev=b;
    return a
    }
    function getPageSize(){
    var c,a;
    if(window.innerHeight&&window.scrollMaxY){
        c=window.innerWidth+window.scrollMaxX;
        a=window.innerHeight+window.scrollMaxY
        }else{
        if(document.body.scrollHeight>document.body.offsetHeight){
            c=document.body.scrollWidth;
            a=document.body.scrollHeight
            }else{
            c=document.body.offsetWidth;
            a=document.body.offsetHeight
            }
        }
    var b,d;
if(self.innerHeight){
    if(document.documentElement.clientWidth){
        b=document.documentElement.clientWidth
        }else{
        b=self.innerWidth
        }
        d=self.innerHeight
    }else{
    if(document.documentElement&&document.documentElement.clientHeight){
        b=document.documentElement.clientWidth;
        d=document.documentElement.clientHeight
        }else{
        if(document.body){
            b=document.body.clientWidth;
            d=document.body.clientHeight
            }
        }
}
if(a<d){
    pageHeight=d
    }else{
    pageHeight=a
}
if(c<b){
    pageWidth=c
    }else{
    pageWidth=b
    }
    arrayPageSize=new Array(pageWidth,pageHeight,b,d);
return arrayPageSize
}
var beforeUnloadHandler_contentChanged=false;
var beforeUnloadHandler=function(){
    if(beforeUnloadHandler_contentChanged){
        return translate.msg_unsaved_changes
        }
        if(window.tinyMCE){
        var a=false;
        for(var c in tinyMCE.instances){
            var b=tinyMCE.instances[c];
            if(!tinyMCE.isInstance(b)){
                continue
            }
            if(b.isDirty()){
                return translate.msg_unsaved_changes
                }
            }
        }
        return
};

function getCookie(a){
    if(document.cookie.length>0){
        c_start=document.cookie.indexOf(a+"=");
        if(c_start!=-1){
            c_start=c_start+a.length+1;
            c_end=document.cookie.indexOf(";",c_start);
            if(c_end==-1){
                c_end=document.cookie.length
                }
                return unescape(document.cookie.substring(c_start,c_end))
            }
        }
    return null
}
function setCookie(b,c,a){
    var d=new Date();
    d.setDate(d.getDate()+a);
    document.cookie=b+"="+escape(c)+((a==null)?"":";expires="+d.toGMTString())
    }
    window.onbeforeunload=beforeUnloadHandler;
var Behaviour={
    list:new Array,
    register:function(a){
        Behaviour.list.push(a)
    },
    start:function(){
        Behaviour.addLoadEvent(function(){
            Behaviour.apply()
            })
        },
    apply:function(){
        for(h=0;sheet=Behaviour.list[h];h++){
            for(selector in sheet){
                list=document.getElementsBySelector(selector);
                if(!list){
                    continue
                }
                for(i=0;element=list[i];i++){
                    sheet[selector](element)
                    }
                }
            }
        },
addLoadEvent:function(a){
    var b=window.onload;
    if(typeof window.onload!="function"){
        window.onload=a
        }else{
        window.onload=function(){
            try{
                if(typeof b=="function"){
                    b()
                    }
                }catch(c){}finally{}
        try{
            if(typeof a=="function"){
                a()
                }
            }catch(c){}finally{}
}
}
}
};

Behaviour.start();
function getAllChildren(a){
    return a.all?a.all:a.getElementsByTagName("*")
    }
    document.getElementsBySelector=function(x){
    if(!document.getElementsByTagName){
        return new Array()
        }
        var r=x.split(" ");
    var m=new Array(document);
    for(var z=0;z<r.length;z++){
        token=r[z].replace(/^\s+/,"").replace(/\s+$/,"");
        if(token.indexOf("#")>-1){
            var u=token.split("#");
            var d=u[0];
            var t=u[1];
            var b=document.getElementById(t);
            if(d&&b.nodeName.toLowerCase()!=d){
                return new Array()
                }
                m=new Array(b);
            continue
        }
        if(token.indexOf(".")>-1){
            var u=token.split(".");
            var d=u[0];
            var c=u[1];
            if(!d){
                d="*"
                }
                var o=new Array;
            var n=0;
            for(var A=0;A<m.length;A++){
                var p;
                if(d=="*"){
                    p=getAllChildren(m[A])
                    }else{
                    p=m[A].getElementsByTagName(d)
                    }
                    for(var w=0;w<p.length;w++){
                    o[n++]=p[w]
                    }
                }
                m=new Array;
        var s=0;
        for(var v=0;v<o.length;v++){
            if(o[v].className&&o[v].className.match(new RegExp("\\b"+c+"\\b"))){
                m[s++]=o[v]
                }
            }
        continue
    }
    if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){
        var d=RegExp.$1;
        var y=RegExp.$2;
        var a=RegExp.$3;
        var q=RegExp.$4;
        if(!d){
            d="*"
            }
            var o=new Array;
        var n=0;
        for(var A=0;A<m.length;A++){
            var p;
            if(d=="*"){
                p=getAllChildren(m[A])
                }else{
                p=m[A].getElementsByTagName(d)
                }
                for(var w=0;w<p.length;w++){
                o[n++]=p[w]
                }
            }
            m=new Array;
    var s=0;
    var l;
    switch(a){
        case"=":
            l=function(k){
            return(k.getAttribute(y)==q)
            };
            
        break;
        case"~":
            l=function(k){
            return(k.getAttribute(y).match(new RegExp("\\b"+q+"\\b")))
            };
            
        break;
        case"|":
            l=function(k){
            return(k.getAttribute(y).match(new RegExp("^"+q+"-?")))
            };
            
        break;
        case"^":
            l=function(k){
            return(k.getAttribute(y).indexOf(q)==0)
        };
        
        break;
        case"$":
            l=function(k){
            return(k.getAttribute(y).lastIndexOf(q)==k.getAttribute(y).length-q.length)
            };
            
        break;
        case"*":
            l=function(k){
            return(k.getAttribute(y).indexOf(q)>-1)
            };
            
        break;
        default:
            l=function(k){
            return k.getAttribute(y)
            }
        }
        m=new Array;
var s=0;
for(var v=0;v<o.length;v++){
    if(l(o[v])){
        m[s++]=o[v]
        }
    }
continue
}
if(!m[0]){
    return
}
d=token;
var o=new Array;
var n=0;
for(var A=0;A<m.length;A++){
    var p=m[A].getElementsByTagName(d);
    for(var w=0;w<p.length;w++){
        o[n++]=p[w]
        }
    }
    m=o
}
return m
};

if(!sswgt_CartManager){
    var sswgt_CartManager={
        prefix:"my_",
        mode:"frame",
        add2cart:function(a){
            this.shop_url=a.getAttribute("rel");
            sizes=getPageSize();
            this.show(a.href+"&widgets=1",sizes[2]*0.7,sizes[3]*0.7);
            return false
            },
        go2cart:function(a){
            this.shop_url=a.getAttribute("rel");
            sizes=getPageSize();
            this.show(a.href,sizes[2]*0.7,sizes[3]*0.7);
            return false
            },
        _show:function(width,height){
            this.hide(true);
            hideSelectBoxes();
            hideFlash();
            this.div();
            this.base();
            if(this.mode=="frame"){
                this.frame(this.params.url,width,height)
                }else{
                if(this.mode=="layer"){
                    this.layer(this.params.layer_id,width,height)
                }
            }
            this.border(this.objMain);
        this.closeButton(this.objBorder);
        var old_onresize=window.onresize;
        window.onresize=function(){
            with(sswgt_CartManager){
                if(!(objOverlay&&objDiv)){
                    return
                }
                var arrayPageSize=getPageSize();
                objOverlay.style.width=arrayPageSize[2]+"px";
                objOverlay.style.height=arrayPageSize[3]+"px";
                objBase.style.width=arrayPageSize[2]+"px";
                objBase.style.height=arrayPageSize[3]+"px";
                if(sswgt_CartManager.mode=="frame"){
                    sswgt_CartManager.frame(null,frameWidth,frameHeight)
                    }else{
                    if(sswgt_CartManager.mode=="layer"){
                        this.layer(sswgt_CartManager.params.layer_id,frameWidth,frameHeight)
                        }
                    }
					
					
					
                border(sswgt_CartManager.objMain);
            closeButton(objBorder)
            }
            if(old_onresize){
            old_onresize()
            }
        };
    
var old_onkeydown=document.onkeydown;
document.onkeydown=function(event){
    event=event?event:window.event;
    if(event){
        switch(event.keyCode?event.keyCode:event.which?event.which:null){
            case 27:
                sswgt_CartManager.hide(true)
                }
            }
    if(old_onkeydown){
    old_onkeydown()
    }
}
},
showLayer:function(c,b,a){
    this.mode="layer";
    this.params={
        layer_id:c
    };
    
    this._show(b,a);
    showSelectBoxes()
    },
show:function(b,c,a){
    this.mode="frame";
    this.params={
        url:b
    };
    
    this._show(c,a)
    },
resizeFrame:function(b,a){
    if(b!=null){
        this.frameWidth=b
        }
        if(a!=null){
        this.frameHeight=a
        }
        this.frame(null,this.frameWidth,this.frameHeight);
    this.border(this.objFrame);
    this.closeButton(this.objBorder)
    },
div:function(){
    this.objDiv=document.createElement("div");
    setStyle(this.objDiv,"zIndex:100; position: absolute; left:0; top: 0;");
    var a=document.getElementsByTagName("body").item(0);
    a.appendChild(this.objDiv);
    this.objDiv.style.backgroundAttachment="fixed"
    },
layer:function(l,b,a){
    var m=getLayer(l);
    setStyle(m,"visibility:hidden; display: block");
    if(!b){
        b=m.offsetWidth
        }
        if(!a){
        a=m.offsetHeight
        }
        this.frameWidth=b;
    this.frameHeight=a;
    var c=getPageSize();
    var k=(c[2]-b)/2;
    if(k<0){
        k=0
        }
        var d=(c[3]-a)/2;
    if(d<10){
        d=10
        }
        this.objBase.appendChild(m);
    setStyle(m,"top:"+d+"px; left:"+k+"px; width:"+b+"px; height:"+a+"px;overflow: auto;zIndex:121; position:relative;visibility:visible");
    this.objBase.style.visibility="visible";
    this.objMain=m
    },
frame:function(a,b,r){

    if (window.navigator.userAgent.indexOf("MSIE") > (-1)){
var IE=true;
        window.scroll(0,0); 
    }
    this.frameWidth=b;
    this.frameHeight=r;
    var l=getPageSize();
    var d=(l[2]-b)/2;
    if(d<0){
        d=0
        }
        var n=(l[3]-r)/2;
    if(n<10){
        n=10
        }
        var p=document.getElementById(this.prefix+"frame");
    if(!p){
        var o=document.createElement("div");
        o.style.display="none";
        o.innerHTML='<iframe id="'+this.prefix+'frame" frameborder="0"></iframe>';
        this.objBase.appendChild(o);
        p=document.getElementById(this.prefix+"frame");
        this.objBase.appendChild(p);
        this.objBase.removeChild(o);
        setStyle(p,"zIndex:120; position:absolute; backgroundColor:#ffffff");
        var q=document.createElement("div");
        this.objBase.appendChild(q);
        setStyle(q,"backgroundColor:#ffffff; zIndex:121; position:absolute; padding:20px; left:"+(l[2]/2-50+20)+"px; top:"+(l[3]/2-50)+"px;visibility: visible;");
        var m=document.createElement("img");
        m.src=((window.CONF_ON_WEBASYST||(this.shop_url.search("webasyst.net")!=-1))?(this.shop_url.replace(/shop\//,"")+"shop/"):(this.shop_url+"published/SC/html/scripts/"))+"images_common/loading.gif";
        q.appendChild(m);
        setTimeout(function(){
            p.src=a
            },100);
        var k=this.objBase;
        function c(){
            if(p.style.visibility!="visible"){
                var t=q;
                var s=k;
                setTimeout(function(){
                    if(t&&t.parentNode){
                        t.parentNode.removeChild(t);
                        t=null
                        }
                        s.style.visibility="visible"
                    },800)
                }
            }
        if(p.addEventListener){
        p.addEventListener("load",c,false)
        }else{
        if(p.attachEvent){
            p.attachEvent("onload",c)
            }
        }
    this.objFrame=p;
this.objMain=this.objFrame
}
//brain
// block width of frame
//setStyle(p,"top:"+n+"px; left:"+d+"px; width:"+b+"px; height:"+r+"px")
setStyle(p,"top:"+n+"px; left:"+d+"px; width:950px; height:"+r+"px")
},
base:function(){
    if(!/MSIE/.test(navigator.userAgent)){
        var a=document.createElement("div");
        a.style.visibility="hidden"
        }else{
        this.objDiv.innerHTML+='<div id="myBase" style=\'z-index:95; position:absolute; visibility:hidden; top: expression(parseInt(document.documentElement.scrollTop || document.body.scrollTop, 10)+"px"); left: expression(parseInt(document.documentElement.scrollLeft || document.body.scrollLeft, 10)+"px");\'></div>';
        var a=document.getElementById("myBase")
        }
        setStyle(a,"zIndex:95");
    if(!/MSIE/.test(navigator.userAgent)){
        setStyle(a,"top:0; left:0; position: fixed")
    }
    var b=getPageSize();
    a.style.width=b[2]+"px";
    a.style.height=b[3]+"px";
    a.onclick=function(c){
        if(getEventObject(c).target.id&&getEventObject(c).target.id==this.id){
            sswgt_CartManager.hide(true)
            }
        };
    
this.objDiv.insertBefore(a,this.objDiv.firstChild);
this.objBase=a;
this.overlay()
},
overlay:function(){
    var c=document.getElementById(this.prefix+"overlay");
    if(!c){
        c=document.createElement("div");
        c.id=this.prefix+"overlay";
        this.objBase.appendChild(c)
        }
        var k=0;
    var d=0;
    var b=this.objBase.offsetWidth;
    var a=this.objBase.offsetHeight;
    setStyle(c,"position:absolute; visibility: visible; top:"+d+"; left:"+k+"; width:"+b+"px; height:"+a+"px; backgroundColor:#000000");
    setOpacity(c,0.7);
    c.onclick=function(l){
        if(getEventObject(l).target.id&&getEventObject(l).target.id==this.id){
            sswgt_CartManager.hide(true)
            }
        };
    
this.objOverlay=c
},
hide:function(a){
   // alert('');
    //closeButton(my_frame);
    

parent.parent.parent.document.html.style.overflow="auto";

    
    if(this.objDiv&&this.objDiv.parentNode){
        if(this.objOverlay){
            this.objDiv.appendChild(this.objOverlay)
            }
            this.objDiv.style.display="none";
        if(a){
            if(this.mode=="layer"){
                setStyle(this.objMain,"display:none");
                setStyle(this.objMain,"visibility:hidden");
                document.body.appendChild(this.objMain)
                }
                this.objDiv.parentNode.removeChild(this.objDiv);
            this.objDiv=null;
            this.objOverlay=null
            }
            showSelectBoxes();
        showFlash()
        }
    },
closeButton:function(parentObject){
    with(this){
        var objCloseButton=document.getElementById(prefix+"closeButton");
        if(!objCloseButton){
            objCloseButton=document.createElement("img");
            objCloseButton.id=prefix+"closeButton"
            }
            var left=parentObject.offsetLeft+parentObject.offsetWidth-22;
        var top=parentObject.offsetTop-25;
        setStyle(objCloseButton,"position:absolute; top:"+top+"; left:"+left+"; cursor:pointer; cursor:hand");
        objCloseButton.src=((window.CONF_ON_WEBASYST||(this.shop_url.search("webasyst.net")!=-1))?(this.shop_url.replace(/shop\//,"")+"shop/"):(this.shop_url+"published/SC/html/scripts/"))+"images_common/close.gif";
        objCloseButton.onclick=function(){
            sswgt_CartManager.hide(true);
            return false
            };
            
        objBase.appendChild(objCloseButton)
        }
    },
border:function(k){
    var b=document.getElementById(this.prefix+"border");
    if(!b){
        b=document.createElement("div");
        b.id=this.prefix+"border";
        this.objBase.appendChild(b)
        }
        var c=0;
    var m=parseInt(k.style.left,10)-c;
    var l=parseInt(k.style.top,10)-c;
    var d=k.offsetWidth;
    var a=k.offsetHeight;
    if(/MSIE/.test(navigator.userAgent)){
        d+=c*2;
        a+=c*2
        }
        setStyle(b,"position:absolute; top:"+l+"; left:"+m+"; width:"+d+"px; height:"+a+"px; border: "+c+"px solid #efefef");
    this.objBorder=b
    }
};

function showSelectBoxes(){
    var a=document.getElementsByTagName("select");
    for(i=0;i!=a.length;i++){
        a[i].style.visibility="visible"
        }
    }
    function hideSelectBoxes(){
    var a=document.getElementsByTagName("select");
    for(i=0;i!=a.length;i++){
        a[i].style.visibility="hidden"
        }
    }
    function showFlash(){
    var b=document.getElementsByTagName("object");
    for(i=0;i<b.length;i++){
        b[i].style.visibility="visible"
        }
        var a=document.getElementsByTagName("embed");
    for(i=0;i<a.length;i++){
        a[i].style.visibility="visible"
        }
    }
    function hideFlash(){
    var b=document.getElementsByTagName("object");
    for(i=0;i<b.length;i++){
        b[i].style.visibility="hidden"
    }
    var a=document.getElementsByTagName("embed");
    for(i=0;i<a.length;i++){
        a[i].style.visibility="hidden"
        }
    }
    function getPageSize(){
    var c,a;
    if(window.innerHeight&&window.scrollMaxY){
        c=window.innerWidth+window.scrollMaxX;
        a=window.innerHeight+window.scrollMaxY
        }else{
        if(document.body.scrollHeight>document.body.offsetHeight){
            c=document.body.scrollWidth;
            a=document.body.scrollHeight
            }else{
            c=document.body.offsetWidth;
            a=document.body.offsetHeight
            }
        }
    var b,d;
if(self.innerHeight){
    if(document.documentElement.clientWidth){
        b=document.documentElement.clientWidth
        }else{
        b=self.innerWidth
        }
        d=self.innerHeight
    }else{
    if(document.documentElement&&document.documentElement.clientHeight){
        b=document.documentElement.clientWidth;
        d=document.documentElement.clientHeight
        }else{
        if(document.body){
            b=document.body.clientWidth;
            d=document.body.clientHeight
            }
        }
}
if(a<d){
    pageHeight=d
    }else{
    pageHeight=a
    }
    if(c<b){
    pageWidth=c
    }else{
    pageWidth=b
    }
    arrayPageSize=new Array(pageWidth,pageHeight,b,d);
return arrayPageSize
}
function setOpacity(a,b){
    if(b==1){
        a.style.opacity=(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:null;
        if(/MSIE/.test(navigator.userAgent)){
            a.style.filter=a.style.filter.replace(/alpha\([^\)]*\)/gi,"")
            }
        }else{
    if(b<0.00001){
        b=0
        }
        a.style.opacity=b;
    if(/MSIE/.test(navigator.userAgent)){
        a.style.filter=a.style.filter.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+b*100+")"
        }
    }
}
function setStyle(obj,style_str){
    var styles=style_str.split(";");
    with(obj){
        for(var k=styles.length-1;k>=0;k--){
            var _style=styles[k].split(":",2);
            if(!_style[1]){
                continue
            }
            _style[0]=_style[0].replace(/^\s|\s$/,"");
            _style[1]=_style[1].replace(/^\s|\s$/,"");
            style[_style[0]]=_style[1]
            }
        }
    }
function getEventObject(b){
    var a={};
    
    b=b?b:window.event;
    if(b.srcElement){
        a.target=b.srcElement
        }else{
        a.target=b.target
        }
        a.ev=b;
    return a
    }
}


function open_printable_version(a){
    var b="menubar=no,location=no,resizable=yes,scrollbars=yes";
    newWin=window.open(a,"printableWin",b);
    if(newWin){
        newWin.focus()
        }
    }
function confirmUnsubscribe(){
    temp=window.confirm(translate.cnfrm_unsubscribe);
    if(temp){
        window.location="index.php?killuser=yes"
        }
    }
function validate(){
    if(document.subscription_form.email.value.length<1){
        alert(translate.err_input_email);
        return false
        }
        if(document.subscription_form.email.value=="Email"){
        alert(translate.err_input_email);
        return false
        }
        return true
    }
    function validate_disc(){
    if(document.formD.nick.value.length<1){
        alert(translate.err_input_nickname);
        return false
        }
        if(document.formD.topic.value.length<1){
        alert(translate.err_input_message_subject);
        return false
        }
        return true
    }
    function validate_search(){
    if(document.Sform.price1.value!=""&&((document.Sform.price1.value<0)||isNaN(document.Sform.price1.value))){
        alert(translate.err_input_price);
        return false
        }
        if(document.Sform.price2.value!=""&&((document.Sform.price2.value<0)||isNaN(document.Sform.price2.value))){
        alert(translate.err_input_price);
        return false
        }
        return true
    }
    function validate_input_digit(d){
    var l;
    var k;
    var c;
    try{
        if(window.event){
            l=window.event.keyCode
            }else{
            if(d.which){
                l=d.which
                }
            }
    }catch(b){
    alert(b.message)
    }
    l=parseInt(l);
if(l==13){
    return false
    }
    if(l>=33&&l<=40){
    return true
    }
    if(l==8){
    return true
    }
    if(l==17){
    return true
    }
    if(l==45){
    return true
    }
    if(l==46){
    return true
    }
    if(l>=96&&l<=105){
    l-=48
}
k=String.fromCharCode(l);
c=/\d/;
return c.test(k);
var a=c.test(k);
return a
}
Behaviour.register({
    "input.input_message":function(a){
        a.onfocus=function(){
            this.className=this.className.replace(/input_message/,"")+" input_message_focus";
            if(this.value!=this.getAttribute("rel")){
                return
            }
            this.value=""
            };
            
        a.onblur=function(){
            if(this.value!=""){
                return
            }
            this.className=this.className.replace(/input_message_focus/,"")+" input_message";
            this.value=this.getAttribute("rel")
            }
        },
".product_option":function(a){
    a.onchange=function(){
        var n=getFormByElem(this);
        if(!n){
            return true
            }
            var b=getElementsByClass("product_option",n);
        var l=parseFloat(getElementByClass("product_price",n).value);
        var k=0;
        var m=getElementByClass("product_list_price",n);
        if(m){
            k=parseFloat(m.value)
            }
            for(var c=b.length-1;c>=0;c--){
            var d=select_getCurrOption(b[c]);
            if(!d){
                continue
            }
            l+=parseFloat(d.getAttribute("rel"));
            k+=parseFloat(d.getAttribute("rel"))
            }
            getElementByClass("totalPrice",n).innerHTML=formatPrice(l);
        var m=getElementByClass("regularPrice",n);
        if(m){
            m.innerHTML=formatPrice(k)
            }
            var m=getElementByClass("youSavePrice",n);
        if(m){
            m.innerHTML=formatPrice(k-l)+" ("+Math.round((k-l)/k*100,2)+"%)"
            }
        }
},
".hndl_proceed_checkout":function(a){
    a.onclick=function(){
        openFadeIFrame(ORIG_LANG_URL+set_query("?ukey=cart&view=noframe"));
        return false
        }
    },
"input.goto":function(a){
    a.onclick=function(){
        if(this.className.search(/confirm/)!==-1&&!window.confirm(this.getAttribute("title"))){
            return
        }
        document.location.href=this.getAttribute("rel")
        }
    },
".gofromfade":function(a){
    a.onclick=function(){
        parent.document.location.href=this.href;
        parent.closeFadeIFrame();
        return false
        }
    },
"input.digit":function(a){
    a.onkeydown=function(b){
        return validate_input_digit(b)
        }
    }
});
var cartHandlerBehavior={
    ".add2cart_handler":function(a){
        a.onclick=function(){
            //jQuery(".cpt_maincontent").children("form").attr("action", "/index.php?productID=1&ukey=product&did=34");
            //console.log(jQuery(".cpt_maincontent").children("form").serialize()+"&add2cart.x=2&add2cart.y=1");
            //$.post("/index.php?productID=1&ukey=product&did=34", jQuery(".cpt_maincontent").children("form").serialize()+"&add2cart.x=2&add2cart.y=1");
            //$.post("/index.php?productID=1&ukey=product&did=34", "productID=1&add2cart.x=2&add2cart.y=1&message_subject=%D0%A2%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D1%8B%D0%B9+%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82&productID=1&customer_name=%D0%92%D0%B0%D1%88%D0%B5+%D0%B8%D0%BC%D1%8F&customer_email=%D0%9A%D0%BE%D0%BD%D1%82%D0%B0%D0%BA%D1%82%D0%BD%D1%8B%D0%B9+e-mail&message_text=%D0%9F%D0%BE%D0%B6%D0%B0%D0%BB%D1%83%D0%B9%D1%81%D1%82%D0%B0%2C+%D1%81%D1%84%D0%BE%D1%80%D0%BC%D1%83%D0%BB%D0%B8%D1%80%D1%83%D0%B9%D1%82%D0%B5+%D0%92%D0%B0%D1%88+%D0%B2%D0%BE%D0%BF%D1%80%D0%BE%D1%81");
            var m=getFormByElem(this);
            if(!m){
                alert("form not found");
                return true
                }
                var c=getElementsByClass("product_option",m);
            var l="";
            for(var k=c.length-1;k>=0;k--){
                if(!parseInt(c[k].value)){
                    continue
                }
                if(c[k].name){
                    l+="&"+c[k].name+"="+parseInt(c[k].value)
                    }
                }
            var b=getElementByClass("product_qty",m);
        if(b){
            b=parseInt(b.value);
            if(b>1){
                l+="&product_qty="+b
                }
            }
        var d=ORIG_LANG_URL+set_query("?ukey=cart&view=noframe&action=add_product&"+l+"&productID="+m.getAttribute("rel"),"");
    openFadeIFrame(d);
    return false
    }
}
};

jQuery(document).ready(function() {
        jQuery("#ShoppingCartFormID").submit(function(){
        $.ajax({
            type: 'POST',
            url: jQuery("#ShoppingCartFormID").attr("action"),
            data: jQuery("#ShoppingCartFormID").serialize(),
            success: function(){window.parent.location="/index.php?ukey=checkout";},
            dataType: "html"
        });
        //jQuery.post(jQuery("#ShoppingCartFormID").attr("action"), jQuery("#ShoppingCartFormID").serialize());
        /*
        jQuery("#ShoppingCartFormID").append("<a href='/index.php?ukey=checkout' target='_parent' id='redirect'></a>");
        jQuery('#redirect').delegate('', 'click', function() {
        });
        jQuery("#redirect").click();
        */
        return false;
    });
    //submitOrderForm();
    /*jQuery(".cpt_maincontent").children("form").submit(function() {
        jQuery(".cpt_maincontent").children("form").attr("action", "/index.php?productID=1&ukey=product&did=34");
        jQuery.post("/index.php?productID=1&ukey=product&did=34", "productID=1&add2cart.x=2&add2cart.y=1&message_subject=%D0%A2%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D1%8B%D0%B9+%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82&productID=1&customer_name=%D0%92%D0%B0%D1%88%D0%B5+%D0%B8%D0%BC%D1%8F&customer_email=%D0%9A%D0%BE%D0%BD%D1%82%D0%B0%D0%BA%D1%82%D0%BD%D1%8B%D0%B9+e-mail&message_text=%D0%9F%D0%BE%D0%B6%D0%B0%D0%BB%D1%83%D0%B9%D1%81%D1%82%D0%B0%2C+%D1%81%D1%84%D0%BE%D1%80%D0%BC%D1%83%D0%BB%D0%B8%D1%80%D1%83%D0%B9%D1%82%D0%B5+%D0%92%D0%B0%D1%88+%D0%B2%D0%BE%D0%BF%D1%80%D0%BE%D1%81");
        alert("submit");
        return false;
    });*/
});


Behaviour.register(cartHandlerBehavior);
Behaviour.addLoadEvent(function(){
    var a=getElementsByClass("totalPrice");
    for(var b=a.length-1;b>=0;b--){
        var n=getFormByElem(a[b]);
        if(!n){
            continue
        }
        var o=getElementsByClass("product_option",n);
        var m=parseFloat(getElementByClass("product_price",n).value);
        var p=0;
        var c=getElementByClass("product_list_price",n);
        if(c){
            p=parseFloat(c.value)
            }
            for(var d=o.length-1;d>=0;d--){
            var l=select_getCurrOption(o[d]);
            if(!l){
                continue
            }
            m+=parseFloat(l.getAttribute("rel"));
            p+=parseFloat(l.getAttribute("rel"))
            }
            a[b].innerHTML=formatPrice(m);
        var c=getElementByClass("regularPrice",n);
        if(c){
            c.innerHTML=formatPrice(p)
            }
            var c=getElementByClass("youSavePrice",n);
        if(c){
            c.innerHTML=formatPrice(p-m)+" ("+Math.round((p-m)/p*100,2)+"%)"
            }
        }
    });
var owsLoadCategoryDataAll=function(b,a){
    jQuery("#owsCategoryID").val(b);
    jQuery("#advSearchContainer").fadeOut("fast",function(){
        jQuery("#owsAJAXContainerPreloaderSearch").fadeIn("normal",function(){
            jQuery.getJSON(WAROOT_URL + "/index.php",{
                did:1003,
                action:"getStateFull",
                catID:b
            },function(k){
                for(var d=0;d<k.length;d++){
                    var l=k[d];
                    if(l.type=="category"){
                        var c=owsAppendCategoryData(l,a);
                        a=c[0]
                        }else{
                        if(l.type="options"){
                            var c=owsAppendParamsData(l,a)
                            }
                        }
                }
                jQuery("#advSearchContainerControl").fadeIn("fast");
            jQuery("#owsAJAXContainerPreloaderSearch").fadeOut("fast",function(){
                jQuery("#advSearchContainer").fadeIn("normal")
                })
            })
        })
    })
};

var owsLoadCategoryData=function(b,a){
    jQuery("#owsCategoryID").val(b);
    jQuery("#advSearchContainer").fadeOut("fast",function(){
        jQuery("#owsAJAXContainerPreloaderSearch").fadeIn("normal",function(){
            jQuery.getJSON(WAROOT_URL + "/index.php",{
                did:1003,
                action:"getState",
                catID:b
            },function(c){
                if(c.type=="category"){
                    owsAppendCategoryData(c,a)
                    }else{
                    if(c.type="options"){
                        owsAppendParamsData(c,a)
                        }
                    }
                jQuery("#advSearchContainerControl").fadeIn("fast");
                jQuery("#owsAJAXContainerPreloaderSearch").fadeOut("fast",function(){
                jQuery("#advSearchContainer").fadeIn("normal")
            })
            })
        })
    })
};




var owsAppendParamsData=function(o,a){
    var d=o.elements;
    var q=jQuery("<table>");
    for(var n=0;n<d.length;n++){
        var b=d[n];
        var p=owsSeacrhParamValues[b.optionID];
        if(!p){
            p=""
            }
            if(b.controlIsTextField=="1"){
            jQuery("<tr>").append(jQuery("<td>").text(b.name).append(jQuery("<br/>")).append(jQuery("<input type='text' name='param_"+b.optionID+"'/>").val(p))).appendTo(q)
            }else{
            var m=jQuery("<select name='param_"+b.optionID+"'>").append(jQuery("<option value='0'>").text(owsDefaultParamValue));
            for(var l=0;l<b.variants.length;l++){
                var c=b.variants[l];
                var k="";
                if(owsSeacrhParamValues[b.optionID]&&c.variantID==owsSeacrhParamValues[b.optionID]){
                    k="selected='selected'"
                    }
                    jQuery("<option value='"+c.variantID+"' "+k+">").text(c.value).appendTo(m)
                }
                jQuery("<tr>").append(jQuery("<td>").text(b.name).append(jQuery("<br/>")).append(m)).appendTo(q)
            }
        }
    return[q.appendTo(a)]
};

var owsAppendCategoryData=function(k,b){
    var c=k.elements;
    var n=jQuery("<div id='advSearchContainer_"+k.categoryID+"'>");
    var a=jQuery("<select rel='"+k.categoryID+"' name='owsCatSelect_"+k.categoryID+"' id='owsCatSelect_"+k.categoryID+"'>").change(function(o){
        jQuery("#advSearchContainer_"+jQuery(o.target).attr("rel")).empty();
        jQuery("#advSearchContainerControl").fadeOut("fast");
        if(o.target.value!="0"){
            owsLoadCategoryData(o.target.value,n)
            }
        }).appendTo(b);
jQuery("<option value='0'>").text("Любая категория").appendTo(a);
for(var d=0;d<c.length;d++){
    var m=c[d];
    var l="";
    if(m.selected){
        l="selected='selected'"
        }
        jQuery("<option value='"+m.categoryID+"' "+l+">").text(m.name).appendTo(a)
    }
    return[n.appendTo(b),a]
};



function submitProductsComparison(){
    var d=getFormByElem(this);
    var b=getElementsByClass("ctrl_products_cmp");
    var c=getElementByClass("comparison_products",d);
    c.value="";
    for(var a=b.length-1;a>=0;a--){
        if(!b[a].checked){
            continue
        }
        c.value+=" "+b[a].value
        }
        if(c.value!=""){
        d.submit()
        }
    }
Behaviour.register({
    "input.hndl_submit_prds_cmp":function(a){
        a.onclick=submitProductsComparison
        }
    });
var hs={
    graphicsDir:"highslide/graphics/",
    restoreCursor:"zoomout.cur",
    expandSteps:10,
    expandDuration:250,
    restoreSteps:10,
    restoreDuration:250,
    allowMultipleInstances:true,
    hideThumbOnExpand:true,
    captionSlideSpeed:1,
    outlineWhileAnimating:false,
    outlineStartOffset:3,
    marginLeft:10,
    marginRight:35,
    marginTop:10,
    marginBottom:35,
    numberOfImagesToPreload:5,
    zIndexCounter:1001,
    fullExpandIcon:"fullexpand.gif",
    fullExpandTitle:"В полном размере.",
    restoreTitle:"Нажмите, чтобы закрыть, Нажмите и перетащите для перемещения. Используйте стрелки, чтобы листать фото.",
    focusTitle:"Click to bring to front",
    loadingText:"Загрузка...",
    loadingTitle:"Click to cancel",
    loadingOpacity:0.75,
    showCredits:false,
    creditsText:"Powered by <i>Highslide JS</i>",
    creditsHref:"http://vikjavev.no/highslide/",
    creditsTitle:"Go to the Highslide JS homepage",
    enableKeyListener:true,
    anchor:"auto",
    align:"auto", 
    targetX:null,
    targetY:null,
    captionId:null,
    captionTemplateId:null,
    slideshowGroup:null,
    spaceForCaption:30,
    minWidth:200,
    minHeight:200,
    allowSizeReduction:true,
    outlineType:"drop-shadow",
    wrapperClassName:null,
    preloadTheseImages:[],
    continuePreloading:true,
    expandedImagesCounter:0,
    expanders:[],
    overrides:["anchor","align","targetX","targetY","outlineType","outlineWhileAnimating","spaceForCaption","wrapperClassName","minWidth","minHeight","captionId","captionTemplateId","allowSizeReduction","slideshowGroup"],
    overlays:[],
    pendingOutlines:{},
    clones:{},
    faders:[],
    ie:(document.all&&!window.opera),
    safari:navigator.userAgent.indexOf("Safari")!=-1,
    hasFocused:false,
    $:function(a){
        return document.getElementById(a)
    },
    push:function(a,b){
        a[a.length]=b
        },
    createElement:function(a,l,k,d,c){
        var b=document.createElement(a);
        if(l){
            hs.setAttribs(b,l)
            }
            if(c){
            hs.setStyles(b,{
                padding:0,
                border:"none",
                margin:0
            })
            }
            if(k){
            hs.setStyles(b,k)
            }
            if(d){
            d.appendChild(b)
            }
            return b
        },
    setAttribs:function(b,c){
        for(var a in c){
            b[a]=c[a]
            }
        },
setStyles:function(b,c){
    for(var a in c){
        try{
            if(hs.ie&&a=="opacity"){
                b.style.filter=c[a]==1?"none":"alpha(opacity="+(c[a]*100)+")"
                }else{
                b.style[a]=c[a]
                }
            }catch(d){}
        }
    },
ieVersion:function(){
    arr=navigator.appVersion.split("MSIE");
    return parseFloat(arr[1])
    },
clientInfo:function(){
    var a=document.compatMode&&document.compatMode!="BackCompat"?document.documentElement:document.body;
// brain
// First photo will not bigger than 400*400
//     this.width=hs.ie?a.clientWidth:self.innerWidth;
//    this.height=hs.ie?a.clientHeight:self.innerHeight;
this.width=hs.ie?a.clientWidth:self.innerWidth;
    this.height=hs.ie?450:450;
    this.scrollLeft=hs.ie?a.scrollLeft:pageXOffset;
    this.scrollTop=hs.ie?a.scrollTop:pageYOffset+200
    }, 
position:function(a){
    var b={
        x:a.offsetLeft,
        y:a.offsetTop
        };
    while(a.offsetParent){
        a=a.offsetParent;
        b.x+=a.offsetLeft;
        b.y+=a.offsetTop;
        if(a!=document.body&&a!=document.documentElement){
            b.x-=a.scrollLeft;
            b.y-=a.scrollTop
            }
        }
    return b
},
expand:function(b,k,c){
    try{
        new HsExpander(b,k,c);
        return false
        }catch(d){
        return true
        }
    },
focusTopmost:function(){
    var b=0,a=-1;
    for(i=0;i<hs.expanders.length;i++){
        if(hs.expanders[i]){
            if(hs.expanders[i].wrapper.style.zIndex&&hs.expanders[i].wrapper.style.zIndex>b){
                b=hs.expanders[i].wrapper.style.zIndex;
                a=i
                }
            }
    }
    if(a==-1){
    hs.focusKey=-1
    }else{
    hs.expanders[a].focus()
    }
},
closeId:function(a){
    return hs.close(a)
    },
close:function(a){
    try{
        hs.getExpander(a).doClose()
        }catch(b){}
    return false
    },
getAdjacentAnchor:function(d,m){
    var a=document.getElementsByTagName("A"),b={},k=-1,c=0;
    var l=null;
    for(i=0;i<a.length;i++){
        if(hs.isHsAnchor(a[i])&&((hs.expanders[d].slideshowGroup==hs.getParam(a[i],"slideshowGroup")))){
            if(c==0){
                l=a[i]
                }
                b[c]=a[i];
            if(hs.expanders[d]&&a[i]==hs.expanders[d].a){
                k=c
                }
                c++
        }
    }
    if(c==(k+m)){
    return l
    }
    if(-1==(k+m)){
    return b[c-1]
    }
    return b[k+m]
},
getParam:function(a,param){
    try{
        var s=a.onclick.toString().replace(/\s/g," ").split("{")[2].split("}")[0];
        if(hs.safari){
            for(var i=0;i<hs.overrides.length;
                i++){
                s=s.replace(hs.overrides[i]+":",","+hs.overrides[i]+":").replace(new RegExp("^\\s*?,"),"")
                }
            }
            eval("var arr = {"+s+"};");
    if(arr[param]){
        return arr[param]
        }else{
        return hs[param]
        }
    }catch(e){
    return hs[param]
    }
},
getSrc:function(b){
    var c=hs.getParam(b,"src");
    if(c){
        return c
        }
        return b.rel.replace(/_slash_/g,"/")||b.href
    },
getNode:function(k){
    var c=hs.$(k),d=hs.clones[k],b={};
    
    if(!c&&!d){
        return null
        }
        if(!d){
        d=c.cloneNode(true);
        d.id="";
        hs.clones[k]=d;
        return c
        }else{
        return d.cloneNode(true)
        }
    },
purge:function(m){
    if(!hs.ie){
        return
    }
    var c=m.attributes,k,b,o;
    if(c){
        b=c.length;
        for(k=0;k<b;k+=1){
            o=c[k].name;
            if(typeof m[o]==="function"){
                m[o]=null
                }
            }
        }
    if(hs.geckoBug&&hs.geckoBug(m)){
    return
}
c=m.childNodes;
if(c){
    b=c.length;
    for(k=0;k<b;k+=1){
        hs.purge(m.childNodes[k])
        }
    }
},
previousOrNext:function(a,d){
    var c=hs.getExpander(a);
    try{
        hs.getAdjacentAnchor(c.key,d).onclick()
        }catch(b){}
    try{
        c.doClose()
        }catch(b){}
    return false
    },
previous:function(a){
    return hs.previousOrNext(a,-1)
    },
next:function(a){
    return hs.previousOrNext(a,1)
    },
keyHandler:function(a){
    if(!a){
        a=window.event
    }
    if(!a.target){
        a.target=a.srcElement
        }
        if(a.target.form){
        return
    }
    var b=null;
    switch(a.keyCode){
        case 34:case 39:case 40:
            b=1;
            break;
        case 33:case 37:case 38:
            b=-1;
            break;
        case 27:case 13:
            b=0
            }
            if(b!==null){
        hs.removeEventListener(document,"keydown",hs.keyHandler);
        try{
            if(!hs.enableKeyListener){
                return true
                }
            }catch(a){}
    if(a.preventDefault){
        a.preventDefault()
        }else{
        a.returnValue=false
        }
        if(b==0){
        try{
            hs.getExpander().doClose()
            }catch(a){}
        return false
        }else{
        return hs.previousOrNext(hs.focusKey,b)
        }
    }else{
    return true
    }
},
registerOverlay:function(a){
    hs.push(hs.overlays,a)
    },
getWrapperKey:function(a){
    var c,b=/^highslide-wrapper-([0-9]+)$/;
    c=a;
    while(c.parentNode){
        c=c.parentNode;
        if(b.test(c.id)){
            return c.id.replace(b,"$1")
            }
        }
    c=a;
while(c.parentNode){
    if(c.tagName&&hs.isHsAnchor(c)){
        for(key=0;key<hs.expanders.length;key++){
            exp=hs.expanders[key];
            if(exp&&exp.a==c){
                return key
                }
            }
        }
    c=c.parentNode
}
},
getExpander:function(a){
    try{
        if(typeof a=="undefined"){
            return hs.expanders[hs.focusKey]
            }
            if(typeof a=="number"){
            return hs.expanders[a]
            }
            if(typeof a=="string"){
            a=hs.$(a)
        }
        return hs.expanders[hs.getWrapperKey(a)]
        }catch(b){}
},
cleanUp:function(){
    for(i=0;i<hs.expanders.length;i++){
        if(hs.expanders[i]&&hs.expanders[i].isExpanded){
            hs.focusTopmost()
            }
        }
    },
mouseClickHandler:function(d){
    if(!d){
        d=window.event
        }
        if(d.button>1){
        return true
        }
        if(!d.target){
        d.target=d.srcElement
        }
        if(d.target.form){
        return
    }
    var l=d.target;
    while(l.parentNode&&!(l.className&&l.className.match(/highslide-(image|move|html)/))){
        l=l.parentNode
        }
        if(!l.parentNode){
        return
    }
    hs.dragExp=hs.getExpander(l);
    if(l.className.match(/highslide-(image|move)/)){
        var c=true;
        var b=parseInt(hs.dragExp.wrapper.style.left);
        var k=parseInt(hs.dragExp.wrapper.style.top)
        }
        if(d.type=="mousedown"){
        if(c){
            if(l.className.match("highslide-image")){
                hs.dragExp.content.style.cursor="move"
                }
                hs.wLeft=b;
            hs.wTop=k;
            hs.dragX=d.clientX;
            hs.dragY=d.clientY;
            hs.addEventListener(document,"mousemove",hs.mouseMoveHandler);
            if(d.preventDefault){
                d.preventDefault()
                }
                if(hs.dragExp.content.className.match(/highslide-(image|html)-blur/)){
                hs.dragExp.focus();
                hs.hasFocused=true
            }
            return false
            }else{
            if(l.className.match(/highslide-html/)){
                hs.dragExp.focus();
                hs.dragExp.redoShowHide();
                hs.hasFocused=false
                }
            }
    }else{
    if(d.type=="mouseup"){
        hs.removeEventListener(document,"mousemove",hs.mouseMoveHandler);
        if(c&&hs.dragExp){
            if(l.className.match("highslide-image")){
                l.style.cursor=hs.styleRestoreCursor
                }
                var a=b!=hs.wLeft||k!=hs.wTop;
            if(!a&&!hs.hasFocused&&!l.className.match(/highslide-move/)){
                hs.dragExp.onClick()
                }else{
                if(a||(!a&&hs.hasHtmlexpanders)){
                    hs.dragExp.redoShowHide()
                    }
                }
            hs.hasFocused=false
        }else{
        if(l.className.match("highslide-image-blur")){
            l.style.cursor=hs.styleRestoreCursor
            }
        }
}
}
},
mouseMoveHandler:function(b){
    if(!hs.dragExp||!hs.dragExp.wrapper){
        return
    }
    if(!b){
        b=window.event
        }
        hs.dragExp.x.min=hs.wLeft+b.clientX-hs.dragX;
    hs.dragExp.y.min=hs.wTop+b.clientY-hs.dragY;
    var a=hs.dragExp.wrapper;
    a.style.left=hs.dragExp.x.min+"px";
    a.style.top=hs.dragExp.y.min+"px";
    if(hs.dragExp.objOutline){
        var c=hs.dragExp.objOutline;
        c.table.style.left=(hs.dragExp.x.min-c.offset)+"px";
        c.table.style.top=(hs.dragExp.y.min-c.offset)+"px"
    }
    return false
    },
addEventListener:function(a,c,b){
    try{
        a.addEventListener(c,b,false)
        }catch(d){
        try{
            a.detachEvent("on"+c,b);
            a.attachEvent("on"+c,b)
            }catch(d){
            a["on"+c]=b
            }
        }
},
removeEventListener:function(a,c,b){
    try{
        a.removeEventListener(c,b,false)
        }catch(d){
        try{
            a.detachEvent("on"+c,b)
            }catch(d){
            a["on"+c]=null
            }
        }
},
isHsAnchor:function(b){
    return(b.onclick&&b.onclick.toString().replace(/\s/g," ").match(/hs.(htmlE|e)xpand/))
},
preloadFullImage:function(b){
    if(hs.continuePreloading&&hs.preloadTheseImages[b]&&hs.preloadTheseImages[b]!="undefined"){
        var a=document.createElement("img");
        a.onload=function(){
            hs.preloadFullImage(b+1)
            };
            
        a.src=hs.preloadTheseImages[b]
        }
    },
preloadImages:function(k){
    if(k&&typeof k!="object"){
        hs.numberOfImagesToPreload=k
        }
        var b,d,c=0;
    var m=document.getElementsByTagName("A");
    for(i=0;i<m.length;i++){
        b=m[i];
        d=hs.isHsAnchor(b);
        if(d&&d[0]=="hs.expand"){
            if(c<hs.numberOfImagesToPreload){
                hs.preloadTheseImages[c]=hs.getSrc(b);
                c++
            }
        }
    }
    new HsOutline(hs.outlineType,function(){
    hs.preloadFullImage(0)
    });
var l=hs.createElement("img",{
    src:hs.graphicsDir+hs.restoreCursor
    })
},
genContainer:function(){
    if(!hs.container){
        hs.container=hs.createElement("div",null,{
            position:"absolute",
            left:0,
            top:0,
            width:"100%",
            zIndex:hs.zIndexCounter
            },document.body,true)
        }
    },
fade:function(d,k,c,a,b){
    k=parseFloat(k);
    d.style.visibility=(k<=0)?"hidden":"visible";
    if(k<0||(a==1&&k>c)){
        return
    }
    if(b==null){
        b=hs.faders.length
        }
        if(typeof(d.i)!="undefined"&&d.i!=b){
        clearTimeout(hs.faders[d.i]);
        k=d.tempOpacity
        }
        d.i=b;
    d.tempOpacity=k;
    d.style.visibility=(k<=0)?"hidden":"visible";
    hs.setStyles(d,{
        opacity:k
    });
    hs.faders[b]=setTimeout(function(){
        hs.fade(d,Math.round((k+0.1*a)*100)/100,c,a,b)
        },25)
    }
};

HsOutline=function(l,d){
    this.onLoad=d;
    this.outlineType=l;
    var a=hs.ieVersion(),k;
    this.hasAlphaImageLoader=hs.ie&&a>=5.5&&a<7;
    this.hasPngSupport=!hs.ie||(hs.ie&&a>=7);
    if(!l||(!this.hasAlphaImageLoader&&!this.hasPngSupport)){
        if(d){
            d()
            }
            return
    }
    hs.genContainer();
    this.table=hs.createElement("table",{
        cellSpacing:0
    },{
        visibility:"hidden",
        position:"absolute",
        zIndex:hs.zIndexCounter++,
        borderCollapse:"collapse"
    },hs.container,true);
    this.tbody=hs.createElement("tbody",null,null,this.table,1);
    this.td=[];
    for(var b=0;b<=8;b++){
        if(b%3==0){
            k=hs.createElement("tr",null,{
                height:"auto"
            },this.tbody,true)
            }
            this.td[b]=hs.createElement("td",null,null,k,true);
        var c=b!=4?{
            lineHeight:0,
            fontSize:0
        }:{
            position:"relative"
        };
        
        hs.setStyles(this.td[b],c)
        }
        this.td[4].className=l;
    this.preloadGraphic()
    };
    
HsOutline.prototype.preloadGraphic=function(){
    var b=hs.graphicsDir+"outlines/"+this.outlineType+".png";
    var a=hs.safari?hs.container:null;
    this.graphic=hs.createElement("img",null,{
        position:"absolute",
        left:"-9999px",
        top:"-9999px"
    },a,true);
    var c=this;
    this.graphic.onload=function(){
        c.onGraphicLoad()
        };
        
    this.graphic.src=b
    };
    
HsOutline.prototype.onGraphicLoad=function(){
    var d=this.offset=this.graphic.width/4,l=[[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],c={
        height:(2*d)+"px",
        width:(2*d)+"px"
        };
        
    for(var b=0;b<=8;b++){
        if(l[b]){
            if(this.hasAlphaImageLoader){
                var a=(b==1||b==7)?"100%":this.graphic.width+"px";
                var k=hs.createElement("div",null,{
                    width:"100%",
                    height:"100%",
                    position:"relative",
                    overflow:"hidden"
                },this.td[b],true);
                hs.createElement("div",null,{
                    filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+this.graphic.src+"')",
                    position:"absolute",
                    width:a,
                    height:this.graphic.height+"px",
                    left:(l[b][0]*d)+"px",
                    top:(l[b][1]*d)+"px"
                    },k,true)
                }else{
                hs.setStyles(this.td[b],{
                    background:"url("+this.graphic.src+") "+(l[b][0]*d)+"px "+(l[b][1]*d)+"px"
                    })
                }
                hs.setStyles(this.td[b],c)
            }
        }
    hs.pendingOutlines[this.outlineType]=this;
if(this.onLoad){
    this.onLoad()
    }
};

HsOutline.prototype.destroy=function(){
    hs.purge(this.table);
    try{
        this.table.parentNode.removeChild(this.table)
        }catch(a){}
};

HsExpander=function(o,k,b,p){
    hs.continuePreloading=false;
    this.custom=b;
    for(i=0;i<hs.overrides.length;i++){
        var c=hs.overrides[i];
        if(k&&typeof k[c]!="undefined"){
            this[c]=k[c]
            }else{
            this[c]=hs[c]
            }
        }
    var d;
if(k&&k.thumbnailId){
    d=hs.$(k.thumbnailId)
    }else{
    d=o.getElementsByTagName("IMG")[0]
    }
    if(!d){
    d=o
    }
    for(i=0;i<hs.expanders.length;i++){
    if(hs.expanders[i]&&hs.expanders[i].thumb!=d&&!hs.expanders[i].onLoadStarted){
        hs.expanders[i].cancelLoading()
    }
}
for(i=0;i<hs.expanders.length;i++){
    if(hs.expanders[i]&&hs.expanders[i].a==o){
        hs.expanders[i].focus();
        return false
        }
    }
if(!hs.allowMultipleInstances){
    try{
        hs.expanders[hs.expandedImagesCounter-1].doClose()
        }catch(m){}
}
var q=this.key=hs.expandedImagesCounter++;
hs.expanders[this.key]=this;
if(p=="html"){
    this.isHtml=true;
    this.contentType="html"
    }else{
    this.isImage=true;
    this.contentType="image"
    }
    this.a=o;
this.thumbsUserSetId=d.id||o.id;
this.thumb=d;
this.overlays=[];
var n=hs.position(d);
this.wrapper=hs.createElement("div",{
    id:"highslide-wrapper-"+this.key,
    className:this.wrapperClassName
    },{
    visibility:"hidden",
    position:"absolute",
    zIndex:hs.zIndexCounter++
},null,true);
this.wrapper.onmouseover=function(a){
    try{
        hs.expanders[q].onMouseOver(a)
        }catch(a){}
};

this.wrapper.onmouseout=function(a){
    try{
        hs.expanders[q].onMouseOut(a)
        }catch(a){}
};

this.thumbWidth=d.width?d.width:d.offsetWidth;
this.thumbHeight=d.height?d.height:d.offsetHeight;
this.thumbLeft=n.x;
this.thumbTop=n.y;
this.thumbOffsetBorderW=(this.thumb.offsetWidth-this.thumbWidth)/2;
this.thumbOffsetBorderH=(this.thumb.offsetHeight-this.thumbHeight)/2;
hs.genContainer();
if(hs.pendingOutlines[this.outlineType]){
    this.connectOutline();
    this[this.contentType+"Create"]()
    }else{
    if(!this.outlineType){
        this[this.contentType+"Create"]()
        }else{
        this.displayLoading();
        var l=this;
        new HsOutline(this.outlineType,function(){
            l.connectOutline();
            l[l.contentType+"Create"]()
            })
        }
    }
};

HsExpander.prototype.connectOutline=function(a,c){
    var b=hs.pendingOutlines[this.outlineType];
    this.objOutline=b;
    hs.pendingOutlines[this.outlineType]=null
    };
    
HsExpander.prototype.displayLoading=function(){
    if(this.onLoadStarted||this.loading){
        return
    }
    this.originalCursor=this.a.style.cursor;
    this.a.style.cursor="wait";
    if(!hs.loading){
        hs.loading=hs.createElement("a",{
            className:"highslide-loading",
            title:hs.loadingTitle,
            innerHTML:hs.loadingText
            },{
            position:"absolute",
            opacity:hs.loadingOpacity
            },hs.container)
        }
        this.loading=hs.loading;
    this.loading.href="javascript:hs.expanders["+this.key+"].cancelLoading()";
    this.loading.visibility="visible";
    this.loading.style.left=(this.thumbLeft+this.thumbOffsetBorderW+(this.thumbWidth-this.loading.offsetWidth)/2)+"px";
    this.loading.style.top=(this.thumbTop+(this.thumbHeight-this.loading.offsetHeight)/2)+"px";
    setTimeout("if (hs.expanders["+this.key+"] && hs.expanders["+this.key+"].loading) hs.expanders["+this.key+"].loading.style.visibility = 'visible';",100)
    };
    
HsExpander.prototype.imageCreate=function(){
    var b=this.key;
    var a=document.createElement("img");
    this.content=a;
    a.onload=function(){
        try{
            hs.expanders[b].onLoad()
            }catch(c){}
    };
    
a.className="highslide-image";
a.style.visibility="hidden";
a.style.display="block";
a.style.position="absolute";
a.style.maxWidth="none";
a.style.zIndex=3;
a.title=hs.restoreTitle;
if(hs.safari){
    hs.container.appendChild(a)
    }
    a.src=hs.getSrc(this.a);
    this.displayLoading()
    };
    
HsExpander.prototype.onLoad=function(){
    try{
        if(!this.content){
            return
        }
        if(this.onLoadStarted){
            return
        }else{
            this.onLoadStarted=true
            }
            if(this.loading){
            this.loading.style.visibility="hidden";
            this.loading=null;
            this.a.style.cursor=this.originalCursor||""
        }
        if(this.isImage){
            this.newWidth=this.content.width;
            this.newHeight=this.content.height;
            this.fullExpandWidth=this.newWidth;
            this.fullExpandHeight=this.newHeight;
            this.content.width=this.thumbWidth;
            this.content.height=this.thumbHeight
            }else{
            if(this.htmlGetSize){
                this.htmlGetSize()
                }
            }
        this.marginBottom=hs.marginBottom;
    this.getCaption();
    this.wrapper.appendChild(this.content);
    this.content.style.position="relative";
    if(this.caption){
        this.wrapper.appendChild(this.caption)
        }
        this.wrapper.style.left=this.thumbLeft+"px";
    this.wrapper.style.top=this.thumbTop+"px";
    hs.container.appendChild(this.wrapper);
    this.offsetBorderW=(this.content.offsetWidth-this.thumbWidth)/2;
    this.offsetBorderH=(this.content.offsetHeight-this.thumbHeight)/2;
    var d=hs.marginRight+2*this.offsetBorderW;
    this.marginBottom+=2*this.offsetBorderH;
    var m=this.newWidth/this.newHeight;
    var b=this.allowSizeReduction?this.minWidth:this.newWidth;
    var p=this.allowSizeReduction?this.minHeight:this.newHeight;
    var k={
        x:"auto",
        y:"auto"
    };
    
    if(this.align=="center"){
        k.x="center";
        k.y="center"
        }else{
        if(this.anchor.match(/^top/)){
            k.y=null
            }
            if(this.anchor.match(/right$/)){
            k.x="max"
            }
            if(this.anchor.match(/^bottom/)){
            k.y="max"
            }
            if(this.anchor.match(/left$/)){
            k.x=null
            }
        }
    client=new hs.clientInfo();
    this.x={
    min:parseInt(this.thumbLeft)-this.offsetBorderW+this.thumbOffsetBorderW,
    span:this.newWidth,
    minSpan:this.newWidth<b?this.newWidth:b,
    justify:k.x,
    target:this.targetX,
    marginMin:hs.marginLeft,
    marginMax:d,
    scroll:client.scrollLeft,
    clientSpan:client.width,
    thumbSpan:this.thumbWidth
    };
    
var c=this.x.min+parseInt(this.thumbWidth);
    this.x=this.justify(this.x);
    this.y={
    min:parseInt(this.thumbTop)-this.offsetBorderH+this.thumbOffsetBorderH,
    span:this.newHeight,
    minSpan:this.newHeight<p?this.newHeight:p,
    justify:k.y,
    target:this.targetY,
    marginMin:hs.marginTop,
    marginMax:this.marginBottom,
    scroll:client.scrollTop,
    clientSpan:client.height,
    thumbSpan:this.thumbHeight
    };
    
var a=this.y.min+parseInt(this.thumbHeight);
    this.y=this.justify(this.y);
    if(this.isHtml){
    this.htmlSizeOperations()
    }
    if(this.isImage){
    this.correctRatio(m)
}
var o=this.x;
var n=this.y;
this.show()
    }catch(l){
    if(hs.expanders[this.key]&&hs.expanders[this.key].a){
        window.location.href=hs.getSrc(hs.expanders[this.key].a)
        }
    }
};

HsExpander.prototype.show=function(){
    var b={
        x:this.x.min-20,
        y:this.y.min-20,
        w:this.x.span+40,
        h:this.y.span+40+this.spaceForCaption
        };
        
    hs.hideSelects=(hs.ie&&hs.ieVersion()<7);
    if(hs.hideSelects){
        this.showHideElements("SELECT","hidden",b)
        }
        hs.hideIframes=(window.opera||navigator.vendor=="KDE"||(hs.ie&&hs.ieVersion()<5.5));
    if(hs.hideIframes){
        this.showHideElements("IFRAME","hidden",b)
        }
        if(this.objOutline&&!this.outlineWhileAnimating){
        this.positionOutline(this.x.min,this.y.min,this.x.span,this.y.span)
        }
        var a=this.objOutline?this.objOutline.offset:0;
    this.changeSize(1,this.thumbLeft+this.thumbOffsetBorderW-this.offsetBorderW,this.thumbTop+this.thumbOffsetBorderH-this.offsetBorderH,this.thumbWidth,this.thumbHeight,this.x.min,this.y.min,this.x.span,this.y.span,hs.expandDuration,hs.expandSteps,hs.outlineStartOffset,a)
    };
    
HsExpander.prototype.justify=function(d){
    var k,c=d==this.x?"x":"y";
    if(d.target&&d.target.match(/ /)){
        k=d.target.split(" ");
        d.target=k[0]
        }
        if(d.target&&hs.$(d.target)){
        d.min=hs.position(hs.$(d.target))[c];
        if(k&&k[1]&&k[1].match(/^[-]?[0-9]+px$/)){
            d.min+=parseInt(k[1])
            }
        }else{
    if(d.justify=="auto"||d.justify=="center"){
        var b=false;
        var a=true;
        if(d.justify=="center"){
            d.min=Math.round(d.scroll+(d.clientSpan-d.span-d.marginMax)/2)
            }else{
            d.min=Math.round(d.min-((d.span-d.thumbSpan)/2))
            }
            if(d.min<d.scroll+d.marginMin){
            d.min=d.scroll+d.marginMin;
            b=true
            }
            if(d.span<d.minSpan){
            d.span=d.minSpan;
            a=false
            }
            if(d.min+d.span>d.scroll+d.clientSpan-d.marginMax){
            if(b&&a){
                d.span=d.clientSpan-d.marginMin-d.marginMax
                }else{
                if(d.span<d.clientSpan-d.marginMin-d.marginMax){
                    d.min=d.scroll+d.clientSpan-d.span-d.marginMin-d.marginMax
                    }else{
                    d.min=d.scroll+d.marginMin;
                    if(a){
                        d.span=d.clientSpan-d.marginMin-d.marginMax
                        }
                    }
            }
    }
if(d.span<d.minSpan){
    d.span=d.minSpan;
    a=false
    }
}else{
    if(d.justify=="max"){
        d.min=Math.floor(d.min-d.span+d.thumbSpan)
        }
    }
}
if(d.min<d.marginMin){
    tmpMin=d.min;
    d.min=d.marginMin;
    if(a){
        d.span=d.span-(d.min-tmpMin)
    }
}
return d
};

HsExpander.prototype.correctRatio=function(c){
    var b=this.x;
    var l=this.y;
    var k=false;
    if(b.span/l.span>c){
        var a=b.span;
        b.span=l.span*c;
        if(b.span<b.minSpan){
            b.span=b.minSpan;
            l.span=b.span/c
            }
            k=true
        }else{
        if(b.span/l.span<c){
            var d=l.span;
            l.span=b.span/c;
            k=true
            }
        }
    if(k){
    b.min=parseInt(this.thumbLeft)-this.offsetBorderW+this.thumbOffsetBorderW;
    b.minSpan=b.span;
    this.x=this.justify(b);
    l.min=parseInt(this.thumbTop)-this.offsetBorderH+this.thumbOffsetBorderH;
    l.minSpan=l.span;
    this.y=this.justify(l)
    }
};

HsExpander.prototype.changeSize=function(x,B,c,r,p,A,a,q,o,y,z,d,b){
    var m=(q-r)/z,u=(o-p)/z,l=(A-B)/z,k=(a-c)/z,C=(b-d)/z,v,n="hs.expanders["+this.key+"]";
    for(i=1;i<=z;i++){
        r+=m;
        p+=u;
        B+=l;
        c+=k;
        d+=C;
        v=Math.round(i*(y/z));
        var w="try {";
        if(i==1){
            w+=n+".content.style.visibility = 'visible';if ("+n+".thumb.tagName == 'IMG' && hs.hideThumbOnExpand) "+n+".thumb.style.visibility = 'hidden';"
            }
            if(i==z){
            r=q;
            p=o;
            B=A;
            c=a;
            d=b
            }
            w+=n+"."+this.contentType+"SetSize("+Math.round(r)+", "+Math.round(p)+", "+Math.round(B)+", "+Math.round(c)+", "+Math.round(d);
        w+=");} catch (e) {}";
        setTimeout(w,v)
        }
        if(x==1){
        setTimeout("try { "+n+'.objOutline.table.style.visibility = "visible"; } catch (e){}',v);
        setTimeout("try { "+n+".onExpanded(); } catch(e){}",v+50)
        }else{
        setTimeout("try { "+n+".onEndClose(); } catch(e){}",v)
        }
    };

HsExpander.prototype.imageSetSize=function(b,c,a,m,l){
    try{
        this.content.width=b;
        this.content.height=c;
        if(this.objOutline&&this.outlineWhileAnimating){
            var k=this.objOutline.offset-l;
            this.positionOutline(a+k,m+k,b-2*k,c-2*k,1)
            }
            hs.setStyles(this.wrapper,{
            visibility:"visible",
            left:a+"px",
            top:m+"px"
            })
        }catch(d){
        window.location.href=hs.getSrc(this.a)
        }
    };

HsExpander.prototype.positionOutline=function(a,l,b,c,d){
    if(!this.objOutline){
        return
    }
    var k=this.objOutline;
    if(d){
        k.table.style.visibility="visible"
        }
        k.table.style.left=(a-k.offset)+"px";
    k.table.style.top=(l-k.offset)+"px";
    k.table.style.width=(b+2*(this.offsetBorderW+k.offset))+"px";
    b+=2*(this.offsetBorderW-k.offset);
    c+=+2*(this.offsetBorderH-k.offset);
    k.td[4].style.width=b>=0?b+"px":0;
    k.td[4].style.height=c>=0?c+"px":0;
    if(k.hasAlphaImageLoader){
        k.td[3].style.height=k.td[5].style.height=k.td[4].style.height
        }
    };

HsExpander.prototype.onExpanded=function(){
    this.isExpanded=true;
    this.focus();
    if(this.isHtml&&this.objectLoadTime=="after"){
        this.writeExtendedContent()
        }
        this.createCustomOverlays();
    if(hs.showCredits){
        this.writeCredits()
        }
        if(this.caption){
        this.writeCaption()
        }
        if(this.fullExpandWidth>this.x.span){
        this.createFullExpand()
        }
        if(!this.caption){
        this.onDisplayFinished()
        }
    };

HsExpander.prototype.onDisplayFinished=function(){
    var a=this.key;
    var b=this.outlineType;
    new HsOutline(b,function(){
        try{
            hs.expanders[a].preloadNext()
            }catch(c){}
    })
};

HsExpander.prototype.preloadNext=function(){
    var b=hs.getAdjacentAnchor(this.key,1);
    if(b.onclick.toString().match(/hs\.expand/)){
        var a=hs.createElement("img",{
            src:hs.getSrc(b)
            })
        }
    };

HsExpander.prototype.cancelLoading=function(){
    this.a.style.cursor=this.originalCursor;
    if(this.loading){
        hs.loading.style.visibility="hidden"
        }
        hs.expanders[this.key]=null
    };
    
HsExpander.prototype.writeCredits=function(){};
HsExpander.prototype.getCaption=function(){
    if(!this.captionId&&this.thumbsUserSetId){
        this.captionId="caption-for-"+this.thumbsUserSetId
        }
        if(this.captionId){
        this.caption=hs.getNode(this.captionId)
        }
        if(this.captionTemplateId){
        var a=(this.caption)?this.caption.innerHTML:"";
        this.caption=hs.getNode(this.captionTemplateId);
        if(this.caption){
            this.caption.innerHTML=this.caption.innerHTML.replace(/\s/g," ").replace("{caption}",a)
            }
        }
    if(this.caption){
    this.marginBottom+=this.spaceForCaption
    }
};

HsExpander.prototype.writeCaption=function(){
    try{
        this.wrapper.style.width=this.wrapper.offsetWidth+"px";
        this.caption.style.visibility="hidden";
        this.caption.className+=" highslide-display-block";
        var height;
        if(hs.ie&&(hs.ieVersion()<6||document.compatMode=="BackCompat")){
            height=this.caption.offsetHeight
            }else{
            var temp=hs.createElement("div",{
                innerHTML:this.caption.innerHTML
                },null,null,true);
            this.caption.innerHTML="";
            this.caption.appendChild(temp);
            height=this.caption.childNodes[0].offsetHeight;
            this.caption.innerHTML=this.caption.childNodes[0].innerHTML
        }
        hs.setStyles(this.caption,{
            overflow:"hidden",
            height:0,
            zIndex:2
        });
        if(hs.captionSlideSpeed){
            step=Math.round(height/50);
            if(step==0){
                step=1
                }
                step=step*hs.captionSlideSpeed
            }else{
            this.placeCaption(height,1);
            return
        }
        var t=0;
        for(var h=height%step;h<=height;h+=step,t+=10){
            var end=(h==height)?1:0;
            var eval="try { hs.expanders["+this.key+"].placeCaption("+h+", "+end+");} catch (e) {}";
            setTimeout(eval,t)
            }
        }catch(e){}
};

HsExpander.prototype.placeCaption=function(a,b){
    if(!this.caption){
        return
    }
    this.caption.style.height=a+"px";
    this.caption.style.visibility="visible";
    this.y.span=this.wrapper.offsetHeight-2*this.offsetBorderH;
    var c=this.objOutline;
    if(c){
        c.td[4].style.height=(this.wrapper.offsetHeight-2*this.objOutline.offset)+"px";
        if(c.hasAlphaImageLoader){
            c.td[3].style.height=c.td[5].style.height=c.td[4].style.height
            }
        }
    if(b){
    this.onDisplayFinished()
    }
};

HsExpander.prototype.showHideElements=function(b,a,k){
    var d=document.getElementsByTagName(b);
    if(d){
        for(i=0;i<d.length;i++){
            if(d[i].nodeName==b){
                var m=d[i].getAttribute("hidden-by");
                if(a=="visible"&&m){
                    m=m.replace("["+this.key+"]","");
                    d[i].setAttribute("hidden-by",m);
                    if(!m){
                        d[i].style.visibility="visible"
                        }
                    }else{
                if(a=="hidden"){
                    var o=hs.position(d[i]);
                    o.w=d[i].offsetWidth;
                    o.h=d[i].offsetHeight;
                    var n=(o.x+o.w<k.x||o.x>k.x+k.w);
                    var l=(o.y+o.h<k.y||o.y>k.y+k.h);
                    var c=hs.getWrapperKey(d[i]);
                    if(!n&&!l&&c!=this.key){
                        if(!d[i].currentStyle||(d[i].currentStyle&&d[i].currentStyle.visibility!="hidden")){
                            if(!m){
                                d[i].setAttribute("hidden-by","["+this.key+"]")
                                }else{
                                if(!m.match("["+this.key+"]")){
                                    d[i].setAttribute("hidden-by",m+"["+this.key+"]")
                                    }
                                }
                            d[i].style.visibility="hidden"
                        }
                    }else{
                if(m=="["+this.key+"]"||hs.focusKey==c){
                    d[i].setAttribute("hidden-by","");
                    d[i].style.visibility="visible"
                    }else{
                    if(m&&m.match("["+this.key+"]")){
                        d[i].setAttribute("hidden-by",m.replace("["+this.key+"]",""))
                        }
                    }
            }
        }
}
}
}
}
};

HsExpander.prototype.focus=function(){
    for(i=0;i<hs.expanders.length;i++){
        if(hs.expanders[i]&&i==hs.focusKey){
            var a=hs.expanders[i];
            a.content.className+=" highslide-"+a.contentType+"-blur";
            if(a.caption){
                a.caption.className+=" highslide-caption-blur"
            }
            if(a.isImage){
                a.content.style.cursor=hs.ie?"hand":"pointer";
                a.content.title=hs.focusTitle
                }
            }
    }
    this.wrapper.style.zIndex=hs.zIndexCounter++;
if(this.objOutline){
    this.objOutline.table.style.zIndex=this.wrapper.style.zIndex
    }
    this.content.className="highslide-"+this.contentType;
if(this.caption){
    this.caption.className=this.caption.className.replace(" highslide-caption-blur","")
    }
    if(this.isImage){
    this.content.title=hs.restoreTitle;
    hs.styleRestoreCursor=window.opera?"pointer":"url("+hs.graphicsDir+hs.restoreCursor+"), pointer";
    if(hs.ie&&hs.ieVersion()<6){
        hs.styleRestoreCursor="hand"
        }
        this.content.style.cursor=hs.styleRestoreCursor
    }
    hs.focusKey=this.key;
hs.addEventListener(document,"keydown",hs.keyHandler)
};

HsExpander.prototype.onClick=function(){
    this.doClose()
    };
    
HsExpander.prototype.doClose=function(){
    hs.removeEventListener(document,"keydown",hs.keyHandler);
    try{
        this.isClosing=true;
        var a=parseInt(this.wrapper.style.left);
        var o=parseInt(this.wrapper.style.top);
        var b=(this.isImage)?this.content.width:parseInt(this.content.style.width);
        var c=(this.isImage)?this.content.height:parseInt(this.content.style.height);
        if(this.objOutline){
            if(this.outlineWhileAnimating){
                this.positionOutline(a,o,b,c)
                }else{
                if(this.preserveContent){
                    this.objOutline.table.style.visibility="hidden"
                    }else{
                    this.objOutline.destroy()
                    }
                }
        }
    var m=this.wrapper.childNodes.length;
for(i=m-1;i>=0;i--){
    var l=this.wrapper.childNodes[i];
    if(l!=this.content){
        hs.purge(this.wrapper.childNodes[i]);
        this.wrapper.removeChild(this.wrapper.childNodes[i])
        }
    }
if(this.isHtml){
    this.htmlOnClose()
    }
    this.wrapper.style.width="auto";
this.content.style.cursor="default";
var d=this.objOutline?this.objOutline.offset:0;
this.changeSize(-1,a,o,b,c,this.thumbLeft-this.offsetBorderW+this.thumbOffsetBorderW,this.thumbTop-this.offsetBorderH+this.thumbOffsetBorderH,this.thumbWidth,this.thumbHeight,hs.restoreDuration,hs.restoreSteps,d,hs.outlineStartOffset)
}catch(k){
    this.onEndClose()
    }
};

HsExpander.prototype.onEndClose=function(){
    this.thumb.style.visibility="visible";
    if(hs.hideSelects){
        this.showHideElements("SELECT","visible")
    }
    if(hs.hideIframes){
        this.showHideElements("IFRAME","visible")
        }
        if(this.isHtml&&this.preserveContent){
        this.sleep()
        }else{
        if(this.objOutline&&this.outlineWhileAnimating){
            this.objOutline.destroy()
            }
            hs.purge(this.wrapper);
        if(hs.ie&&hs.ieVersion()<5.5){
            this.wrapper.innerHTML=""
            }else{
            this.wrapper.parentNode.removeChild(this.wrapper)
            }
        }
    if(hs.mask){
    hs.mask.style.display="none"
    }
    hs.expanders[this.key]=null;
hs.cleanUp()
    };
    
HsExpander.prototype.createOverlay=function(a,d,n,k){
    if(typeof a=="string"){
        a=hs.getNode(a)
        }
        if(!a||typeof a=="string"||!this.isImage){
        return
    }
    var c=hs.createElement("div",null,{
        left:0,
        top:0,
        position:"absolute",
        zIndex:3,
        visibility:"hidden"
    },this.wrapper,true);
    if(k){
        hs.setStyles(a,{
            opacity:k
        })
        }
        a.className+=" highslide-display-block";
    c.appendChild(a);
    var b=this.offsetBorderW;
    var o=this.content.width-c.offsetWidth;
    var m=this.offsetBorderH;
    var l=this.content.height-c.offsetHeight;
    if(!d){
        d="center center"
        }
        if(d.match(/^bottom/)){
        m+=l
        }
        if(d.match(/^center/)){
        m+=l/2
        }
        if(d.match(/right$/)){
        b+=o
        }
        if(d.match(/center$/)){
        b+=o/2
    }
    c.style.left=b+"px";
    c.style.top=m+"px";
    if(n){
        c.setAttribute("hideOnMouseOut",true)
        }
        if(!k){
        k=1
        }
        c.setAttribute("opacity",k);
    hs.fade(c,0,k,1);
    hs.push(this.overlays,c)
    };
    
HsExpander.prototype.createCustomOverlays=function(){
    for(i=0;i<hs.overlays.length;i++){
        var a=hs.overlays[i];
        if(a.thumbnailId==null||a.thumbnailId==this.thumbsUserSetId){
            this.createOverlay(a.overlayId,a.position,a.hideOnMouseOut,a.opacity)
            }
        }
    };

HsExpander.prototype.onMouseOver=function(){
    for(i=0;i<this.overlays.length;i++){
        var a=this.overlays[i];
        if(a.getAttribute("hideOnMouseOut")){
            hs.fade(a,0,a.getAttribute("opacity"),1)
            }
        }
    };

HsExpander.prototype.onMouseOut=function(){
    for(i=0;i<this.overlays.length;i++){
        var a=this.overlays[i];
        if(a.getAttribute("hideOnMouseOut")){
            hs.fade(a,a.getAttribute("opacity"),0,-1)
            }
        }
    };

HsExpander.prototype.createFullExpand=function(){
    var b=hs.createElement("a",{
        href:"javascript:hs.expanders["+this.key+"].doFullExpand();",
        title:hs.fullExpandTitle
        },{
        background:"url("+hs.graphicsDir+hs.fullExpandIcon+")",
        display:"block",
        margin:"0 10px 10px 0",
        width:"45px",
        height:"44px"
    },null,true);
    this.createOverlay(b,"bottom right",true,0.75);
    this.fullExpandIcon=b
    };
    
HsExpander.prototype.doFullExpand=function(){
    try{
        hs.purge(this.fullExpandIcon);
        this.fullExpandIcon.parentNode.removeChild(this.fullExpandIcon);
        this.focus();
        this.x.min=parseInt(this.wrapper.style.left)-(this.fullExpandWidth-this.content.width)/2;
        if(this.x.min<hs.marginLeft){
            this.x.min=hs.marginLeft
            }
            this.wrapper.style.left=this.x.min+"px";
        var a=this.wrapper.offsetWidth-this.content.width;
        this.content.width=this.fullExpandWidth;
        this.content.height=this.fullExpandHeight;
        this.x.span=this.content.width;
        this.wrapper.style.width=(this.x.span+a)+"px";
        this.y.span=this.wrapper.offsetHeight-2*this.offsetBorderH;
        this.positionOutline(this.x.min,this.y.min,this.x.span,this.y.span);
        for(var b=0;b<this.overlays.length;b++){
            hs.purge(this.overlays[b]);
            this.overlays[b].parentNode.removeChild(this.overlays[b])
            }
            if(hs.showCredits){
            this.writeCredits()
            }
            this.createCustomOverlays();
        this.redoShowHide()
        }catch(c){
        window.location.href=this.content.src
    }
};

HsExpander.prototype.redoShowHide=function(){
    var a={
        x:parseInt(this.wrapper.style.left)-20,
        y:parseInt(this.wrapper.style.top)-20,
        w:this.content.offsetWidth+40,
        h:this.content.offsetHeight+40+this.spaceForCaption
        };
        
    if(hs.hideSelects){
        this.showHideElements("SELECT","hidden",a)
        }
        if(hs.hideIframes){
        this.showHideElements("IFRAME","hidden",a)
        }
    };

hs.addEventListener(document,"mousedown",hs.mouseClickHandler);
hs.addEventListener(document,"mouseup",hs.mouseClickHandler);
hs.addEventListener(window,"load",hs.preloadImages);
var sendCategoryContentRequest=function(a){
    var b=a+"&actiontype=ajax";
    jQuery("#owsCategoryAJAXContainer").fadeTo("normal",0.1,function(){
        jQuery("#owsAJAXContainerPreloader").show("fast",function(){
            jQuery("<div>").load(b,{},function(c,d){
                jQuery(this).appendTo(jQuery("#owsCategoryAJAXContainer").empty());
                jQuery("#owsAJAXContainerPreloader").hide();
                jQuery("#owsCategoryAJAXContainer").fadeTo("normal",1);
                bindnavLinksToAJAX();
                bindcartLinksToFrame()
                
                
                
    var he_bigmaincenter = jQuery("#center_blok2_descr").offset();
    var offset = he_bigmaincenter.top;
    var offsetd = offset/200;
      jQuery("#removeMe").delay(500).css("top", (offset+(offsetd*15)));

    var he_removeMe = jQuery("#removeMe").height();
    jQuery("#center_blok2_descr").css("height", (he_removeMe + 30));

      return false;



                })
            })
        })
    };
    
var bindnavLinksToAJAX=function(){
    jQuery("p#cat_product_sort a").click(function(a){
        sendCategoryContentRequest(this.href);
        return false
        });
    jQuery("p#cat_product_navigatorTop a").click(function(a){
        sendCategoryContentRequest(this.href);
        return false
        });
    jQuery("p#cat_product_navigatorBottom a").click(function(a){
        sendCategoryContentRequest(this.href);
        return false
        })

      return false;
    };
    
var bindcartLinksToFrame=function(){
    jQuery(".add2cart_handler").click(function(k){
        var m=getFormByElem(this);
        if(!m){
            return true
            }
            var b=getElementsByClass("product_option",m);
        var l="";
        for(var d=b.length-1;d>=0;d--){
            if(!parseInt(b[d].value)){
                continue
            }
            if(b[d].name){
                l+="&"+b[d].name+"="+parseInt(b[d].value)
                }
            }
        var a=getElementByClass("product_qty",m);
        if(a){
        a=parseInt(a.value);
        if(a>1){
            l+="&product_qty="+a
            }
        }
    var c=ORIG_LANG_URL+set_query("?ukey=cart&view=noframe&action=add_product&"+l+"&productID="+m.getAttribute("rel"),"");
    openFadeIFrame(c);
    return false
    })
    
    

};

jQuery(document).ready(function(){
    bindnavLinksToAJAX()
    });
function prddet_clickThumbnail(){
    var b=getElementByClass("current_prd_thumbnail",getLayer("current_prd_thumbnail"));
    if(b){
        b.className="prd_thumbnail"
        }
        this.className="current_prd_thumbnail";
    var a=getLayer("current_picture");
    if(a){
        a.href=this.getAttribute("img_enlarged");
        a.setAttribute("allow_enlarge",!this.getAttribute("img_enlarged")?"0":"1");
        getLayer("img-enlarge-link").style.display=this.getAttribute("img_enlarged")?"block":"none";
        a.setAttribute("img_width",this.getAttribute("img_width"));
        a.setAttribute("img_height",this.getAttribute("img_height"));
        getLayer("img-current_picture").src=this.getAttribute("img_picture")
        }
    }
Behaviour.register({
    "a.prd_thumbnail":function(a){
        a.onclick=prddet_clickThumbnail
        },
    "a.current_prd_thumbnail":function(a){
        a.onclick=prddet_clickThumbnail
        }
    });
var enlargedPict=getLayer("current_picture");
if(enlargedPict){
    enlargedPict.onclick=function(){
        if(this.getAttribute("allow_enlarge")!="0"){
            open_window(this.href,this.getAttribute("img_width"),this.getAttribute("img_height"))
            }
            return false
        }
    }
    var regActions_handlers={
    "#ows__reg_from_chldren_is_ubsent":function(a){
        a.onclick=function(){
            for(var b=1;b<=5*2;b++){
                var c=b+2;
                document.getElementById("children_row_"+b).style.display="none";
                document.getElementById("fld_additional_field_"+c).value=""
                }
                for(var b=1;b<=5*2;b=b+2){
                document.getElementById("hr_children_row_"+b).style.display="none"
                }
                for(var b=1;b<=5;b=b+2){
                document.getElementById("remove_ChildrenField_"+b).style.display="none"
                }
                ows__KeyCountChieldrenFields=0;
            document.getElementById("ows__KeyCountChieldrenFields").value="0";
            document.getElementById("children_row_more").style.display="none";
            return true
            }
        },
"#ows__reg_from_chldren_is_present":function(a){
    a.onclick=function(){
        if(ows__KeyCountChieldrenFields!=0){
            return true
            }
            document.getElementById("hr_children_row_1").style.display="";
        document.getElementById("children_row_1").style.display="";
        document.getElementById("children_row_2").style.display="";
        ows__KeyCountChieldrenFields=1;
        document.getElementById("ows__KeyCountChieldrenFields").value="1";
        document.getElementById("children_row_more").style.display="";
        return true
        }
    }
};

Behaviour.register(regActions_handlers);
var addChildrenRow=function(){
    if(ows__KeyCountChieldrenFields==5){
        return
    }
    var a=(++ows__KeyCountChieldrenFields)*2;
    document.getElementById("ows__KeyCountChieldrenFields").value=ows__KeyCountChieldrenFields;
    document.getElementById("remove_ChildrenField_"+(ows__KeyCountChieldrenFields-1)).style.display="none";
    document.getElementById("remove_ChildrenField_"+(ows__KeyCountChieldrenFields)).style.display="";
    document.getElementById("hr_children_row_"+(a-1)).style.display="";
    document.getElementById("children_row_"+(a-1)).style.display="";
    document.getElementById("children_row_"+(a)).style.display="";
    if(ows__KeyCountChieldrenFields==5){
        document.getElementById("children_row_more").style.display="none"
        }
    };

var removeChildrenRow=function(){
    if(ows__KeyCountChieldrenFields==1){
        return
    }
    var a=(ows__KeyCountChieldrenFields)*2;
    document.getElementById("remove_ChildrenField_"+(ows__KeyCountChieldrenFields-1)).style.display="";
    document.getElementById("remove_ChildrenField_"+(ows__KeyCountChieldrenFields)).style.display="none";
    document.getElementById("hr_children_row_"+(a-1)).style.display="none";
    document.getElementById("children_row_"+(a-1)).style.display="none";
    document.getElementById("children_row_"+(a)).style.display="none";
    document.getElementById("fld_additional_field_"+(a-1)).value="";
    document.getElementById("fld_additional_field_"+(a)).value="";
    document.getElementById("ows__KeyCountChieldrenFields").value=(--ows__KeyCountChieldrenFields);
    document.getElementById("children_row_more").style.display="";
    if(ows__KeyCountChieldrenFields==1){
        document.getElementById("remove_ChildrenField_"+(ows__KeyCountChieldrenFields)).style.display="none"
        }
    };

var expandTreeToRoot=function(b){
    var a=b.parent("div.owsTreeContainer").parent("div.owsTreeMenu");
    if(a.length&&a.hasClass("owsPlus")){
        a.removeClass("owsPlus").addClass("owsMinus");
        expandTreeToRoot(a)
        }
    };

var appendCategoryTreeResult=function(a,b,c){
    jQuery.each(b,function(k,l){
        var m=jQuery("<div>");
        var n=l.cs?"/index.php?categoryID="+l.cid+"&category_slug="+l.cs:"/index.php?categoryID="+l.cid;
        m.attr("id","categoryID_"+l.cid);
        m.addClass("owsTreeMenu");
        m.append(jQuery("<div>").addClass("owsTreeControllExpand").click((function(o,p){
            return function(r){
                if(!o.isRendered&&o.csub.length){
                    o.isRendered=true;
                    var q=jQuery("<div>").addClass("owsTreeContainer");
                    p.append(q);
                    appendCategoryTreeResult(q,l.csub,c)
                    }
                    var s=jQuery(this).parent("div");
                if(s.hasClass("owsMinus")){
                    s.removeClass("owsMinus").addClass("owsPlus")
                    }else{
                    if(s.hasClass("owsPlus")){
                        s.removeClass("owsPlus").addClass("owsMinus")
                        }
                    }
            }
        })(l,m)));
m.append(jQuery("<a>").attr("href",n).addClass(l.cp==1?"owsTreeRoot":"").addClass(l.cid==c?"owsSelected":"").text(l.cn));
if(l.csub.length){
    m.addClass("owsPlus");
    if(l.csel||l.chsel){
        l.isRendered=true;
        var d=jQuery("<div>").addClass("owsTreeContainer");
        m.append(d);
        appendCategoryTreeResult(d,l.csub,c)
        }
    }
m.appendTo(a)
})
};

jQuery(document).ready(function(){
    jQuery("#catTreeContainer").fadeOut("fast",function(){
        jQuery("#owsAJAXContainerPreloaderCatTree").fadeIn("normal",function(){
            jQuery.getJSON("index.php",{
                did:1006,
                action:"getTree",
                scatID:ows_SelectedCategoryInTree
            },function(a){
                ows_CategoryTreeSource=a;
                appendCategoryTreeResult(jQuery("#catTreeContainer"),a,ows_SelectedCategoryInTree);
                if(jQuery("a.owsSelected").length==1){
                    expandTreeToRoot(jQuery("a.owsSelected").parent("div.owsTreeMenu"));
                    if(jQuery("a.owsSelected").parent("div.owsTreeMenu").hasClass("owsPlus")){
                        jQuery("a.owsSelected").parent("div.owsTreeMenu").removeClass("owsPlus").addClass("owsMinus")
                        }
                    }
                jQuery("#owsAJAXContainerPreloaderCatTree").fadeOut("fast",function(){
                jQuery("#catTreeContainer").fadeIn("normal")
                })
            })
        })
    })
});
