1/* 2 Ðàçíûå ïîëåçíûå ôóíêöèè 3*/ 4 5//Common. Çàìåíà êàðòèíêè 6function ChangeImgSrc(sImgName, sValue) { 7 var oImage = document.images[sImgName]; 8 if (oImage != null) { 9 oImage.src = sValue; 10 } 11} 12 13//ðàçäâèãàíèå ìåíþ èëè ôîðóìà 14function OnElementClickIE(ControlName, nElementId, OpenImgSrc, CloseImgSrc) 15{ 16 var pElementReply = document.getElementById(ControlName + "_ElementReply_" + nElementId.toString()); 17 var pElementPic = document.getElementById(ControlName + "_ElementPic_" + nElementId.toString()); 18 if (pElementReply && pElementPic) { 19 if (pElementReply.style.display == "none") { 20 pElementReply.style.display = "inline"; 21 pElementPic.src = OpenImgSrc; 22 //çàïèñûâàåì id ðàçäåëà â êóêè 23// if(document.cookie.length > 0){ 24// nStart = document.cookie.indexOf("open_parts"); 25// if(nStart > -1){ 26// nStart = nStart + 11; 27// nEnd=document.cookie.indexOf(";", nStart); 28// if (nEnd == -1) nEnd=document.cookie.length; 29// sOpenParts = unescape(document.cookie.substring(nStart,nEnd)); 30// pParent = document.getElementById("ParentId" + nElementId); 31// if(pParent && pParent.value.length > 0){ 32// sArray = sOpenParts.split("."); 33// for(i = 0; i < sArray.length; i++){ 34// if(sArray.indexOf("-" + pParent.value + "-") > -1){ 35// sOpenParts = sOpenParts.replace(sArray, sArray + "-" + nElementId + "-"); 36// break; 37// } 38// } 39// } 40// else 41// sOpenParts += ".-" + nElementId + "-"; 42// document.cookie = "open_parts=" + sOpenParts + ";"; 43// } 44// else 45// document.cookie = "open_parts=" + "-" + nElementId + "-.;"; 46// alert(document.cookie); 47// } 48 } 49 else { 50 pElementReply.style.display = "none"; 51 pElementPic.src = CloseImgSrc; 52 //âûïèñûâàåì id ðàçäåëà èç êóêîâ 53// nStart = document.cookie.indexOf("open_parts"); 54// nStart = nStart + 11; 55// nEnd=document.cookie.indexOf(";", nStart); 56// if (nEnd == -1) nEnd=document.cookie.length; 57// sOpenParts = unescape(document.cookie.substring(nStart,nEnd)); 58// pParent = document.getElementById("ParentId" + nElementId); 59// sArray = sOpenParts.split("."); 60// for(i = 0; i < sOpenParts.length; i++){ 61// if(sArray.indexOf("-" + nElementId + "-") > -1){ 62// if(pParent == null || pParent.value.length == 0){ 63// sOpenParts = sOpenParts.replace(sArray + ".", ""); 64// } 65// else{ 66// sOpenParts = sOpenParts.replace(sArray, sArray.substring(0, sArray.indexOf("-" + nElementId + "-"))); 67// } 68// break; 69// } 70// } 71// document.cookie = "open_parts=" + sOpenParts + ";"; 72// alert(document.cookie); 73 } 74 } 75 ParseStructure(ControlName); 76} 77 78//ðàçäâèãàíèå ìåíþ èëè ôîðóìà 79function ChangeClassElementClick(ControlName, nElementId, OpenClass, CloseClass) 80{ 81 var pElementReply = document.getElementById(ControlName + "_ElementReply_" + nElementId.toString()); 82 var pElementPic = document.getElementById(ControlName + "_Element_" + nElementId.toString()); 83 if (pElementReply && pElementPic) { 84 if (pElementReply.style.display == "none") { 85 pElementReply.style.display = "inline"; 86 pElementPic.className = CloseClass; 87 } 88 else { 89 pElementReply.style.display = "none"; 90 pElementPic.className = OpenClass; 91 } 92 } 93} 94 95//Ïðîâåðêà íà íàæàòèå enter 96function TestKeyPressOnEnter(event, UniqueID){ 97 if (event.keyCode == 13) { 98 var p = document.getElementById(UniqueID); 99 p.focus(); 100// p.click(); 101 var agt = navigator.userAgent.toLowerCase(); 102 if (agt.indexOf('ie') != -1 ){ 103 p.click(); 104 } 105 else{ 106 var oEvt = document.createEvent ('MouseEvents'); 107 oEvt.initMouseEvent("click", true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null); 108 p.dispatchEvent(oEvt); 109 } 110 } 111} 112 113//îòêðûòèå popupwindow 114function PopupWindow(url) 115{ 116 window.open(url); 117} 118 119//Àäìèí. Ïðîâåðÿëêà íà êîððåêòíîñòü äàòû 120function TestFormToRequreFilds(UniqueID, eventArgument) 121{ 122 var ControlName = UniqueID.replace(/[:]/g,'$'); 123 var ArraySize = eval(ControlName + "_Array_Size"); 124 var IsEmty = false; 125 for (i=1; i<=ArraySize; i++){ 126 if (document.getElementById(ControlName + "_IsReq_" + i.toString()).value.length == 0){ 127 IsEmty = true; 128 break; 129 } 130 } 131 if (IsEmty){ 132 alert("Íåîáõîäèìî çàïîëíèòü îáÿçàòåëüíûå ïîëÿ! \n "); 133 } 134 else{ 135 __doPostBack(UniqueID, eventArgument); 136 } 137} 138 139//Ôóíêöèè ïðîâåðêè êîððåêòíîñòè äàòû 140//ôóíêöèÿ ïåðåñ÷åòà äíåé ïðè èçìåíåíèè òåêóùåãî äíÿ 141function ProcessDayChange(ControlName, sName) { 142 //Ïîèñê ýëåìåíòîâ 143 var pDay = document.getElementById(ControlName + '_' + sName + '_Day'); 144 var pMonth = document.getElementById(ControlName + '_' + sName + '_Month'); 145 var pYear = document.getElementById(ControlName + '_' + sName + '_Year'); 146 //Ïðîâåðêà íàëè÷èÿ ýëåìåíòîâ íà ñòðàíèöå 147 if(pDay == null || pMonth == null || pYear == null) { 148 return; 149 } 150 //åñëè äî ýòîãî áûëà âûáðàíà íåñóùåñòâóþùàÿ äàòà 151 if(pYear.value == 1913){ 152 if(pMonth.options[1].value == 1) 153 pMonth.options[0]= null; 154 if(pDay.options[1].value == 1) 155 pDay.options[0] = null; 156 pYear.selectedIndex = 1; 157 pMonth.selectedIndex = 0; 158 } 159} 160 161//Ôóíêöèè ïðîâåðêè êîððåêòíîñòè äàòû 162//ôóíêöèÿ ïåðåñ÷åòà äíåé ïðè èçìåíåíèè òåêóùåãî ìåñÿöà 163function ProcessMonthChange(ControlName, sName) { 164 //Ïîèñê ýëåìåíòîâ 165 var pDay = document.getElementById(ControlName + '_' + sName + '_Day'); 166 var pMonth = document.getElementById(ControlName + '_' + sName + '_Month'); 167 var pYear = document.getElementById(ControlName + '_' + sName + '_Year'); 168 //Ïðîâåðêà íàëè÷èÿ ýëåìåíòîâ íà ñòðàíèöå 169 if(pDay == null || pMonth == null || pYear == null) { 170 return; 171 } 172 //åñëè äî ýòîãî áûëà âûáðàíà íåñóùåñòâóþùàÿ äàòà 173 if(pYear.value == 1913){ 174 if(pMonth.options[1].value == 1) 175 pMonth.options[0]= null; 176 if(pDay.options[1].value == 1) 177 pDay.options[0] = null; 178 pYear.selectedIndex = 1; 179 pDay.selectedIndex = 0; 180 } 181 // ìàññèâ ñ êîëè÷åñòâîì äíåé â ìåñÿöàõ 182 var aDay = Array(31,29,31,30,31,30,31,31,30,31,30,31); 183 var nHowManyDays = aDay[pMonth.value - 1]; 184 //åñëè â âûáðàííîì ìåñÿöå ìåíüøå äíåé, ÷åì â òåêóùåì, òî óäàëÿåì ëèøíèå 185 if(pDay.length > nHowManyDays) { 186 //åñëè òåêóùåãî äíÿ â âûáðàííîì ìåñÿöå íå ñóùåñòâóåò, 187 //òî òåêóùèì íàçíà÷àåòñÿ ïîñëåäíèé äåíü âûáðàííîãî ìåñÿöà 188 if(pDay.selectedIndex >= nHowManyDays) { 189 pDay.selectedIndex = nHowManyDays - 1; 190 } 191 for(i = pDay.length; i>nHowManyDays; i--) { 192 pDay.options[i-1] = null; 193 } 194 } 195 // åñëè â âûáðàííîì ìåñÿöå áîëüøå äíåé, ÷åì â òåêóùåì, òî äîáàâëÿåì íåäîñòàþùèå 196 else { 197 for (i = pDay.length; i<nHowManyDays; i++) { 198 pDay.options[i] = new Option(i+1,i+1); 199 } 200 } 201 //åñëè âûáðàííûé ìåñÿö - ôåâðàëü è âûáðàííûé ãîä - íåâèñîêîñíûé, òî óäàëÿåì 29-é äåíü 202 if(pMonth.value == 2 && pYear.value % 4 != 0) { 203 //åñëè òåêóùèì áûëî 29 ôåâðàëÿ, òî òåêóùèì íàçíà÷àåòñÿ 28-å 204 if(pDay.selectedIndex==28) { 205 pDay.selectedIndex = 27; 206 } 207 pDay.options[28]= null; 208 } 209} 210 211//ïðè èçìåíåíèè â ñïèñêå ëåò 212function ProcessYearChange(ControlName, sName) { 213 //Ïîèñê ýëåìåíòîâ 214 var pDay = document.getElementById(ControlName + '_' + sName + '_Day'); 215 var pMonth = document.getElementById(ControlName + '_' + sName + '_Month'); 216 var pYear = document.getElementById(ControlName + '_' + sName + '_Year'); 217 218 //Ïðîâåðêà íàëè÷èÿ ýëåìåíòîâ íà ñòðàíèöå 219 if(pDay == null || pYear == null) { 220 return; 221 } 222 //Åñëè âûáðàí "íåñóùåñòâóþùèé" ãîä, òî â äðîïàõ "äíè" è "ìåñÿöû" àâòîìàòè÷åñêè 223 //äîáàâëÿåòñÿ ïóíêò "-" 224 if(pYear.value == 1913){ 225 pDay.options[pDay.length] = new Option();
226 for(i = pDay.length - 1; i > 0; i--){ 227 pDay.options[i].value = pDay.options[i-1].value; 228 pDay.options[i].text = pDay.options[i-1].text; 229 } 230 pDay.options[0] = new Option("--", 1); 231 pDay.selectedIndex = 0; 232 pMonth.options[pMonth.length] = new Option(); 233 for(i = pMonth.length - 1; i > 0; i--){ 234 pMonth.options[i].value = pMonth.options[i-1].value; 235 pMonth.options[i].text = pMonth.options[i-1].text; 236 } 237 pMonth.options[0] = new Option("---", 1); 238 pMonth.selectedIndex = 0; 239 } 240 else{ 241 //åñëè ìåñÿöåâ 13 - çíà÷èò, äî ýòîãî âûáèðàëè "íåñóùåñòâóþùèé ãîä", 242 //è òåïåðü 1-å ýëåìåíòû â "äíÿõ" è "ìåñÿöàõ" íóæíî óäàëèòü 243 if(pMonth.length == 13){ 244 pMonth.options[0] = null; 245 pMonth.selectedIndex = 0; 246 pDay.options[0] = null; 247 pDay.selectedIndex = 0; 248 } 249 //åñëè â òåêóùåì ìåñÿöå 28 äíåé è âûáðàí âèñîêîñíûé ãîä, 250 //òî äîáàâëÿåòñÿ 29-é äåíü 251 if(pDay.length ==28 && pYear.value%4==0) { 252 pDay.options[28] = new Option(29,29); 253 } 254 else { 255 //åñëè â òåêóùåì ìåñÿöå 29 äíåé è âûáðàí íåâèñîêîñíûé ãîä, 256 //òî óäàëÿåì 29-é äåíü 257 if(pDay.length == 29 && pYear.value%4 != 0) { 258 //åñëè áûëî âûáðàíî 29 ôåâðàëÿ, òî âûáîð ñìåùàåòñÿ íà 28 259 if(pDay.selectedIndex==28) { 260 pDay.selectedIndex = 27; 261 } 262 pDay.options[28] = null; 263 } 264 } 265 } 266} 267 268//Ðåäèðåêò ïîñëå ïàóçû 269function CountRedirect(sUrl, nTime, CounterName) { 270 if(nTime == "0") { 271 window.location = sUrl; 272 } else { 273 var pCounter = document.getElementById(CounterName); 274 pCounter.innerText = nTime.toString(); 275 setTimeout("CountRedirect('" + sUrl + "'," + (--nTime).toString() + ", '" + CounterName + "')", 1000); 276 } 277}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.