﻿/*
* @author Jeremy Flores
* Beyond the saucy name, inputStripper prevents certain values from being entered into an input field
* It traps for letters, numbers, symbols and spaces or any combination you like (need numbers and spaces but no symbols or
* letters? We can do that!). The only option it accepts is an array detailing the *invalid* types. When the user presses
* a key on one of the affected elements, inputStripper checks it against the list of disallowed types (via regular expression)
* and if it fails any one of the tests, the event is not allowed to bubble.
*
* This plugin could be easily extended by simple introducing more stripper names and stripper regexes. Don't like the letter
* R when used next to a number or backslash? Write a regex to match that pattern and add its stripper name to the switch
* statement.
*/
$.fn.inputStripper = function (options) {
    var defaults = {
        strippers: ['letters', 'numbers', 'symbols', 'spaces'] //which items to strip
    }
    var options = $.extend(defaults, options);
    $(this).each(function () {
        var $this = $(this);
        $this.keypress(function (e) {
            var press = String.fromCharCode(e.which);
            if (e.charCode == 0) return true; //a control character like backspace

            var valid = true;
            $.map(options.strippers, function (element) {
                if (valid) {
                    switch (element) {
                        case "letters":
                            valid = press.match(/[a-zA-Z]+/) ? false : true;
                            break;
                        case "numbers":
                            valid = press.match(/\d+/) ? false : true;
                            break;
                        case "symbols":
                            valid = press.match(/[^a-zA-Z\d\s]+/) ? false : true;
                            break;
                        case "spaces":
                            valid = press.match(/\s+/) ? false : true;
                            break;
                    }
                }
            });
            return valid;
        });
    });
};

/*
* @author Jeremy Flores
* Simple function to pop the spinner and disable the primary search form in the application header
*/
$.fn.disableOnSubmit = function (options) {
    var defaults = {
        selectors: 'input,button,textarea,select', //selectors for fields to disable
        top: 0, //move the spinner's pop spot up and down
        left: 0, //move the spinner's pop spot left and right,
        spinnerPath: "images/lightbox/lightbox-ico-loading.gif" //path to the spinner image
    }
    var options = $.extend(defaults, options);

    // Makes sure button is enabled at start
    $(this).find(options.selectors).removeAttr('disabled');

    $(this).submit(function () {
        var $this = $(this);
        $this.find(options.selectors).attr('disabled', 'disabled'); //disable the form
        var offset = $this.offset(); //get the position of the form

        //pop the spinner in the middle of the form
        var xPos = Math.floor(offset.left + ($this.width() / 2)) - 19 + 'px';
        var yPos = offset.top - 11 + 'px';
        $('body').prepend('<div id="searchSpinner" style="display: none; top: ' + yPos + '; left: ' + xPos + ';">'
  	+ '<img src="' + options.spinnerPath + '" alt="Please Wait"></div>');
        $this.parent().fadeTo('fast', .5, function () {
            $('#searchSpinner').fadeIn('fast'); //fade the spinner in so the user knows the system is working
        }); //fade the form to indicate it's disabled status

        return false; //this needs to be removed in production - it prevents the form from submitting
    });
    return this;
};

/*
* @author Jeremy Flores
* Simple image preloader for use with the thumbBigMaker below. In short, throw it a selector that pulls the
* anchors containing the path to the larger images you're wanting to pre-load and it'll pre-load them. Handy.
*/
jQuery.preloadImages = function (options) {
    var defaults = {
        selector: 'a.thumber', //the selector that pulls the elements containing the path to the large image
        attribute: 'href' //attribute of the element that has our path.
    }
    var options = $.extend(defaults, options);

    $(options.selector).each(function () {
        //for each item in the iteration, make (and then discard) an image element. Then, the image
        //is sitting in cache when you need it - no need to make a new request
        jQuery("<img />").attr("src", $(this).attr(options.attribute));
    });
}

