function Browser(detect_for_flash,detect_for_quicktime){
this.author="Guy Shahar";
this.lastModified="v4.0 rev 11/09/05";
this.lastModifiedBy=this.author;
http="http:/\/";
this.Usage_URL=http+"www.guyshahar.com/detect/usage.html";
this.browserName=false;
this.platform="Unknown Platform";
this.v=parseFloat(navigator.appVersion);
this.uA=navigator.userAgent;
this.ns=false;
this.ns6=false;
this.ie=false;
this.ie5=false;
this.opera=false;
this.AOL=false;
this.mozilla=false;
this.firefox=false;
this.safari=false;
this.gecko=false;
this.mac=false;
this.pc=false;
this.linux=false;
this.dhtml=false;
this.Java=false;
this.Flash_Download=http+"www.macromedia.com/go/getflashplayer";
this.Flash_Codebase=http+"download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab";
this.Flash="Not Detected";
this.FlashDescription="Not Detected";
this.QuickTime="Not Detected";
this.QuickTime_Codebase=http+"www.apple.com/qtactivex/qtplugin.cab";
this.loaded=false;
this.mac=navigator.appVersion.toLowerCase().indexOf('mac')!=-1?true:false;
this.pc=navigator.appVersion.toLowerCase().indexOf('win')!=-1?true:false;
this.linux=navigator.platform.toLowerCase().indexOf('linux')!=-1?true:false;
var ns6pos=this.uA.indexOf('Netscape/');
var iepos=this.uA.indexOf('MSIE');
var oppos=this.uA.indexOf('Opera');
var AOLpos=this.uA.toUpperCase().indexOf('AOL');
var firefox_pos=this.uA.indexOf('Firefox');
var mozilla_pos=this.uA.indexOf('Mozilla');
var gecko_pos=this.uA.indexOf('Gecko');
var safari_pos=this.uA.indexOf('Safari');
this.gecko=(gecko_pos!=-1)?true:false;
this.mozilla=(mozilla_pos!=-1)?true:false;
if(oppos>0){
this.v=parseFloat(this.uA.substring(oppos+6,this.uA.length));
this.opera=true;
}
if(navigator.appName.indexOf('Netscape')!=-1){
this.ns=true;
this.browserName="Netscape";
ns_temparray=this.uA.substring(ns6pos+9,this.uA.length).split(" ");
if(ns6pos!=-1){
this.v=parseFloat(ns_temparray[0]);
this.ns6=true;
this.browserName="Netscape";
}
}
if(mozilla_pos!=-1){
this.mozilla=true;
if(!document.layers&&!this.ns6){
this.ns=false;
this.browserName="Mozilla";
mz_array=this.uA.substring(this.uA.indexOf("rv:")+3,this.uA.length).split(")");
this.v=parseFloat(mz_array[0]);
}
}
if(firefox_pos!=-1){
this.firefox=true;
this.ns=false;
this.browserName="Firefox";
fx_temparray=this.uA.substring(firefox_pos+8,this.uA.length).split(" ");
this.v=parseFloat(fx_temparray[0]);
}
if(safari_pos!=-1){
this.safari=true;
this.ns=false;
this.browserName="Safari";
fx_temparray=this.uA.substring(safari_pos+7,this.uA.length).split(" ");
this.v=parseFloat(fx_temparray[0]);
}
if(iepos!=-1){
this.ie=true;
this.browserName="IE";
ie5cut=this.uA.substring(iepos+5,this.uA.length);
this.v=parseFloat(ie5cut.substring(0,ie5cut.indexOf('\;')));
if(this.v>=5){
this.ie5=true;
}
}
this.guy=true;
if(AOLpos!=-1){
this.AOL=parseFloat(this.uA.substring((AOLpos+3),this.uA.length));
}
if(document.getElementById||document.all||document.layers){
this.dhtml=true;
}
this.Java=navigator.javaEnabled();
if(this.mac){
this.platform="Mac";
}
else if(this.pc){
this.platform="Windows";
}
else if(this.linux){
this.platform="Linux";
}
Browser.prototype.Display=DetectDisplay;
Browser.prototype.DetectFlash=DetectFlash;
Browser.prototype.EmbedFlash=DetectEmbedFlash;
Browser.prototype.DetectQuickTime=DetectQuickTime;
Browser.prototype.EmbedQuickTime=DetectEmbedQuickTime;
Browser.prototype.EmbedStyleSheet=DetectEmbedStyleSheet;
Browser.prototype.AlternateCSS=DetectAlternateCSS;
Browser.prototype.FixPrint=DetectFixPrint;
Browser.prototype.Help=DetectHelp;
Browser.prototype.Usage=DetectHelp;
if(detect_for_flash==true){
this.DetectFlash();
}
if(detect_for_quicktime==true){
this.DetectQuickTime();
}
}

