/*  This file is part of WebSiCo: online Web Site Composer, http://websico.net. Copyright (c) 2005-2011 Olivier Seston, http://seston.net. All rights reserved */ var ws_mode; if (!window.addEventListener) { function addEventListener(event_name, handler, capture) { var old_handler = this['on' + event_name] ? this['on' + event_name] : function(){}; this['on' + event_name] = function() {old_handler(); return handler();}; } } if (self.name == 'ws_info_window') setInterval("if (!self.opener || self.opener.closed) self.close()", 500); var ws_containerList = new Array();				window.addEventListener("load", ws_compute_layout, false); function ws_compute_layout() { for (var i=ws_containerList.length-1; i>=0; i--) { var elt = ws_containerList[i]; if (elt.ws_props & WS_SYSTEM_CONTAINER && elt.className.indexOf(' WS_ALONE') != -1) { if (elt.ws_owner && (elt.ws_owner.ws_props & WS_SYSTEM_CONTAINER)) { elt.style.height = elt.ws_owner.offsetHeight + 'px'; } } } } document.onkeydown = function(event) { var event = window.event || event; var target = event.target || event.srcElement; if (ws_gallery && ws_gallery.active >= 0) { 		    if (event.keyCode == 27) {											    	ws_gallery.hide(); } else if (event.keyCode == 39 || event.keyCode == 32) {					ws_gallery.show(ws_gallery.active + 1); } else if (event.keyCode == 37) {											ws_gallery.show(ws_gallery.active - 1); } } else if (event.keyCode == 123 && event.altKey && event.shiftKey) {	        	ws_reloadRequest({mode: (ws_mode == WS_DEBUG ? 0 : WS_DEBUG)}); } else if (event.keyCode == 123 && event.altKey && !ws_dont_explore) {				ws_reloadRequest({mode: (ws_mode == WS_EXPLORE ? 0 : WS_EXPLORE)}); } else if (event.keyCode == 123 && event.shiftKey) {					        	ws_reloadRequest({mode: (ws_mode == WS_PREVIEW ? 0 : WS_PREVIEW)}); } else if (event.keyCode == 123) {                                                	ws_reloadRequest({mode: (ws_mode == WS_EDIT ? 0 : WS_EDIT)}); } else if (window.ws_cancelAction && event.keyCode == 27) {				            ws_cancelAction(); } else if (window.ws_validateAction && (event.metaKey || event.ctrlKey) && event.keyCode == 83) {             ws_validateAction(); } else if (window.ws_validateAction && event.keyCode == 13 && target.tagName == "INPUT") {             ws_validateAction(); } else { return true; } return false; }; var ws_gallery;		window.addEventListener("load", function(){ws_gallery = new ws_Gallery()}, false); function ws_Gallery(){ this.active = -1; this.movie = 0; this.moviePeriod = 2500;								this.controlImg = document.createElement('img');		this.controlImg.src = ws_core_path + 'ws_images/ws_gallery_control.gif'; this.movieOnImg = document.createElement('img');		this.movieOnImg.src = ws_core_path + 'ws_images/ws_movie_on.gif'; this.goodBrowserResize = navigator.userAgent.indexOf('Safari') != -1 || navigator.userAgent.indexOf('Opera') != -1;  this.images = []; var links = document.getElementsByTagName('a'); for (var i = 0, j = 0; i < links.length; i++) {			if (links[i].firstChild && links[i].firstChild.tagName == 'IMG' && links[i].className.indexOf("zoomable") != -1) { var a = links[i]; var img = a.firstChild; this.images[j] = { thumbNail: img,     path: a.href, width: img.width, height: img.height, img: document.createElement('img'), loaded_path: 0, requested_path: 0, progressImg: document.createElement('img')				}; this.images[j].progressImg.className = "progressBar"; this.images[j].progressImg.src = ws_core_path + 'ws_images/ws_progress.gif'; this.images[j].img.ws_galleryIndex = j; try { this.images[j].caption = document.getElementById(a.getAttribute('captionId')).innerHTML; } catch (e){} a.ws_gIndex = j++; a.onclick = function(event){ event = window.event || event; if (ws_mode & WS_EDIT) ws_cancelAction(); ws_gallery.show(this.ws_gIndex); event.cancelBubble = true; return false}; a.onmousedown = function(event){return false}; img.onmouseover = function(){ws_gallery.loadImage(this.parentNode.ws_gIndex); return false}; } } if (this.images.length) { this.gallery = document.createElement('div'); this.gallery.onmouseover = function() { clearTimeout(this.ws_hideControl); ws_gallery.control.style.visibility = 'visible'; this.ws_hideControl = setTimeout("ws_gallery.control.style.visibility='hidden';", 3000); }; this.gallery.appendChild(document.createElement('div'));			this.caption = this.gallery.appendChild(document.createElement('div')); this.caption.className = "caption"; this.img = this.gallery.appendChild(document.createElement('img')); this.img.className = "image"; this.img.onclick = function(){ws_gallery.hide()}; this.control = this.gallery.appendChild(document.createElement('div')); this.control.className = "control"; this.counter = this.control.appendChild(document.createElement('div')); this.counter.className = "counter"; this.controlMapImg = this.control.appendChild(document.createElement('img')); this.controlMapImg.src = this.controlImg.src; this.controlMapImg.useMap = "#controlMap"; this.control.onmouseover = function(event) { event = window.event || event; clearTimeout(this.parentNode.ws_hideControl); event.cancelBubble = true; return false}; var map = this.control.appendChild(document.createElement('map')); map.id = "controlMap"; map.name = "controlMap"; map.innerHTML = '\ <area href="javascript:ws_gallery.show(ws_gallery.active + 1)" coords="0,5,30,25" />\ <area href="javascript:ws_gallery.show(ws_gallery.active -1)" coords="0,28,30,48" />\ <area href="javascript:ws_gallery.movieControl()" coords="0,60,30,80" />\ <area href="javascript:ws_gallery.setMoviePeriod(ws_gallery.moviePeriod/2 - 1)" coords="0,80,30,92" />\ <area href="javascript:ws_gallery.setMoviePeriod(ws_gallery.moviePeriod*2 + 1)" coords="0,92,30,105" />\ <area href="javascript:ws_gallery.hide()" coords="0,130,30,160" />\ '; window.addEventListener("resize", function(){ws_gallery.resize()}, false); this.resize();		} } ws_Gallery.prototype.show = function(i) { i = (i < 0) ? this.images.length - 1 : (i >= this.images.length) ? 0 : i; this.gallery.replaceChild(this.images[i].progressImg, this.gallery.firstChild); this.gallery.firstChild.style.left = (ws_getInnerWidth() - this.gallery.firstChild.width) / 2 + 'px'; this.active = i; if (this.images[i].caption) { this.caption.innerHTML = this.images[i].caption; this.caption.style.display = ''; } else { this.caption.style.display = 'none'; } this.counter.innerHTML = (i+1) + '/' + this.images.length; var ratio = Math.min(this.width / this.images[i].width, this.height / this.images[i].height); var width = this.images[i].width * ratio; var height = this.images[i].height * ratio; this.img.style.width = width + 'px'; this.img.style.height = height + 'px'; this.img.style.marginTop = (ws_getInnerHeight() - height) / 2 + 'px'; this.img.src = this.images[i].loaded_path || this.images[i].thumbNail.src; this.loadImage(i); this.loadImage(i + 1); this.loadImage(i - 1); document.body.appendChild(this.gallery); var page = document.getElementById('outerContainer'); if ((pageToolBar = document.getElementById('ws_pageToolbar'))) { pageToolBar.style.display = 'none'; page = page.parentNode; } if (!page.style.display.length) { this.savedScrollX = ws_getScrollX(); this.savedScrollY = ws_getScrollY(); } page.style.display = 'none'; document.body.className = 'gallery'; window.scroll(0, 0); }; ws_Gallery.prototype.loadImage = function(i) {			i = (i < 0) ? this.images.length - 1 : (i >= this.images.length) ? 0 : i; var gImg = this.images[i]; var imagePath = this.goodBrowserResize ? gImg.path : ws_core_path + "ws_buildimage.php?url=" + gImg.path + "&height=" + this.height + "&width=" + this.width; if (imagePath != gImg.requested_path) {			gImg.requested_path = imagePath; gImg.img.ws_galleryIndex = i; gImg.progressImg.style.visibility = 'visible'; gImg.img.onload = function() { var gImg = ws_gallery.images[this.ws_galleryIndex]; gImg.loaded_path = gImg.requested_path; gImg.progressImg.style.visibility = 'hidden'; if (ws_gallery.active == this.ws_galleryIndex) { ws_gallery.img.src = this.src; ws_gallery.img.style.width = ''; ws_gallery.img.style.height = ''; } }; gImg.img.src = gImg.requested_path; } }; ws_Gallery.prototype.resize = function() {				this.width = ws_getInnerWidth() - 40; this.height = ws_getInnerHeight() - 40; if ((i = this.active) >= 0) this.show(i); }; ws_Gallery.prototype.hide = function hide() {			if (this.active >= 0) { var page = document.getElementById('outerContainer'); if ((pageToolBar = document.getElementById('ws_pageToolbar'))) { pageToolBar.style.display = ''; page = page.parentNode; } document.body.className = ''; document.body.removeChild(this.gallery); page.style.display = ''; document.body.focus();			clearTimeout(this.gallery.ws_hideControl); this.movieControl(0); this.active = -1; window.scroll(this.savedScrollX, this.savedScrollY); } }; ws_Gallery.prototype.movieControl = function(action) { this.movie = arguments.length ? action : !this.movie; clearInterval(this.movieTimer); if (this.movie) { this.controlMapImg.src = this.movieOnImg.src; this.movieTimer = setInterval("ws_gallery.show(ws_gallery.active + 1);", this.moviePeriod); } else { this.controlMapImg.src = this.controlImg.src; } }; ws_Gallery.prototype.setMoviePeriod = function(period) { if (this.movie) { this.moviePeriod = period; if (this.moviePeriod < 0) this.moviePeriod = 0; this.movieControl(1); } }; function ws_showMenu(menuId, parentItem, event) { var menu = document.getElementById(menuId); if (menu && !menu.ws_active) { menu.ws_active = true; menu.style.display = 'block';					menu.style.fontSize = '100%';					if (parentItem && !menu.ws_displayed) { parentItem.parentNode.appendChild(menu);				var parentX = parentItem.offsetLeft + findPosX(parentItem.offsetParent) - findPosX(menu.offsetParent); var parentY = parentItem.offsetTop +  findPosY(parentItem.offsetParent) - findPosY(menu.offsetParent); menu.ws_parentLink = parentItem; menu.ws_parentLink.className += ' hover'; menu.style.margin = 0;										if (parentItem.parentNode.className == "horizontal") { menu.style.top = parentY + parentItem.offsetHeight + 'px'; menu.style.left = parentX + 'px'; menu.style.minWidth = parentItem.offsetWidth + 'px'; } else { menu.style.top = parentY + 'px'; menu.style.left = parentX + parentItem.offsetWidth - 10 + 'px'; } if (findPosY(menu) + menu.offsetHeight > ws_getInnerHeight() + ws_getScrollY()) menu.style.top = ws_getInnerHeight() + ws_getScrollY() - menu.offsetHeight - 20 + 'px'; if (findPosY(menu) < ws_getScrollY()) menu.style.top = ws_getScrollY() - findPosY(menu.offsetParent) + 'px'; if (findPosX(menu) + menu.offsetWidth > ws_getInnerWidth() + ws_getScrollX()) menu.style.left = parentX - menu.offsetWidth + 10 + 'px'; if (findPosX(menu) < ws_getScrollX()) menu.style.left = ws_getScrollX() - findPosX(menu.offsetParent) + 'px'; } menu.ws_displayed = true; ws_overPopup = 1;							} } function ws_hideMenu(menuId) { var menu = document.getElementById(menuId); if (menu && menu.ws_active) { menu.ws_active = false; setTimeout("\ var menu=document.getElementById('" + menuId + "');\ if (!menu.ws_active){\ menu.style.display = 'none';\ ws_overPopup = 0;\ if (menu.ws_parentLink)\ menu.ws_parentLink.className = new String(menu.ws_parentLink.className).replace(' hover', '');\ menu.ws_displayed = false;\ }", 100); } } function ws_userSelect(objectId, check) { var cdata = ''; if (document.cookie.search('wsc_selected=') != -1) { cdata = document.cookie.replace(/.*wsc_selected=([^;]*).*/, '$1'); cdata = cdata.replace(objectId, ''); cdata = cdata.replace(/^,*/, ''); cdata = cdata.replace(/(,*)$/, ''); cdata = cdata.replace(/,,*/g, ','); } if (check) { if (cdata.length) cdata += ','; cdata += objectId; } d = new Date(new Date().getTime() + 30*24*3600*1000).toGMTString(); document.cookie = 'wsc_selected=' + cdata + '; expires=' + d; } function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; } while (obj = obj.offsetParent); } else if (obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); } else if (obj.y) curtop += obj.y; return curtop; } function ws_getScrollX() { if (window.pageXOffset) return window.pageXOffset; else if (document.documentElement && document.documentElement.scrollLeft) return document.documentElement.scrollLeft; else return document.body.scrollLeft; } function ws_getScrollY() { if (window.pageYOffset) return window.pageYOffset; else if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop; else return document.body.scrollTop; } function ws_getInnerWidth() { if (window.innerWidth) return window.innerWidth; else if (document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth; else return document.body.clientWidth; } function ws_getInnerHeight() { if (window.innerHeight) return window.innerHeight; else if (document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight; else return document.body.clientHeight; } function ws_getDocumentWidth() { if (window.scrollMaxX)				  		return ws_getInnerWidth() + window.scrollMaxX; else return document.body.scrollWidth; } function ws_getDocumentHeight() { if (window.scrollMaxY)				  		return ws_getInnerHeight() + window.scrollMaxY; else return document.body.scrollHeight; } function ws_setOpacity(element, opacity) { element.style.zoom = 1;			element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity*100 + ')'; element.style.opacity = opacity; } function ws_bsn2nl(s) { return s.replace(/\\n/g, "\n"); } function ws_setupElement(id, properties, ownerId) { if (elt = document.getElementById(id)) { if (properties & WS_CONTAINER) ws_containerList.push(elt); else ws_componentList.push(elt); elt.ws_props = properties; elt.ws_owner = document.getElementById(ownerId); } } function ws_reloadRequest(variables) { var sep = "?"; for (var i in variables) { str = new String(location.href); if (location.search) { var match = str.match(new RegExp('([?&])' + i + '=[^&#]*')); if (match) { str = str.replace(match[0], match[1] + i + "=" + variables[i]); if (str.indexOf('?') == -1 && str.indexOf('&') != -1) str = str.replace(/(^[^&]+)&/, '$1?'); } else { str += "&" + i + "=" + variables[i]; } } else if (location.hash) { str = str.replace("#", "?" + i + "=" + variables[i] + "#"); } else { str += sep + i + "=" + variables[i]; sep = "&"; } } location.href = str; } function Disp(str, obj) { var res = ""; for(var i = 0; i < str.length; i++) res += String.fromCharCode(str.charCodeAt(i) + i%4 - 1); if (obj) obj.href = 'mailto:' + res; return res; } var ws_miniWindow = 0; function miniWindow(url, width, height) { if (ws_miniWindow) ws_miniWindow.close();	  	if (!width) width = 100; if (!height) height = 100; ws_miniWindow = open(url,'miniWindow','resizable, scrollbars, width=' + width + ', height=' + height); } function adjustWindowSize(startWidth, startHeight, w) { if (!w) w = window; w.resizeTo(startWidth ? startWidth : 110, startHeight ? startHeight : 110); w.scrollTo(1000,1000); w.focus(); var delta = 16; var step = w.document.documentElement.scrollLeft / 5; while(w.document.documentElement.scrollLeft) {			w.moveBy(-delta, 0); w.resizeBy(step, 0); w.moveBy(delta + 1, 0); } var step = w.document.documentElement.scrollTop / 5; while(w.document.documentElement.scrollTop) { w.moveBy(0, -delta); w.resizeBy(0, step); w.moveBy(0, delta + 1); } } var ws_infoWindow = 0; var WS_INFO_SERVER = 'http:/' + '/doc.websico.com';       function ws_openInfo(pageName, anchor) { var windowRight = (window.screenX + window.outerWidth) || (window.screenLeft + document.documentElement.clientWidth); if (!ws_infoWindow || ws_infoWindow.closed) { var windowFeatures = window.screenY ? 'top=' + window.screenY : ''; windowFeatures += ', left=' + windowRight; windowFeatures += ', scrollbars=yes, resizable=yes, location=yes, toolbar=yes'; windowFeatures += ', width=470';            ws_infoWindow = open('', 'ws_info_window', windowFeatures); ws_infoWindow.resizeTo(470, window.screen.height * 3/4);       } anchor = anchor || 'info'; ws_infoWindow.location.href = WS_INFO_SERVER + '/' + ws_lang + '/' + pageName + '.html#' + anchor; ws_infoWindow.focus(); } function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g="gecko",w="webkit",s="safari",o="opera",m="mobile",h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?("ie ie"+RegExp.$1):is("firefox/2")?g+" ff2":is("firefox/3.5")?g+" ff3 ff3_5":is("firefox/3.6")?g+" ff3 ff3_6":is("firefox/3")?g+" ff3":is("gecko/")?g:is("opera")?o+(/version\/(\d+)/.test(ua)?" "+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?" "+o+RegExp.$2:"")):is("konqueror")?"konqueror":is("blackberry")?m+" blackberry":is("android")?m+" android":is("chrome")?w+" chrome":is("iron")?w+" iron":is("applewebkit/")?w+" "+s+(/version\/(\d+)/.test(ua)?" "+s+RegExp.$1:""):is("mozilla/")?g:"",is("j2me")?m+" j2me":is("iphone")?m+" iphone":is("ipod")?m+" ipod":is("ipad")?m+" ipad":is("mac")?"mac":is("darwin")?"mac":is("webtv")?"webtv":is("win")?"win"+(is("windows nt 6.0")?" vista":""):is("freebsd")?"freebsd":(is("x11")||is("linux"))?"linux":"","js"]; c = b.join(" "); c=c.toUpperCase();h.className += " "+c; return c;}; css_browser_selector(navigator.userAgent); function ws_request(url, callBack) { var httpRequest; if (window.XMLHttpRequest) {         httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType('text/xhtml'); } } else if (window.ActiveXObject) {         try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!httpRequest) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } httpRequest.onreadystatechange = function() { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { callBack(httpRequest.responseText); } else { callBack('Error ' + httpRequest.status); } } }; httpRequest.open('POST', url, true);        httpRequest.send(''); } function ws_getElementById(id, bufId){ ws_request(WS_CORE_PATH + 'ws_service.php?WS_CMD=get_element_by_id&WS_ID=' + id, function(res){document.getElementById(bufId).innerHTML = res}); } 
