// ****************************************************************************
// DevForceDownloads.js - Javascript functions for supporting DevForce Version Downloads
// 
// 5/24/06 Now requires ideablade2.js on the page; ideablade.js no longer needed.
// ****************************************************************************

//==============================================================
var CurrentReleaseNumber = "3.7.0.0";
var BetaReleaseNumber = ""; // Empty means no betas
var RootDirectory = IBGlobals.Root;
var ClassicProLicense = "24217349665";
var SilverlightExpressLicense = "56554106-5415-c704-0040-1200487a18be";
var WinClientExpressLicense = "02514503-4442-c445-0414-07501d2e4bad";
var DevForceV5ReleaseNumber = "5.2.6";
var NextReleaseDate = "April 2010";
var ProductReleaseDate = "March 4, 2010";
var ClassicReleaseDate = "May 10, 2010";

//===============================================================
// Archive Release(s)

// Write Archive download rows
function WriteArchiveReleaseDownloadRowsHtml() {
  // Add line in this manner for each archived release
  // Omit 3rd parameter if no appropriate Installation Guide for this release  
  WriteDownloadRowHtml("3.6.9.1","Download DevForce Archive","3.6.9.1");
  WriteDownloadRowHtml("3.6.8.1","Download DevForce Archive","3.6.8.1");
}
// Write IdeaBlade 2.x Archive download rows
function WriteIdeaBladeReleaseDownloadRowsHtml() {
  WriteDownloadResourceRowHtml(RootDirectory +"IBDownloads/IdeaBlade.Full.2.2.1.7.zip","IdeaBlade Full 2.2.1.7","Download the paid complete IdeaBlade 2.2.1.7");
}

//================================================================
// Utilities for Download pages

function WriteClassicProKey() {
    document.write(ClassicProLicense);
}

function WriteSLExpressKey() {
    document.write(SilverlightExpressLicense);
}

function WriteWinClientExpressKey() {
    document.write(WinClientExpressLicense);
}

function OpenClassicDownloadURL() {
    window.open(ReleaseUrl(CurrentReleaseNumber));
}

function OpenDevForceV5DownloadURL() {
    window.open(DownloadsDirectory + "v5/IdeaBladeDevForce." + DevForceV5ReleaseNumber + ".zip");
}

function DownloadsDirectory() {
  return RootDirectory + "elqNow/elqRedir.htm?ref=http://www.ideablade.com/DevForceDownloads/";
}

// Address of a release, given its version number
function ReleaseUrl(pVersionNumber) {
  return DownloadsDirectory()+"IdeaBladeDevForce-"+pVersionNumber+".zip";
}

// Html for DevForce release download link for specific version
// pVersionNumber - String of version to download, e.g. "3.1.1.0"; Null = current
// pLabel - string label to appear in link; null = "Download DevForce"
function ReleaseHtml(pVersionNumber, pDownloadLabel) {
  if (!pVersionNumber || pVersionNumber == "") pVersionNumber = CurrentReleaseNumber;
  if (!pDownloadLabel || pDownloadLabel == "") pDownloadLabel = "Download DevForce";
  var url = escape(ReleaseUrl(pVersionNumber));
  var popUpWarning = DownloadsDirectory()+'UninstallWarning.html?'+url;
  var s='<a class="stronglink" href="'+popUpWarning+'" target="_blank">'+pDownloadLabel +'</a>';
  return s;
}
function WriteReleaseHtml(pVersionNumber, pLabel) {
  document.write(ReleaseHtml(pVersionNumber, pDownloadLabel));
}

// Html to display the specified version release number
function ReleaseNumberHtml(pVersionNumber) {
  return pVersionNumber;
}

// Address of an Installation Guide, given its version number
function InstallationGuideUrl(pVersionNumber) {
  return DownloadsDirectory()+"DevForceInstallationGuide-"+pVersionNumber+".pdf";
}


