function loadStyleSheet( doc, sheetURL, mediaTypes ) { var link; if( doc.createElement && ( link = doc.createElement( 'link' ) ) ) { link.rel = 'stylesheet'; link.href = 'css/' + sheetURL; link.type = 'text/css'; if( mediaTypes ) link.media = mediaTypes; } var head = doc.getElementsByTagName( 'head' )[0]; if( head ) head.appendChild( link ); }