var MetrixLabGLOB_IsCalled=false;
var MetrixLabGLOB_CountryLanguage_Allowed = false;
var MetrixLab_Channel = escape(window.location.href);
//P08855 intercepts
var MetrixLabGLOB_CountryIntercept_ar_es=0;
var MetrixLabGLOB_CountryIntercept_au_en=0;
var MetrixLabGLOB_CountryIntercept_be_nl=0;
var MetrixLabGLOB_CountryIntercept_be_fr=0;
var MetrixLabGLOB_CountryIntercept_br_pt=0;
var MetrixLabGLOB_CountryIntercept_ca_en=0;
var MetrixLabGLOB_CountryIntercept_ca_fr=0;
var MetrixLabGLOB_CountryIntercept_cn_zh=0;
var MetrixLabGLOB_CountryIntercept_cz_cs=0;
var MetrixLabGLOB_CountryIntercept_fr_fr=0;
var MetrixLabGLOB_CountryIntercept_de_de=0;
var MetrixLabGLOB_CountryIntercept_global_en=0;
var MetrixLabGLOB_CountryIntercept_in_en=0;
var MetrixLabGLOB_CountryIntercept_it_it=0;
var MetrixLabGLOB_CountryIntercept_jp_ja=0;
var MetrixLabGLOB_CountryIntercept_kr_ko=0;
var MetrixLabGLOB_CountryIntercept_my_en=0;
var MetrixLabGLOB_CountryIntercept_me_en=0;
var MetrixLabGLOB_CountryIntercept_mx_es=0;
var MetrixLabGLOB_CountryIntercept_nl_nl=0;
var MetrixLabGLOB_CountryIntercept_pl_pl=0;
var MetrixLabGLOB_CountryIntercept_ru_ru=0;
var MetrixLabGLOB_CountryIntercept_es_es=0;
var MetrixLabGLOB_CountryIntercept_se_sv=0;
var MetrixLabGLOB_CountryIntercept_tw_zh=0;
var MetrixLabGLOB_CountryIntercept_tr_tr=0;
var MetrixLabGLOB_CountryIntercept_gb_en=0;
var MetrixLabGLOB_CountryIntercept_us_en=0;
//

//P08157 intercepts
var MetrixLabGLOB_Intercept_p08157_web_ar_es_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_be_fr_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_be_nl_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_br_pt_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_ca_en_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_ca_fr_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_cn_zh_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_cz_cs_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_de_de_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_dk_da_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_es_es_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_fi_fi_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_fr_fr_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_gb_en_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_global_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_gr_el_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_hk_en_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_in_en_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_it_it_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_jp_ja_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_kr_ko_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_mx_es_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_nl_nl_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_no_no_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_pl_pl_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_pt_pt_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_ru_ru_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_se_sv_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_sg_en_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_tr_tr_sms=1;
var MetrixLabGLOB_Intercept_p08157_web_us_en_sms=1;
//

//P09787 chat intercepts
var MetrixLabGLOB_Intercept_p09787_gb_en=0;
var MetrixLabGLOB_Intercept_p09787_de_de=0;
var MetrixLabGLOB_Intercept_p09787_nl_nl=0;
var MetrixLabGLOB_Intercept_p09787_es_es=0;
var MetrixLabGLOB_Intercept_p09787_br_pt=0;
var MetrixLabGLOB_Intercept_p09787_cn_zh=0;
var MetrixLabGLOB_Intercept_p09787_fr_fr=0;
//

//P08492_concu_fr intercepts
var MetrixLabGLOB_Intercept_p08492_concu_fr_fr=1;
//

//PrivacyURLs
var MetrixLabGLOB_PrivacyURL_ar_es='http://www.philips.com.ar/about/index.page';
var MetrixLabGLOB_PrivacyURL_au_en='http://www.philips.com.au/about/index.page';
var MetrixLabGLOB_PrivacyURL_be_nl='http://www.philips.be/about/index.page';
var MetrixLabGLOB_PrivacyURL_be_fr='http://www.philips.be/fr/about/index.page';
var MetrixLabGLOB_PrivacyURL_br_pt='http://www.philips.com.br/about/index.page';
var MetrixLabGLOB_PrivacyURL_ca_en='http://www.philips.ca/about/index.page';
var MetrixLabGLOB_PrivacyURL_ca_fr='http://www.philips.ca/fr/about/index.page';
var MetrixLabGLOB_PrivacyURL_cn_zh='http://www.philips.com.cn/about/index.page';
var MetrixLabGLOB_PrivacyURL_cz_cs='http://www.philips.cz/about/index.page';
var MetrixLabGLOB_PrivacyURL_fr_fr='http://www.philips.fr/about/index.page';
var MetrixLabGLOB_PrivacyURL_de_de='http://www.philips.de/about/index.page';
var MetrixLabGLOB_PrivacyURL_global_en='http://www.philips.com/about/index.page';
var MetrixLabGLOB_PrivacyURL_in_en='http://www.india.philips.com/about/index.page';
var MetrixLabGLOB_PrivacyURL_it_it='http://www.philips.it/about/index.page';
var MetrixLabGLOB_PrivacyURL_jp_ja='http://www.philips.co.jp/about/index.page';
var MetrixLabGLOB_PrivacyURL_kr_ko='http://www.philips.co.kr/about/index.page';
var MetrixLabGLOB_PrivacyURL_my_en='http://www.philips.com.my/about/index.page';
var MetrixLabGLOB_PrivacyURL_me_en='http://www.mea.philips.com/about/index.page';
var MetrixLabGLOB_PrivacyURL_mx_es='http://www.philips.com.mx/about/index.page';
var MetrixLabGLOB_PrivacyURL_nl_nl='http://www.philips.nl/about/index.page';
var MetrixLabGLOB_PrivacyURL_pl_pl='http://www.philips.pl/about/index.page';
var MetrixLabGLOB_PrivacyURL_ru_ru='http://www.philips.ru/about/index.page';
var MetrixLabGLOB_PrivacyURL_es_es='http://www.philips.es/about/index.page';
var MetrixLabGLOB_PrivacyURL_se_sv='http://www.philips.se/about/index.page';
var MetrixLabGLOB_PrivacyURL_tw_zh='http://www.philips.com.tw/about/index.page';
var MetrixLabGLOB_PrivacyURL_tr_tr='http://www.turkey.philips.com/about/index.page';
var MetrixLabGLOB_PrivacyURL_gb_en='http://www.philips.co.uk/privacypolicy/index.page';
var MetrixLabGLOB_PrivacyURL_us_en='http://www.usa.philips.com/about/index.page';
//

