1 var cookiepath = "/xynt/";
3 function $(id) { return document.getElementById(id); }
5 function getStyle(x,IEstyleProp, MozStyleProp)
8 var y = x.currentStyle[IEstyleProp];
9 } else if (window.getComputedStyle) {
10 var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(MozStyleProp);
15 /* replacement of setInterval on IE */
17 /*if not IE, do nothing*/
18 if(!document.uniqueID){return;};
20 /*Copy the default setInterval behavior*/
21 var nativeSetInterval = window.setInterval;
22 window.setInterval = function(fn,ms) {
24 if(arguments.length <= 2) {
25 return nativeSetInterval(fn,ms);
28 for(var i=2;i<arguments.length;i+=1) {
29 param[i-2] = arguments[i];
33 if(typeof(fn)=='function') {
35 return (function (fn,ms,param) {
36 var fo = function () {
37 fn.apply(window,param);
39 return nativeSetInterval(fo,ms);
42 else if(typeof(fn)=='string')
44 return nativeSetInterval(fn,ms);
48 throw Error('setInterval Error\nInvalid function type');
52 /*Copy the default setTimeout behavior*/
53 var nativeSetTimeout = window.setTimeout;
54 window.setTimeout = function(fn,ms) {
56 if(arguments.length <= 2) {
57 return nativeSetTimeout(fn,ms);
60 for(var i=2;i<arguments.length;i+=1) {
61 param[i-2] = arguments[i];
65 if(typeof(fn)=='function') {
67 return (function (fn,ms,param) {
68 var fo = function () {
69 fn.apply(window,param);
71 return nativeSetTimeout(fo,ms);
74 else if(typeof(fn)=='string')
76 return nativeSetTimeout(fn,ms);
80 throw Error('setTimeout Error\nInvalid function type');
86 function getStyle(x,IEstyleProp, MozStyleProp)
89 var y = x.currentStyle[IEstyleProp];
90 } else if (window.getComputedStyle) {
91 var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(MozStyleProp);
98 function doSomething(e) {
99 if (!e) var e = window.event
101 e.cancelBubble = true;
102 if (e.stopPropagation) e.stopPropagation();
106 * GESTIONE DEI COOKIES
108 function createCookie(name,value,hours,path) {
110 var date = new Date();
111 date.setTime(date.getTime()+(hours*60*60*1000));
112 var expires = "; expires="+date.toGMTString();
114 else var expires = "";
115 document.cookie = name+"="+value+expires+"; path="+path;
118 function readCookie(name) {
119 var nameEQ = name + "=";
120 var ca = document.cookie.split(';');
121 for(var i=0;i < ca.length;i++) {
123 while (c.charAt(0)==' ') c = c.substring(1,c.length);
124 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
129 function eraseCookie(name) {
130 createCookie(name,"",-1);
133 function url_append_arg(url, name, value)
135 var pos, sep, pref, rest;
137 if ((pos = url.indexOf('?'+name+'=')) == -1) {
138 pos = url.indexOf('&'+name+'=');
141 if ((pos = url.indexOf('?')) != -1)
146 return (url+sep+name+"="+encodeURIComponent(value));
149 pref = url.substring(0, pos+1);
150 rest = url.substring(pos+1);
151 // alert("rest: "+rest+" pos: "+pos);
152 if ((pos = rest.indexOf('&')) != -1) {
153 rest = rest.substring(pos);
158 return (pref+name+"="+encodeURIComponent(value)+rest);
162 function url_append_args(url)
167 for (i = 1 ; i < arguments.length-1 ; i+= 2) {
168 ret = url_append_arg(ret, arguments[i], arguments[i+1]);
174 function url_complete(parent, url)
177 var host = "", path = "";
180 p = parent.indexOf("://");
182 rest = parent.substring(p+3);
183 p2 = rest.indexOf("/");
185 host = parent.substring(0, p+3+p2);
186 rest = parent.substring(p+3+p2);
198 p = rest.lastIndexOf("/");
200 path = rest.substring(0, p+1);
203 // alert("host: ["+host+"] path: ["+path+"]");
204 if (url.substring(0,6) == 'http:/' || url.substring(0,7) == 'https:/') {
207 else if (url.substring(0,1) == '/') {
211 return (host+path+url);