/*** Get URL parameters Example: http://www.site.com/#floorplans ***/ function getHash(url) { if(!url) url = document.URL; var arrReturn = []; url = url.split("#"); if(url.length > 1) { url.shift(); url = url.join("#"); arrReturn = url.split("/"); } return(arrReturn); } /*** Set div dimension, whith content Description: Resize divContent element on main html. ***/ function setContentDimension() { var w = document.body.clientWidth; var h = document.body.clientHeight; var div = document.getElementById("divContent"); if(is_full_flash) { if(w > content_w) w = "100%"; else w = content_w + "px"; if(h > content_h) h = "100%"; else h = content_h + "px"; } else { w = content_w + "px"; h = content_h + "px"; } div.style.width = w; div.style.height = screen.height; setTimeout(function() { div.style.height = h; }, 100); } /*** Popup window Usage: popup(url:String, title:String, w:Number, h:Number, scroll:Boolean); ***/ popup = function(url, title, w, h, allow_scrol) { var left = (screen.width) ? ((screen.width - w) / 2) : 100; var top = (screen.height) ? ((screen.height-h) / 2) - 28 : 20; if(left < 0) left = 0; if(top < 0) top = 0; var conf = "width=" + w + ", height=" + h + ", left=" + left + ", top=" + top + ", scrollbars=" + allow_scrol + ", status=0"; window.open(url, title, conf); } /*** Logger methods Description: log user navigation into robots. Currently uses only Google Analitics (GA). ***/ Logger = new Object(); Logger.arrIDs = new Array(); Logger.is_enabled = true; Logger.is_debugging = false; Logger.is_initialized = false; Logger.init = function(obj) { if(obj.is_enabled === true) Logger.is_enabled = true; if(obj.is_debugging === true) Logger.is_debugging = true; if(Logger.is_enabled) { for(var i = -1, id; id = obj.ids[++i], (id !== undefined && id !== null);) { Logger.arrIDs.push(id); _uacct = id; urchinTracker(); _uff = 0; } } } Logger.logGA = function(value) { if(value == undefined || value == null) value = ""; if(value && Logger.is_debugging) alert("[JS] logGA: " + value); if(!Logger.is_enabled) return; /* if(!) { Logger.init({ids:google_url_ids, is_enabled:reporting, is_debugging:false}); }*/ for(var i = -1, id; id = Logger.arrIDs[++i], (id !== undefined && id !== null);) { _uff = 0; _uacct = id; urchinTracker(value); } } /*** BrowserHistory methods Description: enable navigation by browser buttons (back/forward) ***/ BrowserHistory = new Object(); BrowserHistory.flashElement = null; //BrowserHistory.page_title = top.document.title; BrowserHistory.page_title = document.title; /* BrowserHistory.may_hash = (top.location.href.indexOf("#") == -1); BrowserHistory.dont_hash = true; */ BrowserHistory.iframe_url = "browser_history_iframe.html"; BrowserHistory.actual = null; BrowserHistory.init = function() { // Find flash object try { BrowserHistory.flashElement = document.getElementById(flash_name); } catch(e) { try { BrowserHistory.flashElement = document[flash_name]; } catch(e) { } } if(BrowserHistory.flashElement != null) { BrowserHistory.flashElement.SetVariable("browser_history_init", "1"); } else { setTimeout(BrowserHistory.init, 1000); } } // Changes the browser's title and address bar BrowserHistory.updateBrowserInfo = function(title, add_main_title) { //BrowserHistory.updateBrowserAddrBar(BrowserHistory.actual); BrowserHistory.updateBrowserTitle(title, add_main_title); } BrowserHistory.updateBrowserAddrBar = function(value) { if(BrowserHistory.dont_hash) BrowserHistory.dont_hash = false; //else if(BrowserHistory.may_hash && (top.location.hash != "#" + value)) top.location.hash = value; else if(BrowserHistory.may_hash && (location.hash != "#" + value)) location.hash = value; } BrowserHistory.updateBrowserTitle = function(title, add_main_title) { if(add_main_title !== true) title = BrowserHistory.page_title + " - " + title; title = unescape(title); try { //top.document.title = title; document.title = title; BrowserHistory.ifr.contentWindow.document.title = title; } catch(e) { }; } // Set "flash listener" back or foward (navigation) value BrowserHistory.setFlashVariable = function(value) { if(value != BrowserHistory.actual) { BrowserHistory.flashElement.SetVariable("browser_history_listener", value); BrowserHistory.actual = value; } } // Open iframe with rights arguments for history navigation BrowserHistory.setBackSection = function(section, name, iframe_url) { BrowserHistory.actual = section; if(!iframe_url) var iframe_url = BrowserHistory.iframe_url; iframe_url += "?section=" + section + "&name=" + name; if(BrowserHistory.ifr) BrowserHistory.ifr.setAttribute("src", iframe_url); } // Define "Home" initial values BrowserHistory.setHomeSection = function(section, name, iframe_url) { BrowserHistory.actual = section; if(!iframe_url) var iframe_url = "browser_history_iframe.html"; iframe_url += "?section=" + section + "&name=" + name; var ifr = document.createElement("iframe"); ifr.setAttribute("src", iframe_url); ifr.style.position = "absolute"; ifr.style.width = "1px"; ifr.style.height = "1px"; ifr.style.top = "-10px"; document.body.appendChild(ifr); BrowserHistory.ifr = ifr; } BrowserHistory.init(); is_JS_loaded = true;