// Html for DevForce Installation Guide download link for specific version
// Current version is the default
function InstallationGuideHtml(pVersionNumber, pDownloadLabel){
  if (!pVersionNumber || pVersionNumber == "") pVersionNumber = CurrentReleaseNumber;
  if (!pDownloadLabel || pDownloadLabel == "") pDownloadLabel = "View Installation Guide"
  var url = InstallationGuideUrl(pVersionNumber);
  var s='<a href="'+url+'" target="_blank">'+ pDownloadLabel + '</a>'
  return s;
}
function WriteInstallationGuideHtml(pVersionNumber, pDownloadLabel){
  document.write(InstallationGuideHtml(pVersionNumber, pDownloadLabel));
}

// Html for a row in table offering a DevForce version download.
// 3 Cells: Version label and link, Version number, Installation Guide link (optional)
// pVersionNumber - the version number to download
// pDownloadLabel - text of the label identifying the download
// pInstallationGuideVersionNumber - Version number of Installation Guide to go with it
//   None offered if no version number. Number could differ from release version 
//   but you should know why.
function DownloadRowHtml(pVersionNumber,pDownloadLabel,pInstallationGuideVersionNumber) {
  if (!pVersionNumber || pVersionNumber == "") pVersionNumber = CurrentReleaseNumber;
  if (!pDownloadLabel || pDownloadLabel == "") pDownloadLabel = "Download DevForce";
  var s = '<tr align="center"><td>' +
      ReleaseHtml(pVersionNumber,pDownloadLabel)+'</td><td>'+
      ReleaseNumberHtml(pVersionNumber)+'</td><td>';
  if (!pInstallationGuideVersionNumber) {
    s+='&nbsp;';
  } else {
    s+=InstallationGuideHtml(pVersionNumber)
  } 
  s+='</td></tr>';
  return s; 
}

function WriteDownloadRowHtml(pVersionNumber,pDownloadLabel,pInstallationGuideVersionNumber) {
  document.write(DownloadRowHtml(pVersionNumber,pDownloadLabel,pInstallationGuideVersionNumber));
}

// Html for a row in table offering a DevForce resource in a popup window.
// 2 Cells: link & description
// pUrl - where to find the resource
// pLabel - text of the label identifying the resource
// pDescription - Html of description of the resource
//   None offered if no version number. Number could differ from release version 
//   but you should know why.
function DownloadResourceRowHtml(pUrl,pLabel,pDescription) {
  var s='<tr valign="top"><td width="30%" >'+
    '<a class="stronglink" href="'+pUrl+'" target="_blank">'+pLabel+'</a></td><td>'+
    pDescription+'</td></tr>';
  return s; 
}

function WriteDownloadResourceRowHtml(pUrl,pLabel,pDescription) {
  document.write(DownloadResourceRowHtml(pUrl,pLabel,pDescription));
}

function CompareEmail()	{		
	if (document.all['txtEmail'].value != document.all['txtEmail2'].value) {
		window.alert("The email addresses you typed do not match!");
		document.all['txtEmail'].focus();			
	}		
}		

//===============================================================
// Download Current Release
// Write current release download row(s)
function WriteCurrentReleaseDownloadRowsHtml() {
  // Add line in this manner for each current release [WHY MORE THAN ONE?]
  // Omit 3rd parameter if no appropriate Installation Guide for this release
  WriteDownloadRowHtml(CurrentReleaseNumber,"Download DevForce Classic",CurrentReleaseNumber)
}

function WriteCurrentReleaseHtml() {
  document.write(ReleaseHtml(CurrentReleaseNumber,"Download DevForce Classic"));
}

function WriteCurrentReleaseVersionNumberHtml() {
  document.write(ReleaseNumberHtml(CurrentReleaseNumber));
}

function WriteCurrentInstallationGuideHtml() {
  document.write(InstallationGuideHtml(CurrentReleaseNumber));
}

//===============================================================
// Current Beta
// Write Beta download rows
function WriteBetaReleaseDownloadRowsHtml() {
  if (BetaReleaseNumber == null || BetaReleaseNumber == "") {
    document.write('<tr><td align="middle" colspan=3><i>There are no beta releases at this time.</i></td></tr>');
  } else {
  // Add line in this manner for each beta release
  // Omit 3rd parameter if no appropriate Installation Guide for this release
    WriteDownloadRowHtml(BetaReleaseNumber,"Download DevForce Beta",BetaReleaseNumber)
  }
}

function WriteBetaReleaseHtml() {
  document.write(ReleaseHtml(BetaReleaseNumber,"Download DevForce Beta"));
}

