var current="cp_tab_1";function show(A){    $("#"+current).css("display","none");$("#"+A).css("display","block");current=A;}function cp_init_sIFR(){    if(typeof sIFR !='undefined'){    /*        sIFR.replace(header, {            selector: 'div.tab1 span.intro'            ,            css: '.sIFR-root {background-color:#FFFFFF;color:#01b5cc;font-size:33px;}'            ,            wmode: 'transparent'        });        sIFR.replace(header, {            selector: 'div.tab1 h2'            ,            css: '.sIFR-root {background-color:#FFFFFF;color:#01b5cc;font-size:33px;}'            ,            wmode: 'transparent'        });            sIFR.replace(header, {            selector: '.tab_content h2'            ,            css: '.sIFR-root {background-color:#FFFFFF;color:#01b5cc;font-size:33px;}'            ,            wmode: 'transparent'        });    	sIFR.replace(header, {		selector: '#p-rcb h3'		,css: '.sIFR-root {background-color:#FFFFFF;color:#7CBD2A;font-size:20px;}'		,wmode: 'transparent'	});	sIFR.replace(header, {		selector: '#p-rcb h4'		,css: '.sIFR-root {background-color:#FFFFFF;color:#005c1f;font-size:22px;}'		,wmode: 'transparent'	});	sIFR.replace(header, {		selector: '#p-rcb h5'		,css: '.sIFR-root {background-color:#FFFFFF;color:#005c1f;font-size:22px;}'		,wmode: 'transparent'	});	sIFR.replace(header, {		selector: '#p-rcb h6'		,css: '.sIFR-root {background-color:#FFFFFF;color:#FFFFFF;font-size:22px;}'		,wmode: 'transparent'	});*/    }    // get variable from location    var userRequestedTab = $.jget['tab'];    // find index from universal tab names    for (var i = 0; i < universalTabNames.length; i++) {        if (universalTabNames[i] == userRequestedTab)            userRequestedTab = i;    }    // needs to wait to make sure sifr has kicked in.    setTimeout("cp_setTab('"+userRequestedTab+"')", "10");}/* setup other swf files */function cp_init_swfobject(){}// <TABS LOGIC>var __currentTabIndex;/* * show a tab and hides others * * @var integer || string that can be parsed into a integer */function cp_setTab(value) {    if (typeof value == 'undefined')        value = 0;    if (!parseInt(value))        value = 0;    if (value >= $('#p-rcb #cp_wrap_tab_productdetails li').length)        value = 0;    if (__currentTabIndex == value)        return;    // hide all    for (var i = 0; i < $('#p-rcb #cp_wrap_tab_productdetails li').length; i++) {        if (i == value) {            $('#cp_tab_'+(i+1)).addClass('cp_active');            $('#cp_tab_'+(i+1)).removeClass('cp_inactive');            $('#cp_tab_content_'+(i+1)).show();        } else {            $('#cp_tab_'+(i+1)).addClass('cp_inactive');            $('#cp_tab_'+(i+1)).removeClass('cp_active');            $('#cp_tab_content_'+(i+1)).hide();        //alert("yeah");        }    }        // remember last set index    __currentTabIndex = value;    // change the header    cp_setHeader(value);    // ping statistics    cp_sendStatistics(value);    // replace the title with a sifr one    sifrReplaceWork(value+1);   }var __currentHeaderSRC;/* * changes the header swf * * @var integer, the index of the availableHeadersSRC global */function cp_setHeader(value) {		if (typeof availableHeadersSRC[value] == undefined)		return false;	var src = availableHeadersSRC[value];	if (src == __currentHeaderSRC)		return false;	__currentHeaderSRC = src;		// Change placeholder image	var placeholderSrc = "url(/consumerfiles/pageitems/master/categorypages/GarmentCare/assets/images/videoPlayer_Tab" + (value + 1) +"_placeholder.jpg) no-repeat 0px 0px";	$("#flashcontent_header").css("background", placeholderSrc);		// SWFObject 2	$.testBandwidth(function(status){        if (status == "medium" || status == "high" || status == "vhigh") {            var flashvars = { bandwidth : status };            var params = {                menu: "false",                wmode: "transparent",				allowScriptAccess: "true",                allowfullscreen: "true"            };            var attributes = {};            swfobject.embedSWF(src, "flash-inner-wrapper", "960", "275", "9.0.0","expressInstall.swf", flashvars, params, attributes);        }    });}/* * Send statictics when the user interacts with the tabs. */var __statsHaveNotBeenSendViaTabInteraction = true;function cp_sendStatistics(value) {    if (typeof s != 'object')        return;    // normalize tab values;    if (typeof universalTabNames[value] != 'undefined')        value = universalTabNames[value];    else        value = "TAB" + value;    if (!__statsHaveNotBeenSendViaTabInteraction) {        var PRODUCTSUBCATEGORY = cp_getMetrics('PRODUCTSUBCATEGORY');        var DIVISION = cp_getMetrics('DIVISION');        var SECTION = cp_getMetrics('SECTION');        var CATALOGTYPE = cp_getMetrics('CATALOGTYPE');        var PRODUCTGROUP = cp_getMetrics('PRODUCTGROUP');        var PRODUCTCATEGORY = cp_getMetrics('PRODUCTCATEGORY');        if (PRODUCTSUBCATEGORY != "") {            var TABSECTION = PRODUCTSUBCATEGORY + '_' + value;            s.pageName = DIVISION + ":" + SECTION + ":" + TABSECTION + ":" + CATALOGTYPE;        } else if (PRODUCTCATEGORY != "") {            var TABSECTION = PRODUCTCATEGORY + '_' + value;            s.pageName = DIVISION + ":" + SECTION + ":" + TABSECTION + ":" + CATALOGTYPE;        }        s.t();    }    __statsHaveNotBeenSendViaTabInteraction = false;}function cp_getMetrics(metric) {    var content = $("meta[name='PHILIPS.METRICS."+metric+"']").attr("content");    if (typeof content == 'undefined' || content == null)        return '';    else        return content;}// </TABS LOGIC>$(document).ready(function() {    //sIFR needs a timeout for safari or sometimes sIFR won't behave correctly    setTimeout("cp_init_sIFR()", "1000");    cp_init_swfobject();    tooltipsSetup();    tabsSetup();    stainLibrarySetup();    makeBlocksEvenHeight();    verticalCentreTooltipPanelText();    makeOverviewBlocksClickable();    verticalCentreTooltipPanelText();    cp_setTab(0);    });/* * Bandwidth detection */(function($){  $.bandwidth = null;  $.bandwidthTestEndpoint = 'http://test.philips.com/esi/getbw_js_tpi.esi';  $.testBandwidth = function(cb){    if ($.bandwidth) {      cb($.bandwidth);    } else {      $.onBandwidthTested = cb;      $.getScript($.bandwidthTestEndpoint);    }  }})(jQuery);/** * jget plugin * @author Alexandre Magno * @desc get a query string to be accessible for javascript * @version 1.0 * @example * * http://www.foo.com/test.php?var1=test1 * var outputQuery = $.jget['var1']; * $.debug(outputQuery); * //Will show 'test1' * * * @license free * @param bool vertical, bool horizontal * @site http://blog.alexandremagno.net * */jQuery.extend({    //starting the jget object    jget: {},    //get the url    url: window.location.href.replace(/^[^\?]+\??/,''),    //get the queryString    parseQuery: function ( query ) {        var Params = {};        if ( ! query ) {            return Params;        }// return empty object        var Pairs = query.split(/[;&]/);        for ( var i = 0; i < Pairs.length; i++ ) {            var KeyVal = Pairs[i].split('=');            if ( ! KeyVal || KeyVal.length != 2 ) {                continue;            }            var key = unescape( KeyVal[0] );            var val = unescape( KeyVal[1] );            val = val.replace(/\+/g, ' ');            Params[key] = val;        }        return Params;    },    //Make the jget object available to jQuery.extend    getQueryString: function() {        this.jget = this.parseQuery(this.url);    },    //debugging    debug: function(message) {        if(!$.browser.msie) {            console.info(message);        } else if($.browser.safari) {            window.console.log(message);        } else {            alert(message);        }    }});//start the plugin$.getQueryString();// DIV POPUPfunction showOverlay(element, div, left, top)//, text){    var e = document.getElementById(element);    var d = document.getElementById(div);    //var t = document.getElementById('overlay_text');    d.style.display = '';    //t.innerHTML = text;    var divheight = 0;    if(d.offsetHeight) {        divheight = d.offsetHeight;    }    else if(d.style.pixelHeight) {        divheight = d.style.pixelHeight;    }    //left 18 top 50    d.style.left = (findPosX(e) - (-left)) + "px";    d.style.top = (findPosY(e) - (-top) - divheight) + "px";}function hideMe(div){    var d = document.getElementById(div);    d.style.display = 'none';}function findPosX(obj){    var curleft = 0;    if(obj.offsetParent)        while(1)        {            curleft += obj.offsetLeft;            if(!obj.offsetParent)                break;            obj = obj.offsetParent;        }    else if(obj.x)        curleft += obj.x;    return curleft;}function findPosY(obj){    var curtop = 0;    if(obj.offsetParent)        while(1)        {            curtop += obj.offsetTop;            if(!obj.offsetParent)                break;            obj = obj.offsetParent;        }    else if(obj.y)        curtop += obj.y;    return curtop;}/************************************************************************* * Tab 1 - Blocks *************************************************************************/function makeBlocksEvenHeight() {    var x1 = $('div.tab1 div.blocks div.block1').height();    var x2 = $('div.tab1 div.blocks div.block2').height();    var x3 = x2-x1;    if (x3 < 0) {        x3 = x3-(2 * x3);    }    if (x3 != 0){        if(x1 > x2){            $('div.tab1 div.blocks div.block2 div.block2_top').height($('div.tab1 div.blocks div.block2 div.block2_top').height()+x3);        } else if (x2 > x1) {            $('div.tab1 div.blocks div.block1 div.block1_top').height($('div.tab1 div.blocks div.block1 div.block1_top').height()+x3);        }    }}/************************************************************************* * Tab 3 - Tooltip *************************************************************************/function tooltipsSetup(){    var tooltip_button = $("div.tab3 div.tooltip_block ul li a");    var tooltip_caption = "";    var tooltip_all_captions = $("div.tab3 div.tooltip_block ul li div.tt_header");	var yOffset;    var xOffset;    tooltip_all_captions.hide();        $(tooltip_button).hover(        function(e) {            tooltip_all_captions.hide();            tooltip_caption = $(this).siblings("div.tt_header");            xOffset = -(tooltip_caption.width()/2)-135;            yOffset = tooltip_caption.height()+120;						            $(tooltip_caption)            .css("position","absolute")            .css("top",(e.pageY - yOffset) + "px")            .css("left",(e.pageX + xOffset) + "px")            .show();        },        function() {            $(tooltip_caption).css("display","none");        });    $(tooltip_button).mousemove(function(e){        $(tooltip_caption)        .css("top",(e.pageY - yOffset) + "px")        .css("left",(e.pageX + xOffset) + "px");    });    // disable click    $(tooltip_button).click(function(){         return false;    });}/************************************************************************* * Tab 3 - Tabs *************************************************************************/function tabsSetup() {    // set up some quick access variables    var tab_buttons = 'div.tab3 div.section2 ul.section2_tabs_menu li a';    var all_tabs = 'div.tab3 div.section2 div.section2_tabs_tab_content div';    // tab menu click action    $(tab_buttons).click(function() {        switchTabs($(this));               return false;    });    // switches between tabs    function switchTabs(clickedTab) {        // reset the tabs        resetTabs();        // get the target tab        var target_tab = clickedTab.attr('href').replace('#', '');        // show it        $(all_tabs+'.'+target_tab).fadeIn(300);        // add the active class to the parent        clickedTab.parent('li').addClass('active');    }    // hide all tabs, and remove the active class    function resetTabs() {        $(tab_buttons).parent('li').removeClass('active');        $(all_tabs).hide();    }    // activate the first tab    $(tab_buttons.replace('li', 'li:first')).click();}/************************************************************************* * Tab 3 - Stain library *************************************************************************/function stainLibrarySetup() {    // setup some vars    var allStains   = 'div.tab3 div.section3 div.left_column div.stain_solutions div';    var stainList   = 'div.tab3 div.section3 div.left_column select.stain_list';    var stainButton = 'div.tab3 div.section3 div.left_column a.stain_button';    // when the button is clicked     $(stainButton).click(function(){        switchStain($(stainList).attr('value'));               return false;    });    // switch the stain    function switchStain(targetStain) {        if($(allStains+'.'+targetStain).css('display') == 'none') {            // reset the stains            resetStains();            // show me the stain            $(allStains+'.'+targetStain).fadeIn(300);        }    }    // reset     function resetStains() {        $(allStains).hide();    }    resetStains();}function sifrReplaceWork(tabVal) {    sIFR.replace(header, {        selector: 'div.tab' + tabVal + ' h2'        ,        css: '.sIFR-root {background-color:#FFFFFF;color:#01b5cc;font-size:33px;}'        ,        wmode: 'transparent'    });    sIFR.replace(header, {        selector: 'div.tab1 span.intro'        ,        css: '.sIFR-root {background-color:#FFFFFF;color:#01b5cc;font-size:33px;}'        ,        wmode: 'transparent'    });}function verticalCentreTooltipPanelText() {    $('div.tab3 div.section1 div.tooltip_block ul li.tl_panel a').each(function(){        var toMove = ($(this).height()/2) - (($(this).children('span').height())/2);        $(this).children('span').css('padding-top', toMove+'px').css('display', 'block');    });}function makeOverviewBlocksClickable(){    $('div.tab1 div.blocks div.block1, div.tab1 div.blocks div.block2').css('cursor', 'pointer');    $('div.tab1 div.blocks div.block1').click(function(){        $('li#cp_tab_2 a').click();    });    $('div.tab1 div.blocks div.block2').click(function(){        $('li#cp_tab_3 a').click();    });}