/*
* @author Jeremy Flores
* Don't laugh at the name. You had to be there. It was hilarious.
* thumbBigMaker, employed primarily in search results, creates a simple floating div that contains a larger
* version of a thumbnailed image. the div pops when the user clicks on the img
* (which is wrapped in an anchor with an href pointing at the larger image).
*/
$.fn.thumbBigMaker = function (options) {
    var defaults = {
        left: 0, //how far to shove the thumbBigMaker past the left edge of the element that triggered it
        top: 0, //how far to shove the thumbBigMaker below the top of the element that triggered it
        attribute: 'href', //which attribute of the triggering element contains the path to the larger image
        captionAttribute: 'title' //the attribute containing the caption, if any.
    };
    var options = $.extend(defaults, options);

    // Creates the code to display the thumbBigMaker
    getTip = function () {
        var tip = '<div id="thumbBig" style="display: none;">' +
      '<div class="closer"><a href="#" onclick="$(\'#thumbBig\').hide(); return false;">Close</a></div>' +
      '<div class="inner"></div>' +
      '<div class="caption"></div>' +
		'</div>';
        return tip;
    };

    // Append div to body
    $('body').prepend(getTip());

    // Apply the hover event listener to each element in the set
    $(this).each(function () {
        var $this = $(this);
        var thumbBigger = $('#thumbBig');

        //grab the path for the larger image. If it's an anchor, and it should be most of the time,
        //we want it to be the href (for graceful degredation).
        var imagePath = $this.attr(options.attribute);
        var caption = $this.attr(options.captionAttribute);
        $this.click(function () {
            thumbBigger.hide(); //if it's already showing, hide it for updating before showing it again.
            // Calculate Offset  
            var offset = $(this).offset();

            var xTip = (offset.left + options.left) + "px";
            var yTip = (offset.top + options.top) + "px";
            thumbBigger.children('.inner').html('<img src="' + imagePath + '"/>');
            thumbBigger.children('.caption').html(caption)
            thumbBigger.css({
                'position': 'absolute',
                'top': yTip,
                'left': xTip,
                'z-index': 9999
            });
            thumbBigger.show(1, function () {
                var $this = $(this);
                var imageWidth = $this.children('.inner').children('img').width();
                $this.width(imageWidth + 20);
            });

            return false; //prevent bubbling
        });
    });
};


/*
* Globally override jQuery Tab implementation default value
*/
jQuery.ui.tabs.defaults.panelTemplate = '<div class="content tab-area"><div class="wrapper"></div></div>';
jQuery.ui.tabs.defaults.tabTemplate = '<li><h3><a href="#{href}">#{label}</a></h3></li>';

/*
* @author Jon Hartman
* Handles the display of hidden HTML tool tips on hover of containing elements.
* Based on tool-tip code at http://net.tutsplus.com/tutorials/javascript-ajax/build-a-better-tooltip-with-jquery-awesomeness/
*/
$.fn.toolTip = function (options) {
    /* Setup the options for the tooltip that can be  
    accessed from outside the plugin              */
    var defaults = {
        top: 30,    // Vertical offset for the tool tip
        left: 90    // Horizontal offset for the tool tip
    };
    var options = $.extend(defaults, options);

    // Creates the code to display the tooltip
    getTip = function () {
        var tip = '<div id="toolTip">' +
		  '<div class="wrap">' +
		    '<div class="inner"></div>' +
			'</div>' +
			'<div class="bottom">&nbsp;</div>'
        '</div>';

        return tip;
    };

    // Append tooltip to body
    $('body').prepend(getTip());

    // Apply the hover event listener to each element in the set
    $(this).each(function () {
        var $this = $(this);
        var toolTip = $('#toolTip');

        // Hover
        $this.hover(function () {
            // Calculate Offset  
            var offset = $(this).offset();
            var tLeft = offset.left;
            var tTop = offset.top;

            // Copy hidden HTML into the tool tip element
            toolTip.find('.inner').html($this.find('.tooltip').html());

            // Move the tool tip to the hovered element
            setTip(tTop, tLeft);

            // Show the tool tip
            toolTip.show();
        },
			function () {
			    // Hide the tool tip
			    toolTip.hide();
			}
		);

        /* Position the tooltip relative to the class  
        associated with the tooltip                */
        setTip = function (top, left) {
            var toolTip = $('#toolTip');
            var xTip = (left + options.left) + "px";
            var yTip = (top + options.top) + "px";
            toolTip.css({ 'top': yTip, 'left': xTip, 'z-index': 9999 });
        }
    });
}

