var ECSJSGeneral_ScrollContainerId; var ECSJSGeneral_ScrollVOffset; var ECSJSGeneral_ScrollHOffset; var ECSJSGeneral_ScrollDelay; function ECSJSGeneral_GetObjectPosition(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } return [curleft, curtop]; } function ECSJSGeneral_OpenModalWindow(contentUrl, width, height) { var _window = openModalWindow(contentUrl); _window.setSize(width, height); _window.set_visibleTitlebar(true); _window.set_behaviors( Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close ); _window.center(); } function openModalWindow(contentUrl) { var _modalWindow = null; var _currentWindow = GetRadWindow(); if(_currentWindow) { var _modalWindow = _currentWindow.BrowserWindow.radopen(contentUrl, null); _modalWindow.set_modal(true); } else { var _modalWindow = radopen (contentUrl, null ); _modalWindow.set_modal(true); } return _modalWindow; } function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement) oWindow = window.frameElement.radWindow; return oWindow; } function GetParentWindow() { var _pWindow = null; if( GetRadWindow().get_windowManager().get_windows().length > 1 ) _pWindow = GetRadWindow().get_windowManager().get_windows()[GetRadWindow().get_windowManager().get_windows().length-2].get_contentFrame().contentWindow; if( GetRadWindow().get_windowManager().get_windows().length == 1 ) _pWindow = GetRadWindow().BrowserWindow; return _pWindow; } ECSJSGeneral_Windows_OpenedWindows = []; //Close all oppened windows function ECSJSGeneral_CloseChildWindows() { //alert(Windows_OpenedWindows.length); for(i=0; i < ECSJSGeneral_Windows_OpenedWindows.length; i++) { if(ECSJSGeneral_Windows_OpenedWindows[i] != null && !ECSJSGeneral_Windows_OpenedWindows[i].closed) ECSJSGeneral_Windows_OpenedWindows[i].close(); } } function ECSJSGeneral_FillTextCounter(textField1UniqueId, textField1MaxLength, textField2UniqueId, textField2MaxLength, counterFieldUniqueId) { var _counterValue1 = 0; var _counterValue2 = 0; _counterValue1 = textField1MaxLength - document.forms[0].elements[textField1UniqueId].value.length; document.all(counterFieldUniqueId).innerText = _counterValue1.toString(); if(document.forms[0].elements[textField1UniqueId].value.length > textField1MaxLength) document.forms[0].elements[textField1UniqueId].value = document.forms[0].elements[textField1UniqueId].value.substr(0,textField1MaxLength); if(document.forms[0].elements[textField2UniqueId] != null) { _counterValue2 = textField2MaxLength - document.forms[0].elements[textField2UniqueId].value.length; document.all(counterFieldUniqueId).innerText += " / " + _counterValue2.toString(); if(document.forms[0].elements[textField2UniqueId].value.length > textField2MaxLength) document.forms[0].elements[textField2UniqueId].value = document.forms[0].elements[textField2UniqueId].value.substr(0,textField2MaxLength); } } function ECSJSGeneral_ClearFields(fieldsToClear) { var _form = document.forms[0]; for(i=0; i < fieldsToClear.length; i++) { if(_form.elements[fieldsToClear[i]] != null) { if(_form.elements[fieldsToClear[i]].type == "select-multiple" || _form.elements[fieldsToClear[i]].type == "select-one") _form.elements[fieldsToClear[i]].selectedIndex = 0; else _form.elements[fieldsToClear[i]].value = ""; } else { if( _form.document.all(fieldsToClear[i]) != null ) _form.document.all(fieldsToClear[i]).innerText = ""; } } } function ECSJSGeneral_MarkStarsOver(imageUniqueId) { var _imageNumber = imageUniqueId.charAt(imageUniqueId.length-1); for(i = 0; i < 6; i++) { if(i <= _imageNumber) document.getElementById(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Ico_Star_On.gif'; else document.getElementById(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Ico_Star_Off.gif'; } } function ECSJSGeneral_MarkStarsOut(imageUniqueId, productRate) { for(i = 0; i < 6; i++) { if(i < productRate) document.getElementById(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Ico_Star_On.gif'; else document.getElementById(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Ico_Star_Off.gif'; } } function ECSJSGeneral_MarkPricesOver(imageUniqueId, priceNameUniqueId, priceName) { //document.all(priceNameUniqueId).innerText = priceName; document.getElementById(priceNameUniqueId).innerText = priceName; var _imageNumber = imageUniqueId.charAt(imageUniqueId.length-1); for(i = 1; i < 8; i++) { if(i == _imageNumber) document.all(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Marker_Filed_10_6.gif'; else document.all(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Marker_Empty_10_6.gif'; } } function ECSJSGeneral_MarkPricesOut(imageUniqueId, priceId, priceNameUniqueId, priceName) { document.getElementById(priceNameUniqueId).innerText = priceName; //document.all(priceNameUniqueId).innerText = priceName; for(i = 1; i < 8; i++) { if(i == priceId) document.all(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Marker_Filed_10_6.gif'; else document.all(imageUniqueId.substring(0, imageUniqueId.length-1)+i).src = 'Files/SystemImages/Marker_Empty_10_6.gif'; } } function ECSJSGeneral_Scroll_Action() { document.getElementById(ECSJSGeneral_ScrollContainerId).scrollTop += ECSJSGeneral_ScrollVOffset; document.getElementById(ECSJSGeneral_ScrollContainerId).scrollLeft += ECSJSGeneral_ScrollHOffset; } function ECSJSGeneral_Scroll_BeginAction(containerId, hOffset, vOffset, delay) { ECSJSGeneral_ScrollContainerId = containerId; ECSJSGeneral_ScrollHOffset = hOffset; ECSJSGeneral_ScrollVOffset = vOffset; ECSJSGeneral_ScrollDelay = delay; ECSJSGeneral_Scroll_Action(); ECSJSGeneral_ActionTimeout = setInterval("ECSJSGeneral_Scroll_Action()", ECSJSGeneral_ScrollDelay); } function ECSJSGeneral_Scroll_EndAction() { if (typeof(ECSJSGeneral_ActionTimeout) != "undefined") clearTimeout(ECSJSGeneral_ActionTimeout); } function ECSJSGeneral_SelectInselectPicture(pictureControl, isSelected, borderWidth, borderColor) { if(isSelected) { pictureControl.width -= borderWidth*2; pictureControl.height -= borderWidth*2; pictureControl.style.borderWidth = borderWidth + 'px'; pictureControl.style.borderColor = borderColor; } else { pictureControl.width += borderWidth*2; pictureControl.height += borderWidth*2; pictureControl.style.borderWidth = '0px'; } }