//Show More Button coordinates
var MetrixLabGLOB_Coordinate_MoreButton_ar_es='103,194,221,206';
var MetrixLabGLOB_Coordinate_MoreButton_au_en='51,194,128,206';
var MetrixLabGLOB_Coordinate_MoreButton_be_nl='53,197,103,210';
var MetrixLabGLOB_Coordinate_MoreButton_be_fr='112,197,177,206';
var MetrixLabGLOB_Coordinate_MoreButton_br_pt='54,189,124,200';
var MetrixLabGLOB_Coordinate_MoreButton_ca_en='51,194,128,206';
var MetrixLabGLOB_Coordinate_MoreButton_ca_fr='113,195,174,206';
var MetrixLabGLOB_Coordinate_MoreButton_cn_zh='190,180,243,195';
var MetrixLabGLOB_Coordinate_MoreButton_cz_cs='29,182,106,194';
var MetrixLabGLOB_Coordinate_MoreButton_fr_fr='112,195,173,209';
var MetrixLabGLOB_Coordinate_MoreButton_de_de='161,188,260,201';
var MetrixLabGLOB_Coordinate_MoreButton_global_en='51,194,128,206';
var MetrixLabGLOB_Coordinate_MoreButton_in_en='51,194,128,206';
var MetrixLabGLOB_Coordinate_MoreButton_it_it='9,197,68,209';
var MetrixLabGLOB_Coordinate_MoreButton_jp_ja='237,186,321,200';
var MetrixLabGLOB_Coordinate_MoreButton_kr_ko='284,158,339,170';
var MetrixLabGLOB_Coordinate_MoreButton_my_en='51,194,128,206';
var MetrixLabGLOB_Coordinate_MoreButton_me_en='51,194,128,206';
var MetrixLabGLOB_Coordinate_MoreButton_mx_es='178,200,229,213';
var MetrixLabGLOB_Coordinate_MoreButton_nl_nl='75,192,120,206';
var MetrixLabGLOB_Coordinate_MoreButton_pl_pl='157,202,220,213';
var MetrixLabGLOB_Coordinate_MoreButton_ru_ru='271,197,347,207';
var MetrixLabGLOB_Coordinate_MoreButton_es_es='29,190,82,201';
var MetrixLabGLOB_Coordinate_MoreButton_se_sv='274,185,331,199';
var MetrixLabGLOB_Coordinate_MoreButton_tw_zh='188,155,222,171';
var MetrixLabGLOB_Coordinate_MoreButton_tr_tr='261,202,342,213';
var MetrixLabGLOB_Coordinate_MoreButton_gb_en='51,194,128,206';
var MetrixLabGLOB_Coordinate_MoreButton_us_en='51,194,128,206';
//

//The meta tags which will be read
var MetrixLabGLOBMeta_Division='PHILIPS.METRICS.DIVISION';
var MetrixLabGLOBMeta_Section='PHILIPS.METRICS.SECTION';
var MetrixLabGLOBMeta_Country='PHILIPS.METRICS.COUNTRY';
var MetrixLabGLOBMeta_Language='PHILIPS.METRICS.LANGUAGE';
var MetrixLabGLOBMeta_Catalogtype='PHILIPS.METRICS.CATALOGTYPE';
var MetrixLabGLOBMeta_ProductGroup='PHILIPS.METRICS.PRODUCTGROUP';
var MetrixLabGLOBMeta_ProductCategory='PHILIPS.METRICS.PRODUCTCATEGORY';
var MetrixLabGLOBMeta_ProductSubcategory='PHILIPS.METRICS.PRODUCTSUBCATEGORY';
var MetrixLabGLOBMeta_Productid='PHILIPS.METRICS.PRODUCTID';
var MetrixLabGLOBMeta_Pagename='PHILIPS.METRICS.PAGENAME';
var MetrixLabGLOBMeta_Hierarchy='PHILIPS.METRICS.HIERARCHY';
   
var MetrixLabGLOB_Coordinate_YesButton='15,241,124,262';
var MetrixLabGLOB_Coordinate_NoButton='212,241,338,263';
var MetrixLabGLOB_Coordinate_CloseButton='302,3,344,14';
var MetrixLabGLOB_Coordinate_PrivacyButton='219,284,258,296';
var MetrixLabGLOB_Coordinate_MetrixButton='273,285,344,295';
var MetrixLabGLOB_Coordinate_MoreButton='';
var MetrixLabGLOB_DivStartLeft='100';
var MetrixLabGLOB_DivStartTop='100';
var MetrixLabGLOB_Overlay_Width='350';
var MetrixLabGLOB_Overlay_Height='300';
var MetrixLabGLOB_ForceData='';
var MetrixLabGLOB_MeasuredData='';

var MetrixLabGLOB_p08157_web_Coordinate_YesButton='14,239,206,265';
var MetrixLabGLOB_p08157_web_Coordinate_NoButton='210,239,344,265';
var MetrixLabGLOB_p08157_web_Coordinate_CloseButton='296,2,350,22';
var MetrixLabGLOB_p08157_web_Coordinate_PrivacyButton='158,284,268,300';
var MetrixLabGLOB_p08157_web_Coordinate_MetrixButton='267,284,351,301';

var MetrixLabGLOB_p09787_Coordinate_YesButton = '13,239,203,262';
var MetrixLabGLOB_p09787_Coordinate_NoButton = '208,239,340,262';
var MetrixLabGLOB_p09787_Coordinate_CloseButton = '289,2,345,17';
var MetrixLabGLOB_p09787_Coordinate_PrivacyButton = '180,283,263,298';
var MetrixLabGLOB_p09787_Coordinate_MetrixButton = '276,285,345,298';

//The sections of the site where the script should run
var MetrixLabGLOBMeta_AllowedSections=new Array();  
MetrixLabGLOBMeta_AllowedSections[0]='main';
MetrixLabGLOBMeta_AllowedSections[1]='main:homepage';
MetrixLabGLOBMeta_AllowedSections[2]='CO:main';
MetrixLabGLOBMeta_AllowedSections[3]='CO:main:homepage';
MetrixLabGLOBMeta_AllowedSections[4]='CP:main';
MetrixLabGLOBMeta_AllowedSections[5]='LI:main';
MetrixLabGLOBMeta_AllowedSections[6]='HC:main';
MetrixLabGLOBMeta_AllowedSections[7]='netforum';
MetrixLabGLOBMeta_AllowedSections[8]='HC:netforum';
MetrixLabGLOBMeta_AllowedSections[9]='SP:sms';
MetrixLabGLOBMeta_AllowedSections[10]='sms';
MetrixLabGLOBMeta_AllowedSections[11]='SP:p4c';
MetrixLabGLOBMeta_AllowedSections[12]='p4c';
MetrixLabGLOBMeta_AllowedSections[13]='sonicare';
MetrixLabGLOBMeta_AllowedSections[14]='CP:sonicare';
MetrixLabGLOBMeta_AllowedSections[15]='learning_center';
MetrixLabGLOBMeta_AllowedSections[16]='HC:learning_center';
MetrixLabGLOBMeta_AllowedSections[17]='LEARNING CENTER';
MetrixLabGLOBMeta_AllowedSections[18]='mylife';
MetrixLabGLOBMeta_AllowedSections[19]='mykitchen';
MetrixLabGLOBMeta_AllowedSections[20]='inside_health';
MetrixLabGLOBMeta_AllowedSections[21]='livablecities';
MetrixLabGLOBMeta_AllowedSections[22]='tv_customizer';
MetrixLabGLOBMeta_AllowedSections[23]='tvcustomizer';

var MetrixLabGLOB_isSupportPage=false;
var MetrixLabGLOB_ProjectNumber='p08855';
var MetrixLabGLOB_SupportProjectNumber='p08157_web';
var MetrixLabGLOB_ChatProjectNumber='P09787';
var MetrixLabGLOB_P08492concuProjectNumber='p08492_concu';
var MetrixLabGLOB_isP08855Survey=true;
var MetrixLabGLOB_isSupportSurvey=false;
var MetrixLabGLOB_isChatSurvey=false;
var MetrixLabGLOB_isP08492concuSurvey=false;

var MetrixLabGLOB_PrivacyURL='http://www.philips.com/about/company/index.page';
var MetrixLabGLOB_isChineseDomain=false;
var MetrixLabGLOB_RndNo;
var MetrixLabGLOB_ContinueExecution=true;
var MetrixLabGLOB_isAllowed=false;
var MetrixLabGLOB_InviteIntercept=0;
var MetrixLabGLOB_SurveyServers=new Array();
MetrixLabGLOB_SurveyServers[0]='http://websurvey.opinionbar.com';
MetrixLabGLOB_SurveyServers[1]='http://websurvey2.opinionbar.com';