/*
* @authors Jon Hartmann, Jeremy Flores
* Plugin to even the height of tabs when one has multiple lines
*/
$.fn.fixTabs = function (options) {
    var defaults = {
        tabSelector: '.ui-state-default'
    };

    // Options
    var options = $.extend(defaults, options);

    $(this).each(function () {
        var $this = $(this);                      // Get Current Element
        var tabs = $(options.tabSelector, $this); // Get contained tabs
        var maxHeight = 0;                           // Create a default max height that is smaller than any possible tab

        // Loop over each tab and find the maximum height
        tabs.each(function () {
            var height = $(this).height();
            if (height > maxHeight)
                maxHeight = height;
        });
        // Set all tabs to that height;
        tabs.height(maxHeight);
    });
}

/*
* @authors Jon Hartmann, Jeremy Flores
* Plug-in to handle expandable/collapsible sections of HTML
*/
$.fn.expander = function (options, callback) {
    var defaults = {
        speed: 'slow',          // Animation speed for the slideUp/slideDown toggle
        opener: '.expander',    // Selector for the item that is clicked to open the expander, must be child of targeted element
        area: '.area',          // Select for the item that is expanded/collapsed, must be a child of targed element
        openerClass: 'closed'   // Class to be toggled on the opener, used to indicated open/closed state
    }
    var callback = callback;
    var options = $.extend(defaults, options);

    // Apply the event listener to each of the elements in the set
    $(this).each(function () {
        var $this = $(this);
        var area = $(options.area, $this);
        var opener = $(options.opener, $this);

        opener.click(function (event) {
            event.preventDefault();
            area.slideToggle(options.speed);

            // If the openerClass is declared, apply the openerClass
            if (options.openerClass)
                opener.toggleClass(options.openerClass);

            // If the callback is delared, call the callback
            if (callback) //throw the opener element to the callback
                callback(opener);
        })
    });
};

/*
* @author Jeremy Flores
* other_select, when attached to a select box, pops a sibling input field with similar
* attributes. Use it to record user input that falls outside the options provided in a
* select box.
*/
$.fn.other_select = function (options) {
    var defaults = {
        speed: 'normal', //rate at which the alternate input field appears/disappears
        nameSuffix: '_other', //suffix appended to the alternate input's name attribute
        idSuffix: '_other', //suffix appended to the alternate input's id attribute
        title: 'Other', //title text for the alternate input
        className: 'input', //need a specific class on the input? assign it here
        type: 'text', //it doesn't have to be a text field, but it probably should be
        popValue: 'other' //this is the value in the select options that pops the alternate input
    };

    var options = $.extend(defaults, options);

    $(this).each(function () {
        var $this = $(this);
        $this.bind('change', function () {
            if ($this.val() == options.popValue) { //user selected "Other" -> Pop the alternate input
                if ($this.siblings("#" + $this.attr('id') + options.idSuffix).size() == 0) {
                    //we don't have the sibiling selector built, so lets build it
                    var inputString = "<input style='display: none;' id='"
            + $this.attr('id') + options.idSuffix
            + "' type='" + options.type
            + "' name='" + $this.attr('name') + options.nameSuffix
            + "' title='" + options.title
            + "' class='" + options.className + "' />";
                    //and now lets insert it after the select box
                    $this.parent().append(inputString);
                }
                //show it!
                $this.siblings("#" + $this.attr('id') + options.idSuffix).fadeIn(options.speed);
            } else { //user selected a provided value -> Hide and clear the alternate input, if it exists
                if ($("#" + $this.attr('id') + options.idSuffix)) {
                    $("#" + $this.attr('id') + options.idSuffix).fadeOut(options.speed).val('');
                }
            }
        });
    });
};


/*
* @author Jon Hartmann
* Max length enforcement for textareas
*/
$.fn.maxlength = function (options) {
    var defaults = {
        length: 4000,
        on: 'keyup'
    };
    var options = $.extend(defaults, options);

    $(this).each(function () {
        var $this = $(this);

        $this.bind(options.on, function () {
            var text = $this.html().toString();

            if (text.length > options.length) {
                text = text.substr(0, options.length);
                $this.html(text);
            }
        });
    });
};

