// Adobe Acrobat Detection  v1.0
// documentation: http://www.dithered.com/javascript/acrobat_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


var acrobatVersion = 0;
function getAcrobatVersion() {

   var agent = navigator.userAgent.toLowerCase(); 
  
   // NS3+, Opera3+, IE5+ Mac, Safari (support plugin array):  check for Acrobat plugin in plugin array
   if (navigator.plugins != null && navigator.plugins.length > 0) {

      for (i=0; i < navigator.plugins.length; i++ ) {
         var plugin = navigator.plugins[i];

         if (plugin.name.indexOf("Adobe Acrobat") > -1) {
            acrobatVersion = parseFloat(plugin.description.substring(30));
         }
      }
   }
   
   // IE4+ Win32:  attempt to create an ActiveX object using VBScript
   else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {

alert(agent); 
      document.write('<scr' + 'ipt language="VBScript"\> \n');
      document.write('on error resume next \n');
      document.write('dim obAcrobat \n');
      document.write('set obAcrobat = CreateObject("PDF.PdfCtrl.5") \n');
      document.write('if IsObject(obAcrobat) then \n');
      document.write('acrobatVersion = 5 \n');
      document.write('else set obAcrobat = CreateObject("PDF.PdfCtrl.1") end if \n');
      document.write('if acrobatVersion < 5 and IsObject(obAcrobat) then \n');
      document.write('acrobatVersion = 4 \n');
      document.write('end if');
      document.write('</scr' + 'ipt\> \n');
  }

   // Can't detect in all other cases
   else {
      acrobatVersion = acrobatVersion_DONTKNOW;
   }

   return acrobatVersion;
}

acrobatVersion_DONTKNOW = -1;

//getAcrobatVersion();





function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase(); 
//alert(ua);

   // browser engine name
   this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

   // browser name
   this.isKonqueror   = (ua.indexOf('konqueror') != -1); 
   this.isSafari      = (ua.indexOf('safari') != - 1);
   this.isOmniweb     = (ua.indexOf('omniweb') != - 1);
   this.isOpera       = (ua.indexOf('opera') != -1); 
   this.isIcab        = (ua.indexOf('icab') != -1); 
   this.isAol         = (ua.indexOf('aol') != -1); 
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isFirebird    = (ua.indexOf('firebird/') != -1);
   this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   
   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // rendering engine versions
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
   this.appleWebKitVersion = ( (this.isAppleWebKit) ? parseFloat( ua.substring( ua.indexOf('applewebkit/') + 12) ) : -1 );
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isGecko && !this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 3) + 1 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
   }
   else if (this.isOmniweb) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('omniweb/') + 8 ) );
   }
   else if (this.isOpera) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera') + 6 ) );
   }
   else if (this.isIcab) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab') + 5 ) );
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin    = (ua.indexOf('win') != -1);
   this.isWin32  = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac    = (ua.indexOf('mac') != -1);
   this.isUnix   = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux  = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);
   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
}
var browser = new BrowserDetect();





function isDefined(property) {
  return (typeof property != 'undefined');
}

var flashVersion = 0;
function getFlashVersion() {
   var latestFlashVersion = 8;
   var agent = navigator.userAgent.toLowerCase(); 
   
   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
   }
   
   // NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
   if (navigator.plugins != null && navigator.plugins.length > 0) {
      var flashPlugin = navigator.plugins['Shockwave Flash'];
      if (typeof flashPlugin == 'object') { 
         for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
      }
   }

   // IE4+ Win32:  attempt to create an ActiveX object using VBScript
   else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
      var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
      
   // WebTV 2.5 supports flash 3
   else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

   // older WebTV supports flash 2
   else if (agent.indexOf("webtv") != -1) flashVersion = 2;

   // Can't detect in all other cases
   else {
      flashVersion = flashVersion_DONTKNOW;
   }



   return flashVersion;


}

flashVersion_DONTKNOW = -1;

getFlashVersion();


resolutionvalue = 0;

function checkresolution() {
alert(screen.width + ' ' + screen.height);


if ((screen.width == 1024) && (screen.height == 768))
alert('OK');
else alert('best viewed at 1024 X 768 screen resolution.');

resolutionvalue = screen.width + ' ' + screen.height;

return resolutionvalue;

}

//checkresolution();



var hascookie = 'false';

function cc()
{
 /* check for a cookie */
  if (document.cookie == "") 
  {
    /* if a cookie is not found - alert user -
     change cookieexists field value to false */
    alert("COOKIES need to be enabled!");

    /* If the user has Cookies disabled an alert will let him know 
        that cookies need to be enabled to log on.*/ 

    //document.checkcookie.cookieexists.value ="false"  
    hascookie = 'false';
  } else {
   /* this sets the value to true and nothing else will happen,
       the user will be able to log on*/
    //document.checkcookie.cookieexists.value ="true"
    hascookie = 'true';
  }
  
//alert('cookies = ' + document.checkcookie.cookieexists.value);  


checkbrowser();

  
}

/* Set a cookie to be sure that one exists.
   Note that this is outside the function*/
