function InsertBrowserSpecCSS() { var agt=navigator.userAgent.toLowerCase(); if(agt.Contains("msie 6.")) { CSS.load("/css/style_ie6.css"); } else if(agt.Contains("msie 7.")) { CSS.load("/css/style_ie7.css"); } else if(agt.Contains("firefox")) { CSS.load("/css/style_firefox.css"); } else if(agt.Contains("safari")) { CSS.load("/css/style_safari.css"); } } var CSS = { load: /*static*/ function (url_) { // We are preventing loading a file already loaded var _links = document.getElementsByTagName("link"); var _head = document.getElementsByTagName("head")[0]; var removeLater=null; // Loop through the length of the links for( i = 0; _links.length > i; i++) { // If the href is already present, remove it var lastQi = _links[i].href.lastIndexOf('?'); var lastQu = url_.lastIndexOf('?'); var compi = _links[i].href.substring(0, lastQi); if (compi.indexOf(url_)!=-1) { removeLater = _links[i]; } } // Build link element var _elstyle = document.createElement("link"); _elstyle.setAttribute("rel", "stylesheet"); _elstyle.setAttribute("type", "text/css"); _elstyle.setAttribute("href", url_ + '?'+(Math.random()*9999).toString()); // Add style _head.appendChild(_elstyle); if(removeLater !==null) { window.setTimeout(function(){_head.removeChild(removeLater);},350); } } };