function WriteBetaReleaseVersionNumberHtml() {
  document.write(ReleaseNumberHtml(BetaReleaseNumber));
}

function WriteBetaInstallationGuideHtml() {
  document.write(InstallationGuideHtml(BetaReleaseNumber));
}

//===============================================================
// Registration Boilerplate Html
function RegistrationBoilerPlateHtml() {
	 var s='<p>You will need to use the product key listed just above the text input box that you will see during'+
	   ' the installation process. Thank you.</p>';
	   s+=PrivacyNoteHtml() +'<p>The items marked in <span style="color: red">red</span> are required.</p>';
     
	return s;
}

function RegistrationBoilerPlateForDevForceEnterpriseHtml() {
	 var s='<p>During the installation process, you will need to use the product key that will be emailed to the address you register below.'+
	   ' Thank you.</p>';
	   s+=PrivacyNoteHtml() +'<p>The items marked in <span style="color: red">red</span> are required.</p>';
     
	return s;
}

function WriteRegistrationBoilerPlateHtml() {
  document.write(RegistrationBoilerPlateHtml())
}

function WriteRegistrationBoilerPlateForDevForceEnterpriseHtml() {
  document.write(RegistrationBoilerPlateForDevForceEnterpriseHtml())
}

//===============================================================
// Rob's Personal Registration Welcome Html
function RobRegistrationWelcomeHtml() {
	      
	var s='<p>Thank you for your interest in IdeaBlade&nbsp;DevForce for .NET 3.0.</p>'+
	  '<p>Our goal is to ensure that you obtain maximum success with our technology.&nbsp; '+
  	'Please contact me if you have any questions, require any assistance, or would like to '+
  	'discuss partnering or demo opportunities.&nbsp; '+
  	'I will make sure that the most appropriate individual within our organization gets back to you quickly.</p>'+
  	'<p style="margin-left: 40px">Michael Davis, VP Sales<br /> '+
  	'<a href="mailto:michaeld@ideablade.com">MichaelD@IdeaBlade.com</a> or (510) 596-5100 x101</p>';
	return s;
}

function RobRegistrationWelcomeMSUGHtml() {
	      
	var s='<p>Thank you for your interest in IdeaBlade&nbsp;DevForce for .NET 3.0.</p>'+
	'<p>We are pleased to provide you with a free DevForce Professional version of our .Net framework '+
	'including one year of tech support and upgrades at no charge.</p>'+
	  '<p>Our goal is to ensure that you obtain maximum success with our technology.&nbsp; '+
  	'Please contact me if you have any questions, require any assistance, or would like to '+
  	'discuss partnering or demo opportunities.&nbsp; '+
  	'I will make sure that the most appropriate individual within our organization gets back to you quickly.</p>'+
  	'<p style="margin-left: 40px">Michael Davis, VP of Sales<br /> '+
  	'<a href="mailto:michaeld@ideablade.com">MichaelD@IdeaBlade.com</a> or (510) 596-5100 x101</p>';
	return s;
}

function RobRegistrationWelcomeEnterpriseDownloadHtml() {
	      
	var s='<p>Thank you for your interest in IdeaBlade&nbsp;DevForce for .NET 3.0.</p>'+
	'<p>We are pleased to provide you with a free DevForce Enterprise version of our .Net framework '+
	'including one year of tech support and upgrades at no charge.</p>'+
	  '<p>Our goal is to ensure that you obtain maximum success with our technology.&nbsp; '+
  	'Please contact me if you have any questions, require any assistance, or would like to '+
  	'discuss partnering or demo opportunities.&nbsp; '+
  	'I will make sure that the most appropriate individual within our organization gets back to you quickly.</p>'+
  	'<p style="margin-left: 40px">Michael Davis, VP of Sales<br /> '+
  	'<a href="mailto:michaeld@ideablade.com">MichaelD@IdeaBlade.com</a> or (510) 596-5100 x101</p>';
	return s;
}

function WriteRobRegistrationWelcomeHtml() {
  document.write(RobRegistrationWelcomeHtml())
}

function WriteRobRegistrationWelcomeMSUGHtml() {
  document.write(RobRegistrationWelcomeMSUGHtml())
}