/*
* @author Michael Wheatley
* These functions drive navigation
*/
function createRequest() {
    var request = null;
    try {
        request = new XMLHttpRequest();
    } catch (trymicrosoft) {
        try {
            request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (othermicrosoft) {
            try {
                request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (failed) {
                request = null;
            }
        }
    }
    if (request == null) {
        alert("Your browser does not support XMLHttpRequest");
    } else {
        return request;
    }
}
var devKeepMenusOpen = false; // Use to prevent menus from going away.  This line can safely be removed at the end of development.
var flyoutShowing = false;
var allowFade = true;
var maskHeight = 0;
var lastPanel0;
var lastPanel1;
var fromPanel1 = false;
var fromPanel2 = false;
var preventPanel2 = true;
var buttonOver = 0;
var t; // Used to prevent menu showing when trying to reach search box
var menuToLaunch = "";
var triggered = false;
var servicesTwoTier = false; // Drives positioning of the Services sub menu
var menuHeightArray = new Array(0, 0, 0);
var htmlBlock = "";
var menuRequest = createRequest();
if (typeof (menuToLoad) === "undefined") {
    var menuToLoad = "germanmenu.xml";
}
// Following gets rid of the z-index problem for form elements in IE6:
(function ($) { $.fn.bgIframe = $.fn.bgiframe = function (s) { if ($.browser.msie && /6.0/.test(navigator.userAgent)) { s = $.extend({ top: 'auto', left: 'auto', width: 'auto', height: 'auto', opacity: true, src: 'javascript:false;' }, s || {}); var prop = function (n) { return n && n.constructor == Number ? n + 'px' : n; }, html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"' + 'style="display:block;position:absolute;z-index:-1;' + (s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') + 'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' + 'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' + 'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth+\'px\')' : prop(s.width)) + ';' + 'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' + '"/>'; return this.each(function () { if ($('> iframe.bgiframe', this).length == 0) this.insertBefore(document.createElement(html), this.firstChild); }); } return this; }; })(jQuery);
$(function () {
    primePage();
});
function calcScreenHeight() {
    maskHeight = ($("body").height() - 96) + "px";
}
function delayLaunch() {
    launchMenu(menuToLaunch);
}
function primePage() {
    $("#menuContainer").bgiframe();
    $('<div id="menuFade"></div>').prependTo("#menuContainer").css("opacity", 0);
    // Create the highlights and menu adds:
    $(".regMenu").mouseover(function () {
        clearTimeout(t);
        $(".regMenu, .dropMenu").removeClass("dropMenuOver").removeClass("menuOver");
        $(this).addClass("menuOver");
        dropMenus();
    });
    $(".dropMenu").mouseover(function () {
        clearTimeout(t);
        $(".regMenu, .dropMenu").removeClass("dropMenuOver").removeClass("menuOver");
        $(this).addClass("dropMenuOver");
        //launchMenu(this.id);
        menuToLaunch = this.id;
        allowFade = false;
        if (!triggered) {
            t = setTimeout("delayLaunch()", 400);
        } else {
            launchMenu(this.id);
        }
    });
    // Hide the highlights and menu hides:
    $(".regMenu, .dropMenu").mouseout(function () {
        clearTimeout(t);
        $(this).removeClass("menuOver");
        hideMenus();
    });
    $(".regMenu, .noSub").click(function () { // Makes whole button act as link without losing SEO
        //window.location = this.firstChild;
        var m_Url;
        if (this.childNodes[1] != null)
        {
            m_Url = this.childNodes[1].toString();
        }
        else
        {
            m_Url = this.firstChild.toString();
        }
        
        if ($.trim(m_Url) != "")
        {
            if (m_Url.indexOf("http://www.thermo.com.cn") != -1 && m_Url != "http://www.thermo.com.cn/bbs")
            {
                window.location = m_Url;
            }
            else
            {
                window.open(m_Url);
            }
            return false;
        }
    });
    // Code for the dropdown:
    $("#panel0 div.subHolder div, #panel1 div.subHolder div, #panel2 div.subHolder div").mouseover(function () {
        $(this).addClass("over");
    });
    $("#panel0 div.subHolder div").mouseover(function () {
        if (fromPanel1 && lastPanel0 != this) {
            $(lastPanel0).removeClass("over");
            fromPanel1 = false;
        }
        lastPanel0 = this;
        if ($(this).hasClass("hasSub")) {
            $("#panel1 .subHolder").hide();
            $("#sub1_" + this.id.substr(7)).show();
            preventPanel2 = false;
            $("#slider1").stop().animate({ left: "314px" }, function () {
                $("#menuBottomShadow").stop().css("width", "598px");
            });
        } else {
            preventPanel2 = true;
            $("#menuBottomShadow").stop().css("width", "330px");
            $("#slider1").stop().animate({ left: "46px" });
            //$("#menuBottomShadow").stop().css("width", "330px");
        }
        $("#slider2").stop().animate({ left: "0px" });
    });
    $("#panel1 div.subHolder div").mouseover(function () {
        if (fromPanel2 && lastPanel1 != this) {
            $(lastPanel1).removeClass("over");
            fromPanel2 = false;
        }
        lastPanel1 = this;
        if ($(this).hasClass("hasSub") && !preventPanel2) {
            $("#panel2 .subHolder").hide();
            $("#sub2_" + this.id.substr(7)).show();
            $("#slider2").stop().animate({ left: "268px" }, function () {
                $("#menuBottomShadow").stop().css("width", "866px");
            });
            //$("#menuBottomShadow").stop().animate({width: "866px"});
        } else {
            $("#menuBottomShadow").stop().css("width", "598px");
            //$("#menuBottomShadow").stop().animate({width: "598px"});
            $("#slider2").stop().animate({ left: "0px" });
        }
    });
    $("#panel1").mouseover(function () {
        fromPanel1 = true;
        $(lastPanel0).addClass("over");
    });
    $("#panel2").mouseover(function () {
        fromPanel2 = true;
        $(lastPanel1).addClass("over");
    });
    $("#panel0 div.subHolder div, #panel1 div.subHolder div, #panel2 div").mouseout(function () {
        $(this).removeClass("over");
    });
    for (var i = 0; i < 5; i++) {
        menuHeightArray[i] = $("#sub0_" + i).height();
        $("#sub0_" + i + " .hasSub").each(function () {
            var p1Id = this.id.substr(7);
            menuHeightArray[i] = Math.max(menuHeightArray[i], $("#sub1_" + p1Id).height());
            $("#sub1_" + p1Id + " .hasSub").each(function () {
                menuHeightArray[i] = Math.max(menuHeightArray[i], $("#sub2_" + this.id.substr(7)).height());
            });
        });
    }
    calcScreenHeight();
    $("#menuHolder").hide();
    $("#menuHolder").css("visibility", "visible");
    $(window).resize(calcScreenHeight);
};
function launchMenu(index) {
    allowFade = false;
    triggered = true;
    buttonOver = parseInt(index.substr(index.length - 1));
    $("#menuContainer").css("height", maskHeight); // Sets the height of the fadeout to real height of page.  Elegent hack for IE5/6
    $("#menuBottomShadow").stop().css({ "width": "330px", "top": (menuHeightArray[buttonOver] + 44) + "px" });
    $("#panelsHolder, #panel0, #panel1, #panel2").css("height", (menuHeightArray[buttonOver] + 27) + "px"); // sets the height of the dropdown menu
    $("#newShadow").css("height", (menuHeightArray[buttonOver] + 44) + "px");
    switch (buttonOver) {
        case 0:
        case 1:
            $("#menuHolder").css({ "left": "86px" });
            break;
        case 2:
            $("#menuHolder").css({ "left": servicesTwoTier ? "3500px" : "390px" });
            break;
        case 3:
            $("#menuHolder").css({ "left": servicesTwoTier ? "420px" : "460px" });
            break;
        case 4:
            $("#menuHolder").css({ "left": servicesTwoTier ? "500px" : "540px" });
            break;
    }
    $("#slider1").stop().css({ left: "46px" });
    $("#slider2").stop().css({ left: "0px" });
    $("#panel0 div, #panel1 div").removeClass("over");
    $("#menuHolder").slideDown();
    $("#menuFade").stop().animate({ "opacity": 0.6 });
    $("#panel0 .subHolder, #panel1 .subHolder, #panel2 .subHolder").hide();
    $("#sub0_" + buttonOver).show();
}
function hideMenus() {
    allowFade = true;
    setTimeout("performFadeout()", 100);
}
function performFadeout() {
    if (allowFade && !flyoutShowing) {
        dropMenus();
    }
}
function dropMenus() {
    if (typeof (devKeepMenusOpen) == "undefined" || !devKeepMenusOpen) {
        allowFade = true;
        $("#menuHolder").slideUp(function () {
            if (allowFade) {
                // Need this check because it could still get overridden by another call to launchMenus() during the timeout period
                $(".dropMenu").removeClass("dropMenuOver");
                triggered = false;
            }
        });
        $("#slider1").stop().css({ left: "46px" });
        $("#slider2").stop().css({ left: "0px" });
        $("#panel0 div, #panel1 div").removeClass("over");
        $("#menuFade").stop().animate({ "opacity": 0 }, (function () {
            $("#menuContainer").css("height", "0px");
        }));
    }
}
function setFlyoutCovered(bool) {
    flyoutShowing = bool;
    if (bool) {
        $("#drop" + buttonOver).addClass("dropMenuOver");
    } else {
        hideMenus();
    }
}