var MetrixLabGLOB_SearchEngines=new Array(25);
for (i=0;i<MetrixLabGLOB_SearchEngines.length;i++)
{
	MetrixLabGLOB_SearchEngines[i]=new Array(2);
}

MetrixLabGLOB_SearchEngines[0][0]='google.';
MetrixLabGLOB_SearchEngines[0][1]='q=';

MetrixLabGLOB_SearchEngines[1][0]='baidu.';
MetrixLabGLOB_SearchEngines[1][1]='wd=';

MetrixLabGLOB_SearchEngines[2][0]='yahoo.';
MetrixLabGLOB_SearchEngines[2][1]='p=';

MetrixLabGLOB_SearchEngines[3][0]='bing.';
MetrixLabGLOB_SearchEngines[3][1]='text=';

MetrixLabGLOB_SearchEngines[4][0]='yandex.';
MetrixLabGLOB_SearchEngines[4][1]='q=';

MetrixLabGLOB_SearchEngines[5][0]='naver.';
MetrixLabGLOB_SearchEngines[5][1]='query=';

MetrixLabGLOB_SearchEngines[6][0]='ask.';
MetrixLabGLOB_SearchEngines[6][1]='q=';

MetrixLabGLOB_SearchEngines[7][0]='aol.';
MetrixLabGLOB_SearchEngines[7][1]='q=';

MetrixLabGLOB_SearchEngines[8][0]='live.';
MetrixLabGLOB_SearchEngines[8][1]='q=';

MetrixLabGLOB_SearchEngines[9][0]='seznam.';
MetrixLabGLOB_SearchEngines[9][1]='q=';

MetrixLabGLOB_SearchEngines[10][0]='daum.';
MetrixLabGLOB_SearchEngines[10][1]='q=';

MetrixLabGLOB_SearchEngines[11][0]='mail.ru';
MetrixLabGLOB_SearchEngines[11][1]='q=';

MetrixLabGLOB_SearchEngines[12][0]='virgilio.';
MetrixLabGLOB_SearchEngines[12][1]='qs=';

MetrixLabGLOB_SearchEngines[13][0]='msn.';
MetrixLabGLOB_SearchEngines[13][1]='q=';

MetrixLabGLOB_SearchEngines[14][0]='icq.';
MetrixLabGLOB_SearchEngines[14][1]='q=';

MetrixLabGLOB_SearchEngines[15][0]='web.de';
MetrixLabGLOB_SearchEngines[15][1]='su=';

MetrixLabGLOB_SearchEngines[16][0]='startsiden.';
MetrixLabGLOB_SearchEngines[16][1]='q=';

MetrixLabGLOB_SearchEngines[17][0]='kvasir.';
MetrixLabGLOB_SearchEngines[17][1]='q';

MetrixLabGLOB_SearchEngines[18][0]='tiscali.';
MetrixLabGLOB_SearchEngines[18][1]='query=';

MetrixLabGLOB_SearchEngines[19][0]='busca.uol.';
MetrixLabGLOB_SearchEngines[19][1]='q=';

MetrixLabGLOB_SearchEngines[20][0]='eniro.';
MetrixLabGLOB_SearchEngines[20][1]='search_word=';

MetrixLabGLOB_SearchEngines[21][0]='altavista.';
MetrixLabGLOB_SearchEngines[21][1]='q=';

MetrixLabGLOB_SearchEngines[22][0]='centrum.cz';
MetrixLabGLOB_SearchEngines[22][1]='q=';

MetrixLabGLOB_SearchEngines[23][0]='myway.';
MetrixLabGLOB_SearchEngines[23][1]='searchfor=';

MetrixLabGLOB_SearchEngines[24][0]='goo.ne.jp';
MetrixLabGLOB_SearchEngines[24][1]='MT=';

if (typeof _page!="undefined")
{
    if (_page.area)
    {
        if(_page.area.toLowerCase()=="support")
        {
            MetrixLabGLOB_isSupportPage=true;
        }        
    }
}
else
{
    if (location.href.indexOf('support.philips.com')!=-1)
    {
        MetrixLabGLOB_isSupportPage=true;
    }
}

MetrixLabGLOB_isChatSurvey=MetrixLabGLOB_isChatSurveySurveyNeeded();

if (MetrixLabGLOB_isSupportPage)
{
    MetrixLabGLOB_RndNo=MetrixLabGLOB_GetRandomNumber(1,20);
    if (MetrixLabGLOB_RndNo<=5)
    {        
        MetrixLabGLOB_isSupportSurvey=true;
    }
    else
    {
        if (MetrixLabGLOB_RndNo>=16)
        {
            MetrixLabGLOB_Set_P08855_Intercepts(1);
			MetrixLabGLOB_isP08855Survey=true;           
        }
        else
        {
            MetrixLabGLOB_ContinueExecution=false;   
        }   
    }    
}

if (MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Section)=='made_to_move')
{
	MetrixLabGLOB_isP08492concuSurvey=true;
	MetrixLabGLOB_ContinueExecution=true;
}

if (MetrixLabGLOB_isChatSurvey || MetrixLabGLOB_isSupportSurvey || MetrixLabGLOB_isP08492concuSurvey)
{
	MetrixLabGLOB_isP08855Survey=false;
}
if (MetrixLabGLOB_isChatSurvey)
{
	MetrixLabGLOB_ContinueExecution=true;
}


MetrixLabGLOB_CheckSection();

//region Functions



function MetrixLabGLOB_ShowChatInvite()
{
	MetrixLabGLOB_isChatSurvey=MetrixLabGLOB_isChatSurveySurveyNeeded();
	if (MetrixLabGLOB_isChatSurvey)
	{
		MetrixLabGLOB_isSupportSurvey=false;
		MetrixLabGLOB_isP08492concuSurvey=false;
		MetrixLabGLOB_isP08855Survey=false;
		MetrixLabGLOB_ContinueExecution=true;
		MetrixLabGLOB_CheckSection();
	}
}

function MetrixLabGLOB_ShowChatInvite1(lcLastEventId, lcLastEventTime) {

    MetrixLabGLOB_IsCalled=true;
	var MetrixLabGLOB_Country_Lang=MetrixLabGLOB_GetCountryAndLanguage();
	
	switch(MetrixLabGLOB_Country_Lang)
	{
		//case 'es_es':
		//	MetrixLabGLOB_CountryLanguage_Allowed=true;
		//	break;
		//case 'br_pt':
		//	MetrixLabGLOB_CountryLanguage_Allowed=true;
		//	break;
		// case 'cn_zh':
			// MetrixLabGLOB_CountryLanguage_Allowed=true;
			// break;
		//case 'us_en':
			//MetrixLabGLOB_CountryLanguage_Allowed=true;
			//break;
		case 'gb_en':
			MetrixLabGLOB_CountryLanguage_Allowed=true;
			break;
		//case 'nl_nl':
		//	MetrixLabGLOB_CountryLanguage_Allowed=true;
		//	break;
		case 'ca_en':
			MetrixLabGLOB_CountryLanguage_Allowed=true;
			break;
		//case 'de_de':
		//	MetrixLabGLOB_CountryLanguage_Allowed=true;
		//	break;	
		//case 'fr_fr' :
		//	MetrixLabGLOB_CountryLanguage_Allowed=true;
		//	break;	
	}
	
	if (MetrixLabGLOB_CountryLanguage_Allowed)
	{
		var dt = new Date();
		var diff = dt.getTime() - lcLastEventTime;
		hrs = Math.floor(diff / 3600000);
		if (hrs <= 2 && hrs != -999999) {
			MetrixLabGLOB_isChatSurvey = true;
		}
		else {
			MetrixLabGLOB_isChatSurvey = false;
		}

		if (MetrixLabGLOB_isChatSurvey) {
			MetrixLabGLOB_isSupportSurvey = false;
			MetrixLabGLOB_isP08492concuSurvey = false;
			MetrixLabGLOB_isP08855Survey = false;
			MetrixLabGLOB_ContinueExecution = true;
			MetrixLabGLOB_CheckSection();
		}
	}
}