function WriteRobRegistrationWelcomeEnterpriseDownloadHtml() {
  document.write(RobRegistrationWelcomeEnterpriseDownloadHtml())
}

//===============================================================
// Download Boilerplate
function DownloadBoilerplateHtml() {
	var s='<p>Click on the download link below to begin download of the zip file.&nbsp; '+
    'If you experience any difficulty downloading the file or need additional assistance, '+
    'please contact us at <a title="mailto:info@ideablade.com" href="mailto:info@ideablade.com">info@ideablade.com</a>.&nbsp; ' +
    'You may also submit a support request through our online <a href="http://www.ideablade.com/CustomerSupportRequestForm.aspx" target="_blank">support page</a>.&nbsp; ' +
    'In addition, we welcome your contributions to our DevForce Community Support Forum at: <a href="Http://www.ideablade.com/forum">www.ideablade.com/Forum</a>.</p>'+
    '<p>You will need to use the <b>Product Key you received via email</b>, and copy the key into the text input box on the DevForce installer window.&nbsp; '+
    'You will find instructions for installing DevForce and information about this release in the '+
    'Installation Guide that is included in the zip.&nbsp; The Installation Guide is also available separately via a link from this page.</p>';

  var note = '<p>Please remember to uninstall your existing version of DevForce before installing a new version.&nbsp; '+
    'The chapter "<strong><em>Updating Existing Applications</em></strong>" in the Installation Guide offers specific instructions '+
    'on upgrading your existing DevForce application to the new version of DevForce.</p>';

  var s2 ='<p><i>Please be patient, your Antivirus software may extend the download time!</i></p>'+
     '<p><strong>The next release will be in '+NextReleaseDate+'.</strong></p>';
  	
  return s+NoteHtml(note)+s2;
}

function WriteDownloadBoilerplateHtml(){
  document.write(DownloadBoilerplateHtml());
}

//===============================================================
// Download Resources

// Write Download Resources rows
function WriteDownloadResourcesRowsHtml() {

  var concepts="Concepts manual describing architecture, issues, and features for building distributed enterprise applications with DevForce.";
  WriteDownloadResourceRowHtml(RootDirectory+"IdeaBlade_DevForce_Concepts.zip","DevForce Concepts",concepts);
  
  var quickVideo = 'This 15 minute video introduces '+
    'object mapping, extended data binding, and separation of model from view and controller.';
  WriteDownloadResourceRowHtml(RootDirectory+"demos.html","App Building Video",quickVideo);
}

//===============================================================
// Developer Express Limitations Html
function DeveloperExpressLimitationsHtml() {
 return NoteHtml( 'DevForce Express does not support certain features of our Professional and Enterprise editions.&nbsp; '+
  'The DevForce&nbsp;UI&nbsp;binding&nbsp;managers are available for .NET controls '+
  'but not for 3rd party UI control suites such as those from <b>DeveloperExpress</b> and <b>Infragistics</b>.&nbsp; '+
  'Stored procedures, web services, and n-tier deployments are also precluded.&nbsp;'+
  'Please contact us at <a href="mailto:sales@ideablade.com">sales@ideablade.com</a> to discuss upgrading to these '+
  'and other advanced features.'
  , "yellownote");
}

function WriteDeveloperExpressLimitationsHtml() {
  document.write(DeveloperExpressLimitationsHtml())
}
//===============================================================
// Uninstall Warning Html
function UninstallWarningHtml() {
 return NoteHtml( '<span class="blue">Please note</span>:&nbsp;  If you see the following message during install, you must answer&nbsp; <b>No</b>.&nbsp; '+
  '<p align="center"><img src="DevForceUpgradeMessageBox.gif" border="0" /></p>'+
  '<p>DevForce is already installed and must be uninstalled via "Add/Remove Programs" first.&nbsp; </p>'+
  '<p align="center"><b>Do not answer "Yes"!</b></p>'+
  '<p>If you say "Yes", your installation will fail and you will have difficulty uninstalling '+
  'in which case please see the topic “Un-install fails” in the Troubleshooting chapter of the Installation Guide.'
  , "rednote");
}

