if(!HW){var HW = {};}

HW.Cookie = {
            _set:function(s) {
                        document.cookie = s;
            },
            _get:function(s) {
                        return document.cookie;
            },
          
            /****
            n : name of cookie (String)
            v : value of cookie (String)
            t : Optional - number of days to store cookie, if left blank cookie will expire when browser closed (Number)
            ****/
            set:function(n,v,t) {
                        if (t) {
                                    var date = new Date();
                                    date.setTime(date.getTime()+(t*24*60*60*1000));
                                    var ex = "; expires="+date.toGMTString();
                        }
                        else {var ex = "";};
                        this._set(n+"="+v+ex+"; path=/");
            },
            /****
            n : name of cookie (String)
            ****/ 
            get:function(n) {
                        var retVal = "not found";
                        n = n + "=";
                        var ca = this._get().split(';');
                        for(var i=0;i < ca.length;i++) {
                                    var c = ca[i];
                                    while (c.charAt(0)==' ') c = c.substring(1,c.length);
                                    if (c.indexOf(n) == 0) retVal = c.substring(n.length,c.length);
                        }
                        //var swf = window.document.WeatherMap;
                        var swf = this.getMovie('WeatherMap');
						swf.SetVariable("savedState", retVal);
            },
            /****
            n : name of cookie (String)
            ****/
            clear:function(n) {
                        var date = new Date();
                        date.setTime(date.getTime()-1);
                        var ex = date.toGMTString();
                        this._set(n+"=0;expires="+ex+"; path=/");
            },
            
			getMovie:function(movieName) {
				if(navigator.appName.indexOf("Microsoft") != -1) {
					if (window[movieName] != undefined) {
						return window[movieName];
					}
					return window.document[movieName];
				}
				else {
					if(document[movieName].length != undefined) {
						return document[movieName][1];
					}
					return document[movieName];
				}
			}

}

