

























//country select functions
var currentUrl = encodeURIComponent(window.location.href.toString());
var countrySelectURL = "http://www.invitrogen.com/cms/html/countryselect.html?currentUrl=" + currentUrl + "&amp;";
/* Update for Mercury 6425 */
countrySelectURL += "keepThis=true&amp;&amp;TB_iframe=true&amp;height=425&amp;width=530";
/* End Update for Mercury 6425 */
var javaScriptInclude = "http://www.invitrogen.com/cms/scripts/web/jquery.thickbox-mod.js";

function performExportCountrySelect(){
    if((getUserCountryCode() == null) || (getUserCountryCode() == '')){
        getJSInclude(javaScriptInclude, countrySelectURL);
    } 
}
//Sets the country data in env var countryInfo
var countryInfo = {"country": [{"CountryCode": "","CountryName": "","CountryFlag": "","CountryPhone": "&nbsp;", "CountryLanguages": ""}]};
var url = 'http://www.invitrogen.com/site.countryLookup.';
url += getUserCountryCode() + ".js";
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.getElementsByTagName("head").item(0).appendChild(script);


//used by Rich Text Editor
function CFC_popup(url, name, features){
    var defaultWidth = 500;
    var defaultHeight = 400;
    name = name.replace(" ", "");

    if (url.indexOf("/") == 0) url = "http://www.invitrogen.com" + url;
    if (features.indexOf("width") == -1) features += ",width=" + defaultWidth;
    if (features.indexOf("height") == -1) features += ",height=" + defaultHeight;
    var w = window.open(url, name, features);
    w.focus();
}

function getIEVersion() {
	var dataString = navigator.userAgent;
	var index = dataString.indexOf("MSIE");
	if (index == -1) return;
	return parseFloat(dataString.substring(index + 5));
}	

function getCookie(name){
  var cname = name + '=';
  var dc = document.cookie;
  if (dc == null) return '';
  if (dc.length > 0)
  {
    var begin = dc.indexOf(cname);
    if (begin != -1)
    {
      begin += cname.length;
      var end = dc.indexOf(';', begin);
      if (end == -1) end = dc.length;
      return unescape(dc.substring(begin, end));
    }
  }
  return '';
}
	
function getValueFromCookie(cookieValue, index){
	var cookie_ary = cookieValue.split(";");
	var pair = cookie_ary[index].split(":");
	return value = pair[1];
}

function getOrderId(cookieValue){
	return getValueFromCookie(cookieValue, 0);
}

function getCartItems(cookieValue){
	return getValueFromCookie(cookieValue, 1);
}

function getCountryIcon() {
	return "http://www.invitrogen.com/shared-static/images/icons/flags/" + countryInfo.country[0].CountryFlag;
}

function getCountryHeaderName() {
	return countryInfo.country[0].CountryName;
}

function getCountryPhone() {
	return countryInfo.country[0].CountryPhone;
}

function getCountryLanguages() {
	return countryInfo.country[0].CountryLanguages;
}

// findValue, selectItem and formatItem all used in conjuction with autocomplete
function findValue(li) {
	if( li == null ) return alert("No match!");
	if( !!li.extra ) var sValue = li.extra[0];
	else var sValue = li.selectValue;
}

function selectItem(li) {
	findValue(li);
}

function formatItem(row) {
	return row[0];
}