/* Greybox Redux
* Required: http://jquery.com/
* Written by: John Resig
* Based on code by: 4mir Salihefendic (http://amix.dk)
* License: LGPL (read more in LGPL.txt)
*/

var GB_DONE = false;
var GB_HEIGHT = 400;
var GB_WIDTH = 200;

function GB_show(caption, url, height, width)
{
    GB_HEIGHT = height || 400;
    GB_WIDTH = width || 200;
    if (!GB_DONE)
    {
        $(document.body)
      .append("<div id='GB_overlay'></div><div id='GB_window'><div id='GB_caption'></div>"
        + "<img src='image/close.gif' alt='关闭窗口'/></div>");
        $("#GB_window img").click(GB_hide);
        $("#GB_overlay").click(GB_hide);
        $(window).resize(GB_position);
        GB_DONE = true;
    }

    $("#GB_frame").remove();
    $("#GB_window").append("<iframe id='GB_frame' frameborder='0' scrolling='no' src='" + url + "'></iframe>");

    $("#GB_caption").html(caption);
    $("#GB_overlay").show();
    GB_position();

    if (GB_ANIMATION)
        $("#GB_window").slideDown("slow");
    else
        $("#GB_window").show();
}

function GB_hide()
{
    $("#GB_window,#GB_overlay").hide();
}

