/***************************************************************
* iViewAnywhere Application Library
* (c) copyright 2005-2008 Fushia Corp. All rights reserved
****************************************************************/


isOpen= false;
aWindow=null

function help() {
     if ( isOpen==true && aWindow!=null ) {
      	aWindow.close();
      }
      isOpen = true;
      aWindow = window.open("","",'width=360,height=220,directories=no,location=no,menubar=no, scrollbars=yes,status=no,toolbar=no,resizable=no'); 
      aWindow.document.write("<html>");
      aWindow.document.write("<title>Help</title>");
      aWindow.document.write("<head>");
      aWindow.document.write("<link href='/ivaw/css/style.css' rel='stylesheet' type='text/css' />");
      aWindow.document.write("</head>"); 

      aWindow.document.write("<div id='main-inner-forgotpwd'>");
 
      aWindow.document.write("<form id='form2' name='form2' method='post' action='/help'>");
      aWindow.document.write("<br>");
      aWindow.document.write("<p> <font color = '#003366' size = 3pt><b> iViewAnywhere Help </b></p>");

      aWindow.document.write("<font color = '#FF6600' size = 2pt>");
      aWindow.document.write("<label><b>Your Login Email Address:</b><br/>");
      aWindow.document.write("<input name='email' type='text' id='email' size='30' />");
      aWindow.document.write("</label><br/>");
      aWindow.document.write("<br/>");

      aWindow.document.write("<input type='submit' name='Submit' value='Submit' />"); 

      aWindow.document.write("</form>");

      aWindow.document.write("</div>");

     aWindow.document.write("</html>");
 
   }

function resetpwd() {
     if ( isOpen==true && aWindow!=null ) {
      	aWindow.close();
      }
      isOpen = true;
      aWindow = window.open("","",'width=350,height=400,directories=no,location=no,menubar=no, scrollbars=yes,status=no,toolbar=no,resizable=no'); 
      aWindow.document.write("<html>");
      aWindow.document.write("<title>Reset Password</title>");
      aWindow.document.write("<head>");
      aWindow.document.write("<link href='/ivaw/css/style.css' rel='stylesheet' type='text/css' />");
      aWindow.document.write("</head>"); 

      aWindow.document.write("<div id='main-inner-forgotpwd'>");
 
      aWindow.document.write("<form id='form2' name='form2' method='post' action='/forgotpwd'>");
      aWindow.document.write("<br>");
      aWindow.document.write("<p> <font color = '#003366' size = 3pt><b> Verify User Identity Information </b></p>");

      aWindow.document.write("<font color = '#FF6600' size = 2pt>");
      aWindow.document.write("<label><b>Email:</b><br />");
      aWindow.document.write("<input name='email' type='text' id='email' size='30' />");
      aWindow.document.write("</label><br/>");
      aWindow.document.write("<br>");

      aWindow.document.write("<font color = '#FF6600' size = 2pt>");
      aWindow.document.write("<label><b>Zip or Postal Code:</b><br />");
      aWindow.document.write("<input name='zip' type='text' id='zip' size='30'/>");
      aWindow.document.write("</label><br/>");
      aWindow.document.write("<br>");

      aWindow.document.write("<font color = '#FF6600' size = 2pt>");
      aWindow.document.write("<label><b>Question:</b></>");
      aWindow.document.write("<select name='question'>");
      aWindow.document.write("<OPTION value='What was the color of your first car?' SELECTED>What was the color of your first car?");
      aWindow.document.write("<OPTION value='What is the name of your pet?' >What is the name of your pet?");
      aWindow.document.write("<OPTION value='What is the name of your favorite restaurant?' >What is the name of your favorite restaurant?");
      aWindow.document.write("<OPTION value='What is your favorite song?' >What is your favorite song?");
      aWindow.document.write("<OPTION value='What is the name of your favorite pop singer?'>What is the name of your favorite pop singer?");
      aWindow.document.write("<OPTION value='What is the name of your favorite movie star?' >What is the name of your favorite movie star?");
      aWindow.document.write("<OPTION value='What is your favorite sport?' >What is your favorite sport?");
      aWindow.document.write("</select>");
      aWindow.document.write("<p />");



      aWindow.document.write("<font color = '#FF6600' size = 2pt>");
      aWindow.document.write("<label><b>Answer:</b><br/>");
      aWindow.document.write("<input name='answer' type='text' id='answer' size='30' />");
      aWindow.document.write("</label><br>");
      aWindow.document.write("<br>");


      aWindow.document.write("<div id='forgotpwd_submit'><input type='submit' name='Submit' value='Submit' /></div>");
      

      aWindow.document.write("</form>");

      aWindow.document.write("</div>");

     aWindow.document.write("<html>");
 
   }


function launchJNLPJavaAutoInstallFF( url ) {
   string =  fusGetDownloadJavaFFContent( url ) ; 
   document.write( string );

}


function launchJNLPJavaAutoInstall( url ) {
   string =  fusGetDownloadJavaIEContent( url ) ; 
   document.write( string );

}


function isWindowIE() {
   if (browserName=="Microsoft Internet Explorer") {
      return 1;
   }
   else {
      return 0;
   }
}
    


function isJava5IE() {
   try {
      var obj = new ActiveXObject("JavaWebStart.isInstalled.1.5.0.0");
      if ( obj!=null ) {
         return 1;
      }
   }
   catch ( exception ) {
      return 0;
   }
}

function isJava6IE() {
   try {
      var obj = new ActiveXObject("JavaWebStart.isInstalled.1.6.0.0");
      if ( obj!=null ) {
         return 1;
      }
   }
   catch ( exception ) {
      return 0;
   }
}

function isJava56FF() {
   
   for ( var i=0; i<navigator.mimeTypes.length;++i ) {
     s = navigator.mimeTypes[i].type;
     if ( s == "application/x-java-applet;version=1.5" ) {
         return 1;
     }
     else if (  s == "application/x-java-applet;version=1.6" ) {
         return 1;
     }

   }

   return 0;
}


function launchJNLPGetJava( url ) {
   window.open("http://java.com/getjava", "newWindow");
   launchTID = setInterval('launchApp(url)', 100 );
}

function launchApp(app) {
   x = navigator.mimeTypes['application/x-java-applet;version=1.5'];
   if ( x ) {
     window.location = app;
     clearInterval( launchTID );
   }
}



function launchiview( url ) {
  if ( isJava5IE() || isJava6IE() || isJava56FF()) {
     window.location=url;
  }
  else if ( isWindowIE() ) {
      launchJNLPJavaAutoInstall(url);
      
  }
  else {
     launchJNLPJavaAutoInstallFF(url);
  }

}

function viewwebfileplay( document) {
  string = "/download/iwebfileplay/iwebfileplay.jnlp?" + document;
  launchiview( string );
}