document.cookie = 'killme' + escape('nothing')


//POPUP

function checkbrowser() {

//if ( document.checkcookie.cookieexists.value == 'false' || ((screen.width < 1024) && (screen.height < 768)) || (flashVersion < 1) )
//{

var generator=window.open('','detect','height=300,width=340');
  
  generator.document.write('<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Detection</title>');
  generator.document.write('<link rel="stylesheet" href="style.css">');
  generator.document.write('<head><body style="background-color:#ffffff;"><h3><!--- System check --->&#12471;&#12473;&#12486;&#12512;&#12481;&#12455;&#12483;&#12463;</h3>');
if (browser.versionMajor < 6) {
  generator.document.write('<p><!--- Browser version not supported.--->Browser version not supported.&#12502;&#12521;&#12454;&#12470;&#12539;&#12496;&#12540;&#12472;&#12519;&#12531;&#12399;&#12469;&#12509;&#12540;&#12488;&#12373;&#12428;&#12390;&#12356;&#12414;&#12379;&#12435;&#12290;</p> ');
} else {
  generator.document.write('<p><!--- Browser version supported. --->Browser version supported.&#12502;&#12521;&#12454;&#12470;&#65381;&#12496;&#12540;&#12472;&#12519;&#12531;&#12399;&#12469;&#12509;&#12540;&#12488;&#12373;&#12428;&#12390;&#12356;&#12414;&#12377;</p>');

}

if (flashVersion < 6) {
  generator.document.write('<p><!--- Flash player version not supported or not installed. --->	&#12501;&#12521;&#12483;&#12471;&#12517;&#12503;&#12524;&#12540;&#12516;&#12540;&#12539;&#12496;&#12540;&#12472;&#12519;&#12531;&#12399;&#12469;&#12509;&#12540;&#12488;&#12373;&#12428;&#12390;&#12356;&#12394;&#12356;&#12363;&#12289;&#12452;&#12531;&#12473;&#12488;&#12540;&#12523;&#12373;&#12428;&#12390;&#12356;&#12414;&#12379;&#12435;&#12290;</p>');
} else {

  generator.document.write('<p><!--- Flash player version supported. --->&#12501;&#12521;&#12483;&#12471;&#12517;&#12503;&#12524;&#12540;&#12516;&#12540;&#12539;&#12496;&#12540;&#12472;&#12519;&#12531;&#12399;&#12469;&#12509;&#12540;&#12488;&#12373;&#12428;&#12390;&#12356;&#12414;&#12377;&#12290;</p>');
}

if ( hascookie ) {
  generator.document.write("<p><!--- Cookies enabled. --->&#12463;&#12483;&#12461;&#12540;&#12399;&#26377;&#21177;&#12395;&#12394;&#12426;&#12414;&#12375;&#12383;&#12290;</p>");

} else {
  generator.document.write("<p><!--- Cookies not enabled on your browser!  Please enable cookies. --->	&#12354;&#12394;&#12383;&#12398;&#12502;&#12521;&#12454;&#12470;&#12391;&#12399;&#12463;&#12483;&#12461;&#12540;&#12364;&#26377;&#21177;&#12395;&#12394;&#12387;&#12390;&#12356;&#12414;&#12379;&#12435;&#12290;&#12463;&#12483;&#12461;&#12540;&#12434;&#26377;&#21177;&#12395;&#12375;&#12390;&#12367;&#12384;&#12373;&#12356;&#12290;</p>");

}

if (screen.width < 1024 || screen.height < 768) {
  generator.document.write('<p><!--- Current screen resolution not supported. --->&#29694;&#22312;&#12398;&#12473;&#12463;&#12522;&#12540;&#12531;&#35299;&#20687;&#24230;&#12399;&#12469;&#12509;&#12540;&#12488;&#12373;&#12428;&#12390;&#12356;&#12414;&#12379;&#12435;&#12290;</p>');
  generator.document.write('<p><!--- Best viewed at 1024 X 768 screen resolution. --->	1024 X 768 &#12398;&#12473;&#12463;&#12522;&#12540;&#12531;&#35299;&#20687;&#24230;&#12391;&#26368;&#36969;&#12395;&#34920;&#31034;&#12373;&#12428;&#12414;&#12377;&#12290;</p>');
} else {

  generator.document.write('<p><!--- Current screen resolution supported: --->&#29694;&#22312;&#12398;&#12473;&#12463;&#12522;&#12540;&#12531;&#35299;&#20687;&#24230;&#12399;&#12469;&#12509;&#12540;&#12488;&#12373;&#12428;&#12390;&#12356;&#12414;&#12377;&#12290; ' + screen.width + ' X ' + screen.height + '</p>');
}


  generator.document.write('<a href="javascript:self.close()"><!--- Close Window --->&#12454;&#12451;&#12531;&#12489;&#12454;&#12434;&#38281;&#12376;&#12427;&#12290;</a></p>');
  generator.document.write(' </body>');

  generator.document.write('</html>');
  
  generator.document.close();


//}


}
