????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.147.44.46 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/apps/school/www_old7/js/ |
Upload File : |
//Copied from initial on 30 Jul 2014 function shared_setHeaderTable(idDivTable, title, subTitle, isBtnHomeRequired, isBtnPlayAgainRequired) { var table = ""; var deviceType = shared_getDeviceType(); var headerStyle = 'shared_style_buttons_header_footer'; var sizePercentage = shared_getSizePercentageAsPerDeviceHeightWidth(); var sizeMultiplyValue = 40; var fontSize = sizeMultiplyValue * sizePercentage; var fontSizeTitle = fontSize * 0.4; var fontSizeButtonText = fontSizeTitle; var buttonHeight = fontSize * 1.0; var borderRadius = fontSize; var fontSizeSubTitle = fontSizeTitle * 0.8; fontSizeTitle = fontSizeTitle + 'px'; fontSizeSubTitle = fontSizeSubTitle + 'px'; fontSizeButtonText = fontSizeButtonText + 'px'; buttonHeight = buttonHeight + 'px'; borderRadius = borderRadius + 'px'; var headerHeight = shared_dataTableHeight * 8 / 100.0; table += ' <table id="shared_style_tblMainiPadHeader" border="0" width="100%" height="' + headerHeight + '" cellspacing="0">'; table += ' <tr>'; if (isBtnHomeRequired) { table += ' <td width="20%" onClick="btnHome_click()" style="padding-left: 5px">'; table += ' <input type="button" class="' + headerStyle + '" value="Home" style="width: 100%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto">'; } else { table += ' <td width="20%" style="padding-left: 5px">'; } table += ' </td>'; table += ' <td width="*" align="center">'; table += ' <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">'; table += ' <tr height="50%">'; table += ' <td width="100%" align="center" style="font-size:' + fontSizeTitle + '"><b>' + title + '</b></td>'; table += ' </tr>'; if (subTitle !== '') { table += ' <tr height="50%">'; table += ' <td width="100%" align="center" style="font-size:' + fontSizeSubTitle + '">' + subTitle + '</td>'; table += ' </tr>'; } table += ' </table>'; table += ' </td>'; if (isBtnPlayAgainRequired) { table += ' <td width="20%" onClick="shared_btnPlayAgain_click()" align="right" style="padding-right: 5px">'; table += ' <input type="button" class="' + headerStyle + '" value="Play Again" style="width: 100%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '">'; } else { table += ' <td width="20%" align="right" style="padding-right:2%">'; var resString = subTitle.substr(subTitle.length - 10, subTitle.length); if ((subTitle != 'Levels') && (resString != 'Categories')) { if ((shared_currentDeviceType == shared_DeviceTypeWindowsPhone) || (shared_currentDeviceType == shared_DeviceTypeInternetExplorer)) { var imageHeight = 1.2 * fontSize; var imageWidth = 1.2 * fontSize; table += ' <img src="../../../readingImage.jpg" width="' + imageWidth + '" height="' + imageHeight + '" draggable="false"/>'; } else { table += ' <img src="../../../readingImage.jpg" width="50%" alt="" draggable="false"/>'; } } } table += ' </td>'; table += ' </tr>'; table += ' </table>'; document.getElementById(idDivTable).innerHTML = table; } function shared_setFooterTableEmpty(idDivTable, isCategoriesPage) { var table = ''; var footerHeight = shared_dataTableHeight * 8 / 100.0; table += ' <table id="shared_style_tblMainiPadFooter" border="0" width="100%" height="' + footerHeight + '" cellspacing="0">'; table += ' <tr>'; var imageHeight = 80 * shared_dataTableHeight / 1024; var imageWidth = 200 * shared_dataTableWidth / 768; if (isCategoriesPage) { if (shared_currentDeviceType == shared_DeviceTypeInternetExplorer) { table += ' <td align="center"><img src="../../poweredByAstacus.png" width="' + imageWidth + '" height="' + imageHeight + '"/></td>'; } else { table += ' <td align="center"><img src="../../poweredByAstacus.png" width="22%"/></td>'; } } else { if (shared_currentDeviceType == shared_DeviceTypeInternetExplorer) { table += ' <td align="center"><img src="poweredByAstacus.png" width="' + imageWidth + '" height="' + imageHeight + '"/></td>'; } else { table += ' <td align="center"><img src="poweredByAstacus.png" width="22%"/></td>'; } } table += ' </tr>'; table += ' </table>'; document.getElementById(idDivTable).innerHTML = table; } function shared_setFooterTable(idDivTable, isbtnFirstRequired, isBtnPreviousRequired, isBtnValidateRequired, isBtnNextRequired, isbtnLastRequired)//Aug16 { var table = ''; var deviceType = shared_getDeviceType(); var footerStyle = 'shared_style_buttons_header_footer'; var buttonStyle_disabled = shared_currentDeviceOS == shared_deviceOS_iOS ? 'shared_style_buttons_header_footer' : 'shared_style_buttons_header_footer_disabled';//Aug16 var sizePercentage = shared_getSizePercentageAsPerDeviceHeightWidth(); var sizeMultiplyValue = 40; var fontSize = sizeMultiplyValue * sizePercentage; var fontSizeButtonText = fontSize * 0.4; var buttonHeight = fontSize * 1.0; var borderRadius = fontSize; fontSizeButtonText = fontSizeButtonText + 'px'; buttonHeight = buttonHeight + 'px'; borderRadius = borderRadius + 'px'; var footerHeight = shared_dataTableHeight * 8 / 100.0; table += ' <table id="shared_style_tblMainiPadFooter" border="0" width="100%" height="' + footerHeight + '" cellspacing="0">'; table += ' <tr>'; if (isbtnFirstRequired) { table += ' <td width="15%" onClick="shared_btnFirstLesson_click()" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + footerStyle + '" value="<<" style="width:100%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto">'; } else { table += ' <td width="15%" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + buttonStyle_disabled + '" value="<<" style="width:100%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto" disabled>'; } table += ' </td>'; if (isBtnPreviousRequired) { table += ' <td width="15%" onClick="btnPrevious_click()" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + footerStyle + '" value="<" style="width:75%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto">'; } else { table += ' <td width="15%" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + buttonStyle_disabled + '" value="<" style="width:75%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto" disabled>'; } table += ' </td>'; if (isBtnValidateRequired) { table += ' <td width="*" onClick="btnValidate_click()" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + footerStyle + '" value="Validate" style="width: 50%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto">'; } else { table += ' <td width="*" style="text-align:center; vertical-align:middle">'; } table += ' </td>'; if (isBtnNextRequired) { table += ' <td width="15%" onClick="btnNext_click()" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + footerStyle + '" value=">" style="width:75%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto">'; } else { table += ' <td width="15%" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + buttonStyle_disabled + '" value=">" style="width:75%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto" disabled>'; } table += ' </td>'; if (isbtnLastRequired == true) { table += ' <td width="15%" onClick="shared_btnLastLesson_click()" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + footerStyle + '" value=">>" style="width:100%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto">'; } else { table += ' <td width="15%" style="text-align:center; vertical-align:middle">'; table += ' <input type="button" class="' + buttonStyle_disabled + '" value=">>" style="width:100%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto" disabled>'; } table += ' </td>'; table += ' </tr>'; table += ' </table>'; document.getElementById(idDivTable).innerHTML = table; } function shared_btnHomeLevels_click() { window.location = '../../levels.html'; } function shared_btnHomeCategories_click(levelNameWithoutSpace) { window.location = '../' + levelNameWithoutSpace + 'Categories.html'; } function shared_btnFirstLesson_click() { window.location = shared_currentLevel + shared_currentCategory + 'Lesson01.html'; } function shared_btnLastLesson_click() { window.location = shared_currentLevel + shared_currentCategory + shared_currentCategoryLastLesson; } function shared_btnPlayAgain_click() { window.location.reload(); } function shared_getPageParametersArray() { var urlEncoded = document.URL; var urlDecoded = decodeURI(urlEncoded); var indexOfQuestionMark = urlDecoded.indexOf("?"); var parametersAll = urlDecoded.substring(indexOfQuestionMark + 1); var parametersArray = parametersAll.split("&"); return (parametersArray); } function shared_setTextAndBackgroundColorToGreen(id_text, id_box_destination, text_prefix, text_suffix) { var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); var elementBox = document.getElementById(id_box_destination); var innerHtml = '<u>' + text_prefix + text + '</u>' + text_suffix; elementBox.innerHTML = innerHtml; elementBox.style.backgroundColor = shared_colorGreen; elementBox.style.color = 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_setTextAndBackgroundColorToGreenByTrimmingText(id_text, id_box_destination) { var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); var elementBox = document.getElementById(id_box_destination); var innerHtml = '<u>' + text + '</u>'; elementBox.innerHTML = innerHtml; elementBox.style.backgroundColor = shared_colorGreen; elementBox.style.color = 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_setTextAndBackgroundColorAndIsMovedTrue(id_text, id_box_destination) { var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); var splitText = text.toLowerCase().split(' '); var elementBox = document.getElementById(id_box_destination); elementBox.innerHTML = text; elementBox.style.backgroundColor = splitText[0]; elementBox.style.color = ((splitText[0] == 'white') || (splitText[0] == 'yellow')) ? 'black' : 'white'; elementBox.style.border = (splitText[0] == 'white') ? '2px solid black' : 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_setTextAndBackgroundColorAndIsMovedTrueNew(id_text, id_box_destination) { var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); var splitText = text.toLowerCase().split(' '); var elementBox = document.getElementById(id_box_destination); elementBox.innerHTML = text; elementBox.style.backgroundColor = (splitText[0] == 'brown') ? 'rgba(139, 69, 19, 1)' : splitText[0]; elementBox.style.color = ((splitText[0] == 'white') || (splitText[0] == 'yellow')) ? 'black' : 'white'; elementBox.style.border = (splitText[0] == 'white') ? '2px solid black' : 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_setTextAndBackgroundColorToGreenAndIsMovedTrue(id_text, id_box_destination) { var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); var elementBox = document.getElementById(id_box_destination); elementBox.innerHTML = '<u>' + text + '</u>'; elementBox.style.backgroundColor = shared_colorGreen; elementBox.style.color = 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_setTextAndBackgroundColorToGreenAndIsMovedTrueAndIsFilledTrue(id_text, id_box_destination) { var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); var elementBox = document.getElementById(id_box_destination); elementBox.innerHTML = '<u>' + text + '</u>'; elementBox.style.backgroundColor = shared_colorGreen; elementBox.style.color = 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementBox.isFilled = true;//23-Aug-2014 elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_setTextAndBackgroundColorToGreenAndIsMovedTrueAndReplaceText(id_text, id_box_destination) { var millID = document.getElementById(id_box_destination); var millText = millID.innerText.trim(); millText = millText.substring(0, millText.length - 7); var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); text =text.concat(millText); var elementBox = document.getElementById(id_box_destination); elementBox.innerHTML = '<u>' + text + '</u>'; elementBox.style.backgroundColor = shared_colorGreen; elementBox.style.color = 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_setTextAndBackgroundColorByTrimmingText(id_text, id_box_destination) { var elementText = document.getElementById(id_text); var text = elementText.innerText.trim(); var splitText = text.toLowerCase().split(' '); var elementBox = document.getElementById(id_box_destination); elementBox.innerHTML = text; elementBox.style.backgroundColor = splitText[0]; elementBox.style.color = ((splitText[0] == 'white') || (splitText[0] == 'yellow')) ? 'black' : 'white'; elementBox.style.border = (splitText[0] == 'white') ? '2px solid black' : 'white'; elementBox.style.fontFamily = 'Arial Rounded MT Bold'; elementText.style.display = 'none';//For browser IE elementText.hidden = true; elementText.isMoved = true; } function shared_dragDropImage(id_draggable_image, id_box_destination, id_img_source) { var elementDraggableImage = document.getElementById(id_draggable_image); var elementBox = document.getElementById(id_box_destination); var elementImageSource = document.getElementById(id_img_source); var insertImage = '<img src="' + elementImageSource.src + '" width="' + elementImageSource.width + '" height="' + elementImageSource.height + '"/>'; elementBox.innerHTML = insertImage; elementBox.style.backgroundColor = shared_colorGreen; elementDraggableImage.style.display = 'none';//For browser IE elementDraggableImage.hidden = true; } function shared_dragDropImageAndIsMovedTrue(id_draggable_image, id_box_destination, id_img_source) { var elementDraggableImage = document.getElementById(id_draggable_image); var elementBox = document.getElementById(id_box_destination); var elementImageSource = document.getElementById(id_img_source); var insertImage = '<img src="' + elementImageSource.src + '" width="' + elementImageSource.width + '" height="' + elementImageSource.height + '"/>'; elementBox.innerHTML = insertImage; elementBox.style.backgroundColor = shared_colorGreen; elementDraggableImage.style.display = 'none';//For browser IE elementDraggableImage.hidden = true; elementDraggableImage.isMoved = true; } function shared_hideClapsImage() { var imageDivEelement = document.getElementById('shared_id_div_claps_image'); imageDivEelement.hidden = true; imageDivEelement.style.display = 'none';//For browser IE shared_stopSoundClaps(); } function shared_playSoundClaps() { var pInnerHtml = ""; pInnerHtml += ' <audio id="id_claps_sound" autoplay="autoplay" loop="loop" controls="controls" style="position: absolute; visibility: hidden">'; pInnerHtml += ' <source src="../../../res/sounds/claps-sound.mp3" type="audio/mpeg">'; pInnerHtml += ' </audio>'; document.getElementById('id_playAudio').innerHTML = pInnerHtml; } function shared_stopSoundClaps() { var eSound = document.getElementById('id_claps_sound') if (eSound != null) { eSound.pause(); if ((shared_currentDeviceType == shared_DeviceTypeWindowsPhone) || (shared_currentDeviceType == shared_DeviceTypeInternetExplorer)) { eSound.currentTime.toFixed(0); } else { eSound.currentTime = 0; } } } /*function shared_is_all_infos_moved_show_claps_animation(allElementIdsArray, idDiv) { if (shared_isAllInfosMoved(allElementIdsArray)) { shared_show_claps_animation(idDiv); } } function shared_is_all_infos_moved_show_claps_animationWithIsMoved(allElementIdsArray, idDiv) { if (shared_isAllInfosMovedAndHidden(allElementIdsArray)) { shared_show_claps_animation(idDiv); } } function shared_isAllInfosMoved(allElementIdsArray) { for (index=0; index<allElementIdsArray.length; index++) { var element = document.getElementById(allElementIdsArray[index]); if (element.hidden == false) { return (false); } } return (true); } function shared_isAllInfosMovedAndHidden(allElementIdsArray) { for (index=0; index<allElementIdsArray.length; index++) { var eElement = document.getElementById(allElementIdsArray[index]); if (eElement.isMoved == false) { return (false); } } return (true); }*/ function shared_is_all_infos_filled_show_claps_animationWithIsFilled(boxIdsArray) { if (shared_isAllInfosFilled(boxIdsArray)) { shared_show_claps_animation(); } } function shared_isAllInfosFilled(boxIdsArray) { for (index=0; index<boxIdsArray.length; index++) { var element = document.getElementById(boxIdsArray[index]); if (element.isFilled == false) { return (false); } } return (true); } function shared_setFilledAsFalseToArray(ids_arrayBoxes) { for (index = 0; index < ids_arrayBoxes.length; index++) { var id_element = ids_arrayBoxes[index]; var eElement = document.getElementById(id_element); eElement.isFilled = false; } } //To rectify a problem in Android device. function shared_show_claps_animation_for_initial() { var innerHtml = ''; var clapsImageSize = shared_dataTableWidth / 2.0; innerHtml += ' <div id="id_div">'; innerHtml += ' <table width="' + shared_dataTableWidth + '" height="' + shared_dataTableHeight + '" border="1" cellspacing="0" cellpadding="0" >'; innerHtml += ' <tr>'; innerHtml += ' <td align="center" style="text-align:center; vertical-align:middle">'; innerHtml += ' <input type="image" id="id_image" src="img/claps.gif" width="' + clapsImageSize + '" height="' + clapsImageSize + '" onclick="shared_hideClapsImage()" alt="Claps">'; innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>'; innerHtml += ' </div>'; var eDiv = document.getElementById('shared_id_div_claps_image'); eDiv.innerHTML = innerHtml; eDiv.hidden = false; eDiv.style.display = 'block';//For browser IE eDiv.style.visibility = "visible"; var eDiv = document.getElementById('id_image'); eDiv.setAttribute("unselectable", "on"); eDiv.className = 'shared_style_unselectable shared_style_animation_show_success'; } function shared_show_claps_animation() { var innerHtml = ''; var clapsImageSize = shared_dataTableWidth / 2.0; innerHtml += ' <div id="id_div">'; innerHtml += ' <table width="' + shared_dataTableWidth + '" height="' + shared_dataTableHeight + '" border="1" cellspacing="0" cellpadding="0">'; innerHtml += ' <tr>'; innerHtml += ' <td align="center" style="text-align:center; vertical-align:middle">'; innerHtml += ' <input type="image" id="id_image" src="../../../img/claps.gif" width="' + clapsImageSize + '" height="' + clapsImageSize + '" onclick="shared_hideClapsImage()" alt="Claps">'; innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>'; innerHtml += ' </div>'; innerHtml += ' <span id="id_playAudio"></span>'; var eDiv = document.getElementById('shared_id_div_claps_image'); eDiv.innerHTML = innerHtml; eDiv.hidden = false; eDiv.style.display = 'block';//For browser IE eDiv.style.visibility = "visible"; var eDiv = document.getElementById('id_image'); eDiv.setAttribute("unselectable", "on"); eDiv.className = 'shared_style_unselectable shared_style_animation_show_success'; shared_playSoundClaps(); } function shared_show_message_info(title, message, messageOption) { var deviceType = shared_getDeviceType(); var buttonStyle = 'shared_style_buttons_header_footer'; var messageBoxWidth = shared_dataTableWidth * 0.65; var messageBoxHeight = messageBoxWidth * 0.7; var sizePercentageAsDevice = shared_getSizePercentageAsPerDeviceHeightWidth(); var actualSize = 24; var textSize = actualSize * sizePercentageAsDevice; var fontSizeButtonText = textSize; var buttonHeight = textSize * 1.8; var borderRadius = buttonHeight / 2.0; var tdButtonHeight = buttonHeight * 1.2; var buttonWidthPercent = (messageOption == MessageOption.OKCancel) ? 70 : 35; fontSizeButtonText = fontSizeButtonText + 'px'; buttonHeight = buttonHeight + 'px'; borderRadius = borderRadius + 'px'; tdButtonHeight = tdButtonHeight + 'px'; var innerHtml = ''; innerHtml += ' <div style="position: absolute; text-align:center;z-index: 99;">'; innerHtml += ' <table border="0" cellspacing="0" cellpadding="0" width="' + shared_dataTableWidth + '" height="' + shared_dataTableHeight + '" style="position: absolute; background-color:rgba(0, 0, 0, 0)">';//table1 // White transparent background is required for IE to avoid other buttons click. innerHtml += ' <tr>'; innerHtml += ' <td align="center" style="border:none;">'; innerHtml += ' <table width="' + messageBoxWidth + '" height="' + messageBoxHeight + '" border="0" cellspacing="0" cellpadding="0">';//table2 innerHtml += ' <tr>'; innerHtml += ' <td id="shared_style_messagebox_background" align="center">'; innerHtml += ' <table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0" style="border:none">';//table3 innerHtml += ' <tr height="' + messageBoxHeight / 3.8 + '">';//tr1 innerHtml += ' <td align="center" style="border:none; font-size:' + textSize + 'px">'; innerHtml += ' <span>' + title + '</span>'; innerHtml += ' </td">'; innerHtml += ' </tr>'; innerHtml += ' <tr height="' + messageBoxHeight / 2.4 + '">';//tr2 innerHtml += ' <td align="center" style="border-left:none;border-right:none;">'; innerHtml += ' <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="5" style="border:none">';//table5 innerHtml += ' <tr>'; innerHtml += ' <td align="center" style="border:none; font-size:' + textSize + 'px">'; innerHtml += ' ' + message + ''; innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table5 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' <tr height="' + messageBoxHeight / 3.8 + '">';//tr3 if (deviceType == shared_DeviceTypeAndroid) { innerHtml += ' <td align="center" style="border-bottom:none;border-left:none;border-right:none; padding:5px">'; } else { innerHtml += ' <td align="center" style="border:none; padding:5px">'; } innerHtml += ' <table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0" style="border:none">';//table6 innerHtml += ' <tr>'; innerHtml += ' <td width="50%" align="center" style="border:none">'; innerHtml += ' <input type="button" class="' + buttonStyle + '" value="OK" onClick="hide_message_info()" style="width:' + buttonWidthPercent + '%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto; color:blue">'; innerHtml += ' </td>'; if (messageOption == MessageOption.OKCancel) { innerHtml += ' <td width="50%" align="center" style="border:none">'; innerHtml += ' <input type="button" class="' + buttonStyle + '" value="Cancel" onClick="cancel_message_info()" style="width:' + buttonWidthPercent + '%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto; color:blue">'; innerHtml += ' </td>'; } innerHtml += ' </tr>'; innerHtml += ' </table>';//table6 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table3 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table2 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table1 innerHtml += ' </div>'; var eDiv = document.getElementById('shared_id_div_message'); eDiv.innerHTML = innerHtml; eDiv.setAttribute("unselectable", "on"); eDiv.className = 'shared_style_unselectable'; } /*function shared_show_message_info(title, message, messageOption) { var deviceType = shared_getDeviceType(); var buttonStyle = 'shared_style_buttons_header_footer'; var messageBoxWidth = shared_dataTableWidth * 0.65; var messageBoxHeight = messageBoxWidth * 0.7; var sizePercentageAsDevice = shared_getSizePercentageAsPerDeviceHeightWidth(); var actualSize = 24; var textSize = actualSize * sizePercentageAsDevice; var fontSizeButtonText = textSize; var buttonHeight = textSize * 1.8; var borderRadius = buttonHeight / 2.0; var tdButtonHeight = buttonHeight * 1.2; var buttonWidthPercent = (messageOption == MessageOption.OKCancel) ? 70 : 35; fontSizeButtonText = fontSizeButtonText + 'px'; buttonHeight = buttonHeight + 'px'; borderRadius = borderRadius + 'px'; tdButtonHeight = tdButtonHeight + 'px'; var innerHtml = ''; innerHtml += ' <div style="position: absolute; text-align:center;z-index: 99;">'; innerHtml += ' <table border="0" cellspacing="0" cellpadding="0" width="' + shared_dataTableWidth + '" height="' + shared_dataTableHeight + '" style="position: absolute">';//table1 innerHtml += ' <tr>'; innerHtml += ' <td align="center" style="border:none;">'; innerHtml += ' <table width="' + messageBoxWidth + '" height="' + messageBoxHeight + '" border="0" cellspacing="0" cellpadding="0">';//table2 innerHtml += ' <tr>'; innerHtml += ' <td id="shared_style_messagebox_background" align="center">'; innerHtml += ' <table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0" style="border:none">';//table3 innerHtml += ' <tr height="25%">';//tr1 innerHtml += ' <td align="center" style="border:none; font-size:' + textSize + 'px">'; innerHtml += ' <span>' + title + '</span>'; innerHtml += ' </td">'; innerHtml += ' </tr>'; innerHtml += ' <tr height="*">';//tr2 innerHtml += ' <td align="center" style="border-left:none;border-right:none;">'; innerHtml += ' <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="5" style="border:none">';//table5 innerHtml += ' <tr>'; innerHtml += ' <td align="center" style="border:none; font-size:' + textSize + 'px">'; innerHtml += ' ' + message + ''; innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table5 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' <tr height="25%">';//tr3 if (deviceType == shared_DeviceTypeAndroid) { innerHtml += ' <td align="center" style="border-bottom:none;border-left:none;border-right:none; padding:5px">'; } else { innerHtml += ' <td align="center" style="border:none; padding:5px">'; } innerHtml += ' <table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0" style="border:none">';//table6 innerHtml += ' <tr>'; innerHtml += ' <td width="50%" align="center" style="border:none">'; innerHtml += ' <input type="button" class="' + buttonStyle + '" value="OK" onClick="hide_message_info()" style="width:' + buttonWidthPercent + '%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto; color:blue">'; innerHtml += ' </td>'; if (messageOption == MessageOption.OKCancel) { innerHtml += ' <td width="50%" align="center" style="border:none">'; innerHtml += ' <input type="button" class="' + buttonStyle + '" value="Cancel" onClick="cancel_message_info()" style="width:' + buttonWidthPercent + '%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto; color:blue">'; innerHtml += ' </td>'; } innerHtml += ' </tr>'; innerHtml += ' </table>';//table6 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table3 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table2 innerHtml += ' </td>'; innerHtml += ' </tr>'; innerHtml += ' </table>';//table1 innerHtml += ' </div>'; var eDiv = document.getElementById('shared_id_div_message'); eDiv.innerHTML = innerHtml; eDiv.setAttribute("unselectable", "on"); eDiv.className = 'shared_style_unselectable'; }*/ function show_message_info() { var eDiv = document.getElementById('shared_id_div_message'); eDiv.hidden = false; eDiv.style.display = 'block';//For browser IE } function hide_message_info() { var eDiv = document.getElementById('shared_id_div_message'); eDiv.hidden = true; eDiv.style.display = 'none';//For browser IE } function cancel_message_info() { hide_message_info(); } function shared_setEmptyDropBoxForImageInfo(ids_array_boxes) { for (var idIndex = 0; idIndex < ids_array_boxes.length; idIndex++) { var eTdBox = document.getElementById(ids_array_boxes[idIndex]); eTdBox.style.backgroundColor = '#FFDB99';//Light orange eTdBox.style.color = 'white'; eTdBox.style.textAlign = 'center'; eTdBox.style.verticalAlign = 'middle'; eTdBox.innerHTML = 'Drag here'; } } function shared_init_dropping_spans(ids_spans) { for (var idIndex = 0; idIndex < ids_spans.length; idIndex++) { var eSpan = document.getElementById(ids_spans[idIndex]); eSpan.isMoved = false; } } function shared_init_dropBox_tds_with_drag_here(ids_boxes) { for (var idIndex = 0; idIndex < ids_boxes.length; idIndex++) { var eTdBox = document.getElementById(ids_boxes[idIndex]); eTdBox.style.backgroundColor = '#FFDB99';//Light orange eTdBox.style.color = 'white'; eTdBox.style.textAlign = 'center'; eTdBox.style.verticalAlign = 'middle'; eTdBox.innerHTML = 'Drag here'; eTdBox.isFilled = false; eTdBox.customBackgroundcolor = '#FFDB99';//Light orange } } function shared_init_dropBox_tds_withOUT_drag_here(ids_boxes) { for (var idIndex = 0; idIndex < ids_boxes.length; idIndex++) { var eTdBox = document.getElementById(ids_boxes[idIndex]); eTdBox.isFilled = false; eTdBox.customBackgroundcolor = 'white'; } } function shared_setImageSource(id_image, imagesPath, imageName) { var eImage = document.getElementById(id_image); eImage.src = imagesPath + imageName; } function shared_createProjectPaths() { } function shared_downloadProjectFiles() { } function shared_removeEndPathOrFile(path) { return (path.substring(0, path.lastIndexOf('/'))); } function shared_getSubTitle(level, catNo, lessonNo) { var totalLessons = shared_get_totalLessons(level, catNo); if (shared_isDebug) { return ("Level " + level.name + " [Debug - Cat " + catNo.name + " : Lesson " + lessonNo + "/" + totalLessons + "]"); } else { return ("Level " + level.name + " [" + catNo.name + " - " + lessonNo + " of " + totalLessons + "]"); } } function shared_setFilledAsFalseToArray(ids_arrayBoxes) { for (index = 0; index < ids_arrayBoxes.length; index++) { var id_element = ids_arrayBoxes[index]; var eElement = document.getElementById(id_element); eElement.isFilled = false; } } function shared_hideAllExceptFirstElement(id_prefix, nIds_total) { for (var id_no = 1; id_no <= nIds_total; id_no++) { var idOfElement = id_prefix + id_no; var eElement = document.getElementById(idOfElement); eElement.isMoved = false; eElement.hidden = (id_no == 1) ? false : true; eElement.style.display = (id_no == 1) ? 'block' : 'none'; } } function shared_hideAllExceptFirstElement2(id_startsFrom , id_prefix, nIds_total)//oct29 { for (var id_no = id_startsFrom; id_no <= nIds_total; id_no++) { var idOfElement = id_prefix + id_no; var eElement = document.getElementById(idOfElement); eElement.isMoved = false; eElement.hidden = (id_no == 1) ? false : true; eElement.style.display = (id_no == 1) ? 'block' : 'none'; } } /*function shared_unHideNextElement(id_prefix, nIds_total) { for (var id_no = 1; id_no <= nIds_total; id_no++) { var idOfElement = id_prefix + id_no; var eElement = document.getElementById(idOfElement); if (eElement != null && eElement.hidden == true) { eElement.hidden = false; eElement.style.display = 'block'; return; } } }*/ function shared_unHideNextElementNew(id_prefix, nIds_total) { for (var id_no = 1; id_no <= nIds_total; id_no++) { var idOfElement = id_prefix + id_no; var eElement = document.getElementById(idOfElement); if (eElement != null && eElement.isMoved == false) { eElement.hidden = false; eElement.style.display = 'block'; eElement.setAttribute("draggable", "true"); return; } } } function shared_unHideNextElementNew1(id_startsFrom, id_prefix, nIds_total)//oct29 { for (var id_no = id_startsFrom; id_no <= nIds_total; id_no++) { var idOfElement = id_prefix + id_no; var eElement = document.getElementById(idOfElement); if (eElement != null && eElement.isMoved == false) { eElement.hidden = false; eElement.style.display = 'block'; eElement.setAttribute("draggable", "true"); return; } } } function shared_unHideNextElementNew2(id_spanPrefix, id_tdPrefix, nIds_total) { for (var id_no = 1; id_no <= nIds_total; id_no++) { var id_span = id_spanPrefix + id_no; var eSpan = document.getElementById(id_span); var id_td = id_tdPrefix + id_no; var eTd = document.getElementById(id_td); if (eSpan != null && eSpan.isMoved == false) { eSpan.hidden = false; eSpan.style.display = 'block'; eTd.setAttribute("draggable", "true"); return; } } } function shared_hide_canvas_circle_makeBackgroundWhite(id_canvas) { var eCanvas = document.getElementById(id_canvas); if (eCanvas.style.display == 'block') eCanvas.style.display = 'none'; if (eCanvas.parentElement.parentElement.style.backgroundColor != 'white') { eCanvas.parentElement.parentElement.style.backgroundColor = 'white'; } } function shared_hide_canvas_circle(id_canvas) { var eCanvas = document.getElementById(id_canvas); if (eCanvas.style.display == 'block') eCanvas.style.display = 'none'; } function shared_svg_setEllipseLightGreenTransparentIfisValidatedIsFalse(eEllipse) { if (eEllipse.isValidated == false) { eEllipse.style.stroke = 'rgba(0, 250, 0, 1)';//Added on 16-Sep-2014 eEllipse.style.fill = 'rgba(0, 250, 0, 0.4)';//LightGreen } } function shared_svg_setEllipseFillRedTransparentIfisValidatedIsFalse(eEllipse) { if (eEllipse.isValidated == false) { eEllipse.style.stroke = 'rgba(250, 0, 0, 0.6)';//Added on 16-Sep-2014 eEllipse.style.fill = 'rgba(250, 0, 0, 0.4)';//LightRed } } function shared_svg_setEllipseFillBlackTransparentIfisValidatedIsFalse(eEllipse) { if (eEllipse.isValidated == false) { eEllipse.style.stroke = 'rgba(0, 0, 0, 0.6)';//Added on 16-Sep-2014 eEllipse.style.fill = 'rgba(0, 0, 0, 0.4)';//LightBlack } } function shared_svg_setEllipseBorderRedIfisValidatedIsFalse(eEllipse) { if (eEllipse.isValidated == false) { eEllipse.style.stroke = 'rgba(255, 0, 0, 0)';//Red } } function shared_svg_setEllipseBorderBlackIfisValidatedIsFalse(eEllipse) { if (eEllipse.isValidated == false) { eEllipse.style.stroke = 'rgba(0, 0, 0, 0)';//Black } } function shared_svg_setSvgWidthHeightAndPositionFromTd(id_td, id_eSvg) { var eTd = document.getElementById(id_td); var eTdRectangle = eTd.getBoundingClientRect(); var eSvg = document.getElementById(id_eSvg); eSvg.style.width = eTdRectangle.width + 'px'; eSvg.style.height = eTdRectangle.height + 'px'; eSvg.style.left = eTdRectangle.left + 'px'; eSvg.style.top = eTdRectangle.top + 'px'; eSvg.style.visibility = "visible"; if (shared_isDebug) { eSvg.style.backgroundColor = 'rgba(0, 200, 0, 0.2)'; } } function shared_svg_setEllipseStyle(id_ellipse) { var eEllipse = document.getElementById(id_ellipse); eEllipse.style.stroke = 'transparent'; eEllipse.style.fill = 'transparent'; eEllipse.style.strokeWidth = '1px'; eEllipse.onclick = function(){ellipse_click(id_ellipse)}; eEllipse.isValidated = false; eEllipse.circleColor = CircleColorSvg.None; if (shared_isDebug) { eEllipse.style.stroke = 'rgba(250, 0, 0, 0.5)'; } } function shared_svg_setRectangleStyle(id_rectangle) { var eRectangle = document.getElementById(id_rectangle); eRectangle.style.stroke = 'transparent'; eRectangle.style.fill = 'transparent'; eRectangle.style.strokeWidth = '1px'; eRectangle.onclick = function(){rectangle_click(id_rectangle)}; eRectangle.isValidated = false; eRectangle.circleColor = CircleColorSvg.None; eRectangle.isSelected = false; if (shared_isDebug) { eRectangle.style.stroke = 'rgba(250, 0, 0, 0.5)'; } } function shared_svg_setEllipseStyle_stroke_width_zero(id_ellipse) { var eEllipse = document.getElementById(id_ellipse); eEllipse.style.stroke = 'transparent'; eEllipse.style.fill = 'transparent'; eEllipse.style.strokeWidth = '0px'; eEllipse.onclick = function(){ellipse_click(id_ellipse)}; eEllipse.isValidated = false; eEllipse.circleColor = CircleColorSvg.None; if (shared_isDebug) { eEllipse.style.stroke = 'rgba(250, 0, 0, 0.5)'; } } function shared_svg_clearMultiEllipsesUsingIdsArray(ellipseIdsArray) { for (var indexEllipse = 0; indexEllipse < ellipseIdsArray.length; indexEllipse++) { var id_ellipse = ellipseIdsArray[indexEllipse]; shared_svg_clearEllipse(id_ellipse); } } function shared_svg_clearEllipse(id_ellipse) { var eEllipse = document.getElementById(id_ellipse); eEllipse.style.fill = 'transparent'; eEllipse.style.stroke = 'transparent'; eEllipse.circleColor = CircleColorSvg.None; eEllipse.isValidated = false; } function shared_svg_validateEllipsesForValidationReqd(ellipseIdsArrayValidationReqd, circleColor) { var nCorrectEllipses = 0; for (var indexEllipse = 0; indexEllipse < ellipseIdsArrayValidationReqd.length; indexEllipse++) { var id_ellipse = ellipseIdsArrayValidationReqd[indexEllipse]; var eEllipse = document.getElementById(id_ellipse); if (eEllipse.circleColor != CircleColorSvg.None) { if (eEllipse.circleColor == circleColor) { shared_svg_setEllipseLightGreenTransparentIfisValidatedIsFalse(eEllipse); nCorrectEllipses++; } else { shared_svg_setEllipseFillRedTransparentIfisValidatedIsFalse(eEllipse); } } eEllipse.isValidated = true; } return (nCorrectEllipses); } function shared_svg_validateEllipsesForValidationNotReqdForMulti(ellipseIdsArrayValidationNotReqd) { for (var indexEllipse = 0; indexEllipse < ellipseIdsArrayValidationNotReqd.length; indexEllipse++) { var id_ellipse = ellipseIdsArrayValidationNotReqd[indexEllipse]; shared_svg_validateEllipseForValidationNotReqdForSingle(id_ellipse); } } function shared_svg_validateEllipseForValidationNotReqdForSingle(id_ellipse) { var eEllipse = document.getElementById(id_ellipse); if (eEllipse.circleColor != CircleColorSvg.None) { shared_svg_setEllipseFillRedTransparentIfisValidatedIsFalse(eEllipse); } eEllipse.isValidated = true; } function shared_svg_showHideEllipsesMultipleFor1Td(id_ellipse, allGroupsIdsArrayArray) { var eEllipse = document.getElementById(id_ellipse); if (eEllipse.circleColor == CircleColorSvg.None) { for (var indexGroup = 0; indexGroup < allGroupsIdsArrayArray.length; indexGroup++) { var groupIdsArray = allGroupsIdsArrayArray[indexGroup]; for (var indexEllipse = 0; indexEllipse < groupIdsArray.length; indexEllipse++) { var id_ellipse = groupIdsArray[indexEllipse]; if (eEllipse.id == id_ellipse) { for (var indexEllipseInner = 0; indexEllipseInner < groupIdsArray.length; indexEllipseInner++) { if (indexEllipse != indexEllipseInner) { shared_svg_clearEllipse(groupIdsArray[indexEllipseInner]); } } shared_svg_showEllipse(eEllipse); return; } } } } else { shared_svg_showEllipse(eEllipse); } } function shared_svg_showEllipse(eEllipse) { eEllipse.style.stroke = 'blue'; eEllipse.style.fill = 'Transparent'; eEllipse.circleColor = CircleColorSvg.Blue; eEllipse.isValidated = false; } function shared_svg_showRectangleWithFillColor(id_rectangle, fillColor) { var eRectangle = document.getElementById(id_rectangle); eRectangle.style.stroke = 'blue'; eRectangle.style.fill = fillColor; eRectangle.circleColor = CircleColorSvg.Blue; eRectangle.isValidated = false; } function shared_svg_showRectangleWithFillTransaperent(id_rectangle) { var eRectangle = document.getElementById(id_rectangle); eRectangle.style.stroke = 'green'; eRectangle.style.fill = 'Transparent'; eRectangle.circleColor = CircleColorSvg.Blue; eRectangle.isValidated = false; } function shared_svg_validateEllipses(allEllipseIdsArray, correctEllipseIdsArray) { var nCorrectEllipses = 0; for (var indexEllipse = 0; indexEllipse < allEllipseIdsArray.length; indexEllipse++) { var id_ellipse = allEllipseIdsArray[indexEllipse]; var eEllipse = document.getElementById(id_ellipse); if (eEllipse.circleColor == CircleColorSvg.Blue)//Circled { if (correctEllipseIdsArray.indexOf(id_ellipse) != -1) { shared_svg_setEllipseLightGreenTransparentIfisValidatedIsFalse(eEllipse) nCorrectEllipses++; } else { shared_svg_setEllipseFillRedTransparentIfisValidatedIsFalse(eEllipse) } } eEllipse.isValidated = true; } return (nCorrectEllipses); } function shared_canvas_showHideCirclesOfCorrespondingGroup(idCanvas, allGroupsIdsArrayInArray) { var eCanvas = document.getElementById(idCanvas); if (eCanvas.isCircled == false) { for (var indexGroup = 0; indexGroup < allGroupsIdsArrayInArray.length; indexGroup++) { var groupIdsArray = allGroupsIdsArrayInArray[indexGroup]; for (var indexCanvas = 0; indexCanvas < groupIdsArray.length; indexCanvas++) { var id_canvas = groupIdsArray[indexCanvas]; if (eCanvas.id == id_canvas) { for (var indexCanvasInner = 0; indexCanvasInner < groupIdsArray.length; indexCanvasInner++) { if (indexCanvas != indexCanvasInner) { shared_canvas_clearCircle(groupIdsArray[indexCanvasInner]); } } shared_canvas_showCanvas_border_blue(eCanvas); return; } } } } else { shared_canvas_clearCircle(idCanvas); } } function shared_canvas_showCircles(idCanvas, allGroupsIdsArrayInArray) { var eCanvas = document.getElementById(idCanvas); if (eCanvas.isCircled == false) { for (var indexGroup = 0; indexGroup < allGroupsIdsArrayInArray.length; indexGroup++) { var groupIdsArray = allGroupsIdsArrayInArray[indexGroup]; for (var indexCanvas = 0; indexCanvas < groupIdsArray.length; indexCanvas++) { var id_canvas = groupIdsArray[indexCanvas]; if (eCanvas.id == id_canvas) { shared_canvas_showCanvas_border_blue(eCanvas); return; } } } } else { shared_canvas_clearCircle(idCanvas); } } function shared_canvas_clearCircle(idCanvas) { var eCanvas = document.getElementById(idCanvas); var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.clearRect(0, 0, eCanvas.width, eCanvas.height); eCanvas.style.display = 'none'; eCanvas.isValidated = false; eCanvas.isCircled = false; } function shared_canvas_showCanvas(eCanvas) { var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.clearRect(0, 0, eCanvas.width, eCanvas.height); eCanvasContext.strokeStyle = 'blue'; eCanvasContext.stroke(); eCanvas.style.display = 'block'; eCanvas.isValidated = false; eCanvas.isCircled = true; } function shared_canvas_showCanvas2(eCanvas) { var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.clearRect(0, 0, eCanvas.width, eCanvas.height); eCanvas.style.display = 'block'; eCanvas.isValidated = false; eCanvas.isCircled = true; } function shared_canvas_showCanvas_border_blue(eCanvas) { var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.clearRect(0, 0, eCanvas.width, eCanvas.height); eCanvasContext.strokeStyle = 'blue'; eCanvasContext.stroke(); eCanvas.style.display = 'block'; eCanvas.isValidated = false; eCanvas.isCircled = true; } function shared_canvas_showCanvas_border_black(eCanvas) { var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.clearRect(0, 0, eCanvas.width, eCanvas.height); eCanvasContext.strokeStyle = 'black'; eCanvasContext.stroke(); eCanvas.style.display = 'block'; eCanvas.isValidated = false; eCanvas.isCircled = true; } function shared_canvas_validateCanvases(allGroupsIdsArrayInArray, correctCanvasIdsArray) { var nCorrectCanvases = 0; for (var indexGroup = 0; indexGroup < allGroupsIdsArrayInArray.length; indexGroup++) { var groupIdsArray = allGroupsIdsArrayInArray[indexGroup]; for (var indexCanvas = 0; indexCanvas < groupIdsArray.length; indexCanvas++) { var id_canvas = groupIdsArray[indexCanvas]; var eCanvas = document.getElementById(id_canvas); if (eCanvas.isCircled) { if (correctCanvasIdsArray.indexOf(id_canvas) != -1) { shared_canvas_setCanvasCircleLightGreenTransparentIfisValidatedIsFalse(eCanvas); nCorrectCanvases++; } else { shared_canvas_setCanvasCircleLightRedTransparentIfisValidatedIsFalse(eCanvas); shared_isSelectedWrong = true; } } eCanvas.isValidated = true; } } return (nCorrectCanvases); } //Added on 20-Aug-2014 function shared_canvas_validateCanvases_withoutGroups(allCanvasIdsArray, correctCanvasIdsArray) { var nCorrectCanvases = 0; var nWrongCanvases = 0; var validatedCanvasesArray = null; for (var index = 0; index < allCanvasIdsArray.length; index++) { var id_canvas = allCanvasIdsArray[index]; var eCanvas = document.getElementById(id_canvas); if (eCanvas.isCircled) { if (correctCanvasIdsArray.indexOf(id_canvas) != -1) { shared_canvas_setCanvasCircleLightGreenTransparentIfisValidatedIsFalse(eCanvas); nCorrectCanvases++; } else { shared_canvas_setCanvasCircleLightRedTransparentIfisValidatedIsFalse(eCanvas); shared_isSelectedWrong = true; nWrongCanvases++; } } eCanvas.isValidated = true; } validatedCanvasesArray = [nCorrectCanvases, nWrongCanvases]; return (validatedCanvasesArray); } function shared_canvas_setCanvasCircleLightGreenTransparentIfisValidatedIsFalse(eCanvas) { var eCanvasContext = eCanvas.getContext('2d'); if (eCanvas.isValidated == false) { eCanvasContext.strokeStyle = 'green'; eCanvasContext.stroke(); eCanvasContext.fillStyle = 'rgba(0, 250, 0, 0.4)';//Light green eCanvasContext.fill(); eCanvas.isValidated = true; } } function shared_canvas_setCanvasCircleLightRedTransparentIfisValidatedIsFalse(eCanvas) { var eCanvasContext = eCanvas.getContext('2d'); if (eCanvas.isValidated == false) { eCanvasContext.strokeStyle = 'red'; eCanvasContext.stroke(); eCanvasContext.fillStyle = 'rgba(250, 0, 0, 0.4)';//Light red eCanvasContext.fill(); eCanvas.isValidated = true; } } function shared_canvas_drawCircle(id_canvas, id_td) { shared_canvas_drawCircleWithRadiusPercentageOfTd(id_canvas, id_td, 80); } function shared_canvas_drawCircleWithRadiusPercentageOfTd(id_canvas, id_td, radiousPercentageOfTd) { var eTd = document.getElementById(id_td); var eTdRectangle = eTd.getBoundingClientRect(); var eCanvas = document.getElementById(id_canvas); eCanvas.style.left = eTdRectangle.left + 'px'; eCanvas.style.top = eTdRectangle.top + 'px'; eCanvas.textAlign = 'center'; eCanvas.width = eTdRectangle.width; eCanvas.height = eTdRectangle.height; var minWidthOrHeight = eTdRectangle.width < eTdRectangle.height ? eTdRectangle.width : eTdRectangle.height; var radious = (minWidthOrHeight * radiousPercentageOfTd / 100.0) / 2.0; var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.beginPath(); eCanvasContext.arc(eCanvas.width/2, eCanvas.height/2, radious, 0, 2*Math.PI); eCanvasContext.strokeStyle = 'blue'; eCanvasContext.lineWidth = 2; eCanvasContext.stroke(); eCanvas.isValidated = false; eCanvas.isCircled = false; eCanvas.circleColor = CircleColorCanvas.None; } function shared_show_hideCirclesWithReqdColorForMultiUsingColors(idCanvas, color1, color2) { var eCanvas = document.getElementById(idCanvas); eCanvas.style.display = 'block'; var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.clearRect(0, 0, eCanvas.width, eCanvas.height); var color1Circle = shared_getCanvasCircleColorUsingColor(color1); var color2Circle = shared_getCanvasCircleColorUsingColor(color2); if (eCanvas.circleColor == CircleColorCanvas.None) { eCanvasContext.strokeStyle = color1; eCanvasContext.stroke(); eCanvas.circleColor = color1Circle; eCanvas.isCircled = true; } else if (eCanvas.circleColor == color1Circle) { eCanvasContext.strokeStyle = color2; eCanvasContext.stroke(); eCanvas.circleColor = color2Circle; eCanvas.isCircled = true; } else if (eCanvas.circleColor == color2Circle) { shared_canvas_clearCircle(idCanvas); eCanvas.circleColor = CircleColorCanvas.None; eCanvas.isCircled = false; } eCanvas.isValidated = false; } function shared_show_hideCirclesWithReqdColorForMulti(idCanvas) { var eCanvas = document.getElementById(idCanvas); var eCanvasContext = eCanvas.getContext('2d'); eCanvasContext.clearRect(0, 0, eCanvas.width, eCanvas.height); if (eCanvas.circleColor == CircleColorCanvas.None) { eCanvasContext.strokeStyle = 'blue'; eCanvasContext.stroke(); eCanvas.style.display = 'block'; eCanvas.circleColor = CircleColorCanvas.Blue; eCanvas.isCircled = true; } else if (eCanvas.circleColor == CircleColorCanvas.Blue) { shared_canvas_clearCircle(idCanvas);//23-Aug-2014 eCanvas.circleColor = CircleColorCanvas.None; eCanvas.isCircled = false; } eCanvas.isValidated = false; } function shared_getCanvasCircleColorUsingColor(color) { if (color == 'green') { return (CircleColorCanvas.Green); } else if (color == 'red') { return (CircleColorCanvas.Red); } else if (color == 'blue') { return (CircleColorCanvas.Blue); } else if (color == 'black') { return (CircleColorCanvas.Black); } return (CircleColorCanvas.Blue); } function shared_canvas_getNoOfNotCircledCanvases(canvasIdsArrayValidationNotReqd) { var nCircleNotReqdCanvases = 0; for (var indexCanvas = 0; indexCanvas < canvasIdsArrayValidationNotReqd.length; indexCanvas++) { var id_canvas = canvasIdsArrayValidationNotReqd[indexCanvas]; var eCanvas = document.getElementById(id_canvas); if (eCanvas.circleColor == CircleColorCanvas.None) { nCircleNotReqdCanvases++; } } return (nCircleNotReqdCanvases); } function shared_canvas_validateCanvasesForValidationReqd(canvasIdsArrayValidationReqd, circleColor) { var nCorrectCanvases = 0; for (var indexCanvas = 0; indexCanvas < canvasIdsArrayValidationReqd.length; indexCanvas++) { var id_canvas = canvasIdsArrayValidationReqd[indexCanvas]; var eCanvas = document.getElementById(id_canvas); if (eCanvas.circleColor != CircleColorCanvas.None) { if (eCanvas.circleColor == circleColor) { shared_canvas_setCanvasCircleLightGreenTransparentIfisValidatedIsFalse(eCanvas) nCorrectCanvases++; } else { shared_canvas_setCanvasCircleLightRedTransparentIfisValidatedIsFalse(eCanvas) } } eCanvas.isValidated = true; } return (nCorrectCanvases); } function shared_canvas_validateCanvasesForValidationNotReqdForMulti(canvasIdsArrayValidationNotReqd) { for (var indexCanvas = 0; indexCanvas < canvasIdsArrayValidationNotReqd.length; indexCanvas++) { var id_canvas = canvasIdsArrayValidationNotReqd[indexCanvas]; shared_canvas_validateCanvasForValidationNotReqdForSingle(id_canvas); } } function shared_canvas_validateCanvasForValidationNotReqdForSingle(id_canvas) { var eCanvas = document.getElementById(id_canvas); var eCanvasContext = eCanvas.getContext('2d'); if (eCanvas.circleColor == CircleColorCanvas.None) { eCanvasContext.fillStyle = 'transparent'; eCanvasContext.fill(); eCanvasContext.strokeStyle = 'transparent'; eCanvasContext.stroke(); eCanvas.circleColor = CircleColorCanvas.None; } else { shared_canvas_setCanvasCircleLightRedTransparentIfisValidatedIsFalse(eCanvas) } eCanvas.isValidated = true; } function shared_getSizePercentageAsPerDeviceHeightWidth() { var sizePercentage = (shared_dataTableWidth + shared_dataTableHeight) / (768*0.75 + 1024*0.75); return (sizePercentage); } //Above all are Copied from initial on 30 Jul 2014 function shared_adjust_fontSize_for_ids_webOS(ids_array, sizePercentage) { if (shared_currentDeviceOS == shared_DeviceOS_WebOS) { shared_adjust_fontSize_for_ids_all(ids_array, sizePercentage) } } function shared_adjust_fontSize_for_ids_iPhone(ids_array, sizePercentage) { if ((shared_currentDeviceOS == shared_deviceOS_iOS) && (shared_currentDeviceType == shared_DeviceTypeiPhoneAllSizes)) { shared_adjust_fontSize_for_ids_all(ids_array, sizePercentage) } } function shared_adjust_fontSize_for_ids_iPad(ids_array, sizePercentage) { if ((shared_currentDeviceOS == shared_deviceOS_iOS) && (shared_currentDeviceType == shared_deviceTypeiPad)) { shared_adjust_fontSize_for_ids_all(ids_array, sizePercentage) } } function shared_adjust_fontSize_for_ids_android(ids_array, sizePercentage) { if (shared_currentDeviceOS == shared_deviceOS_Android) { shared_adjust_fontSize_for_ids_all(ids_array, sizePercentage) } } function shared_adjust_fontSize_for_ids_all_devices(ids_array, sizePercentage) { var sizePercentageAsDevice = shared_getSizePercentageAsPerDeviceHeightWidth(); var actualSize = 24; var size = actualSize * sizePercentageAsDevice * (sizePercentage / 100.0); for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.fontSize = size + 'px'; } } function shared_set_border_left_thickness_5px_for_ids_android(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_Android) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderLeft = '5px'; } } } function shared_set_border_right_thickness_5px_for_ids_android(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_Android) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderRight = '5px'; } } } function shared_set_border_top_thickness_5px_for_ids_android(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_Android) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderTop = '5px'; } } } function shared_set_border_bottom_thickness_5px_for_ids_android(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_Android) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderBottom = '5px'; } } } function shared_set_border_none_for_ids_iOS(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_iOS) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.border = 'none'; } } } function shared_set_border_top_none_for_ids_iOS(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_iOS) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderTop = 'none'; } } } function shared_set_border_bottom_none_for_ids_iOS(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_iOS) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderBottom = 'none'; } } } function shared_set_border_left_none_for_ids_iOS(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_iOS) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderLeft = 'none'; } } } function shared_set_border_right_none_for_ids_iOS(ids_array) { if (shared_currentDeviceOS == shared_deviceOS_iOS) { for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; var element = document.getElementById(id_element); element.style.borderRight = 'none'; } } } function shared_allowDrop_web(ev) { ev.preventDefault(); } function shared_dragStart(event) { shared_currentDropingId = event.currentTarget.id; if (shared_currentDeviceOS == shared_DeviceOS_WebOS) { var eDragging = document.getElementById(shared_currentDropingId); var divisor = 3.0; var text = eDragging.innerText; if (text != text.trim()) { divisor = 6.0; } var nChars = text.length; var computedFontSize = window.getComputedStyle(eDragging).fontSize; computedFontSize = computedFontSize.replace('px', ''); var width = nChars * computedFontSize; var height = computedFontSize; event.dataTransfer.setDragImage(event.target,width/divisor, height * 0.75); } return true; } function shared_dragStartNew(event) { shared_currentDropingId = event.currentTarget.firstElementChild.id; var eElement = document.getElementById(shared_currentDropingId); shared_moving_left = eElement.style.left; shared_moving_top = eElement.style.top; } function shared_set_all_draggble_to_false_except_first_element(id_prefix, nIds_total) { for (var id_no = 1; id_no <= nIds_total; id_no++) { var idOfElement = id_prefix + id_no; var eElement = document.getElementById(idOfElement); if (id_no > 1) { eElement.setAttribute("draggable", "false"); } } } function shared_set_all_draggble_to_false_except_first_element2(id_startsFrom, id_prefix, nIds_total) { for (var id_no = id_startsFrom; id_no <= nIds_total; id_no++) { var idOfElement = id_prefix + id_no; var eElement = document.getElementById(idOfElement); if (id_no > 1) { eElement.setAttribute("draggable", "false"); } } } function shared_resetCurrentDroppingPosition(id_dropBox) { var eElement = document.getElementById(shared_currentDropingId); eElement.style.left = shared_moving_left; eElement.style.top = shared_moving_top; shared_un_highlight(id_dropBox); } function shared_resetCurrentDroppingPosition2(id_dropBox) { var eElement = document.getElementById(shared_currentDropingId); eElement.style.left = shared_moving_left; eElement.style.top = shared_moving_top; shared_un_highlight2(id_dropBox); } function shared_isMovingElementIdInTheArraySetIsFilledTrue(id_box, ids_array) { var eBox = document.getElementById(id_box); if (eBox.isFilled) { return (false); } if (shared_is_currentDropingIdHidden())//for iOS { return (false); } for (var index = 0; index < ids_array.length; index++) { var id_element = ids_array[index]; if (shared_currentDropingId == id_element) { eBox.isFilled = true; return (true); } } return (false); } function shared_setCategoryFontSize(id_category) { var sizePercentage = shared_getSizePercentageAsPerDeviceHeightWidth(); var sizeMultiplyValue = 25; var fontSize = sizeMultiplyValue * sizePercentage; fontSize = fontSize + 'px'; var eCategoryText = document.getElementById(id_category); eCategoryText.style.fontSize = fontSize; eCategoryText.style.color = 'blue'; } function shared_getScrolledXY() { var pScrolledXY = new ScrolledXY(); if (typeof (window.pageYOffset) == 'number') { // Netscape pScrolledXY.x = window.pageXOffset; pScrolledXY.y = window.pageYOffset; } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { // DOM pScrolledXY.x = document.body.scrollLeft; pScrolledXY.y = document.body.scrollTop; } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { // IE6 standards compliant mode pScrolledXY.x = document.documentElement.scrollLeft; pScrolledXY.y = document.documentElement.scrollTop; } return (pScrolledXY); } /*function shared_highlight_web(event) { var id_element = event.target.id; shared_highlight(id_element); }*/ function shared_highlight(id_element) { if (shared_is_currentDropingIdHidden()) { return; } var eElement = document.getElementById(id_element); if (eElement.isFilled == false) { if (eElement.nodeName == 'CANVAS') { var eContext = eElement.getContext("2d"); eContext.fillStyle = '#81BEF7';//Light blue eContext.fill(); } else { eElement.style.background = '#81BEF7';//Light blue } } } function shared_is_currentDropingIdHidden() { if (shared_currentDropingId != '') { var eSpan = document.getElementById(shared_currentDropingId); return (eSpan.hidden); } return (false); } /*function shared_is_currentDropingIdHidden() { var eSpan = document.getElementById(shared_currentDropingId); return (eSpan.hidden); }*/ function shared_un_highlight_web(id_element) { var id_element = event.target.id; shared_un_highlight(id_element); } function shared_un_highlight(id_element) { var eElement = document.getElementById(id_element); if (eElement.isFilled == false) { if (eElement.nodeName == 'CANVAS') { shared_canvas_clearCircle(id_element); shared_canvas_showCanvas_border_black(eElement); var eContext = eElement.getContext("2d"); eContext.strokeStyle = 'black'; eContext.stroke(); eContext.fillStyle = '#F2F2F2';//Light gray eContext.fill(); } else { eElement.style.background = eElement.customBackgroundcolor; } } } function shared_un_highlight2(id_element) { var eElement = document.getElementById(id_element); if (eElement.isFilled == false) { if (eElement.nodeName == 'CANVAS') { shared_canvas_clearCircle(id_element); shared_canvas_showCanvas2(eElement); var eContext = eElement.getContext("2d"); } else { eElement.style.background = eElement.customBackgroundcolor; } } } function shared_set_currentDropingId_draggbleToFalse() { var eElement = document.getElementById(shared_currentDropingId); if (eElement.parentElement != null) { eElement.parentElement.setAttribute("draggable", "false"); } } function shared_border_collapse_for_tables_except_android_and_IE(id_tables_array) { if ((shared_currentDeviceOS != shared_deviceOS_Android) && (shared_currentDeviceType != shared_DeviceTypeInternetExplorer)) { for (var idIndex = 0; idIndex < id_tables_array.length; idIndex++) { var eTable = document.getElementById(id_tables_array[idIndex]); eTable.style.borderCollapse = 'collapse'; } } } function shared_border_collapse_for_tables_except_android(id_tables_array) { if (shared_currentDeviceOS != shared_deviceOS_Android) { for (var idIndex = 0; idIndex < id_tables_array.length; idIndex++) { var eTable = document.getElementById(id_tables_array[idIndex]); eTable.style.borderCollapse = 'collapse'; } } } function shared_border_collapse_for_tables_for_all(id_tables_array) { for (var idIndex = 0; idIndex < id_tables_array.length; idIndex++) { var eTable = document.getElementById(id_tables_array[idIndex]); eTable.style.borderCollapse = 'collapse'; } } function shared_increase_thickness_for_td_border_left(id_tds_array) { shared_increase_thickness_for_td_border(id_tds_array, 1); } function shared_increase_thickness_for_td_border_right(id_tds_array) { shared_increase_thickness_for_td_border(id_tds_array, 2); } function shared_increase_thickness_for_td_border_top(id_tds_array) { shared_increase_thickness_for_td_border(id_tds_array, 3); } function shared_increase_thickness_for_td_border_bottom(id_tds_array) { shared_increase_thickness_for_td_border(id_tds_array, 4); } function shared_increase_thickness_for_td_border(id_tds_array, side_no) { for (var idIndex = 0; idIndex < id_tds_array.length; idIndex++) { var eTd = document.getElementById(id_tds_array[idIndex]); if (shared_currentDeviceOS == shared_deviceOS_Android) { if (side_no == 1)//Left { eTd.style.borderLeft = '2px solid'; } else if (side_no == 2)//Right { eTd.style.borderRight = '2px solid'; } else if (side_no == 3)//Top { eTd.style.borderTop = '2px solid'; } else if (side_no == 4)//Bottom { eTd.style.borderBottom = '2px solid'; } } } } function shared_set_border_none_for_td_left_except_android(id_tds_array) { shared_set_border_none_for_td(id_tds_array, 1); } function shared_set_border_none_for_td_right_except_android(id_tds_array) { shared_set_border_none_for_td(id_tds_array, 2); } function shared_set_border_none_for_td_top_except_android(id_tds_array) { shared_set_border_none_for_td(id_tds_array, 3); } function shared_set_border_none_for_td_bottom_except_android(id_tds_array) { shared_set_border_none_for_td(id_tds_array, 4); } function shared_set_border_none_for_td(id_tds_array, side_no) { for (var idIndex = 0; idIndex < id_tds_array.length; idIndex++) { var eTd = document.getElementById(id_tds_array[idIndex]); if (shared_currentDeviceOS != shared_deviceOS_Android) { if (side_no == 1)//Left { eTd.style.borderLeft = '0px'; } else if (side_no == 2)//Right { eTd.style.borderRight = '0px'; } else if (side_no == 3)//Top { eTd.style.borderTop = '0px'; } else if (side_no == 4)//Bottom { eTd.style.borderBottom = '0px'; } } } } function shared_set_border_none_for_table_except_android(id_tds_array) { for (var idIndex = 0; idIndex < id_tds_array.length; idIndex++) { var eTd = document.getElementById(id_tds_array[idIndex]); if (shared_currentDeviceOS != shared_deviceOS_Android) { eTd.style.border = 'none'; } } } function shared_getAngleInRadians(fromPoint, toPoint) { var originPoint = new Point(toPoint.x - fromPoint.x, toPoint.y - fromPoint.y); var angleInRadians = Math.atan2(originPoint.y, originPoint.x); return (angleInRadians); } function shared_getDistance(point1, point2) { var distance = Math.sqrt(((point2.y - point1.y) * (point2.y - point1.y)) + ((point2.x - point1.x) * (point2.x - point1.x))); return (distance); } function shared_getMidPoint(fromPoint, toPoint) { var returnPoint = new Point(); returnPoint.x = (fromPoint.x + toPoint.x) / 2.0; returnPoint.y = (fromPoint.y + toPoint.y) / 2.0; return (returnPoint); } function shared_getPoint(fromPoint, angleInRadians, distance) { var returnPoint = new Point(); returnPoint.x = fromPoint.x + distance * Math.cos(angleInRadians); returnPoint.y = fromPoint.y + distance * Math.sin(angleInRadians); return (returnPoint); } //Added on 05-Nov-2014 function shared_draw_underline(id_td) { var eTd = document.getElementById(id_td); var text = eTd.innerText; eTd.style.color = 'black'; eTd.style.backgroundColor = 'transparent'; eTd.isUnderlined = false; eTd.isValidated = false; eTd.underlineColor = UnderlineColorTd.None; } function shared_showHideUnderlineOfCorrespondingGroup(id_td, allGroupsIdsArrayInArray) { var eTd = document.getElementById(id_td); if (eTd.isUnderlined == false) { for (var indexGroup = 0; indexGroup < allGroupsIdsArrayInArray.length; indexGroup++) { var groupIdsArray = allGroupsIdsArrayInArray[indexGroup]; for (var indexTd = 0; indexTd < groupIdsArray.length; indexTd++) { var idTd = groupIdsArray[indexTd]; if (eTd.id == idTd) { for (var indexTdInner = 0; indexTdInner < groupIdsArray.length; indexTdInner++) { if (indexTd != indexTdInner) { shared_clear_underline(groupIdsArray[indexTdInner]); } } shared_show_underline(eTd); return; } } } } else { shared_clear_underline(id_td); } } function shared_clear_underline(id_td) { var eTd = document.getElementById(id_td); var text = eTd.innerText; eTd.innerHTML = text; eTd.style.backgroundColor = shared_colorWhite; eTd.style.color = shared_colorBlack; eTd.isUnderlined = false; eTd.isValidated = false; } function shared_show_underline(eTd) { var text = eTd.innerText; eTd.innerHTML = '<u style="color:blue">' + text + '</u>'; eTd.style.backgroundColor = shared_colorWhite; eTd.style.color = shared_colorBlack; eTd.isUnderlined = true; eTd.isValidated = false; } function shared_validate_tds(allGroupsIdsArrayInArray, correctTdIdsArray) { var nCorrectTds = 0; for (var indexGroup = 0; indexGroup < allGroupsIdsArrayInArray.length; indexGroup++) { var groupIdsArray = allGroupsIdsArrayInArray[indexGroup]; for (var indexTd = 0; indexTd < groupIdsArray.length; indexTd++) { var id_td = groupIdsArray[indexTd]; var eTd = document.getElementById(id_td); if (eTd.isUnderlined) { if (correctTdIdsArray.indexOf(id_td) != -1) { shared_set_td_backgroundLightGreenTransparentIfisValidatedIsFalse(eTd); nCorrectTds++; } else { shared_set_td_backgroundLightRedTransparentIfisValidatedIsFalse(eTd); shared_isSelectedWrong = true; } } eTd.isValidated = true; } } return (nCorrectTds); } function shared_set_td_backgroundLightGreenTransparentIfisValidatedIsFalse(eTd) { if (eTd.isValidated == false) { eTd.style.backgroundColor = shared_colorLightGreen; eTd.style.color = 'white'; eTd.isValidated = true; } } function shared_set_td_backgroundLightRedTransparentIfisValidatedIsFalse(eTd) { if (eTd.isValidated == false) { eTd.style.backgroundColor = shared_colorRed; eTd.style.color = 'white'; eTd.isValidated = true; } } function shared_show_hideUnderlineWithReqdColorForMultiUsingColors(id_td, color1, color2) { var eTd = document.getElementById(id_td); var text = eTd.innerText; var color1Underline = shared_getUnderlineColorUsingColor(color1); var color2Underline = shared_getUnderlineColorUsingColor(color2); if (eTd.underlineColor == UnderlineColorTd.None) { eTd.innerHTML = '<u style="color:' + color1 + '">' + text + '</u>'; eTd.style.backgroundColor = shared_colorWhite; eTd.underlineColor = color1Underline; eTd.isUnderlined = true; } else if (eTd.underlineColor == color1Underline) { eTd.innerHTML = '<u style="color:' + color2 + '">' + text + '</u>'; eTd.style.backgroundColor = shared_colorWhite; eTd.underlineColor = color2Underline; eTd.isUnderlined = true; } else if (eTd.underlineColor == color2Underline) { eTd.innerHTML = '<span style="color:black">' + text + '</span>'; eTd.style.backgroundColor = shared_colorWhite; eTd.underlineColor = UnderlineColorTd.None; eTd.isUnderlined = false; } eTd.isValidated = false; } function shared_getUnderlineColorUsingColor(color) { if (color == 'blue') { return (UnderlineColorTd.Blue); } else if (color == '#800000')//Brown { return (UnderlineColorTd.Brown); } else if (color == 'green') { return (UnderlineColorTd.Green); } return (UnderlineColorTd.Blue); } function shared_td_getNoOfNotUnderlinedTds(tdIdsArrayValidationNotReqd) { var nUnderlineNotReqdTds = 0; for (var indexTd = 0; indexTd < tdIdsArrayValidationNotReqd.length; indexTd++) { var id_td = tdIdsArrayValidationNotReqd[indexTd]; var eTd = document.getElementById(id_td); if (eTd.isUnderlined) { nUnderlineNotReqdTds++; } } return (nUnderlineNotReqdTds); } function shared_td_validateTdsForValidationNotReqdForMulti(tdIdsArrayValidationNotReqd) { for (var indexTd = 0; indexTd < tdIdsArrayValidationNotReqd.length; indexTd++) { var id_td = tdIdsArrayValidationNotReqd[indexTd]; shared_td_validateTdForValidationNotReqdForSingle(id_td); } } function shared_td_validateTdForValidationNotReqdForSingle(id_td) { var eTd = document.getElementById(id_td); if (eTd.underlineColor == UnderlineColorTd.None) { eTd.style.backgroundColor = shared_colorWhite; eTd.style.color = shared_colorBlack; eTd.underlineColor == UnderlineColorTd.None; } else { shared_set_td_backgroundLightRedTransparentIfisValidatedIsFalse(eTd); shared_isSelectedWrong = true; } eTd.isValidated = true; } function shared_Td_validateTdsForValidationReqd(tdIdsArrayValidationReqd, underlineColor) { var nCorrectTds = 0; for (var indexTd = 0; indexTd < tdIdsArrayValidationReqd.length; indexTd++) { var id_td = tdIdsArrayValidationReqd[indexTd]; var eTd = document.getElementById(id_td); if (eTd.underlineColor != UnderlineColorTd.None) { if (eTd.underlineColor == underlineColor) { shared_set_td_backgroundLightGreenTransparentIfisValidatedIsFalse(eTd); nCorrectTds++; } else { shared_set_td_backgroundLightRedTransparentIfisValidatedIsFalse(eTd); shared_isSelectedWrong = true; } } eTd.isValidated = true; } return (nCorrectTds); } function shared_setHelpButtonsStyle(id_btn) { var deviceType = shared_getDeviceType(); var buttonStyle = 'shared_style_buttons_header_footer'; var sizePercentageAsDevice = shared_getSizePercentageAsPerDeviceHeightWidth(); var actualSize = 15; var textSize = actualSize * sizePercentageAsDevice; var fontSizeButtonText = textSize; var buttonHeight = textSize * 1.8; var borderRadius = buttonHeight / 2.0; var tdButtonHeight = buttonHeight * 1.2; var buttonWidthPercent = 50; fontSizeButtonText = fontSizeButtonText + 'px'; buttonHeight = buttonHeight + 'px'; borderRadius = borderRadius + 'px'; tdButtonHeight = tdButtonHeight + 'px'; var button = document.getElementById(id_btn); button.style.fontSize = fontSizeButtonText; button.style.borderRadius = borderRadius; button.style.width = buttonWidthPercent + '%'; button.style.height = buttonHeight + '%'; } function shared_help_click(pathHtmlOrImage) { var deviceType = shared_getDeviceType(); var buttonStyle = 'shared_style_buttons_header_footer'; var sizePercentageAsDevice = shared_getSizePercentageAsPerDeviceHeightWidth(); var actualSize = 24; var textSize = actualSize * sizePercentageAsDevice; var fontSizeButtonText = textSize; var buttonHeight = textSize * 1.8; var borderRadius = buttonHeight / 2.0; var tdButtonHeight = buttonHeight * 1.2; var buttonWidthPercent = 20; fontSizeButtonText = fontSizeButtonText + 'px'; buttonHeight = buttonHeight + 'px'; borderRadius = borderRadius + 'px'; tdButtonHeight = tdButtonHeight + 'px'; var innerHtml = ''; innerHtml += ' <div style="position: absolute; text-align:center; z-index: 99; -webkit-overflow-scrolling: touch; overflow-y: scroll; right: 0; bottom: 0; left: 8px; top: 8px" >'; innerHtml += ' <table border="0" cellspacing="0" cellpadding="0" width="' + shared_dataTableWidth + '" height="' + shared_dataTableHeight + '" style="position: absolute; background-color: rgba(255, 255, 255, 0.5)">';//table1 if (shared_currentDeviceOS == shared_deviceOS_iOS) { innerHtml += ' <tr height="8%">';//tr2 innerHtml += ' <td align="center">'; innerHtml += ' <input type="button" class="' + buttonStyle + '" value="OK" onClick="hide_message_info()" style="width:' + buttonWidthPercent + '%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto; color:blue">'; innerHtml += ' </td>'; innerHtml += ' </tr>';//tr2 end } innerHtml += ' <tr height="*">';//tr1 innerHtml += ' <td align="center" valign="bottom">'; innerHtml += ' <iframe src="' + pathHtmlOrImage + '" align="center">'; innerHtml += ' </iframe>'; innerHtml += ' </td>'; innerHtml += ' </tr>';//tr1 end innerHtml += ' <tr height="8%">';//tr2 innerHtml += ' <td align="center">'; innerHtml += ' <input type="button" class="' + buttonStyle + '" value="OK" onClick="hide_message_info()" style="width:' + buttonWidthPercent + '%; height:' + buttonHeight + '; font-size:' + fontSizeButtonText + '; border-radius:' + borderRadius + '; text-align:middle; text-height:auto; color:blue">'; innerHtml += ' </td>'; innerHtml += ' </tr>';//tr2 end innerHtml += ' <tr height="8%">';//tr3 innerHtml += ' <td align="center">'; innerHtml += ' '; innerHtml += ' </td>'; innerHtml += ' </tr>';//tr3 end innerHtml += ' </table>'; innerHtml += ' </div>'; var eDiv = document.getElementById('shared_id_div_message'); eDiv.innerHTML = innerHtml; eDiv.setAttribute("unselectable", "on"); eDiv.className = 'shared_style_unselectable'; eDiv.hidden = false; eDiv.style.display = 'block';//For browser IE } function shared_setImageSizesForWindowsOS(id_array_images, widthMultiplier, heightMultiplier) { if ((shared_currentDeviceType == shared_DeviceTypeWindowsPhone) || (shared_currentDeviceType == shared_DeviceTypeInternetExplorer)) { for (index=0; index<id_array_images.length; index++) { var eImage = document.getElementById(id_array_images[index]); eImage.width = shared_dataTableWidth * widthMultiplier; eImage.height = shared_dataTableHeight * heightMultiplier; } } } function shared_setTablesHeightsForIE() { if ((shared_currentDeviceType == shared_DeviceTypeWindowsPhone) || (shared_currentDeviceType == shared_DeviceTypeInternetExplorer)) { var eMainTable = document.getElementById('id_tblMainiPadBody'); //var eId0 = eMainTable.id;//commented var heightMainTable = eMainTable.style.height; var middlesTableRow = eMainTable.rows[1]; //var eId1 = middlesTableRow.id;//commented var middleRowHeight = middlesTableRow.height; if ((middleRowHeight == "") || (middleRowHeight == "*")) { middleRowHeight = middlesTableRow.getAttribute("hieghtForIE"); } var col = middlesTableRow.cells[0]; if (col != null) { //var eId2 = col.id;//commented //var height2 = col.height;//commented var table = col.firstElementChild; if (table != null) { middleRowHeight = middleRowHeight.replace("%", "") / 100.0; //var eId3 = table.id;//commented //var height3 = table.height;//commented var tableHeightToSet = heightMainTable.replace("px", "") * middleRowHeight; shared_setInnerTablesHeightsForIE(table, tableHeightToSet); } } } } function shared_setInnerTablesHeightsForIE(table, tableHeightToSet) { if (table.rows == null) { return; } //var idTbl = table.id;//commented table.style.height = tableHeightToSet + 'px'; var nRows = table.rows.length; for (var i = 0; i < nRows; i++) { var row = table.rows[i]; if (row != null) { //var eId1 = row.id;//commented var heightRow = row.height; if (heightRow == "")//For height="*" getting empty in IE { var hieghtForIE = row.getAttribute("hieghtForIE"); if ((hieghtForIE != null) && (hieghtForIE != "")) { heightRow = hieghtForIE; } else { heightRow = (100.0 / nRows) + "%"; } } var heightValueRow = tableHeightToSet * (heightRow.replace("%", "") / 100.0); var nColumns = row.cells.length; for (var j = 0; j < nColumns; j++) { var col = row.cells[j]; if (col != null) { //var eId2 = col.id;//commented //var height2 = col.height;//commented var firstElement = col.firstElementChild; if (firstElement != null) { //var eId3 = firstElement.id;//commented //var height3 = firstElement.height;//commented if (firstElement.localName == "table") { shared_setInnerTablesHeightsForIE(firstElement, heightValueRow); } else if (firstElement.localName == "img") { shared_setImageHeightForIE(firstElement); } else if (firstElement.localName == "span") { var spanFirstElement = firstElement.firstElementChild; if ((spanFirstElement != null) && (spanFirstElement.localName == "img")) { shared_setImageHeightForIE(spanFirstElement); } } } } } } } } function shared_setImageHeightForIE(imgElement) { var IEsizePercent = imgElement.getAttribute("IESizePercent"); if ((IEsizePercent == null) || (IEsizePercent == "")) { return; } var width = imgElement.style.width.replace("px", ""); var height = imgElement.style.height.replace("px", ""); if (width == "" && height == "") { width = imgElement.width; height = imgElement.height; if ((width != "") && (width > 10))//getting width=1 for some cases { imgElement.style.width = (width * IEsizePercent) + 'px'; //imgElement.style.height = 'auto'; } else if ((height != "") && (height > 10))//getting height=1 for some cases { imgElement.style.height = (height * IEsizePercent) + 'px'; //imgElement.style.width = 'auto'; } } } //11-Mar-2015 function shared_validate_setBGcolors(ids_textBoxes_array) { var isAllTextboxesAreCorrect = true; for (indexTextbox = 0; indexTextbox < ids_textBoxes_array.length; indexTextbox++) { var id_textBox = ids_textBoxes_array[indexTextbox]; var eTextBox = document.getElementById(id_textBox); var enteredValue = eTextBox.value.toUpperCase(); var correctValue = eTextBox.getAttribute('correctValue'); if (enteredValue == correctValue) { eTextBox.style.backgroundColor = shared_colorLightGreen; } else { eTextBox.style.backgroundColor = shared_colorRed; isAllTextboxesAreCorrect = false; } } return (isAllTextboxesAreCorrect); }