function MetrixLabGLOB_IsSearchEngine(MetrixLabGLOB_URL)
{
	var result=false;

	for (i=0;i<MetrixLabGLOB_SearchEngines.length;i++)
	{
		if (MetrixLabGLOB_URL.indexOf(MetrixLabGLOB_SearchEngines[i][0])>-1 && MetrixLabGLOB_URL.indexOf(MetrixLabGLOB_SearchEngines[i][1])>-1)
		{
			result=true;
			break;
		}
	}
	
	return result;
}

function MetrixLabGLOB_GetReferrerType(MetrixLabGLOB_URL)
{
	var ReferrerType='';
	
	if (MetrixLabGLOB_URL=='')
	{
		ReferrerType='typed or bookmark';
	}
	else
	{
		if (MetrixLabGLOB_IsSearchEngine(MetrixLabGLOB_URL) && MetrixLabGLOB_URL.indexOf('origin')>-1)
		{
			ReferrerType='paid search';
		}		
		else if (MetrixLabGLOB_URL.indexOf('origin=1')>-1)
		{
			ReferrerType='banner';
		}
		
		else if (MetrixLabGLOB_IsSearchEngine(MetrixLabGLOB_URL) && MetrixLabGLOB_URL.indexOf('origin')==-1)
		{
			ReferrerType='organic search';
		}
		
		else if (!MetrixLabGLOB_IsSearchEngine(MetrixLabGLOB_URL) && MetrixLabGLOB_URL.indexOf('philips')==-1)
		{
			ReferrerType='other';
		}
	}
	
	return ReferrerType;
}

function MetrixLabGLOB_CheckSection()
{
    var MetrixLabGLOB_pageSection=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Section);
    if (MetrixLabGLOB_pageSection != '')
	{	
		for (i=0;i<MetrixLabGLOBMeta_AllowedSections.length;i++)
		{        
			if (MetrixLabGLOB_pageSection.toLowerCase() == MetrixLabGLOBMeta_AllowedSections[i].toLowerCase())
			{
				MetrixLabGLOB_isAllowed=true;                        
			}
		}
		
		if (MetrixLabGLOB_isSupportPage || MetrixLabGLOB_isP08492concuSurvey) 
		{
			MetrixLabGLOB_isAllowed=true; 
		}

		MetrixLabGLOB_ContinueIfAllowed();
	}
	else
	{
		setTimeout('MetrixLabGLOB_CheckSection();',500);
	}	
    
}

function MetrixLabGLOB_ContinueIfAllowed()
{
	if (MetrixLabGLOB_isAllowed && MetrixLabGLOB_ContinueExecution)
	{    
	  if (!MetrixLabGLOB_isSupportPage)
		{
			MetrixLabGLOB_isChineseDomain=(MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Country)=='cn');        
		}
		else
		{
			if (typeof s!="undefined")
			{
				if (s.prop1)
				{
					MetrixLabGLOB_isChineseDomain=(s.prop1.toLowerCase()=='cn');
				}
			}
		}		
		
		try
		{
			if (MetrixLabGLOB_isSupportSurvey)
			{
					MetrixLabGLOB_InviteIntercept=eval('MetrixLabGLOB_Intercept_p08157_web_'+MetrixLabGLOB_GetCountryAndLanguage()+'_sms');
			}
			
			if (MetrixLabGLOB_isChatSurvey)
			{					
					MetrixLabGLOB_InviteIntercept=eval('MetrixLabGLOB_Intercept_p09787_'+MetrixLabGLOB_GetCountryAndLanguage());
			}
			
			if (MetrixLabGLOB_isP08492concuSurvey)
			{					
					MetrixLabGLOB_InviteIntercept=eval('MetrixLabGLOB_Intercept_p08492_concu_'+MetrixLabGLOB_GetCountryAndLanguage());
			}
			
			if (MetrixLabGLOB_isP08855Survey)
			{
				MetrixLabGLOB_InviteIntercept=eval('MetrixLabGLOB_CountryIntercept_'+MetrixLabGLOB_GetCountryAndLanguage());
			}
		}
		catch(err)
		{
			MetrixLabGLOB_InviteIntercept=0;
		}    
	   
		try
		{
			MetrixLabGLOB_PrivacyURL=eval('MetrixLabGLOB_PrivacyURL_'+MetrixLabGLOB_GetCountryAndLanguage());
		}
		catch(err)
		{
			MetrixLabGLOB_PrivacyURL='http://www.philips.com/about/company/index.page';
		}
		
		try
		{
			MetrixLabGLOB_Coordinate_MoreButton=eval('MetrixLabGLOB_Coordinate_MoreButton_'+MetrixLabGLOB_GetCountryAndLanguage());
		}
		catch(err)
		{
			MetrixLabGLOB_Coordinate_MoreButton='';
		}
		
		var MetrixLabGLOB_Country_Language=MetrixLabGLOB_GetCountryAndLanguage();   
		
		if (MetrixLabGLOB_isSupportSurvey)
		{
			MetrixLabGLOB_ProjectNumber=MetrixLabGLOB_SupportProjectNumber+'_'+MetrixLabGLOB_Country_Language+'_sms';
		}
		
		if (MetrixLabGLOB_isChatSurvey)
		{
			MetrixLabGLOB_ProjectNumber=MetrixLabGLOB_ChatProjectNumber+'_'+MetrixLabGLOB_Country_Language;
		}
		
		if (MetrixLabGLOB_isP08492concuSurvey)
		{
			MetrixLabGLOB_ProjectNumber=MetrixLabGLOB_P08492concuProjectNumber+'_'+MetrixLabGLOB_Country_Language;
		}
		
		if (MetrixLabGLOB_isP08855Survey)
		{
			MetrixLabGLOB_ProjectNumber += '_'+MetrixLabGLOB_Country_Language;
		}
		
		MetrixLabGLOB_ProjectNumber=MetrixLabGLOB_ConvertProjectNumber(MetrixLabGLOB_ProjectNumber);
					 
		//Continue execution only if the intercept is greater than 0 and cookies are enabled
		if (MetrixLabGLOB_InviteIntercept>0 && MetrixLabGLOB_isCookieEnabled())
		{                              
			if (MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Pagename)=='about:company:brand:because')
			{
				MetrixLabGLOB_InviteIntercept=1;
			}
			
			//if (MetrixLabGLOB_ProjectNumber=='p08855_fr_fr')
			//{
				//MetrixLabGLOB_InviteIntercept=1;
			//}
			
			MetrixLabGLOB_randomNumber=MetrixLabGLOB_GetRandomNumber(1,MetrixLabGLOB_InviteIntercept);
			if (MetrixLabGLOB_randomNumber==1)
			{			    	            
				
				if (!MetrixLabGLOB_isChineseDomain)
				{
					var MetrixLabGLOB_Time=new Date();
					var MetrixLabGLOB_Script=document.createElement('script');
					MetrixLabGLOB_Script.src='http://metrixlab58.customers.luna.net/p07086/getCookie.php?t='+MetrixLabGLOB_Time.getTime();
					MetrixLabGLOB_Script.type='text/javascript';
					var MetrixLabGLOB_Body=document.getElementsByTagName('body').item(0);
					MetrixLabGLOB_Body.appendChild(MetrixLabGLOB_Script);		    	   	    
					MetrixLabGLOB_ForceData=MetrixLabGLOB_ReadForceData();	    
					MetrixLabGLOB_checkCookieCrossDouble();
				}
				else
				{
					if (document.cookie.indexOf('MetrixLabGLOB_LocalCookie')==-1)
					{
						MetrixLabGLOB_ForceData=MetrixLabGLOB_ReadForceData();
						MetrixLabGLOB_LoadOverlay();
					}
					else{
						if ( MetrixLabGLOB_ProjectNumber == 'P09787_cn_zh' ){
							if ( document.cookie.indexOf('MetrixLabGLOB_p09787Cookie') == -1  ) {
								MetrixLabGLOB_ForceData=MetrixLabGLOB_ReadForceData();
								MetrixLabGLOB_LoadOverlay();
							}
						}
					}
				}
			}			  
		}    
	}
}