function DetectFlash(){
if(this.Flash!="Not Detected"){
return;
}
ActiveX='<SCRIPT LANGUAGE="VBScript">\n';
ActiveX+='Function VBGetSwfVer(i)\n';
ActiveX+='on error resume next\n';
ActiveX+='Dim swControl, swVersion\n';
ActiveX+='swVersion = 0\n';
ActiveX+='set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))\n';
ActiveX+='if (IsObject(swControl)) then\n';
ActiveX+='swVersion = swControl.GetVariable("$version")\n';
ActiveX+='end if\n';
ActiveX+='VBGetSwfVer = swVersion\n';
ActiveX+='End Function\n';
ActiveX+='<\/SCRIPT>\n';
if(navigator.plugins!=null&&navigator.plugins.length>0){
if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){
var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";
var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;
descArray=flashDescription.split(" ");
tempArrayMajor=descArray[2].split(".");
versionMajor=tempArrayMajor[0];
versionMinor=tempArrayMajor[1];
if(descArray[3]!=""){
tempArrayMinor=descArray[3].split("r");
}
else{
tempArrayMinor=descArray[4].split("r");
}
versionRevision=tempArrayMinor[1]>0?tempArrayMinor[1]:0;
this.Flash=parseInt(versionMajor);
this.FlashDescription=versionMajor+"."+versionMinor+"."+versionRevision;
}
else{
this.Flash=false;
}
}
else if(this.ie){
if(!this.mac||(this.mac&&this.ie&&this.v>=5)){
document.write(ActiveX);
for(i=25;i>0;i--){
versionStr=VBGetSwfVer(i);
if(versionStr==-1){
this.Flash=false;
return false;
}
else if(versionStr!=0){
tempArray=versionStr.split(" ");
tempString=tempArray[1];
versionArray=tempString .split(",");
versionMajor=versionArray[0];
versionMinor=versionArray[1];
versionRevision=versionArray[2];
this.FlashDescription=versionMajor+"."+versionRevision;
this.Flash=parseInt(this.FlashDescription);
break;
}
else if(versionStr==0){
this.Flash=false;
}
}
}
else{
this.Flash=false;
this.FlashDescription="Could not be detected";
}
}
disableFlash=document.URL.toLowerCase().indexOf("flash=false")>document.URL.indexOf("?");
if(disableFlash){
this.Flash=false;
}
}

function DetectQuickTime(){
if(this.QuickTime!="Not Detected"){
return;
}
ActiveX='<SCRIPT LANGUAGE="VBScript">\n';
ActiveX+='Function GetQuickTime\n';
ActiveX+='On Error Resume Next\n';
ActiveX+='Set theObject = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")\n';
ActiveX+='On Error goto 0\n';
ActiveX+='If IsObject(theObject) Then\n';
ActiveX+='If theObject.IsQuickTimeAvailable(0) Then\n';
ActiveX+='QTime = true\n';
ActiveX+='End If\n';
ActiveX+='End If\n';
ActiveX+='GetQuickTime = QTime\n';
ActiveX+='End Function\n';
ActiveX+='<\/SCRIPT>\n';
if(navigator.plugins&&navigator.plugins.length>0){
nparray=navigator.plugins;
nparraylen=nparray.length;
for(i=0;i<nparraylen;i++){
npplugin=nparray[i];
npname=npplugin.name;
npdesc=npplugin.description;
if(npname.indexOf("QuickTime")!=-1){
this.QuickTime=true;
}
}
}
else if(this.ie){
if(!this.mac||(this.mac&&this.ie&&this.v>=5)){
document.write(ActiveX);
this.QuickTime=GetQuickTime();
if(!this.QuickTime){
this.QuickTime=false;
}
}
else{
this.QuickTime=-1;
}
}
disableQuickTime=document.URL.toLowerCase().indexOf("quicktime=false")>document.URL.indexOf("?");
if(disableQuickTime){
this.QuickTime=false;
}
}

