1/** 2 * SiteJay2 3 * @link http://www.sitejay.com 4 * @author Jozef Sokol <[email protected]> 5 * @copyright Copyright (c) 2005 Jozef Sokol Absolutio 6 * 7 * @name SiteJay.common.js 8 * @package SiteJay 9 */ 10 11var SiteJay=new Object(); 12 13/** 14 * BrowserInfo 15 */ 16var sAgent = navigator.userAgent.toLowerCase(); 17SiteJay.IsIE=sAgent.indexOf("msie") != -1; 18SiteJay.IsGecko=!SiteJay.IsIE; 19SiteJay.IsNetscape=sAgent.indexOf("netscape") != -1; 20try 21{ 22 SiteJay.ScreenWidth=screen.width; 23 SiteJay.ScreenHeight=screen.height; 24} 25catch (e) 26{ 27 SiteJay.ScreenWidth=800; 28 SiteJay.ScreenHeight=600; 29} 30 31/** 32* Object SiteJay.ScriptLoader 33*/ 34SiteJay.ScriptLoader = new Object() ; 35SiteJay.ScriptLoader.IsLoading = false ; 36SiteJay.ScriptLoader.Queue = new Array() ; 37 38SiteJay.ScriptLoader.AddScript = function( scriptPath ) 39{ 40 SiteJay.ScriptLoader.Queue[ SiteJay.ScriptLoader.Queue.length ] = scriptPath ; 41 42 if ( !this.IsLoading ) 43 this.CheckQueue() ; 44} 45 46SiteJay.ScriptLoader.CheckQueue = function() 47{ 48 if (this.Queue.length>0) 49 { 50 this.IsLoading=true; 51 var sScriptPath=this.Queue[0]; 52 var oTempArray=new Array(); 53 for (i=1;i<this.Queue.length;i++) 54 oTempArray[i-1]=this.Queue[i]; 55 this.Queue = oTempArray; 56 var e ; 57 if (sScriptPath.lastIndexOf('.css')>0) 58 { 59 e=document.createElement('LINK') ; 60 e.rel='stylesheet'; 61 e.type='text/css'; 62 } 63 else 64 { 65 e=document.createElement("script"); 66 e.type="text/javascript"; 67 } 68 document.getElementsByTagName("head")[0].appendChild(e); 69 // Start downloading it. 70 if (e.tagName=='LINK') 71 { 72 // IE must wait for the file to be downloaded. 73 if (SiteJay.IsIE) 74 e.onload=SiteJay.ScriptLoader_OnLoad ; 75 // Gecko doens't fire any event when the CSS is loaded, so we can't wait for it. 76 else 77 SiteJay.ScriptLoader.CheckQueue(); 78 79 e.href=sScriptPath ; 80 } 81 else 82 { 83 // Gecko fires the "onload" event and IE fires "onreadystatechange" 84 e.onload = e.onreadystatechange = SiteJay.ScriptLoader_OnLoad; 85 e.src = sScriptPath ; 86 } 87 } 88 else 89 { 90 this.IsLoading=false ; 91 } 92} 93SiteJay.ScriptLoader_OnLoad=function() 94{ 95 // Gecko doesn't have a "readyState" property 96 if (this.tagName=='LINK' || !this.readyState || this.readyState=='loaded') 97 // Load the next script available in the queue 98 SiteJay.ScriptLoader.CheckQueue() ; 99} 100 101function sjGetUrlParam(paramName) 102{ 103 var oRegex=new RegExp('[\?&]'+paramName+'=([^&]+)', 'i'); 104 var oMatch=oRegex.exec(window.top.location.search); 105 if (oMatch && oMatch.length>1) 106 return oMatch[1]; 107 else 108 return ''; 109} 110 111function sjEscapeHTML(text) { 112 text=text.replace('\n',''); 113 text=text.replace('&','&'); 114 text=text.replace('<','<'); 115 text=text.replace('>','>'); 116 return text; 117} 118 119function sjGetE(elementId) 120{ 121 return document.getElementById(elementId); 122} 123 124function sjShowE(element,isVisible) 125{ 126 if (typeof(element)=='string') 127 element=sjGetE(element); 128 element.style.display=isVisible?'':'none'; 129} 130 131function sjShowHideE(element) 132{ 133 if (typeof(element)=='string') 134 element=sjGetE(element); 135 if (element.style.display.length==0) 136 element.style.display='none'; 137 else 138 element.style.display=''; 139} 140 141function sjRemoveChilds(element) 142{ 143 if (!element) 144 return; 145 if (element.hasChildNodes()) 146 { 147 for ( var i = 0 ; i < element.childNodes.length ; i++ ) 148 { 149 sjRemoveChilds(element.childNodes[i]); 150 element.removeChild(element.childNodes[i]); 151 } 152 // jebe mu to alebo mne ... nie vzdy odstrani vsetko 153 if (element.hasChildNodes()) 154 sjRemoveChilds(element); 155 } 156} 157 158function sjOpenWindow(url,width,height,name,scrollbars) 159{ 160 var iLeft=(SiteJay.ScreenWidth-width)/2; 161 var iTop=(SiteJay.ScreenHeight-height)/2; 162 163 var sOptions="toolbar=no,status=no,resizable=yes,dependent=yes"; 164 sOptions+=scrollbars?",scrollbars=yes":",scrollbars=no"; 165 sOptions+=",width="+width; 166 sOptions+=",height="+height; 167 sOptions+=",left="+iLeft; 168 sOptions+=",top="+iTop; 169 170 if (name) 171 name="sjWindow"; 172 if (SiteJay.IsIE) 173 { 174 var oWindow=window.open(url,name,sOptions); 175 if (oWindow) 176 oWindow.opener=window; 177 else 178 alert("ups") ; 179 } 180 else 181 window.open(url,name,sOptions); 182} 183 184/** 185 * Events 186 */ 187function sjAddLoadEvent(func) 188{ 189 if (typeof window.addEventListener != "undefined") 190 { 191 window.addEventListener("load",func,false); 192 } 193 else if (typeof window.attachEvent != "undefined") 194 { 195 window.attachEvent("onload",func); 196 } 197 else 198 { 199 if (window.onload != null) { 200 var oldOnload = window.onload; 201 window.onload = function ( e ) { 202 oldOnload( e ); 203 func(); 204 }; 205 } 206 else 207 window.onload = func; 208 } 209} 210 211function before_unload(evt) { 212 try {return confirmleaving();} 213 catch (e) {} 214} 215window.onbeforeunload=before_unload 216 217 218/** 219 * Popup menu 220 */ 221sjMenuPop = function() { 222 var menus=document.getElementsByTagName("UL"); 223 for (var m=0; m<menus.length; m++) 224 { 225 if (menus[m].className=="sjMenu") 226 { 227 var sfEls = menus[m].getElementsByTagName("LI"); 228 for (var i=0; i<sfEls.length; i++) 229 {
230 sfEls[i].onmouseover=function(){this.className+=" sfhover";} 231 sfEls[i].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"), "");} 232 } 233 } 234 } 235} 236if (window.attachEvent) window.attachEvent("onload", sjMenuPop); 237 238/** 239 * Common functions 240 */ 241function sjPopupImage(sURL) 242{ 243 sjOpenWindow("/image.html?"+sURL,200,200,"sjImagePopup"); 244 return false; 245} 246 247function sjMnuOC(btn,objid) 248{ 249 var obj=document.getElementById(objid); 250 if (!obj) 251 return false; 252 if (obj.style.display=='block') 253 { 254 obj.style.display='none'; 255 sjRemoveCookie(objid); 256 if (btn.tagName!="A") 257 btn.className="pmp"; 258 } 259 else 260 { 261 obj.style.display='block'; 262 sjSetCookie(objid,"1"); 263 if (btn.tagName!="A") 264 btn.className="pmm"; 265 } 266} 267 268function sjSetCookie ( sName, sValue, nDays ) 269{ 270 var expires = ""; 271 if (nDays) 272 { 273 var d = new Date(); 274 d.setTime( d.getTime() + nDays * 24 * 60 * 60 * 1000 ); 275 expires = "; expires=" + d.toGMTString(); 276 } 277 278 document.cookie = sName + "=" + sValue + expires + "; path=/"; 279} 280 281function sjRemoveCookie(name) 282{ 283 sjSetCookie( name, "", -1 ); 284}
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.