function MetrixLabGLOB_checkCookieCrossDouble()
{                
    if (MetrixLabGLOB_isChatSurvey)
	{
		if (document.cookie.indexOf('MetrixLabGLOB_p09787Cookie')==-1)
		{
			MetrixLabGLOB_LoadOverlay();
		}
	}
	else
	{
		if (typeof metrixlab_gl_cookieCross != "undefined")
		{	 	    
			if (metrixlab_gl_cookieCross==false && document.cookie.indexOf('MetrixLabGLOB_LocalCookie')==-1)	    
			{	        		    	            						
				MetrixLabGLOB_LoadOverlay();            	        
			}
		}
		else
		{				
			setTimeout('MetrixLabGLOB_checkCookieCrossDouble();',500);
		}
	}
}

function MetrixLabGLOB_LoadOverlay()
{       
	MetrixLabGLOB_setCookie(30*24*60*60);
    var MetrixLabGLOB_Img=new Image();
    MetrixLabGLOB_Img.src='http://invitation.opinionbar.com/popups/'+MetrixLabGLOB_ProjectNumber+'/overlay.gif';
      
    var MetrixLabGLOB_HTMLString="";
    if (MetrixLabGLOB_isP08855Survey)
    {
        MetrixLabGLOB_HTMLString += "<MAP name='MetrixLabGLOB_Popup_Map'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_YesButton+"' href='javascript:MetrixLabGLOB_GoToWebSurvey();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_NoButton+"' href='javascript:MetrixLabGLOB_CloseBanner();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_CloseButton+"' href='javascript:MetrixLabGLOB_CloseBanner();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_PrivacyButton+"' href='javascript:MetrixLabGLOB_GoToPrivacy();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_MetrixButton+"' href='javascript:MetrixLabGLOB_GoToMetrixLab();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_MoreButton+"' href='javascript:MetrixLabGLOB_ViewMore();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += "</MAP>\n";
        MetrixLabGLOB_HTMLString += "<MAP name='MetrixLabGLOB_Popup_Map1'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_YesButton+"' href='javascript:MetrixLabGLOB_GoToWebSurvey();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_NoButton+"' href='javascript:MetrixLabGLOB_CloseBanner();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_CloseButton+"' href='javascript:MetrixLabGLOB_CloseBanner();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_PrivacyButton+"' href='javascript:MetrixLabGLOB_GoToPrivacy();' target='_self'>\n";
        MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_Coordinate_MetrixButton+"' href='javascript:MetrixLabGLOB_GoToMetrixLab();' target='_self'>\n";    
        MetrixLabGLOB_HTMLString += "</MAP>\n";
        MetrixLabGLOB_HTMLString += "<iframe id='MetrixLabGLOB' src='' scrolling='no' width='"+MetrixLabGLOB_Overlay_Width+"' height='"+MetrixLabGLOB_Overlay_Height+"' frameborder='0' style='z-index:99999998;position:absolute; top:"+MetrixLabGLOB_DivStartTop+"px; left:"+MetrixLabGLOB_DivStartLeft+"px;'></iframe>\n";
        MetrixLabGLOB_HTMLString += "<div id='MetrixLabGLOB_overlay' style='position:absolute; z-index:99999999; left: "+MetrixLabGLOB_DivStartLeft+"px; top: "+MetrixLabGLOB_DivStartTop+"px;'>";    
        MetrixLabGLOB_HTMLString += "<img src='http://invitation.opinionbar.com/popups/"+MetrixLabGLOB_ProjectNumber+"/overlay.gif' USEMAP='#MetrixLabGLOB_Popup_Map' alt='' border='0' width='"+MetrixLabGLOB_Overlay_Width+"' height='"+MetrixLabGLOB_Overlay_Height+"' name='MetrixLabGLOB_overlay_gif' id='MetrixLabGLOB_gif'>";
	    MetrixLabGLOB_HTMLString += "<img src='http://invitation.opinionbar.com/popups/"+MetrixLabGLOB_ProjectNumber+"/overlay.gif' USEMAP='#MetrixLabGLOB_Popup_Map1' alt='' border='0' width='"+MetrixLabGLOB_Overlay_Width+"' height='"+MetrixLabGLOB_Overlay_Height+"' name='MetrixLabGLOBMore_overlay_gif' id='MetrixLabGLOBMore_gif' style='display:none'>";
        MetrixLabGLOB_HTMLString += "</div>";
    }
    else
    {
        var MetrixLabGLOB_YesButton=(MetrixLabGLOB_isChatSurvey || MetrixLabGLOB_isP08492concuSurvey)?MetrixLabGLOB_p09787_Coordinate_YesButton:MetrixLabGLOB_p08157_web_Coordinate_YesButton;
		var MetrixLabGLOB_NoButton=(MetrixLabGLOB_isChatSurvey || MetrixLabGLOB_isP08492concuSurvey)?MetrixLabGLOB_p09787_Coordinate_NoButton:MetrixLabGLOB_p08157_web_Coordinate_NoButton;
		var MetrixLabGLOB_CloseButton=(MetrixLabGLOB_isChatSurvey || MetrixLabGLOB_isP08492concuSurvey)?MetrixLabGLOB_p09787_Coordinate_CloseButton:MetrixLabGLOB_p08157_web_Coordinate_CloseButton;
		var MetrixLabGLOB_PrivacyButton=(MetrixLabGLOB_isChatSurvey || MetrixLabGLOB_isP08492concuSurvey)?MetrixLabGLOB_p09787_Coordinate_PrivacyButton:MetrixLabGLOB_p08157_web_Coordinate_PrivacyButton;
		var MetrixLabGLOB_MetrixButton=(MetrixLabGLOB_isChatSurvey || MetrixLabGLOB_isP08492concuSurvey)?MetrixLabGLOB_p09787_Coordinate_MetrixButton:MetrixLabGLOB_p08157_web_Coordinate_MetrixButton;
		
		MetrixLabGLOB_HTMLString += "<MAP name='MetrixLabGLOB_Popup_Map'>\n";
		MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_YesButton+"' href='javascript:MetrixLabGLOB_GoToWebSurvey();' target='_self'>\n";
		MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_NoButton+"' href='javascript:MetrixLabGLOB_CloseBanner();' target='_self'>\n";
		MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_CloseButton+"' href='javascript:MetrixLabGLOB_CloseBanner();' target='_self'>\n";
		MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_PrivacyButton+"' href='javascript:MetrixLabGLOB_GoToPrivacy();' target='_self'>\n";
		MetrixLabGLOB_HTMLString += " <AREA shape='rect' coords='"+MetrixLabGLOB_MetrixButton+"' href='javascript:MetrixLabGLOB_GoToMetrixLab();' target='_self'>\n";        
		MetrixLabGLOB_HTMLString += "</MAP>\n";	
		
        MetrixLabGLOB_HTMLString += "<iframe id='MetrixLabGLOB' src='' scrolling='no' width='"+MetrixLabGLOB_Overlay_Width+"' height='"+MetrixLabGLOB_Overlay_Height+"' frameborder='0' style='z-index:99999998;position:absolute; top:"+MetrixLabGLOB_DivStartTop+"px; left:"+MetrixLabGLOB_DivStartLeft+"px;'></iframe>\n";
        MetrixLabGLOB_HTMLString += "<div id='MetrixLabGLOB_overlay' style='position:absolute; z-index:99999999; left: "+MetrixLabGLOB_DivStartLeft+"px; top: "+MetrixLabGLOB_DivStartTop+"px;'>";    
        MetrixLabGLOB_HTMLString += "<img src='http://invitation.opinionbar.com/popups/"+MetrixLabGLOB_ProjectNumber+"/overlay.gif' USEMAP='#MetrixLabGLOB_Popup_Map' alt='' border='0' width='"+MetrixLabGLOB_Overlay_Width+"' height='"+MetrixLabGLOB_Overlay_Height+"' name='MetrixLabGLOB_overlay_gif' id='MetrixLabGLOB_gif'>";	    
        MetrixLabGLOB_HTMLString += "</div>";
    }
    
    var MetrixLabGLOB_Body=document.getElementsByTagName('body').item(0);
    var MetrixLabGLOB_Div=document.createElement('div');
    MetrixLabGLOB_Div.style.display='block';
    MetrixLabGLOB_Div.id='MetrixLabGLOB_Div';
    MetrixLabGLOB_Div.innerHTML=MetrixLabGLOB_HTMLString;
    MetrixLabGLOB_Body.appendChild(MetrixLabGLOB_Div);
    
}