function DetectDisplay(){
if(this.mac){
font_size=12;
}
else{
font_size=10.5;
}
document.write('<style type="text/css">\<\!--td {font-family: arial;font-size:'+font_size+'pt;}\n .browser-small {font-size:'+(font_size-2)+'pt;}--\></style>');
if(this.Flash&&this.Flash!="Not Detected"){
flash_installed=" with Flash "+this.Flash;
}
else{
flash_installed="";
}
if(this.QuickTime&&this.QuickTime!="Not Detected"){
qt_installed=", QuickTime";
}
else{
qt_installed="";
}
document.writeln('<blockquote><table border="0" cellspacing="1" cellpadding="1">');
document.writeln('<tr><td colspan="2"><font color="#003399"><b>'+this.browserName+' '+this.v+' on '+this.platform+flash_installed+qt_installed+'</b></font><hr></td></tr>');
document.writeln('<tr><td class=browser-small><b>appName</b>: </td><td class=browser-small>'+navigator.appName+'</td></tr>');
document.writeln('<tr><td class=browser-small><b>appVersion</b>: </td><td class=browser-small>'+navigator.appVersion+'</td></tr>');
document.writeln('<tr><td class=browser-small><b>userAgent</b>: </td><td class=browser-small>'+navigator.userAgent+'</td></tr>');
document.writeln('<tr><td class=browser-small><b>platform</b>: </td><td class=browser-small>'+navigator.platform+'</td></tr>');
document.writeln('<tr><td colspan="2">&nbsp;</td></tr>');
document.writeln('<tr><td><b>Browser</b>: </td><td>'+this.browserName+'</td></tr>');
document.writeln('<tr><td><b>Platform</b>: </td><td>'+this.platform+'</td></tr>');
document.writeln('<tr><td><b>ns6</b>: </td><td>'+this.ns6+'</td></tr>');
document.writeln('<tr><td><b>ie</b>: </td><td>'+this.ie+'</td></tr>');
document.writeln('<tr><td><b>ie5+</b>: </td><td>'+this.ie5+'</td></tr>');
document.writeln('<tr><td><b>firefox</b>: </td><td>'+this.firefox+'</td></tr>');
document.writeln('<tr><td><b>mozilla</b>: </td><td>'+this.mozilla+'</td></tr>');
document.writeln('<tr><td><b>safari</b>: </td><td>'+this.safari+'</td></tr>');
document.writeln('<tr><td><b>gecko</b>: </td><td>'+this.gecko+'</td></tr>');
document.writeln('<tr><td><b>opera</b>: </td><td>'+this.opera+'</td></tr>');
document.writeln('<tr><td><b>pc</b>: </td><td>'+this.pc+'</td></tr>');
document.writeln('<tr><td><b>mac</b>: </td><td>'+this.mac+'</td></tr>');
document.writeln('<tr><td><b>linux</b>: </td><td>'+this.linux+'</td></tr>');
document.writeln('<tr><td><b>AOL</b>: </td><td>'+this.AOL+'</td></tr>');
document.writeln('<tr><td><b>dhtml</b>: </td><td>'+this.dhtml+'</td></tr>');
document.writeln('<tr><td><b>Java</b>: </td><td>'+this.Java+'</td></tr>');
document.writeln('<tr><td><b>Flash</b>: </td><td>'+this.Flash+' ('+this.FlashDescription+')</td></tr>');
document.writeln('<tr><td><b>QuickTime</b>: </td><td>'+this.QuickTime+'</td></tr>');
if(document.layers){
document.writeln('<tr><td><b>Width</b>: </td><td>'+this.origWidth+'</td></tr>');
document.writeln('<tr><td><b>Height</b>: </td><td>'+this.origHeight+'</td></tr>');
}
document.writeln('<tr><td><br /></td><td><br /></td></tr>');
document.writeln('<tr><td><b>Author</b>: </td><td>'+this.author+'</td></tr>');
document.writeln('<tr><td><b>Last Revision</b>: </td><td>'+this.lastModified+' by '+this.lastModifiedBy+'</td></tr>');
document.writeln('<tr><td colspan=2><br /><a href="'+this.Usage_URL+'">Usage</a></td></tr>');
document.writeln('</table></blockquote>');
}

