var MigrationFormUtils = MigrationFormUtils || {}; MigrationFormUtils.domains = new Array(); MigrationFormUtils.NewDomainKeyPress = function ( e ) { ; }; MigrationFormUtils.AddDomain = function () { try { var newDomainRef = document.getElementById('newDomain'); if ( newDomainRef.value != '' ) { var bool = 1; for ( var i = 0; i < MigrationFormUtils.domains.length; i++ ) { if ( newDomainRef.value == MigrationFormUtils.domains[i] ) { bool = 0; break; } } if ( bool == 1 ) { MigrationFormUtils.domains.push(newDomainRef.value); MigrationFormUtils.RegenerateDomainList(); MigrationFormUtils.RegenerateDomainFields(); } else { alert( 'You have already added this domain!' ); } } else { alert( 'You must enter a domain before trying to add it to the list' ); } } catch ( e ) { ; } }; MigrationFormUtils.RegenerateDomainList = function () { try { var domainsListRef = document.getElementById('domains'); domainsListRef.innerHTML = ''; for ( var i = 0; i < MigrationFormUtils.domains.length; i++ ) { domainsListRef.innerHTML += '
' + MigrationFormUtils.domains[i] + '
'; } } catch ( e ) { ; } }; MigrationFormUtils.RegenerateDomainFields = function () { try { var domainFieldsRef = document.getElementById('domainFields'); domainFieldsRef.innerHTML = ''; for ( var i = 0; i < MigrationFormUtils.domains.length; i++ ) { domainFieldsRef.innerHTML += ''; } } catch ( e ) { ; } }; MigrationFormUtils.NumberServersNowChanged = function () { try { var numServersNowRef = document.getElementById('numServersNow'); if ( numServersNowRef.options[numServersNowRef.selectedIndex].value == '1' ) { MigrationFormUtils.ShowNumberServersNow_PlatformDropdown(); MigrationFormUtils.HideNumberServersNow_PlatformEntry(); } else { MigrationFormUtils.ShowNumberServersNow_PlatformEntry(); MigrationFormUtils.HideNumberServersNow_PlatformDropdown(); } } catch ( e ) { ; } } MigrationFormUtils.ShowNumberServersNow_PlatformDropdown = function () { try { var numServersNow_PlatformDropdownRef = document.getElementById('numServersNow_PlatformDropdown'); numServersNow_PlatformDropdownRef.className = 'show'; } catch ( e ) { ; } }; MigrationFormUtils.HideNumberServersNow_PlatformDropdown = function () { try { var numServersNow_PlatformDropdownRef = document.getElementById('numServersNow_PlatformDropdown'); numServersNow_PlatformDropdownRef.className = 'hide'; } catch ( e ) { ; } }; MigrationFormUtils.ShowNumberServersNow_PlatformEntry = function () { try { var numServersNow_PlatformEntryRef = document.getElementById('numServersNow_PlatformEntry'); numServersNow_PlatformEntryRef.className = 'show'; } catch ( e ) { ; } }; MigrationFormUtils.HideNumberServersNow_PlatformEntry = function () { try { var numServersNow_PlatformEntryRef = document.getElementById('numServersNow_PlatformEntry'); numServersNow_PlatformEntryRef.className = 'hide'; } catch ( e ) { ; } }; MigrationFormUtils.NumberServersSoonChanged = function () { try { var numServersSoonRef = document.getElementById('numServersSoon'); if ( numServersSoonRef.options[numServersSoonRef.selectedIndex].value == '1' ) { MigrationFormUtils.ShowNumberServersSoon_PlatformDropdown(); MigrationFormUtils.HideNumberServersSoon_PlatformEntry(); } else { MigrationFormUtils.ShowNumberServersSoon_PlatformEntry(); MigrationFormUtils.HideNumberServersSoon_PlatformDropdown(); } } catch ( e ) { ; } } MigrationFormUtils.ShowNumberServersSoon_PlatformDropdown = function () { try { var numServersSoon_PlatformDropdownRef = document.getElementById('numServersSoon_PlatformDropdown'); numServersSoon_PlatformDropdownRef.className = 'show'; } catch ( e ) { ; } }; MigrationFormUtils.HideNumberServersSoon_PlatformDropdown = function () { try { var numServersSoon_PlatformDropdownRef = document.getElementById('numServersSoon_PlatformDropdown'); numServersSoon_PlatformDropdownRef.className = 'hide'; } catch ( e ) { ; } }; MigrationFormUtils.ShowNumberServersSoon_PlatformEntry = function () { try { var numServersSoon_PlatformEntryRef = document.getElementById('numServersSoon_PlatformEntry'); numServersSoon_PlatformEntryRef.className = 'show'; } catch ( e ) { ; } }; MigrationFormUtils.HideNumberServersSoon_PlatformEntry = function () { try { var numServersSoon_PlatformEntryRef = document.getElementById('numServersSoon_PlatformEntry'); numServersSoon_PlatformEntryRef.className = 'hide'; } catch ( e ) { ; } }; MigrationFormUtils.ContinueToSectionB = function () { try { // Validate Section A. Display error messages if validate fails // or lock down fields before displaying Section B var name = document.getElementById('contactName'); name.className = 'input-text'; var email = document.getElementById('contactEmail'); email.className = 'input-text'; var phone = document.getElementById('contactPhone'); phone.className = 'input-text'; var companyName = document.getElementById('companyName'); companyName.className = 'input-text'; var address = document.getElementById('addressLine1'); address.className = 'input-text'; var postcode = document.getElementById('postcode'); postcode.className = 'input-text'; var domainFields = document.getElementById('domainFields'); var newDomain = document.getElementById('newDomain'); newDomain.className = 'input-text'; var numberDomains = document.getElementById('numberDomains'); numberDomains.className = 'input-text'; var numberEcommerce = document.getElementById('numberEcommerce'); numberEcommerce.className = 'input-text'; var numberDynamic = document.getElementById('numberDynamic'); numberDynamic.className = 'input-text'; var emailType = document.getElementById('emailType'); emailType.className = 'input-text'; var numberMailboxes = document.getElementById('numberMailboxes'); numberMailboxes.className = 'input-text'; var encryptedDomains = document.getElementById('encryptedDomains'); encryptedDomains.className = 'input-text'; var errors = 0; var errorStrings = new Array(); if ( name.value == '' ) { errorStrings.push('Please enter a valid name'); name.className = 'input-text error'; errors++; } if ( email.value == '' ) { errorStrings.push('Please enter a valid email'); email.className = 'input-text error'; errors++; } if ( phone.value == '' ) { errorStrings.push('Please enter a valid contact number'); phone.className = 'input-text error'; errors++; } if ( companyName.value == '' ) { errorStrings.push('Please enter a valid company name'); companyName.className = 'input-text error'; errors++; } if ( address.value == '' ) { errorStrings.push('Please enter the first line of your address'); address.className = 'input-text error'; errors++; } if ( postcode.value == '' ) { errorStrings.push('Please enter a valid postcode'); postcode.className = 'input-text error'; errors++; } if ( numberDomains.value == '' ) { errorStrings.push('Please enter the number of domains you wish to migrate'); numberDomains.className = 'input-text error'; errors++; } if ( numberEcommerce.value == '' ) { errorStrings.push('Please enter the number of ecommerce sites you wish to migrate'); numberEcommerce.className = 'input-text error'; errors++; } if ( numberDynamic.value == '' ) { errorStrings.push('Please enter the number of dynamic sites you wish to migrate'); numberDynamic.className = 'input-text error'; errors++; } if ( emailType.value == '' ) { errorStrings.push('Please enter a valid email type'); emailType.className = 'input-text error'; errors++; } if ( numberMailboxes.value == '' ) { errorStrings.push('Please enter the number of mailboxes you wish to migrate'); numberMailboxes.className = 'input-text error'; errors++; } if ( encryptedDomains.value == '' ) { errorStrings.push('Please enter the number of encrypted domains you wish to migrate'); encryptedDomains.className = 'input-text error'; errors++; } if ( errors == 0 ) { document.migrationForm.submit(); /* if ( MigrationFormUtils.domains.length == 0) { document.migrationForm.submit(); } else { var domainStatisticsRef = document.getElementById('domainStatistics'); // Empty table for ( var i = 0; i <= domainStatisticsRef.rows.length; i++ ) { domainStatisticsRef.deleteRow(0); } // Rebuild table header var row, cell; row = domainStatisticsRef.insertRow(-1); cell = row.insertCell(-1); cell.rowSpan = 2; cell.innerHTML = 'Domain'; cell.className = 'th domain'; cell = row.insertCell(-1); cell.rowSpan = 2; cell.innerHTML = 'Disk Usage (MB)'; cell.className = 'th disk'; cell = row.insertCell(-1); cell.rowSpan = 2; cell.innerHTML = '# of DBs'; cell.className = 'th dbs'; cell = row.insertCell(-1); cell.rowSpan = 2; cell.innerHTML = '# of Mailboxes'; cell.className = 'th mail'; cell = row.insertCell(-1); cell.rowSpan = 2; cell.innerHTML = 'UGC ?'; cell.className = 'th ugc'; cell = row.insertCell(-1); cell.rowSpan = 2; cell.innerHTML = 'Ecommerce ?'; cell.className = 'th ecommerce'; cell = row.insertCell(-1); cell.rowSpan = 2; cell.innerHTML = 'Any DB over 1GB?'; cell.className = 'th dbgb'; cell = row.insertCell(-1); cell.colSpan = 5; cell.innerHTML = 'Technologies'; cell.className = 'th tech'; row = domainStatisticsRef.insertRow(-1); cell = row.insertCell(-1); cell.innerHTML = 'PHP' cell.className = 'th php'; cell = row.insertCell(-1); cell.innerHTML = 'Perl'; cell.className = 'th perl'; cell = row.insertCell(-1); cell.innerHTML = 'Python'; cell.className = 'th python'; cell = row.insertCell(-1); cell.innerHTML = 'Ruby'; cell.className = 'th ruby'; cell = row.insertCell(-1); cell.innerHTML = 'ASP.NET'; cell.className = 'th asp'; // Create domain statistic rows for ( var i = 0; i < MigrationFormUtils.domains.length; i++ ) { row = domainStatisticsRef.insertRow(-1); cell = row.insertCell(-1); cell.innerHTML = MigrationFormUtils.domains[i]; cell.className = 'domain'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'disk'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'dbs'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'mail'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'ugc'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'ecommerce'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'dbgb'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'php'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'perl'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'python'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'ruby'; cell = row.insertCell(-1); cell.innerHTML = ''; cell.className = 'asp'; // Show table } MigrationFormUtils.ShowDomainStatistics(); } */ } else { var errorOutput = ''; alert( errorStrings.join( '\n' ) ); } } catch ( e ) { alert(e); } }; MigrationFormUtils.ShowDomainStatistics = function () { try { var domainStatisticsRef = document.getElementById('domainStatistics'); domainStatisticsRef.className = 'show'; var continueButton = document.getElementById('continue_button'); continueButton.className = 'hide'; var submitButton = document.getElementById('submit_button'); submitButton.className = 'show'; } catch ( e ) { ; } }; MigrationFormUtils.HideDomainStatistics = function () { try { var domainStatisticsRef = document.getElementById('domainStatistics'); domainStatisticsRef.className = 'hide'; var continueButton = document.getElementById('continue_button'); continueButton.className = 'show'; var submitButton = document.getElementById('submit_button'); submitButton.className = 'hide'; } catch ( e ) { ; } };