function MetrixLabGLOB_Set_P08855_Intercepts(Intercept)
{
    MetrixLabGLOB_CountryIntercept_ar_es=Intercept;
    MetrixLabGLOB_CountryIntercept_au_en=Intercept;
    MetrixLabGLOB_CountryIntercept_be_nl=Intercept;
    MetrixLabGLOB_CountryIntercept_be_fr=Intercept;
    MetrixLabGLOB_CountryIntercept_br_pt=Intercept;
    MetrixLabGLOB_CountryIntercept_ca_en=Intercept;
    MetrixLabGLOB_CountryIntercept_ca_fr=Intercept;
    MetrixLabGLOB_CountryIntercept_cn_zh=Intercept;
    MetrixLabGLOB_CountryIntercept_cz_cs=Intercept;
    MetrixLabGLOB_CountryIntercept_fr_fr=Intercept;
    MetrixLabGLOB_CountryIntercept_de_de=Intercept;
    MetrixLabGLOB_CountryIntercept_global_en=Intercept;
    MetrixLabGLOB_CountryIntercept_in_en=Intercept;
    MetrixLabGLOB_CountryIntercept_it_it=Intercept;
    MetrixLabGLOB_CountryIntercept_jp_ja=Intercept;
    MetrixLabGLOB_CountryIntercept_kr_ko=Intercept;
    MetrixLabGLOB_CountryIntercept_my_en=Intercept;
    MetrixLabGLOB_CountryIntercept_me_en=Intercept;
    MetrixLabGLOB_CountryIntercept_mx_es=Intercept;
    MetrixLabGLOB_CountryIntercept_nl_nl=Intercept;
    MetrixLabGLOB_CountryIntercept_pl_pl=Intercept;
    MetrixLabGLOB_CountryIntercept_ru_ru=Intercept;
    MetrixLabGLOB_CountryIntercept_es_es=Intercept;
    MetrixLabGLOB_CountryIntercept_se_sv=Intercept;
    MetrixLabGLOB_CountryIntercept_tw_zh=Intercept;
    MetrixLabGLOB_CountryIntercept_tr_tr=Intercept;
    MetrixLabGLOB_CountryIntercept_gb_en=Intercept;
    MetrixLabGLOB_CountryIntercept_us_en=Intercept;
}

function MetrixLabGLOB_isChatSurveySurveyNeeded()
{
    var result=false;
    var hrs=MetrixLabGLOB_getHoursSinceLastChat();
	if (hrs<=2 && hrs!=-999999)	
	{
		result=true;
	}
    return result;
}

function MetrixLabGLOB_getChatCookie(c_name) 
{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
		{
		c_start=c_start + c_name.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 "";
}

function MetrixLabGLOB_getChatSessionID()
{
	return MetrixLabGLOB_getChatCookie('lcLastEventId');
}

function MetrixLabGLOB_getHoursSinceLastChat() 
{
	var hrs=-999999;
	if (MetrixLabGLOB_getChatCookie('lcLastEventTime')!='') {
	var dt = new Date();
	var diff = dt.getTime() - MetrixLabGLOB_getChatCookie('lcLastEventTime');
	
	hrs = Math.floor(diff / 3600000);
	
	}
	return hrs;
}


function MetrixLabGLOB_GetTopLevelDomain()
{
    var MetrixLabGLOB_TopLevelDomain=document.domain;
    MetrixLabGLOB_TopLevelDomain=MetrixLabGLOB_TopLevelDomain.replace('www.','');
    
    var MetrixLabGLOB_ExtensionHasDot=false;
    var MetrixLabGLOB_DomainExtensionsWithDot=new Array();
    MetrixLabGLOB_DomainExtensionsWithDot[0]='co.jp';
    MetrixLabGLOB_DomainExtensionsWithDot[1]='co.kr';
    MetrixLabGLOB_DomainExtensionsWithDot[2]='co.uk';
	MetrixLabGLOB_DomainExtensionsWithDot[3]='com.cn';
    
    for(i=0;i<MetrixLabGLOB_DomainExtensionsWithDot.length;i++)
    {
        if (MetrixLabGLOB_TopLevelDomain.indexOf(MetrixLabGLOB_DomainExtensionsWithDot[i])!=-1)
        {
            MetrixLabGLOB_ExtensionHasDot=true;
        }
    }
    
    var MetrixLabGLOB_URLArray=MetrixLabGLOB_TopLevelDomain.split('.');
    var MetrixLabGLOB_DotCount=MetrixLabGLOB_URLArray.length;
    
    if (MetrixLabGLOB_ExtensionHasDot)
    {
        MetrixLabGLOB_TopLevelDomain=MetrixLabGLOB_URLArray[MetrixLabGLOB_DotCount-3]+'.'+MetrixLabGLOB_URLArray[MetrixLabGLOB_DotCount-2]+'.'+MetrixLabGLOB_URLArray[MetrixLabGLOB_DotCount-1];
    }
    else
    {
        MetrixLabGLOB_TopLevelDomain=MetrixLabGLOB_URLArray[MetrixLabGLOB_DotCount-2]+'.'+MetrixLabGLOB_URLArray[MetrixLabGLOB_DotCount-1];
    }
    
    return MetrixLabGLOB_TopLevelDomain;
}

function MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOB_MetaTagName)
{
    var MetrixLabGLOB_MetaTags=document.getElementsByTagName('meta');
    var MetrixLabGLOB_MetaTagContent='';

    for(i=0;i<MetrixLabGLOB_MetaTags.length;i++)
    {
        if (MetrixLabGLOB_MetaTags[i].name.toUpperCase() == MetrixLabGLOB_MetaTagName.toUpperCase())
        {
            MetrixLabGLOB_MetaTagContent=MetrixLabGLOB_MetaTags[i].content;
        }                
    }
    return MetrixLabGLOB_MetaTagContent.toLowerCase(); 
}

