//Update function =================================================================    function funcAllBlUpdate() {        //Sale block ---------------------------------------------            $.post("/ajax/sale.php", {sale_code: "11092010"},                function(data){                    $("#sale_block").html(data);                }            );        // / Sale block ---------------------------------------------    }// / Update function ===================================================================== //Tag sphere ========================================================================================================//add - my opacity and font size --------------------------------------------------------------    function funcGetColor(tag_type, alpha_num) {        var returnColor = '#3D6C8E';        if (tag_type == 1) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];         }else if(tag_type == 2) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 3) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 4) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 5) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 6) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 7) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 8) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 9) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }else if(tag_type == 10) {            var tagOpacity = [ '#B3C5D3', '#B3C5D3', '#B3C5D3', '#B3C5D3', '#A0B7C8', '#9BB3C5', '#87A4B9', '#7596AE', '#6389A4', '#3D6C8E' ];            returnColor = tagOpacity[alpha_num];          }                return returnColor;    }// / add - my opacity and font size --------------------------------------------------------------(function(){    var tags;    //add - my opacity and font size --------------------------------------------------------------            var tags_link;           var tagsFontSize = ['', '26', '24', '22', '20', '18', '16', '14', '13', '12', '11' ];// / add - my opacity and font size --------------------------------------------------------------            var defaults = {        //height of sphere container        height: 400,        //width of sphere container        width: 400,        //radius of sphere        radius: 150,        //rotation speed        speed: 3,        //sphere rotations slower         slower: 0.97,        //delay between update position        timer: 10,        //dependence of a font size on axis Z        fontMultiplier: 15,        //tag css stylies on mouse over        tagCSSOver: {            border: 'solid 1px blue',            color: 'blue'        },        //tag css stylies on mouse out        tagCSSOut: {            border: '',            color: ''        }    }    var forCalcs = {        halfHeight: null,        halfWidth: null,        hwratio: null,        dtr: null,        diametr: null,        speedX: null,        speedY: null,        tLength: null    }    var curState = {        mouseOver: null,        lastFy: null,        lastFx: null,        sy: null,        cy: null,        sx: null,        cx: null,        mouseX: null,        mouseY: null    }    var options = {};    jQuery.fn.tagSphere = function(opt){        options = jQuery.extend(defaults, opt);        initContainer(this);        initTags(this);        initCalcs();        deployTags();        setInterval(updateTags, options.timer);        return this;    };        function initCalcs(){        forCalcs.halfHeight = options.height / 2;        forCalcs.halfWidth = options.width / 2;        forCalcs.speedX = options.speed / forCalcs.halfWidth;        forCalcs.speedY = options.speed / forCalcs.halfHeight;        forCalcs.dtr = Math.PI / 180;        forCalcs.diametr = options.radius * 2;        forCalcs.hwratio = options.height / options.width;        forCalcs.whratio = options.width / options.height;        forCalcs.tLength = tags.length - 1;        curState.mouseOver = false;        curState.lastFx = options.speed;        curState.lastFy = options.speed;    }        function initContainer(tagCont){        tagCont.height(options.height);        tagCont.width(options.width);        tagCont.css({            'overflow': 'hidden',            'position': 'relative'        });        tagCont.mousemove(function(e){            curState.mouseX = e.pageX - this.offsetLeft;            curState.mouseY = e.pageY - this.offsetTop;        });        tagCont.hover(function(){            curState.mouseOver = true;        }, function(){            curState.mouseOver = false;        });    }        function initTags(tagCont){        tags = tagCont.children('ul').children();//add - my opacity and font size --------------------------------------------------------------            tags_link = tagCont.children('li').children();// / add - my opacity and font size --------------------------------------------------------------                tags.css({            'position': 'absolute',            'list-style-type': 'none',            'list-style-position': 'outside',            'list-style-image': 'none'        });                for (var i = 0; i < tags.length; i++) {            var jTag = jQuery(tags[i]);            var link = jQuery(jTag.children()[0]);            link.html(link.html().replace(/\s/g, '&nbsp;'));            tags[i] = jTag;            //add - my opacity and font size --------------------------------------------------------------                tags_link[i] = link;// / add - my opacity and font size --------------------------------------------------------------                        jTag.hover(function(){                jQuery(this).css(options.tagCSSOver);            }, function(){                jQuery(this).css(options.tagCSSOut);            })        }    }        function deployTags(){        var phi = 0;        var theta = 0;        var max = forCalcs.tLength + 1;        var i = 0;        while (i++ < max) {            phi = Math.acos(-1 + (2 * i - 1) / max);            theta = Math.sqrt(max * Math.PI) * phi;            tags[i - 1].cx = options.radius * Math.cos(theta) * Math.sin(phi);            tags[i - 1].cy = options.radius * Math.sin(theta) * Math.sin(phi);            tags[i - 1].cz = options.radius * Math.cos(phi);            tags[i - 1].h = jQuery(tags[i - 1]).height() / 4;            tags[i - 1].w = jQuery(tags[i - 1]).width() / 4;        }    }        function calcRotation(fy, fx){        curState.sy = Math.sin(fy * forCalcs.dtr);        curState.cy = Math.cos(fy * forCalcs.dtr);        curState.sx = Math.sin(fx * forCalcs.dtr);        curState.cx = Math.cos(fx * forCalcs.dtr);    }        function updateTags(){        var fy;        var fx;        if (curState.mouseOver) {            fy = options.speed - forCalcs.speedY * curState.mouseY;            fx = forCalcs.speedX * curState.mouseX - options.speed;        }        else {            fy = curState.lastFy * options.slower;            fx = curState.lastFx * options.slower;        }        if (curState.lastFy != fy || curState.lastFx != fx) {            calcRotation(fy, fx);            curState.lastFy = fy;            curState.lastFx = fx;        }        if (Math.abs(fy) > 0.01 || Math.abs(fx) > 0.01) {            j = -1;                         while (j++ < forCalcs.tLength) {                rx1 = tags[j].cx;                ry1 = tags[j].cy * curState.cy + tags[j].cz * -curState.sy;                rz1 = tags[j].cy * curState.sy + tags[j].cz * curState.cy;                tags[j].cx = rx1 * curState.cx + rz1 * curState.sx;                tags[j].cy = tags[j].cy * curState.cy + tags[j].cz * -curState.sy;                tags[j].cz = rx1 * -curState.sx + rz1 * curState.cx;                var per = forCalcs.diametr / (forCalcs.diametr + tags[j].cz);                tags[j].x = tags[j].cx * per;                tags[j].y = tags[j].cy * per;                tags[j].alpha = per / 2;                tags[j].css({                    'left': forCalcs.whratio * (tags[j].x - tags[j].w * per) + forCalcs.halfWidth,                    'top': forCalcs.hwratio * (tags[j].y - tags[j].h * per) + forCalcs.halfHeight,                    //'opacity': tags[j].alpha,                    //'font-size': options.fontMultiplier * tags[j].alpha + 'px',                    'z-index': Math.round(-tags[j].cz)                });                //add - my opacity and font size --------------------------------------------------------------                    var tag_type=tags_link[j].attr("tag_type");                                    var alpha_num = 0;                    if (tags[j].alpha < 0.1) {                        var alpha_num = 0;                    } else if(tags[j].alpha >= 0.1 && tags[j].alpha < 0.2 ) {                        var alpha_num = 1;                    } else if(tags[j].alpha >= 0.2 && tags[j].alpha < 0.3 ) {                        var alpha_num = 2;                    } else if(tags[j].alpha >= 0.3 && tags[j].alpha < 0.4 ) {                        var alpha_num = 3;                    } else if(tags[j].alpha >= 0.4 && tags[j].alpha < 0.5 ) {                        var alpha_num = 4;                    } else if(tags[j].alpha >= 0.5 && tags[j].alpha < 0.6 ) {                        var alpha_num = 5;                    } else if(tags[j].alpha >= 0.6 && tags[j].alpha < 0.7 ) {                        var alpha_num = 6;                    } else if(tags[j].alpha >= 0.7 && tags[j].alpha < 0.8 ) {                        var alpha_num = 7;                    } else if(tags[j].alpha >= 0.8 && tags[j].alpha < 0.9 ) {                        var alpha_num = 8;                    } else {                        var alpha_num = 9;                    }                    tags_link[j].css({                        'color': funcGetColor(tag_type, alpha_num),                        'font-size': tagsFontSize[tag_type] * tags[j].alpha + 'px'                                           });                // / add - my opacity and font size --------------------------------------------------------------                       }        }    }})()// / Tag sphere ========================================================================================================//Set Cookie ========================================================================================================//example: setCookie("username", "Test", 30, "/"); - set username on 30 days            function setCookie(name, value, expiredays, path, domain, secure) {        if (expiredays) {            var exdate=new Date();            exdate.setDate(exdate.getDate()+expiredays);            var expires = exdate.toGMTString();        }           document.cookie = name + "=" + escape(value) +            ((expiredays) ? "; expires=" + expires : "") +            ((path) ? "; path=" + path : "") +            ((domain) ? "; domain=" + domain : "") +            ((secure) ? "; secure" : "");}        // / Set Cookie =====================================================================================================//Get Cookie ========================================================================================================//example: var user = getCookie("username");    function getCookie(name) {        var cookie = " " + document.cookie;        var search = " " + name + "=";        var setStr = null;        var offset = 0;        var end = 0;                if (cookie.length > 0) {            offset = cookie.indexOf(search);                  if (offset != -1) {                offset += search.length;                end = cookie.indexOf(";", offset)                         if (end == -1) {                    end = cookie.length;                }                         setStr = unescape(cookie.substring(offset, end));            }        }                return setStr;    }// / Get Cookie =====================================================================================================//Cookie Num Calculate ===========================================================================================       function calcCookie(valCookie)    {        var mystr = document.cookie;        var search = valCookie;        var mycount = 0;                if (mystr.length > 0) {            pos = mystr.indexOf(search);            while ( pos != -1 ) {                mycount++;                pos = mystr.indexOf(search,pos+4);            }        }                return mycount;    }// / Cookie Num Calculate ===========================================================================================$(document).ready(function(){//BOF - TAG SPHERE ########################################################################################################    $(function() {            $("#tagSphere").tagSphere({            "height":240, //height of sphere container            "width":240, //500-100=400  width of sphere container                  "radius":85, //radius of sphere            "speed":3, //rotation speed (скорость вращение)            "slower":0.9, //sphere rotations slower (замедление сферы, когда мышка ушла с контейнера)            "timer":5, //delay between update position (задержка между обновлениями позиции тэгов)            "fontMultiplier":32, //dependence of a font size on axis Z (зависимость размера шрифта от Z)            "tagCSSOver": { //tag css stylies on mouse over (css стили тэгов onMouseOver)                border: '',                color: ''            },            "tagCSSOut": { //tag css stylies on mouse out (css стили тэгов onMouseOut)                border: '',                color: ''            }        });    });//EOF - TAG SPHERE ########################################################################################################//BOF - COMPARISON ########################################################################################################    //Show Comparison Text ======================================================================================================        function funcShowCompareText(valCookie) {                                                //Comparison Num Calculate                    var numCompare;                    numCompare = calcCookie(valCookie);                                         //Show Comparison Text --------------                        var numCompareText = "--";                        if (numCompare) {                            numCompareText = numCompare;                                                        if($(".goToCompare").hasClass("goToCompare_off")) {                                $(".goToCompare").removeClass("goToCompare_off");                            }                                                    }else{                            $(".goToCompare").addClass("goToCompare_off");                        }                        $("#compare_text span").text(numCompareText);                    // / Show Comparison Text --------------               }    // / Show Comparison Text ======================================================================================================    //Add/Remove to/from compare - <a> ===========================================================================================	      $(".compare a").click(function(){	              var mid=$(this).attr("mid"); //get menu id    		    var gid=$(this).attr("gid"); //get good id            var typeid=$(this).attr("typeid"); //get type id            var compare_link_text = "нажмите, чтобы сравнить";            var compare_link_text_on = "добавлено к сравнению";            if (typeid == 2) {                compare_link_text = "сравнить";                compare_link_text_on = "добавлено";            }            if($(this).hasClass("compare_off")) {                //Add to compare ----------------------------------------------------------                        var valCookie = "cv" + mid;                                        setCookie("compare"+mid+"["+gid+"]", valCookie, "", "/");  //Set Cookie - Value                    funcShowCompareText(valCookie); //Show Comparison Text                    //<a2> ---------------------                                                                      var class_var = "#c"+gid;                                              if($(class_var).hasClass("compare2_off")) {                            $(class_var).removeClass("compare2_off");			                      $(class_var).addClass("compare2_on");                        }                                                // / <a2> ------------------                                      			              $(this).removeClass("compare_off");			              $(this).addClass("compare_on");                    $(this).text(compare_link_text_on);                                                    // / Add to compare ----------------------------------------------------------                                    }else{                //Remove from compare ----------------------------------------------------------                                            var valCookie = "cv" + mid;                                        setCookie("compare"+mid+"["+gid+"]", "", "", "/");  //Set Cookie - Null                    funcShowCompareText(valCookie); //Show Comparison Text                                   //<a2> ---------------------                                              var class_var = "#c"+gid;                                              if($(class_var).hasClass("compare2_on")) {                            $(class_var).removeClass("compare2_on");			                      $(class_var).addClass("compare2_off");                        }                                                // / <a2> ------------------  			              $(this).removeClass("compare_on");			              $(this).addClass("compare_off");                    $(this).text(compare_link_text);                // / Remove from compare ----------------------------------------------------------                    }     		        		        return false;	      });          //Add/Remove to/from compare - <a> ===========================================================================================    //Add/Remove to/from compare - <checbox> ===========================================================================================	      $(".compare2 a").click(function(){	              var mid=$(this).attr("mid"); //get menu id    		    var gid=$(this).attr("gid"); //get good id            var typeid=$(this).attr("typeid"); //get type id            var compare_link_text = "нажмите, чтобы сравнить";            var compare_link_text_on = "добавлено к сравнению";            if (typeid == 2) {                compare_link_text = "сравнить";                compare_link_text_on = "добавлено";            }            if($(this).hasClass("compare2_off")) {                //Add to compare ----------------------------------------------------------                           var valCookie = "cv" + mid;                                        setCookie("compare"+mid+"["+gid+"]", valCookie, "", "/");  //Set Cookie - Value                     funcShowCompareText(valCookie); //Show Comparison Text                        //<a> ---------------------                                              var class_var = "#a"+gid;                          if($(class_var).hasClass("compare_off")) {                            $(class_var).removeClass("compare_off");			                      $(class_var).addClass("compare_on");			                      $(class_var).text(compare_link_text_on);                                                  }                                            // / <a> ---------------------                   			              $(this).removeClass("compare2_off");			              $(this).addClass("compare2_on");                                    // / Add to compare ----------------------------------------------------------                                    }else{                //Remove from compare ----------------------------------------------------------                                           var valCookie = "cv" + mid;                                        setCookie("compare"+mid+"["+gid+"]", "", "", "/");  //Set Cookie - Null                    funcShowCompareText(valCookie); //Show Comparison Text                          //<a> ---------------------                                              var class_var = "#a"+gid;                                              if($(class_var).hasClass("compare_on")) {                            $(class_var).removeClass("compare_on");			                      $(class_var).addClass("compare_off");			                      $(class_var).text(compare_link_text);                                                  }                                            // / <a> ---------------------                      			              $(this).removeClass("compare2_on");			              $(this).addClass("compare2_off");                // / Remove from compare ----------------------------------------------------------                    }     		        		        return false;	      });          //Add/Remove to/from compare - <checbox> ===========================================================================================        //Go to The Comparison Page ==========================================================================================	      $(".goToCompare").click(function(){		        screenWidth=window.screen.width;		        screenHeight=window.screen.height;		        var comWin=window.open('/comparison/','','height='+screenHeight+', width='+screenWidth+', scrollbars=yes');		        return false;	      });    //Go to The Comparison Page ==========================================================================================	              //Good Delete from Comparison Page ==========================================================================================           $(".good_del").click(function(){            var mid=$(this).attr("mid"); //get menu id    		    var gid=$(this).attr("gid"); //get good id                    //Remove from compare ----------------------------------------------------------                                       var valCookie = "cv" + mid;                                    setCookie("compare"+mid+"["+gid+"]", "", "", "/");  //Set Cookie - Null                //Show Comparison Text in Comparison Page --------------------                    var numCompare;                    numCompare = calcCookie(valCookie);                                         //Show Comparison Text --------------                        var numCompareText = "0";                        if (numCompare) {                            numCompareText = numCompare;                          }                        $("#compare_text span").text(numCompareText);                // / Show Comparison Text in Comparison Page --------------------            // / Remove from compare ----------------------------------------------------------                                               //Hide col            var class_var = ".good_col"+gid;            $(class_var).slideUp();                        //Hide all col            if (!numCompare)            {                $(".good_col_all").slideUp();                window.close();            }                    });    //Good Delete from Comparison Page ==========================================================================================     //EOF - COMPARISON ########################################################################################################	      });
