var t; $("#openlanguagemenu").click(function () { if ($("#slider").is(":hidden")) { /* warning styles must match original css */ var sliderwidth; // hack to fix browser differences in ie. not sure what cause of this is. if ($.browser.msie) { sliderwidth = "256px"; } else { sliderwidth = "255px"; } /* end hack */ $("#openlanguagemenu a#selected").animate({"width": sliderwidth },200,function() { $("#openlanguagemenu a#selected").css("border-bottom","none"); $("#openlanguagemenu a#selected").css("background","none"); $("#openlanguagemenu #selectedlangtext").hide(); // selected lang crowds available langs. hide. $("#slider").slideDown("fast"); }); } else { $("#slider").hide(); } }); $("#openlanguageul").mouseout( function () { t = setTimeout( function() { $("#slider").slideUp(1000, function() { $("#openlanguagemenu a#selected").css("border-bottom","1px solid #999"); $("#openlanguagemenu a#selected").css("background","url(/images/language_arrow.gif) no-repeat 107px 8px"); $("#openlanguagemenu a#selected").css("width","115px"); $("#openlanguagemenu #selectedlangtext").show(); } ); },1000); }) ; $("#slider").mouseover( function () { clearTimeout(t); }); $("#openlanguageul").mouseover( function () { clearTimeout(t); }); function goTo(lang) { /* find the new site based on the current url */ var baseURL = document.location.href; baseURL = baseURL.replace(/https?:\/\/www.biotek.de\/(de\/)?/g,''); baseURL = baseURL.replace(/https?:\/\/www.biotekchina.com.cn\/(zh-CN\/)?/g,''); baseURL = baseURL.replace(/https?:\/\/www.biotek.es\/(es\/)?/g,''); baseURL = baseURL.replace(/https?:\/\/www.biotek.jp\/(ja\/)?/g,''); baseURL = baseURL.replace(/https?:\/\/www.biotek.fr\/(fr\/)?/g,''); baseURL = baseURL.replace(/https?:\/\/www.biotek.com\//g,''); baseURL = baseURL.replace(/https?:\/\/www.biotekinstruments.it\/(it\/)?/g,''); baseURL = baseURL.replace(/https?:\/\/www.biotekinstruments.co.kr\/(ko\/)?/g,''); baseURL = baseURL.replace(/https?:\/\/www.biotekinstruments.ru\/(ru\/)?/g,''); var newloc = "http://www.biotek.com"; if (lang == 'de') { newloc = "http://www.biotek.de/de/" + baseURL; } else if (lang == 'zh-CN') { newloc = "http://www.biotekchina.com.cn/zh-CN/" + baseURL; } else if (lang == 'ja') { newloc = "http://www.biotek.jp/ja/" + baseURL; } else if (lang == 'es') { newloc = "http://www.biotek.es/es/" + baseURL; } else if (lang == 'fr') { newloc = "http://www.biotek.fr/fr/" + baseURL; } else if (lang == 'it') { newloc = "http://www.biotekinstruments.it/it/" + baseURL; } else if (lang == 'ko') { newloc = "http://www.biotekinstruments.co.kr/ko/" + baseURL; } else if (lang == 'ru') { newloc = "http://www.biotekinstruments.ru/ru/" + baseURL; } else { newloc = "http://www.biotek.com/" + baseURL; } document.location.href = newloc; return false; } $(document).ready(function () { $("#slider li a").click(function() { goTo($(this).attr("href")); return false; }); });