function MetrixLabGLOB_GetCountryAndLanguage()
{
    var MetrixLabGLOB_CountryLanguage='';
    MetrixLabGLOB_CountryLanguage += MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Country);
    MetrixLabGLOB_CountryLanguage += '_'+MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Language);
    
	if (MetrixLabGLOB_CountryLanguage.indexOf('_')==0)
	{
		if (_page.locale)
		{
			MetrixLabGLOB_CountryLanguage=_page.locale;
		}
	}
	
    if (MetrixLabGLOB_CountryLanguage.toLowerCase()=='global')
	{
		MetrixLabGLOB_CountryLanguage='global_en';
	}
	
    return MetrixLabGLOB_CountryLanguage.toLowerCase();
}

function MetrixLabGLOB_ConvertProjectNumber(MetrixLabGLOB_ProjectNumber)
{
    var MetrixLabGLOB_ConvertedProjectNumber='';
    
    switch(MetrixLabGLOB_ProjectNumber)
    {
         case 'p08855_global':
            MetrixLabGLOB_ConvertedProjectNumber='p08855_global_en';
            break; 
		case 'p08855_cz_cs':
            MetrixLabGLOB_ConvertedProjectNumber='p08855_cz_cz';
            break;       
        case 'p08855_me_en':
            MetrixLabGLOB_ConvertedProjectNumber='p08855_MEA_en';
            break;
        case 'p08855_gb_en':
            MetrixLabGLOB_ConvertedProjectNumber='p08855_uk_en';
            break;
        case 'p08157_web_cz_cz_sms':
            MetrixLabGLOB_ConvertedProjectNumber='p08157_web_cz_cz_sms';
            break;       
        case 'p08157_web_me_en_sms':
            MetrixLabGLOB_ConvertedProjectNumber='p08157_web_MEA_en_sms';
            break;		
		case 'p08492_concu_fr_fr':
            MetrixLabGLOB_ConvertedProjectNumber='p08492_concu_fr';
            break;				
			default:
        MetrixLabGLOB_ConvertedProjectNumber=MetrixLabGLOB_ProjectNumber;
    }

	return MetrixLabGLOB_ConvertedProjectNumber;
}

function MetrixLabGLOB_isCookieEnabled()
{
    var cookieEnabled=(navigator.cookieEnabled)? true : false
    
    if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled)
    { 
	    document.cookie="MetrixLabGLOBtestcookie"
	    cookieEnabled=(document.cookie.indexOf("MetrixLabGLOBtestcookie")!=-1)? true : false
    }
    
    return cookieEnabled;      	
}

function MetrixLabGLOB_GetRandomNumber(MetrixLabGLOB_minValue,MetrixLabGLOB_maxValue)
{
    var MetrixLabGLOB_result=0;

    if (MetrixLabGLOB_minValue<=MetrixLabGLOB_maxValue)
    {
	    MetrixLabGLOB_result=Math.round((Math.random()*(MetrixLabGLOB_maxValue-MetrixLabGLOB_minValue+1))+MetrixLabGLOB_minValue-0.5);
	}
	
	return MetrixLabGLOB_result;
}

function MetrixLabGLOB_setChatCookie(ExpireSeconds)
{
	var MetrixLabGLOB_expires=new Date();
	MetrixLabGLOB_expires.setTime(MetrixLabGLOB_expires.getTime() + (ExpireSeconds*1000));
	document.cookie="MetrixLabGLOB_p09787Cookie=1; expires=" + MetrixLabGLOB_expires.toGMTString() + "; path=/; domain="+MetrixLabGLOB_GetTopLevelDomain();
}

function MetrixLabGLOB_setCookie(ExpireSeconds)
{
    if (!MetrixLabGLOB_isChineseDomain)
	{
		var MetrixLabGLOB_Time=new Date();
		var MetrixLabGLOB_Body=document.getElementsByTagName('body').item(0);
		var MetrixLabGLOB_Script=document.createElement('script');
		MetrixLabGLOB_Script.src='http://metrixlab58.customers.luna.net/p07086/setCookie.php?t='+MetrixLabGLOB_Time.getTime()+'&expires='+ExpireSeconds;
		MetrixLabGLOB_Script.type='text/javascript';
		MetrixLabGLOB_Body.appendChild(MetrixLabGLOB_Script);
	}
    
	if (MetrixLabGLOB_isChatSurvey)
	{
		MetrixLabGLOB_setChatCookie(ExpireSeconds*1000);
	}
	
	var MetrixLabGLOB_expires=new Date();
	MetrixLabGLOB_expires.setTime(MetrixLabGLOB_expires.getTime() + (ExpireSeconds*1000));
	document.cookie="MetrixLabGLOB_LocalCookie=1; expires=" + MetrixLabGLOB_expires.toGMTString() + "; path=/; domain="+MetrixLabGLOB_GetTopLevelDomain();
}

function MetrixLabGLOB_GetURLParamValue(ML_URL, ML_Param)
{
	var ML_ParamValue="";
	var ML_StartTag=0;
	var ML_EndTag=0;
	var ML_TmpString="";

	ML_URL=new String(ML_URL);
	ML_Param=new String(ML_Param);

	if ((ML_URL.length>0)&&(ML_Param.length>0))
	{
		ML_Param=ML_Param.toLowerCase();
		ML_StartTag=ML_URL.toLowerCase().indexOf(ML_Param + "=");
		if (ML_StartTag>0)
		{
			ML_TmpString=ML_URL.substring(ML_StartTag+1+ML_Param.length,ML_URL.length);
			if (ML_TmpString.length>0)
			{
				ML_EndTag=ML_TmpString.indexOf("&");
				if (ML_EndTag>=0)
				{
					ML_ParamValue=ML_TmpString.substring(0,ML_EndTag);
				}
				else
				{
					ML_ParamValue=ML_TmpString;
				}
			}
		}
	}
	return ML_ParamValue;
}

function MetrixLabGLOB_GetMeasuredData()
{
    var MetrixLabGLOB_scy='us';
    var MetrixLabGLOB_slg='en';
    var MetrixLabGLOB_ctn='';
    var MetrixLabGLOB_URL=window.location.href.toLowerCase();
    
    if (s)
    {
        MetrixLabGLOB_scy=s.prop1?s.prop1:'us';
        MetrixLabGLOB_slg=s.prop2?s.prop2:'en';
    }
    
    if (MetrixLabGLOB_URL.indexOf("productcode=")>0)
    {
        MetrixLabGLOB_ctn=MetrixLabGLOB_GetURLParamValue(MetrixLabGLOB_URL,'productcode');
    }
    else
    {
        if (MetrixLabGLOB_URL.indexOf("product=")>0)
        {
            MetrixLabGLOB_ctn=MetrixLabGLOB_GetURLParamValue(MetrixLabGLOB_URL,'product');
        }      
    }
    
    return 'scy='+MetrixLabGLOB_scy+'|slg='+MetrixLabGLOB_slg+'|ctn='+MetrixLabGLOB_ctn+'|';
}