function GB_position()
{
    var de = document.documentElement;
    var w = self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    $("#GB_window").css({ width: GB_WIDTH + "px", height: GB_HEIGHT + "px",
        left: ((w - GB_WIDTH) / 2 + 65) + "px"
    });
    $("#GB_frame").css("height", GB_HEIGHT - 32 + "px");
}




function clearAll()
{
    var chks = document.getElementsByTagName("INPUT");
    for (var i = 0; i < chks.length; i++)
    {
        if (chks[i].type == "checkbox")
            chks[i].checked = false;
        else if (chks[i].type == "text" || chks[i].type == "password")
        {
            chks[i].value = "";
        }
    }

    chks = document.getElementsByTagName("textarea");
    for (var i = 0; i < chks.length; i++)
    {
        chks[i].value = "";
    }
}



var mm = 100;
var pk = 1;
var num = 0;

function shan()
{
    if (num < 60)
    {
        var foy = document.getElementById("foy");
        foy.style.filter = "Alpha(Opacity=" + mm + ")";
        if (pk == 1) { mm -= 10; } else { mm += 10; }
        if (foy.style.filter == "Alpha(Opacity=0)")
        {
            pk = 0;
        } else if (foy.style.filter == "Alpha(Opacity=100)") { pk = 1; }
        setTimeout("shan()", 10);
        num += 1;
    }
    else
    {
        document.getElementById("d2").style.display = "none";
        document.getElementById("d3").style.display = "none";
    }
}

window.onload = function ()
{
    setTimeout("shan()", 10);
}

function fun()
{
    document.getElementById("d2").style.display = "none";
    document.getElementById("d3").style.display = "none";
}



