	function DetermineButton()
	{
		var strmoniker = "";
		var struiculture = "";
	
		strmoniker = GetCookie("Moniker");
		struiculture = GetCookie("uiculture");

		

		if(
			strmoniker=="undefined" || strmoniker=="" || typeof(strmoniker) =="undefined" ||
			strmoniker==null
		  )
		{
			
		     if (struiculture == "en-CA")  
			 {document.write('<a target= _top href="/locator.aspx"><img src="/Content/Corporate/images/nav/but_connect.gif" border="0" /></a>');}
		     else if (struiculture == "fr-CA") 
			 {document.write('<a target= _top href="/locator.aspx"><img src="/Content/Corporate/images/nav/fr_but_connect.gif"  border="0" /></a>');}
		     else if (struiculture == "zh-CN") 
			 {document.write('<a target= _top href="/locator.aspx"><img src="/Content/Corporate/images/nav/cn_but_connect.gif"  border="0" /></a>');}

		}
		else
		{
                     if (struiculture == "en-CA") 
			{
                          strmoniker="/" + strmoniker;
			  document.write('<a target= _top href="' + strmoniker + '/ContactMe.aspx"><img src="/Content/Corporate/images/nav/but_connect.gif" border="0" /></a>');
                        }
                     else if (struiculture == "fr-CA") 
                        {
			  strmoniker="/" + strmoniker;
			  document.write('<a target= _top href="' + strmoniker + '/ContactMe.aspx"><img src="/Content/Corporate/images/nav/fr_but_connect.gif"  border="0" /></a>');
                        }
                     else if (struiculture == "zh-CN") 
                        {
			  strmoniker="/" + strmoniker;
			  document.write('<a target= _top href="' + strmoniker + '/ContactMe.aspx"><img src="/Content/Corporate/images/nav/cn_but_connect.gif"  border="0" /></a>');
                        }

		}


 

	}

	function DetermineShopOnlineType(optionalQueryString) {
		if (typeof optionalQueryString == "undefined") {
			optionalQueryString = "";
		}

		var strmoniker = "";
		var struiculture = "";

		strmoniker = GetCookie("Moniker");
		struiculture = GetCookie("uiculture");

		if (
			strmoniker == "undefined" || strmoniker == "" || typeof (strmoniker) == "undefined" ||
			strmoniker == null
		  ) {

			var strnewLink = escape("/locator.aspx") + optionalQueryString;
			top.location = strnewLink;

		}
		else {

			strmoniker = "/" + strmoniker;
			var strnewLink = escape(strmoniker + "/Profile.aspx") + optionalQueryString;
			top.location = strnewLink;
		}
	}


	function GetMoniker()
	{
		var strmoniker = "";
		
	
		strmoniker = GetCookie("Moniker");
		

		

		if(
			strmoniker=="undefined" || strmoniker=="" || typeof(strmoniker) =="undefined" ||
			strmoniker==null
		  )
		{			
	   
		     strmoniker = "";
           	     

		}
		else
		{

	             //strmoniker="/" + strmoniker;
		     


		}

		return strmoniker;
 

	}

	function convertLink(strlink)
	{
		var strmoniker;	
		strmoniker = "";
	


		strmoniker = GetCookie("Moniker");
		//strmoniker="lmacdonald";

		if(
			strmoniker=="undefined" || strmoniker=="" || typeof(strmoniker) =="undefined" ||
			strmoniker==null
		  )
		{

			//alert(strmoniker);
			//alert(document.cookie);
			strmoniker="";

		}
		else
		{
			strmoniker="/" + strmoniker;
			//strmoniker="";

		}

		var strnewLink = escape(strmoniker + strlink);

		//document.location=strnewLink;
		//top.location.href=strnewLink;
		top.location=strnewLink;


	}



        function TrendOpener(what, width, height) {

	    var strmoniker = "";
            strmoniker = GetCookie("Moniker");

	    if(
		strmoniker=="undefined" || strmoniker=="" || typeof(strmoniker) =="undefined" ||
		strmoniker==null
	      )
	      {
                strmoniker="0";
		
	      }

	    var strdomain = "";
            strdomain = document.domain;

	    if(strdomain == "marykay.ca")
            {
            	strdomain="www."+ strdomain;
            }

	    //alert(what+"&d="+strdomain+"&m="+strmoniker);
            window.open(what+"&d="+strdomain+"&m="+strmoniker, '', 'width=' + width + ',height=' + height + ',scrollbars=yes');
        }



	function setCulture()
	{
		var cultureURL="";
		cultureURL= document.URL;
		cultureURL= cultureURL.toLowerCase();


		if (cultureURL.indexOf("/fr-ca/") >= 0)
		{
			SetCookie("LanguageID", "3", null, "/");	
	
		}
		else
		{
			SetCookie("LanguageID", "1", null, "/");	
	
		}
		//alert(GetCookie("LanguageID"));

	}

	

	function ToggleLanguage()

	{		
		var lang = $get('LanguageID');		
		var str = document.URL;
		str= str.toLowerCase();
		
		//delete_cookie("LanguageID");
		
		if (lang.value == "1")
		{
			str = str.replace("/en-ca/", "/fr-ca/");
			
		}
		else if (lang.value == "3")
		{
			str = str.replace("/fr-ca/", "/en-ca/");
		}

		document.location=str;
	}


	function ToggleLanguage_MimicPWS()
	{
		var lang = $get('LanguageID');
		var str = document.URL;
		str= str.toLowerCase();
		var referurl = GetCookie("ReferURL");
		//delete_cookie("LanguageID");

		if (str.indexOf("/en-ca/") >= 0)
		{
			str = str.replace("/en-ca/", "/fr-ca/");
			referurl = referurl.replace("/en-ca/", "/fr-ca/");
			SetCookie("ReferURL", referurl, null, "/");
			SetCookie("Toggled", "true", null, "/");
		}
		else if (str.indexOf("/fr-ca/") >= 0)
		{
			str = str.replace("/fr-ca/", "/en-ca/");
			referurl = referurl.replace("/fr-ca/", "/en-ca/");
			SetCookie("ReferURL", referurl, null, "/");
			SetCookie("Toggled", "true", null, "/");
		}

		window.top.location.href=str;
	}



	function SearchCons() 
    { 

		var lang = $get('LanguageID');


		if (lang.value == "3")
		{
		document.location="/Search?LanguageID=3";
	
		}
		else 
		{
		document.location="/Search?LanguageID=1";
		}


     }	  	     



	function Login() 
    { 
		var strdomain = "";
		var lang = $get('LanguageID');
	
		strdomain = document.domain;
                
        //this is so consultants don't see certificate error if in the domain without the www part
        if (strenv == "PRODUCTION")
		{
        	if(strdomain == "marykay.ca")
            {
            	strdomain="www."+ strdomain
            }
		}
                

		strdomain = location.protocol + "//" + strdomain;


		if (lang.value == "3")
		{
		document.location= strdomain + "/mkbiz?LanguageID=3";
	
		}
		else 
		{
		document.location= strdomain + "/mkbiz?LanguageID=1";
		}


    }	  	 




	function whichHomeCorp() 
	{ 
	 var webDirectory = GetCookie("PWSDir");
	 var lang = $get('LanguageID');

	if(webDirectory==null)
	{
	   webDirectory="";
	}
	


	  if(
		webDirectory=="undefined" || webDirectory=="" || typeof(webDirectory) =="undefined" ||
		webDirectory.indexOf("Display.asp") >= 0 || webDirectory.toUpperCase() == "SEARCH" 
	    )


	  {
		if (lang.value == "3")
		{
			document.location="/Content/corporate/fr-ca/default.html";
	
		}
		else 
		{
			document.location="/Content/corporate/en-ca/default.html";
		}	  	     

	  }

	  else
	  {
		
		if (lang.value == "3")
		{
			document.location= "/" + webDirectory + "?LanguageID=3";
	
		}
		else 
		{
			document.location= "/" + webDirectory + "?LanguageID=1";
		}	  	     

	  }


	}



	function whichBuyCorp() 
	{ 
	 var webDirectory = GetCookie("PWSDir");
	 var lang = $get('LanguageID');
	 //var lang = GetCookie("LanguageID");

	 var url = document.URL;
 
	  if(webDirectory==null)
	  {
	     webDirectory="";
	  }
	 


	  if(
		webDirectory=="undefined" || webDirectory=="" || typeof(webDirectory) =="undefined" ||
		webDirectory.indexOf("Display.asp") >= 0 || webDirectory.toUpperCase() == "SEARCH"
	    )


	  {
		if (lang.value == "3")
		{
			document.location="/Search?LanguageID=3";
	
		}
		else 
		{
			document.location="/Search?LanguageID=1";
		}	  	     

	  }

	  else
	  {
		var strenvPageID ="";

		//if (url.indexOf("http://www.") >= 0 || url.indexOf("https://www.") >= 0)

		if (strenv == "PRODUCTION" || strenv == "STAGING")
		{

			strenvPageID ="1504";
		}
		else
		{
			
			strenvPageID ="1239";;
		}



		
		if (lang.value == "3")
		{			
			document.location= "/Display.asp?PageID=" + strenvPageID + "&LanguageID=3&Directory=" + webDirectory;
	
		}
		else 
		{
			document.location= "/Display.asp?PageID=" + strenvPageID + "&LanguageID=1&Directory=" + webDirectory;
		}	  	     

	  }


	}



	function getCookieVal (offset) {
	  var endstr = document.cookie.indexOf (";", offset);
	  if (endstr == -1)
	    endstr = document.cookie.length;
	  return unescape(document.cookie.substring(offset, endstr));
	}



	function FixCookieDate (date) {
	  var base = new Date(0);
	  var skew = base.getTime(); // dawn of (Unix) time - should be 0
	  if (skew > 0)  // Except on the Mac - ahead of its time
	    date.setTime (date.getTime() - skew);
	}


	function GetCookie (name) {
	  var arg = name + "=";
	  var alen = arg.length;
	  var clen = document.cookie.length;
	  var i = 0;
	  while (i < clen) {
	    var j = i + alen;
	    if (document.cookie.substring(i, j) == arg)
	      return getCookieVal (j);
	    i = document.cookie.indexOf(" ", i) + 1;
	    if (i == 0) break; 
	  }
	  return null;
	}


	function SetCookie (name,value,expires,path,domain,secure) {
	  document.cookie = name + "=" + escape (value) +
	    ((expires) ? "; expires=" + expires.toGMTString() : "") +
	    ((path) ? "; path=" + path : "") +
	    ((domain) ? "; domain=" + domain : "") +
	    ((secure) ? "; secure" : "");
	}



	function DeleteCookie (name,path,domain) {

	var cookie_date = new Date ( );  // current date & time
	cookie_date.setTime ( cookie_date.getTime() - 1 );



	  if (GetCookie(name)) {
	    document.cookie = name + "=" +
	      ((path) ? "; path=" + path : "") +
	      ((domain) ? "; domain=" + domain : "") +
	      "; expires=" + cookie_date.toGMTString();
	  }
	}




	//quuery string parse examples
	//var qs = new Querystring();
	//var v1 = qs.get("Directory");


	function Querystring(qs) { // optionally pass a querystring to parse
		this.params = new Object()
		this.get=Querystring_get
	
		if (qs == null)
		qs=location.search.substring(1,location.search.length)

		if (qs.length == 0) return

	// Turn <plus> back to <space>
	// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
		qs = qs.replace(/\+/g, ' ')
		var args = qs.split('&') // parse out name/value pairs separated via &
	
	// split out each name=value pair
		for (var i=0;i<args.length;i++) {
			var value;
			var pair = args[i].split('=')
			var name = unescape(pair[0])

			if (pair.length == 2)
				value = unescape(pair[1])
			else
				value = name
		
			this.params[name] = value
		}
	}

	function Querystring_get(key, default_) {
		// This silly looking line changes UNDEFINED to NULL
		if (default_ == null) default_ = null;
		
		var value=this.params[key]
		if (value==null) value=default_;
	
		return value
	}
	
	function MM_findObj(n, d) { //v4.01
  		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_preloadImages() { //v3.0
	   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	
	
	
	