function MetrixLabGLOB_ReadForceData()
{
    var MetrixLabGLOB_MetaForceData='';
    var MetrixLabGLOB_ForceItem1='';
    var MetrixLabGLOB_ForceItem2='';
    var MetrixLabGLOB_ForceItem3='';
    var MetrixLabGLOB_ForceItem4='';
    var MetrixLabGLOB_ForceItem5='';
    var MetrixLabGLOB_ForceItem6='';
    var MetrixLabGLOB_ForceItem7='';
    var MetrixLabGLOB_ForceItem8='';
    var MetrixLabGLOB_ForceItem9='';
    var MetrixLabGLOB_ForceItem10='';
    var MetrixLabGLOB_ForceItem11='';
	
	
    
    if (!MetrixLabGLOB_isSupportPage)
    {    
        MetrixLabGLOB_ForceItem1=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Division);
        MetrixLabGLOB_ForceItem2=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Section);
        MetrixLabGLOB_ForceItem3=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Country);
        MetrixLabGLOB_ForceItem4=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Language);
        MetrixLabGLOB_ForceItem5=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Catalogtype);
        MetrixLabGLOB_ForceItem6=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_ProductGroup);
        MetrixLabGLOB_ForceItem7=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_ProductCategory);
        MetrixLabGLOB_ForceItem8=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_ProductSubcategory);
        MetrixLabGLOB_ForceItem9=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Productid);
        MetrixLabGLOB_ForceItem10=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Pagename);
        MetrixLabGLOB_ForceItem11=MetrixLabGLOB_ReadMetaTagContent(MetrixLabGLOBMeta_Hierarchy);    
    }
    else
    {
        if (!MetrixLabGLOB_isSupportSurvey)
        {
            if (s)
            {            
                MetrixLabGLOB_ForceItem1+='9999,1,'+s.prop3?s.prop3:'SP'+';';
                MetrixLabGLOB_ForceItem2+='9999,2,'+s.channel?s.channel:'sms'+';';
                MetrixLabGLOB_ForceItem3+='9999,3,'+s.prop1?s.prop1:''+';';
                MetrixLabGLOB_ForceItem4+='9999,4,'+s.prop2?s.prop2:''+';';
                MetrixLabGLOB_ForceItem10+='9999,10,'+s.pageName?s.pageName:''+';';
                MetrixLabGLOB_ForceItem11+='9999,11,'+s.hier1?s.hier1:''+';';
            }                                  
        }
        else
        {            
            MetrixLabGLOB_MeasuredData=MetrixLabGLOB_GetMeasuredData();
        }
    }
    
    if (MetrixLabGLOB_isSupportSurvey)
    {
        MetrixLabGLOB_MetaForceData='4,4';
        MetrixLabGLOB_MeasuredData=MetrixLabGLOB_GetMeasuredData();
    }
    else
    {
        MetrixLabGLOB_MetaForceData+='9999,1,'+MetrixLabGLOB_ForceItem1+';';
        MetrixLabGLOB_MetaForceData+='9999,2,'+MetrixLabGLOB_ForceItem2+';';
        MetrixLabGLOB_MetaForceData+='9999,3,'+MetrixLabGLOB_ForceItem3+';';
        MetrixLabGLOB_MetaForceData+='9999,4,'+MetrixLabGLOB_ForceItem4+';';
        MetrixLabGLOB_MetaForceData+='9999,5,'+MetrixLabGLOB_ForceItem5+';';
        MetrixLabGLOB_MetaForceData+='9999,6,'+MetrixLabGLOB_ForceItem6+';';
        MetrixLabGLOB_MetaForceData+='9999,7,'+MetrixLabGLOB_ForceItem7+';';
        MetrixLabGLOB_MetaForceData+='9999,8,'+MetrixLabGLOB_ForceItem8+';';
        MetrixLabGLOB_MetaForceData+='9999,9,'+MetrixLabGLOB_ForceItem9+';';
        MetrixLabGLOB_MetaForceData+='9999,10,'+MetrixLabGLOB_ForceItem10+';';
        MetrixLabGLOB_MetaForceData+='9999,11,'+MetrixLabGLOB_ForceItem11+';'; 		

		// if (MetrixLabGLOB_isChatSurvey)
		// {
			// MetrixLabGLOB_MetaForceData+='2000,1,'+MetrixLabGLOB_getChatSessionID();
		// }	
		
		if (MetrixLabGLOB_isP08855Survey && MetrixLabGLOB_GetCountryAndLanguage()=='fr_fr')	
		{
			var MetrixLabGLOB_Referrer = new String(document.referrer);
			var MetrixLabGLOB_ReferrerType=MetrixLabGLOB_GetReferrerType(MetrixLabGLOB_Referrer.toLowerCase());
			MetrixLabGLOB_MetaForceData+='19999,1,'+MetrixLabGLOB_ReferrerType+';';
		}
    }
    
	return MetrixLabGLOB_MetaForceData;
}

function MetrixLabGLOB_CloseBanner()
{
    var MetrixLabGLOB_Div=document.getElementById('MetrixLabGLOB_Div');
    if (MetrixLabGLOB_Div)
    {
        MetrixLabGLOB_Div.parentNode.removeChild(MetrixLabGLOB_Div);
    }
}

function MetrixLabGLOB_GoToPrivacy()
{
    MetrixLabGLOB_PopupPrivacy=window.open(MetrixLabGLOB_PrivacyURL,'MetrixLabGLOB_PopupPrivacy','resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,width=800,height=600');
}

function MetrixLabGLOB_GoToMetrixLab()
{
    MetrixLabGLOB_MetrixWindow=window.open('http://www.metrixlab.com/','MetrixLabGLOB_MetrixWindow','resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,width=750,height=650');
}
function MetrixLabGLOB_ViewMore()
{
    var MetrixLabGLOB_overlayImg_src=document.getElementById('MetrixLabGLOB_gif').src;
    MetrixLabGLOB_overlayImg_src=MetrixLabGLOB_overlayImg_src.replace('overlay.gif','overlayMore.gif');   
	document.getElementById('MetrixLabGLOB_gif').style.display='none';
	document.getElementById('MetrixLabGLOBMore_gif').src=MetrixLabGLOB_overlayImg_src;
	document.getElementById('MetrixLabGLOBMore_gif').style.display='block';
}

function MetrixLabGLOB_GoToWebSurvey()
{
   MetrixLabGLOB_setCookie(180*24*60*60);
   
   var MetrixLabGLOB_SurveyServer=MetrixLabGLOB_SurveyServers[0];
   if (MetrixLabGLOB_isChatSurvey || MetrixLabGLOB_isP08492concuSurvey)
   {
		MetrixLabGLOB_SurveyServer=MetrixLabGLOB_SurveyServers[1];
   }
   
   if (MetrixLabGLOB_ForceData=='' || MetrixLabGLOB_ForceData=='0')
   {
        MetrixLabGLOB_PopupWebSurvey=window.open(MetrixLabGLOB_SurveyServer+'/go.asp?s='+MetrixLabGLOB_ProjectNumber+'&c='+MetrixLab_Channel,'metrixlab_gl_PopupWebSurvey','resizable=yes,scrollbars=yes,toolbar=no,menubar=no,width=750,height=450');
   }
   else
   {
        if (MetrixLabGLOB_ForceData=='4,4')
        {
            MetrixLabGLOB_PopupWebSurvey=window.open(MetrixLabGLOB_SurveyServer+'/go.asp?s='+MetrixLabGLOB_ProjectNumber+'&t=3&u='+MetrixLabGLOB_MeasuredData+'&f=;'+MetrixLabGLOB_ForceData+','+'&c='+MetrixLab_Channel,'metrixlab_gl_PopupWebSurvey','resizable=yes,scrollbars=yes,toolbar=no,menubar=no,width=750,height=450');
        }
        else
        {
            MetrixLabGLOB_PopupWebSurvey=window.open(MetrixLabGLOB_SurveyServer+'/go.asp?s='+MetrixLabGLOB_ProjectNumber+'&f=;'+MetrixLabGLOB_ForceData+'&c='+MetrixLab_Channel,'metrixlab_gl_PopupWebSurvey','resizable=yes,scrollbars=yes,toolbar=no,menubar=no,width=750,height=450');
        }        
   }
   MetrixLabGLOB_CloseBanner();
}

//endregion