// Following function is for opening popups on the site:
var popUpWin = 0;
function newWin(URLStr, left, top, width, height) {
    if (popUpWin) {
        try {
            bClosed = popUpWin.closed; // For IE bug with "unclosed" windows
        }
        catch (e) {
            bClosed = true;
        }
        if (!bClosed) popUpWin.close();
    }
    popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=0,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
}
// Following is to put Flash on pages without the "double call":
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; function ControlVersion() { var version; var axo; var e; try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version") } catch (e) { } if (!version) { try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); version = "WIN 6,0,21,0"; axo.AllowScriptAccess = "always"; version = axo.GetVariable("$version") } catch (e) { } } if (!version) { try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version") } catch (e) { } } if (!version) { try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0" } catch (e) { } } if (!version) { try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); version = "WIN 2,0,0,11" } catch (e) { version = -1 } } return version } function GetSwfVer() { var flashVer = -1; if (navigator.plugins != null && navigator.plugins.length > 0) { if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; var descArray = flashDescription.split(" "); var tempArrayMajor = descArray[2].split("."); var versionMajor = tempArrayMajor[0]; var versionMinor = tempArrayMajor[1]; var versionRevision = descArray[3]; if (versionRevision == "") { versionRevision = descArray[4] } if (versionRevision[0] == "d") { versionRevision = versionRevision.substring(1) } else if (versionRevision[0] == "r") { versionRevision = versionRevision.substring(1); if (versionRevision.indexOf("d") > 0) { versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")) } } var flashVer = versionMajor + "." + versionMinor + "." + versionRevision } } else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; else if (isIE && isWin && !isOpera) { flashVer = ControlVersion() } return flashVer } function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) { versionStr = GetSwfVer(); if (versionStr == -1) { return false } else if (versionStr != 0) { if (isIE && isWin && !isOpera) { tempArray = versionStr.split(" "); tempString = tempArray[1]; versionArray = tempString.split(",") } else { versionArray = versionStr.split(".") } var versionMajor = versionArray[0]; var versionMinor = versionArray[1]; var versionRevision = versionArray[2]; if (versionMajor > parseFloat(reqMajorVer)) { return true } else if (versionMajor == parseFloat(reqMajorVer)) { if (versionMinor > parseFloat(reqMinorVer)) return true; else if (versionMinor == parseFloat(reqMinorVer)) { if (versionRevision >= parseFloat(reqRevision)) return true } } return false } } function AC_AddExtension(src, ext) { if (src.indexOf('?') != -1) return src.replace(/\?/, ext + '?'); else return src + ext } function AC_Generateobj(objAttrs, params, embedAttrs) { var str = ''; if (isIE && isWin && !isOpera) { str += '<object '; for (var i in objAttrs) { str += i + '="' + objAttrs[i] + '" ' } str += '>'; for (var i in params) { str += '<param name="' + i + '" value="' + params[i] + '" /> ' } str += '</object>' } else { str += '<embed '; for (var i in embedAttrs) { str += i + '="' + embedAttrs[i] + '" ' } str += '> </embed>' } document.write(str) } function AC_FL_RunContent() { var ret = AC_GetArgs(arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash"); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs) } function AC_SW_RunContent() { var ret = AC_GetArgs(arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000", null); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs) } function AC_GetArgs(args, ext, srcParamName, classid, mimeType) { var ret = new Object(); ret.embedAttrs = new Object(); ret.params = new Object(); ret.objAttrs = new Object(); for (var i = 0; i < args.length; i = i + 2) { var currArg = args[i].toLowerCase(); switch (currArg) { case "classid": break; case "pluginspage": ret.embedAttrs[args[i]] = args[i + 1]; break; case "src": case "movie": args[i + 1] = AC_AddExtension(args[i + 1], ext); ret.embedAttrs["src"] = args[i + 1]; ret.params[srcParamName] = args[i + 1]; break; case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblclick": case "ondrag": case "ondragend": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": case "type": case "codebase": case "id": ret.objAttrs[args[i]] = args[i + 1]; break; case "width": case "height": case "align": case "vspace": case "hspace": case "class": case "title": case "accesskey": case "name": case "tabindex": ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i + 1]; break; default: ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i + 1] } } ret.objAttrs["classid"] = classid; if (mimeType) ret.embedAttrs["type"] = mimeType; return ret };
var MM_contentVersion = 9; var MM_FlashCanPlay; var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0; if (plugin) { var words = navigator.plugins["Shockwave Flash"].description.split(" "); for (var i = 0; i < words.length; ++i) { if (isNaN(parseInt(words[i]))) { continue } var MM_PluginVersion = words[i] } MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion } else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1)) { document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); document.write('on error resume next \n'); document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n'); document.write('</SCR' + 'IPT\> \n') };
function flashLink(linkToGet) {
    window.location = linkToGet;
}

function DrawImg(ImgD, ThumbnailWidth, ThumbnailHeight) {
    if (ImgD.width > ThumbnailWidth || ImgD.height > ThumbnailHeight) {
        var xImage = new Image();
        xImage.src = ImgD.src;
        var iScale = (xImage.width * 1.0 / ThumbnailWidth) > (xImage.height * 1.0 / ThumbnailHeight) ? (xImage.width * 1.0 / ThumbnailWidth) : (xImage.height * 1.0 / ThumbnailHeight);
        ImgD.width = xImage.width / iScale;
        ImgD.height = xImage.height / iScale;
        //ImgD.alt=xImage.width+"x"+xImage.height;
    }
}