function DetectEmbedFlash(file,width,height,fVersion,autostart,force,flashvars,bgcolor,base){
if(this.Flash=="Not Detected"){
this.DetectFlash();
}
var insHTML="";
var override=document.URL.indexOf("flash=false")>document.URL.indexOf("?");
var force_flash=document.URL.indexOf("flash=true")>document.URL.indexOf("?");
if(!fVersion){
fVersion=3;
}
if(!width){
width=10;
}
if(!height){
height=10;
}
if(!autostart){
autostart=false;
}
if(!bgcolor){
bgcolor="#ffffff";
}
if(!flashvars){
embed_flashvars="";
param_flashvars="";
}
else{
embed_flashvars=" flashvars="+flashvars+" ";
param_flashvars="<PARAM NAME=flashvars VALUE="+flashvars+">";
}
file_ID=(file.indexOf(".")==0||file.indexOf("/")==0)?"Flashfile":file.substring(0,file.indexOf('.'));
if((this.Flash>=parseFloat(fVersion)&&!override)||(force&&this.mac&&this.ie&&this.v<5)||force_flash){
insHTML=('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+this.Flash_Codebase+'" HEIGHT='+height+' WIDTH='+width+' ID='+file_ID+'>\n');
insHTML+=('<PARAM NAME=movie VALUE="'+file+'">\n');
if(param_flashvars!=""){
insHTML+=param_flashvars+"\n";
}
insHTML+=('<PARAM NAME=quality VALUE=best>\n');
insHTML+=('<PARAM NAME=bgcolor VALUE='+bgcolor+'>\n');
insHTML+=('<PARAM NAME=AUTOSTART VALUE='+autostart+'> \n');
insHTML+=('<EMBED src="'+file+'" quality=high width='+width+' height='+height+' bgcolor='+bgcolor+' '+embed_flashvars+' type="application/x-shockwave-flash" pluginspage="'+this.Flash_Download+'" autostart="'+autostart+'"');
insHTML+=('></EMBED>\n');
insHTML+=('</OBJECT>\n');
document.write(insHTML);
return true;
}
else{
return false;
}
}

function DetectEmbedQuickTime(file,width,height,controller,autostart){
if(this.QuickTime=="Not Detected"){
this.DetectQuickTime();
}
var insHTML="";
if(controller==null)controller=false;
if(autostart==null)autostart=true;
var QuickTime_Download_URL="http://www.apple.com/quicktime/download/";
var override=document.URL.toLowerCase().indexOf("quicktime=false")>document.URL.indexOf("?");
if(!override&&this.QuickTime==true){
insHTML=('<OBJECT classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="'+this.QuickTime_Codebase+'" HEIGHT='+height+' WIDTH='+width+'>\n');
insHTML+=('<PARAM NAME=src VALUE="'+file+'">\n');
insHTML+=('<PARAM NAME=controller VALUE='+controller+'>\n');
insHTML+=('<PARAM NAME=autoplay VALUE='+autostart+'> \n');
insHTML+=('<EMBED src="'+file+'" WIDTH='+width+' HEIGHT='+height+' PLUGINSPAGE="'+QuickTime_Download_URL+'" autoplay='+autostart+' controller='+controller+'></EMBED>\n');
insHTML+=('</OBJECT>\n');
document.write(insHTML);
return true;
}
}

function DetectEmbedStyleSheet(file,elsefile){
var args=DetectEmbedStyleSheet.arguments;
var conditions=0;
var embed_file;
for(i=2;i<args.length;i++){
if(args[i]==true){
conditions++;
}
}
if(conditions==(args.length-2)||args.length<=2){
embed_file=file;
}
else if(elsefile){
embed_file=elsefile;
}
if(embed_file){
document.writeln('<LINK REL="stylesheet" TYPE="text/css" HREF="'+embed_file+'" />');
}
}

function DetectAlternateCSS(CSS_ns,CSS_mac){
if(document.layers){
this.EmbedStyleSheet(CSS_ns);
}
if(this.mac&&!this.ns6&&!(this.ie&&this.v>=5)){
this.EmbedStyleSheet(CSS_mac);
}
}
window.print=window.print;

function DetectFixPrint(){
if(this.ie){
if(this.pc){
document.write('<OBJECT ID="thePrinter" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT><SCRIPT LANGUAGE="VBScript">\nsub PrintThis\nOn Error Resume Next\nthePrinter.ExecWB 6, 1\nend sub\n</SCRIPT>');
window.print=new Function("PrintThis()");
}
else{
window.print=new Function("alert('This function is disabled by your browser.\\n\\nClick OK, then press Command-P to Print.')");
}
}
}

function DetectHelp(){
window.open("' + this.Usage_URL + '");
}


var thisClient = new Browser(true);