function WriteUninstallWarningHtml() {
  document.write(UninstallWarningHtml())
}

//===============================================================
// System Requirements Html
function SystemRequirementsHtml() {
  var s='<p class="required"><strong>System requirements</strong></p>'+
  '<p>IdeaBlade DevForce applications require <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&DisplayLang=en" target="_blank">'+
  '.NET Framework 2.0</a> or <a href="http://www.microsoft.com/downloads/details.aspx?familyid=10CC340B-F857-4A14-83F5-25634C3BF043&displaylang=en" target="_blank">3.0</a>.&nbsp; DevForce development requires <a href="http://msdn.microsoft.com/vstudio/products/trial/" target="_blank">'+
	'Visual Studio 2005 or Visual Studio 2008</a>.&nbsp; Additionally, our tutorials require Microsoft SQL Server 2000/2005, 2005 Express or Microsoft SQL Server 2000 Desktop Engine (MSDE).</p>';
	return s;
}

function VerificationEngineNote() {
  var s='<p>Please note that for version 3.5.x of DevForce Express, developers will get a free, fully functional non-production version of IdeaBlade&acute;s new Verification Engine to evaluate. '+
  'By downloading and installing DevForce Express 3.5.x, you agree not to use this function in a production application with DevForce Express. To use the Verification Engine in a '+
  'production application, developers must upgrade to <a href="http://www.ideablade.com/technical_overview.html" target="_blank">DevForce Professional</a>.</p>';
  return s;
}

function WriteSystemRequirementsHtml() {
  //document.write(VerificationEngineNote()) 
  document.write(SystemRequirementsHtml());
}
//===============================================================
// Performance Note Html

function PerformanceNoteHtml() {
  var s='<span class="header2">Performance Note:</span>&nbsp; '+
            'A program executing within the Visual Studio 2005 debugger may run 5 to 20 times slower than the same program running outside the debugger.&nbsp; '+
            'Performance degradation is especially noticeable with BLOB data (e.g., NTEXT columns).&nbsp; '+
            'This behavior is unrelated to DevForce and can be observed with any data intensive application.&nbsp; '+
            'We trust Microsoft will address this problem with .NET 2.1.&nbsp; '+
            'Fortunately, your production program will always operate crisply outside Visual Studio.';
   return NoteHtml(s);
}

function WritePerformanceNoteHtml() {
  document.write(PerformanceNoteHtml())  
}


//===============================================================
// DevForce Express EULA Html
function DevForceExpressEulaHtml() {
  var s='This software is subject to IdeaBlade\'s '+ 
				'<a href="/DevForceDownloads/IdeaBlade_EULA.pdf" target="_blank">'+
				' End User License Agreement (EULA)</a> '+
				'unless superseded by another EULA you signed with IdeaBlade.&nbsp; ';
  return s;
}
function WriteDevForceExpressEulaHtml() {
  document.write(DevForceExpressEulaHtml());
}

//===============================================================
// DevForce Microsoft VSIP EULA Html
function DevForceMsVsipEulaHtml() {
	var s='<p>Your right to use this edition of the IdeaBlade DevForce software is subject to the '+
	'<a href="../RegMicrosoftVSIPuser/VSIP Demo Software License Agreement.pdf" target="_blank">'+
	'VISUAL STUDIO INDUSTRY PARTY (VSIP) SOFTWARE DEMONSTRATION LICENSE AGREEMENT</a> '+
	'signed by Microsoft and IdeaBlade wherein the software is referred to as "Exhibit A".</p>'
  return s;
}
function WriteDevForceMsVsipEulaHtml() {
  document.write(DevForceMsVsipEulaHtml());
}

//===============================================================
// DevForce Microsoft Regional Director EULA Html
function DevForceDemoEulaHtml() {
	var s='<p>Your right to use this edition of the IdeaBlade DevForce software is subject to the '+
	'<a href="'+DownloadsDirectory()+'IdeaBlade Software Demonstration License Agreement.pdf" target="_blank">'+
	'IdeaBlade Software Demonstration License Agreement</a> '+
	'wherein the software is referred to as "Exhibit A".</p>'
  return s;
}
function WriteDevForceDemoEulaHtml() {
  document.write(DevForceDemoEulaHtml());
}
