var theBrowserVersion = navigator.appVersion.toLowerCase();
if(theBrowserVersion.indexOf('safari') != -1) {
	var theBrowserName = 'safari';
} else if(theBrowserVersion.indexOf('msie') != -1) {
	var theBrowserName = 'explorer';
} else {
	var theBrowserName = 'unknown';
}
var aBrowser = navigator.appVersion.toLowerCase();

var alllangsStrings = '|da_|nl_|en_|ee_|fr_|de_|el_|it_|kr_|no_|nn_|pt_|lz_|lt_|lv_|es_|sv_|ca_|cz_|pl_|br_|ja_|ru_|';
var baseServer = 'server001.clicktoweb.com';
var webName = '';
var shoponline = false;
var keepHcentered = false;
var keepVcentered = false;
var selfResized = false;
var userPlatform = getOs();
var browserVersion = getBversion();
var displayTimer = null;
var displayTimerOn = false;
var pageLoaded = false;
var objectCollection = null;
var formLayer = null;
var theDinamicFrame = null;
var userLang = 'fr';
var defaultLang = 'fr';
var msgdata = '';
var mailnotifyAddress = '';
var mailSubject = '';
var documentPath = window.location.href;
var replyPath = window.location.href;
var drawLoop = 0;

var alwaysForbiddenChars = '|\\^:;[{}]¤`"\'';
var alwaysforbiddenAlertString = 'Ce champ contient des caract&egrave;res interdits.';
var defaultAlertString = 'Les champs marqu&eacute;s d\'un ast&eacute;risque rouge sont obligatoires.';

var myAbsolutePath = '';
var pathParts = documentPath.split('/');
for(var i = 0; i < (pathParts.length)-1; i++) {
	thisPart = pathParts[i];
	myAbsolutePath = myAbsolutePath+thisPart+'/';
}
var pageName = '';
pageName = pathParts[(pathParts.length)-1];
if(!pageName) {pageName = 'index.html';}

var mustRedraw = false;
function manageWebpageContents() {
	if(destinationLayer) {mustRedraw = true; return;}
	if(!pageLoaded) {
		if(top != self) {
			if(top.loadfilePath && (top.loadfilePath == self.location.href)) {
				webBox = document.getElementById('databox');
				pageweb = webBox.getElementsByTagName('DIV')[0];
				if(pageweb.getAttribute('printorigin')) {
					var thePrintOrigin = pageweb.getAttribute('printorigin');
					top.pageweb.setAttribute('printorigin',thePrintOrigin);
				}
				theData = pageweb.innerHTML;
				top.importExternalData(theData);
				top.loadfilePath = '';
				pageLoaded = true;
			}
		} else {
			drivePage();
			statPage();
		}
	} else {
		if(displayTimerOn) {clearTimeout(displayTimer);}
		displayTimer = setTimeout('drivePage()',10);
		displayTimerOn = true;
	}
}
function drivePage() {
	displayTimerOn = false;
	webBox = document.getElementById('databox');
	if(webBox.getAttribute('dlang')) {
		defaultLang = webBox.getAttribute('dlang');
	}
	if(webBox.getAttribute('slang')) {
		userLang = webBox.getAttribute('slang');
	}
	if(webBox.getAttribute('wname')) {
		webName = webBox.getAttribute('wname');
	}
	if(webBox.getAttribute('hcenter')) {
		keepHcentered = true;
	}
	if(webBox.getAttribute('vcenter')) {
		keepVcentered = true;
	}
	pageweb = webBox.getElementsByTagName('DIV')[0];
	try {
		if(parent.opener && (parent.opener.winMode) && (parent.opener.winMode == 'c')) {
			parent.opener.winMode = 'a';
			var winW = pageweb.getAttribute('mw');
			var winW = parseInt(winW)+30;
			var winH = pageweb.getAttribute('mh');
			var winH = parseInt(winH)+60;
			var scrW = screen.width;
			var scrH = screen.height;
			if(winW > (scrW-30)) {winW = (scrW-30);}
			if(winH > (scrH-60)) {winH = (scrH-60);}
			var winT = parseInt((scrH-winH)/4);
			var winL = parseInt((scrW-winW)/2);
			window.moveTo(winL,winT);
			window.resizeTo(winW,winH);
		}
	} catch(e) {
	}
	docW = docGetWidth();
	docH = docGetHeight();
	minW = parseInt(pageweb.getAttribute('mw'));
	minH = parseInt(pageweb.getAttribute('mh'));	
	if(docW < minW) {docW = minW;}
	if(docH < minH) {docH = minH;}
	if(keepHcentered) {
		var myLeft = parseInt((docW-minW)/2);
 		pageweb.style.left = myLeft+'px';
	} else {
 		pageweb.style.width = docW+'px';
	}
	if(keepVcentered) {
		var myTop = parseInt((docH-minH)/2);
 		pageweb.style.top = myTop+'px';
	} else {
 		pageweb.style.height = docH+'px';
	}
	pageweb.style.visibility = 'visible';
	if(!pageLoaded) {
		objectCollection = new Array();
		var theNodes = pageweb.childNodes;
		theNodes = onlyValidNodes(theNodes);
		for(var i = 0; i < theNodes.length; i++) {
			aWebpageObj = theNodes[i];
			var myType = aWebpageObj.getAttribute('btype');
			if(myType) {
				objectCollection[objectCollection.length] = aWebpageObj;
			}
			if(aWebpageObj.type == 'radio') {
				aWebpageObj.onclick = clickedRadio;
			}
			if(aWebpageObj.getAttribute('formule')) {
				var myOption = aWebpageObj.getAttribute('formule');
				if(myOption.indexOf('MENU:') == 0) {
					drawPopup(aWebpageObj);
				}
			}
			if(aWebpageObj.getAttribute('tablelayout')) {
				var myNodes = aWebpageObj.childNodes;
				for(var k = 0; k < myNodes.length; k++) {
					var myNode = myNodes[k];
					if(myNode.tagName && (myNode.tagName == 'DIV')) {
						objectCollection[objectCollection.length] = myNode;
					}
				}
			}
		}
		objectCollection = bubbleSortByTops(objectCollection);
	}
	currentObject = null;
	currentObjectIndex = 0;
	drawObjects();
}

function drawObjects() {
	if(objectCollection) {
		if(currentObjectIndex < objectCollection.length) {
			currentObject = objectCollection[currentObjectIndex];
			currentObjectIndex++;
			drawItem();
		} else {
			if(autoscrollBox && (!pageLoaded)) {
				autoscrollSetup();
			}
			pageLoaded = true;
			setTimeout('loadExternalData()',1);
		}
	}
}

var autoscrollBox = null;
var autoscrollDir = 'left';
var scrollingLayer = null;
function autoscrollSetup() {
	if(autoscrollBox.innerHTML.indexOf('<BR>') != -1) {autoscrollDir = 'top';}
	if(autoscrollBox.innerHTML.indexOf('<br>') != -1) {autoscrollDir = 'top';}
	if(autoscrollDir == 'left') {
		var theNodes = autoscrollBox.getElementsByTagName('SPAN');
		for(var i = 0; i < theNodes.length; i++) {
			var aNode = 	theNodes[i];
			var theTxt = aNode.innerHTML;
			if(theTxt.indexOf(' ') != -1) {
				theTxt = theTxt.split(' ');
				theTxt = theTxt.join('&nbsp;');
				aNode.innerHTML = theTxt
			}
		}
		var myW = autoscrollBox.style.width;
		autoscrollBox.style.width = 'auto';
		var boxW = parseInt(autoscrollBox.offsetWidth);
		var boxH = parseInt(autoscrollBox.offsetHeight);
		if(boxW < parseInt(myW)) {boxW = parseInt(myW);}
		autoscrollBox.style.width = myW;
	} else {
		var myH = autoscrollBox.style.height;
		autoscrollBox.style.height = 'auto';
		var boxW = parseInt(autoscrollBox.offsetWidth);
		var boxH = parseInt(autoscrollBox.offsetHeight);
		if(boxH < parseInt(myH)) {boxH = parseInt(myH);}
		autoscrollBox.style.height = myH;
	}
	var newScrollBox = autoscrollBox.cloneNode(true);
	autoscrollBox.innerHTML = '';
	newScrollBox = autoscrollBox.appendChild(newScrollBox);
	newScrollBox.style.width = boxW+'px';
	newScrollBox.style.height = boxH+'px';
	newScrollBox.style.top = '0px';
	newScrollBox.style.left = '0px';
	if(autoscrollDir == 'top') {
		newScrollBox.style.width = '100%';
	}
	newScrollBox = newScrollBox.cloneNode(true);
	newScrollBox = autoscrollBox.appendChild(newScrollBox);
	if(autoscrollDir == 'left') {
		newScrollBox.style.left = boxW+'px';
	} else {
		newScrollBox.style.top = boxH+'px';
	}
	setTimeout('autoScroll()',1000);
}
var scrollOffset = 1;
function autoScroll() {
	var theNodes = autoscrollBox.getElementsByTagName('DIV');
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		if(autoscrollDir == 'left') {
			var myLeft = parseInt(aNode.style.left);
			var newLeft = myLeft-scrollOffset;
			aNode.style.left = newLeft+'px';
			if(i == 0) {
				var myWidth = parseInt(aNode.style.width);
				if(newLeft < (0-myWidth)) {
					aNode = autoscrollBox.appendChild(aNode);
					aNode.style.left = myWidth+'px';
				}
			}
		} else {
			var myTop = parseInt(aNode.style.top);
			var newTop = myTop-scrollOffset;
			aNode.style.top = newTop+'px';
			if(i == 0) {
				var myHeight = parseInt(aNode.style.height);
				if(newTop < (0-myHeight)) {
					aNode = autoscrollBox.appendChild(aNode);
					aNode.style.top = myHeight+'px';
				}
			}
		}
	}
	setTimeout('autoScroll()',30);
}

function drawItem() {
	var myType = false;
	try {
		var myType = currentObject.getAttribute('btype');
	} catch(e) {
	}
	theType = myType;
/* 	theType = currentObject.btype; */
	if(!theType) {drawObjects();return;}
	if(theType == 'pagebkg') {
		if(keepHcentered || keepVcentered) {
			if(currentObject.parentNode != document.body) {
				currentObject = document.body.insertBefore(currentObject,document.body.childNodes[0]);
				currentObject.style.width = '100%';
				currentObject.style.height = '100%';
			}
		} else {
			currentObject.style.width = pageweb.style.width;
			currentObject.style.height = pageweb.style.height;
		}
	} else if(theType == 'graphicbox') {
		drawGbox(currentObject);
		imgAdjust(currentObject);
	} else if(theType == 'mediabox') {
		drawGbox(currentObject);
	} else if(theType == 'pushbutton') {
		if(!pageLoaded) {
			buttonSetup(currentObject);
		} else {
			drawGbox(currentObject);
		}
	} else if((theType == 'pictbox') || (theType == 'contentsbox')) {
		if(!pageLoaded) {
			pictProps(currentObject);
		} else {
			drawGbox(currentObject);
			if(theType == 'pictbox') {
				imgAdjust(currentObject);
			}
		}
	} else if(theType == 'textbox') {
		if(!pageLoaded) {
			textProps(currentObject);
		} else {
			drawGbox(currentObject);
		}
	} else if(theType == 'contentsbox') {
		drawGbox(currentObject);
	} else if(theType == 'dynamicbox') {
		if(!pageLoaded) {
			dynamicProps(currentObject);
		}
	} else if(theType == 'formbox') {
		drawGbox(currentObject);
		if(currentObject.getAttribute('replypath')) {
			replyPath = currentObject.getAttribute('replypath');
			replyPath = myAbsolutePath+replyPath;
		}
		if(currentObject.getAttribute('mailaddress')) {
			mailnotifyAddress = currentObject.getAttribute('mailaddress');
		}
		if(currentObject.getAttribute('subjectstring')) {
			mailSubject = currentObject.getAttribute('subjectstring');
		}
		formTarget = currentObject.getAttribute('userref');
		formTop = parseInt(currentObject.style.top);
		formLeft = parseInt(currentObject.style.left);
		formWidth = parseInt(currentObject.style.width);
		formHeight = parseInt(currentObject.style.height);
	} else if(theType == 'formitem') {
		drawGbox(currentObject);
	} else if(theType == 'cleanbox') {
		var theMenuBox = currentObject.getElementsByTagName('DIV')[0];
		theMenuBox.style.zIndex = 10000;
		var theMenuButtons = theMenuBox.getElementsByTagName('DIV');
		for(var s = 0; s < theMenuButtons.length; s++) {
			var aMenuButton = theMenuButtons[s];
			if(aMenuButton && aMenuButton.getAttribute('ismenuitem')) {
				buttonSetup(aMenuButton);
			}
		}
	}
	if(!pageLoaded) {
		currentObject.style.visibility = 'visible';
	}
	if(!destinationLayer) {
		if(aBrowser.indexOf('safari') != -1) {
			setTimeout('drawObjects()',1);
		} else {
			if(drawLoop < 10) {
				drawLoop++;
				drawObjects();
			} else {
				drawLoop = 0;
				setTimeout('drawObjects()',1);
			}
		}
	}
}

var mailAddresses = '';
var mailSubject = '';
var mailData = '';
function sendmail() {
	mailAddresses = mailnotifyAddress;
	if(!mailSubject) {mailSubject = 'Message depuis le site';}
	mailData = '';
	var theNodes = pageweb.childNodes;
	theNodes = bubbleSortByTabIndex(onlyValidNodes(theNodes));
	for(i = 0; i < theNodes.length; i++) {
		anItem = theNodes[i];
		if(anItem) {
			itemName = anItem.name;
			itemValue = anItem.value;
			var myType = anItem.getAttribute('type');
			if(myType && ((myType == 'radio') || (myType == 'checkbox'))) {
				if(anItem.checked) {
					mailData = mailData+itemName+' = '+itemValue+'<br><br>'
				}
			} else {
				var aTest = checkTextField(anItem);
				if(!aTest) {return aTest;}
				if((itemName && itemValue)) {
					if(itemValue && (itemValue.indexOf('\n') != -1)) {
						itemValue = itemValue.split('\n');
						itemValue = itemValue.join('<br>');
					}
					mailData = mailData+itemName+' = '+itemValue+'<br><br>'
				}
			}
		}
	}
	if(mailData) {
		aConnexionLayer = document.getElementById('_socket');
		aConnexionLayer.style.display = 'block';
		if(theBrowserName != 'explorer') {aConnexionLayer.src = 'about:blank'}
		aConnexionLayer.src = 'my_mailerdaemon.html'
	}
}
function mailSent() {
	window.location.href = replyPath;
}

function clickedRadio(evt) {
	if(theBrowserName == 'explorer') {
		anItem = event.srcElement;
	} else {
		anItem = evt.target;
	}
	var myName = anItem.name;
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		thisItem = theNodes[i];
		if(thisItem && (thisItem != anItem)) {
			itemName = thisItem.name;
			var myType = thisItem.getAttribute('type');
			if(myType && (myType == 'radio')) {
				if(itemName == myName) {
					thisItem.checked = false;
				}
			}
		}
	}
	anItem.checked = true;
}

var theFormSocket = null;
var isFirstItemInfo = '';
var formTarget = '';
var msginfos = '';
var formTop = 0;
var formLeft = 0;
var formWidth = 400;
var formHeight = 400;
function sendForm() {
	isFirstItemInfo = '';
	formLayer = document.getElementById('formLayer');
	if(!formLayer) {
		formLayer = document.body.appendChild(document.createElement('DIV'));
		formLayer.style.width = '1px';
		formLayer.style.height = '1px';
		formLayer.style.overflow = 'hidden';
		formLayer.style.display = 'none';
	}
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		anItem = theNodes[i];
		if(anItem && ((anItem.style.top) && (anItem.style.left))) {
			thatItem = formLayer.appendChild(anItem.cloneNode(true));
			if(!anItem.value) {
				thatItem.value = ' ';
			} else {
				thatItem.value = anItem.value;
			}
			var myType = thatItem.getAttribute('type');
			if((!myType) || (myType == 'text')) {
				var aTest = checkTextField(anItem);
				if(!aTest) {return aTest;}
				if(!isFirstItemInfo) {
					if(anItem.value != ' ') {
						isFirstItemInfo = anItem.value;
					}
				}
				thatItem.setAttribute('value',anItem.value);
			}
			if(thatItem.getAttribute('type') == 'textarea') {
				txtval = thatItem.value;
				if(txtval.indexOf('\n') != -1) {
					txtval = txtval.split('\n');
					txtval = txtval.join('|');
				}
				thatItem.setAttribute('value',txtval);
				thatItem.innerHTML = txtval;
			}
			thatItem.style.top = (parseInt(thatItem.style.top)-formTop)+'px';
			thatItem.style.left = (parseInt(thatItem.style.left)-formLeft)+'px';
		}
	}
	if(!isFirstItemInfo) {return;}
	msginfos = formWidth+'|||'+formHeight+'|||'+isFirstItemInfo;
	msgdata = formLayer.innerHTML;
	if(msgdata.indexOf('VISIBILITY: hidden') != -1) {
		msgdata = msgdata.split('VISIBILITY: hidden');
		msgdata = msgdata.join('VISIBILITY: visible');
	}
	if(msgdata.indexOf('visibility: hidden') != -1) {
		msgdata = msgdata.split('visibility: hidden');
		msgdata = msgdata.join('visibility: visible');
	}
	theFormSocket = document.getElementById('formSocket');
	if(!theFormSocket) {
		theFormSocket = document.getElementById('_socket');
	}
	theFormSocket.style.visibility = 'hidden';
	theFormSocket.style.display = 'block';
	if(theBrowserName != 'explorer') {theFormSocket.src = 'about:blank';}
	theFormSocket.src = 'msgform.html';
}
function sendFormFeedback() {
	setTimeout('reloadDoc()',1000);
}
function reloadDoc() {
	window.location.href = replyPath;
}

function drawGbox(aGraphicbox) {
	pageW = parseInt(pageweb.offsetWidth);
	pageH = parseInt(pageweb.offsetHeight);
	boxT = parseInt(aGraphicbox.style.top);
	boxL = parseInt(aGraphicbox.style.left);
	boxW = parseInt(aGraphicbox.clientWidth);
	boxH = parseInt(aGraphicbox.clientHeight);
	aGraphicGfx = aGraphicbox.getElementsByTagName('IMG')[1];
	if(!aGraphicGfx) {aGraphicGfx = aGraphicbox.getElementsByTagName('IMG')[0]};
	if(aGraphicGfx) {
		gfxT = parseInt(aGraphicGfx.style.top);
		gfxL = parseInt(aGraphicGfx.style.left);
		gfxW = parseInt(aGraphicGfx.clientWidth);
		gfxH = parseInt(aGraphicGfx.clientHeight);
		gfxWoffset = boxW-(gfxL+gfxW);
		gfxHoffset = boxH-(gfxT+gfxH);
	}
	
	locktopleft = aGraphicbox.getAttribute('tls');
	locktopright = aGraphicbox.getAttribute('trs');
	lockbottomleft = aGraphicbox.getAttribute('bls');
	lockbottomright = aGraphicbox.getAttribute('brs');
	rightoffset = parseInt(aGraphicbox.getAttribute('rval'));
	if(!rightoffset) {rightoffset = 0;}
	bottomoffset = parseInt(aGraphicbox.getAttribute('bval'));
	if(!bottomoffset) {bottomoffset = 0;}
	
	if(aGraphicbox.getAttribute('btype') == 'textbox') {
		YpadVal = parseInt(aGraphicbox.style.paddingTop);
		if((!YpadVal) || (YpadVal < 0)) {YpadVal = 0;}
		leftpadVal = parseInt(aGraphicbox.style.paddingLeft);
		if((!leftpadVal) || (leftpadVal < 0)) {leftpadVal = 0;}
		rightpadVal = parseInt(aGraphicbox.style.paddingRight);
		if((!rightpadVal) || (rightpadVal < 0)) {rightpadVal = 0;}
		XpadVal = leftpadVal+rightpadVal;
		if(browserVersion == 'bad') {
			YpadVal = 0-parseInt(YpadVal/4);
			XpadVal = 0-parseInt(XpadVal/4);
		}
	} else {
		YpadVal = 0;
		XpadVal = 0;
	}
	
	hcentered = aGraphicbox.getAttribute('hcenter');
	vcentered = aGraphicbox.getAttribute('vcenter');

	if((locktopleft) && (!locktopright) && (!lockbottomleft) && (!lockbottomright)) {
		/*don't move*/
		/*don't resize*/
	} else if((locktopleft) && (locktopright) && (!lockbottomleft) && (!lockbottomright)) {
		/*don't move*/
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		if(aGraphicbox.getAttribute('btype') == 'pictbox') {
			aGraphicGfx.style.height = '';
			aGraphicbox.style.height = aGraphicGfx.clientHeight+'px';
		}
	} else if((locktopleft) && (!locktopright) && (lockbottomleft) && (!lockbottomright)) {
		/*don't move*/
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (!locktopright) && (!lockbottomleft) && (lockbottomright)) {
		/*don't move*/
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((!locktopleft) && (!locktopright) && (!lockbottomleft) && (lockbottomright)) {
		/*move vertical*/
		if(!vcentered) {
			newVal = pageH-(boxH+bottomoffset);
			if(newVal < 0) {newVal = 0;}
			aGraphicbox.style.top = newVal+'px';
		}
		/*move horizontal*/
		if(!hcentered) {
			newVal = pageW-(boxW+rightoffset);
			if(newVal < 0) {newVal = 0;}
			aGraphicbox.style.left = newVal+'px';
		}
	} else if((!locktopleft) && (locktopright) && (lockbottomleft) && (!lockbottomright)) {
		/*don't move*/
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((!locktopleft) && (!locktopright) && (lockbottomleft) && (lockbottomright)) {
		/*move vertical*/
		if(!vcentered) {
			newVal = pageH-(boxH+bottomoffset);
			if(newVal < 0) {newVal = 0;}
			aGraphicbox.style.top = newVal+'px';
		}
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
	} else if((!locktopleft) && (locktopright) && (!lockbottomleft) && (!lockbottomright)) {
		/*move horizontal*/
		if(!hcentered) {
			newVal = pageW-(boxW+rightoffset);
			if(newVal < 0) {newVal = 0;}
			aGraphicbox.style.left = newVal+'px';
		}
	} else if((!locktopleft) && (!locktopright) && (lockbottomleft) && (!lockbottomright)) {
		/*move vertical*/
		if(!vcentered) {
			newVal = pageH-(boxH+bottomoffset);
			if(newVal < 0) {newVal = 0;}
			aGraphicbox.style.top = newVal+'px';
		}
	} else if((!locktopleft) && (locktopright) && (!lockbottomleft) && (lockbottomright)) {
		/*move horizontal*/
		if(!hcentered) {
			newVal = pageW-(boxW+rightoffset);
			if(newVal < 0) {newVal = 0;}
			aGraphicbox.style.left = newVal+'px';
		}
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((!locktopleft) && (locktopright) && (lockbottomleft) && (lockbottomright)) {
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (locktopright) && (lockbottomleft) && (!lockbottomright)) {
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (locktopright) && (!lockbottomleft) && (lockbottomright)) {
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (!locktopright) && (lockbottomleft) && (lockbottomright)) {
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (locktopright) && (lockbottomleft) && (lockbottomright)) {
		/*resize horizontal*/
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.width = (newVal-XpadVal)+'px';
		/*resize vertical*/
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {newVal = 10;}
		aGraphicbox.style.height = (newVal-YpadVal)+'px';
	}
	if(hcentered) {
		aGraphicbox.style.left = parseInt((pageW-parseInt(aGraphicbox.style.width))/2)+'px';
	}
	if(vcentered) {
		aGraphicbox.style.top = parseInt((pageH-parseInt(aGraphicbox.style.height))/2)+'px';
	}
	if(aGraphicbox.getAttribute('btype') == 'pushbutton') {
		var myW = aGraphicbox.style.width;
		var myH = aGraphicbox.style.height;
		var aTD = aGraphicbox.getElementsByTagName('TD')[0];
		if(aTD.style.width != myW) {aTD.style.width = myW;}
		if(aTD.style.height != myH) {aTD.style.height = myH;}
	}
	if(aGraphicbox.getAttribute('tablelayout')) {
		if(browserVersion == 'bad') {
			var myNodes = aGraphicbox.childNodes;
			for(var k = 0; k < myNodes.length; k++) {
				var myNode = myNodes[k];
				if(myNode.tagName && (myNode.tagName == 'DIV')) {
					var thisTxtNode = myNode.getElementsByTagName('DIV')[0];
					if(thisTxtNode) {
						thisTxtNode.style.width = myNode.style.width;
						thisTxtNode.style.height = myNode.style.height;
					}
					var myBorderTop = parseInt(myNode.style.borderTopWidth);
					if(!myBorderTop) {myBorderTop = 0;}
					var myBorderLeft = parseInt(myNode.style.borderLeftWidth);
					if(!myBorderLeft) {myBorderLeft = 0;}
					var myBorderRight = parseInt(myNode.style.borderRightWidth);
					if(!myBorderRight) {myBorderRight = 0;}
					var myBorderBottom = parseInt(myNode.style.borderBottomWidth);
					if(!myBorderBottom) {myBorderBottom = 0;}
					var myPaddingTop = parseInt(myNode.style.paddingTop);
					if(!myPaddingTop) {myPaddingTop = 0;}
					var myPaddingLeft = parseInt(myNode.style.paddingLeft);
					if(!myPaddingLeft) {myPaddingLeft = 0;}
					var myWidth = parseInt(myNode.style.width);
					var myHeight = parseInt(myNode.style.height);
					myNode.style.width = (myWidth+myBorderLeft+myBorderRight+myPaddingLeft)+'px';
					myNode.style.height = (myHeight+myBorderTop+myBorderBottom+myPaddingTop)+'px';
				}
			}
		}
	}
	if(aGraphicbox.tagName && (aGraphicbox.tagName == 'INPUT')) {
		if(aGraphicbox.getAttribute('btype')) {
			var myType = aGraphicbox.getAttribute('btype');
			if((myType != 'checkbox') && (myType != 'radio')) {
				if(aBrowser.indexOf('safari') != -1) {
					var aW = parseInt(aGraphicbox.style.width);
					aGraphicbox.style.width = (aW+2)+'px';
					var aH = parseInt(aGraphicbox.style.height);
					aGraphicbox.style.height = (aH+2)+'px';
				}
			}
		}
	}
}

function imgAdjust(aGraphicbox) {
	var theImg = aGraphicbox.getElementsByTagName('IMG')[0];
	if(theImg) {
		if(theImg.style.height == '100%') {
			theImg.setAttribute('sizeh','100%');
		}
		if(theImg.style.width == '100%') {
			theImg.setAttribute('sizew','100%');
		}
		if(theImg.sizeh && (theImg.sizeh == '100%')) {
			theImg.style.height = currentObject.offsetHeight+'px';
		}
		if(theImg.sizew && (theImg.sizew == '100%')) {
			theImg.style.width = currentObject.offsetWidth+'px';
		}
	}
}

function pictProps(aPictbox) {
	if(aPictbox.getAttribute('linkHref')) {
		if(aPictbox.getAttribute('linkHref') != 'undefined') {
			setCursor(aPictbox,'pointer');
			aPictbox.onmouseover = overPict;
			aPictbox.onmouseout = outPict;
			aPictbox.onmouseup = upPict;
		}
	} else if(aPictbox.getAttribute('zoomImg')) {
		setCursor(aPictbox,'pointer');
		zoompict = aPictbox.getElementsByTagName('IMG')[1];
		if(!zoompict) {zoompict = aPictbox.getElementsByTagName('IMG')[0];}
		zoompict.onmouseover = zoomFeedback;
		zoompict.onclick = zoomThisImg;
		zoompict.onmouseout = resetStatus;
	} else if(aPictbox.getAttribute('printid')) {
		if(aPictbox.getAttribute('isprinter')) {
			setCursor(aPictbox,'pointer');
			if(aPictbox.getAttribute('printicon')) {
				aPictbox.onclick = printthispage;
			} else {
				aPictbox.onclick = printthistext;
			}
		}
	}
	drawGbox(aPictbox);
}
function overPict(evt) {
	if(theBrowserName == 'explorer') {
		aPict = event.srcElement.parentNode;
	} else {
		aPict = evt.target.parentNode;
	}
	if(aPict.getAttribute('linkHref')) {
		window.status = aPict.getAttribute('linkHref');
		if(aPict.getAttribute('linkType') && (aPict.getAttribute('linkType') == 'togglevisibility')) {
			var targetItem = getItemByUID(aPict.getAttribute('linkHref'));
			if(targetItem) {
				if(targetItem.getAttribute('showatstartup')) {
					showItem(targetItem);
				}
			}
		}
	}
}
function outPict(evt) {
	if(theBrowserName == 'explorer') {
		aPict = event.srcElement.parentNode;
	} else {
		aPict = evt.target.parentNode;
	}
	if(aPict.getAttribute('linkHref')) {
		window.status = '';
		hideItem();
	}
}
function upPict(evt) {
	if(theBrowserName == 'explorer') {
		aPict = event.srcElement.parentNode;
	} else {
		aPict = evt.target.parentNode;
	}
	if((aPict.getAttribute('btype') != 'pictbox') && (aPict.getAttribute('btype') != 'contentsbox')){return;}
	if(aPict.getAttribute('linkHref')) {
		theLink = aPict.getAttribute('linkHref');
		theMode = aPict.getAttribute('linkmode');
		theType = aPict.getAttribute('linkType');
		if(theMode == 'd') {
			var aDynId = aPict.getAttribute('targetzone');
			setDinFrame(aDynId);
		}
		loadPage(theLink,theMode,theType);
	}
}
var imgpath = '';
function zoomThisImg(evt) {
	if(theBrowserName == 'explorer') {
		aPict = event.srcElement;
	} else {
		aPict = evt.target;
	}
	imgpath = aPict.src;
	winPath = 'imgzoom.html';
	newWin = window.open(winPath, 'display', 'toolbar=0,scrollbars=0,resize=0,top=0,left=0,width=100,height=100');
}
function zoomFeedback() {
	window.status = 'Click to zoom';
}
function resetStatus() {
	window.status = '';
}

function printthistext(evt) {
	if(theBrowserName == 'explorer') {
		thePrinter = event.srcElement.parentNode;
	} else {
		thePrinter = evt.target.parentNode;
	}
	printerID = thePrinter.getAttribute('printid');
	theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		aNode = theNodes[i];
		var isValid = false;
		try {
			aNode.getAttribute('printablebox');
			if(aNode.getAttribute('printablebox')) {
				prntrID = aNode.getAttribute('printid');
				isValid = true;
			}
		} catch(e) {
		}
		if(isValid && (prntrID == printerID)) {
			printerData = aNode.innerHTML;
			prinWin = window.open('');
			prinWin.document.open('text/html');
			prinWin.document.write(printerData);
			prinWin.document.close();
			break;
		}
	}
	printerData = '';
}
function printthispage(evt) {
	if(theBrowserName == 'explorer') {
		thePrinter = event.srcElement.parentNode;
	} else {
		thePrinter = evt.target.parentNode;
	}
	printerID = thePrinter.getAttribute('printid');
	posOffset = pageweb.getAttribute('printorigin');
	posOffset = posOffset.split(':');
	offsetTop = parseInt(posOffset[0]);
	offsetleft = parseInt(posOffset[1]);
	pageBuffer = document.body.appendChild(document.createElement('DIV'));
	pageBuffer.style.visibility = 'hidden';
	theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		aNode = theNodes[i];
		var isValid = false;
		try {
			aNode.getAttribute('printid');
			if(aNode.getAttribute('printid')) {
				isValid = true;
			}
		} catch(e) {
		}
		if(isValid) {
			prntrID = aNode.getAttribute('printid');
			if((prntrID == printerID) && (!aNode.getAttribute('isprinter'))) {
				printNode = pageBuffer.appendChild(aNode.cloneNode(false));
				if(aNode.innerHTML) {printNode.innerHTML = aNode.innerHTML;}
				printNode.innerHTML = aNode.innerHTML;
				printNode.removeAttribute('id');
				printNode.style.overflow = 'hidden';
				theFix = document.createTextNode(' ');
				pageBuffer.appendChild(theFix);
				if(printNode.getAttribute('ot')) {
					theTop = parseInt(printNode.getAttribute('ot'));
				} else {
					theTop = parseInt(printNode.style.top);
				}
				if(printNode.getAttribute('ol')) {
					theLeft = parseInt(printNode.getAttribute('ol'));
				} else {
					theLeft = parseInt(printNode.style.left);
				}
				nodeTop = theTop-offsetTop;
				nodeLeft = theLeft-offsetleft;
				printNode.style.top = nodeTop+'px';
				printNode.style.left = nodeLeft+'px';
				if(printNode.getAttribute('ow')) {
					printNode.style.width = parseInt(printNode.getAttribute('ow'))+'px';
				}
				if(printNode.getAttribute('oh')) {
					printNode.style.height = parseInt(printNode.getAttribute('oh'))+'px';
				}
			}
		}
	}
	printerData = pageBuffer.innerHTML;
	pageBuffer.parentNode.removeChild(pageBuffer);
	printerData = printerData.split('VISIBILITY: hidden;');
	printerData = printerData.join('VISIBILITY: visible;');
	printerData = printerData.split('visibility: hidden;');
	printerData = printerData.join('visibility: visible;');
	printerData = printerFile+printerData+printerfileEnd;
	prinWin = window.open('');
	prinWin.document.open('text/html');
	prinWin.document.write(printerData);
	prinWin.document.close();
}

var printerFile = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n';
printerFile = printerFile+'        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">\n';
printerFile = printerFile+'<html>\n';
printerFile = printerFile+'<head>\n';
printerFile = printerFile+'	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">\n';
printerFile = printerFile+'	<meta http-equiv="Pragma" content="no-cache">\n';
printerFile = printerFile+'	<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">\n';
printerFile = printerFile+'	<meta http-equiv="expired" content="01-Mar-94 00:00:01 GMT"> \n';
printerFile = printerFile+'	<meta name="generator" content="ClickToWeb">\n';
printerFile = printerFile+'	<title>My WEB</title>\n';
printerFile = printerFile+'<style type="text/css">\n';
printerFile = printerFile+'<!--\n';
printerFile = printerFile+'body {\n';
printerFile = printerFile+'	font-family:Verdana, Arial, sans-serif;\n';
printerFile = printerFile+'	font-size:12px;\n';
printerFile = printerFile+'	margin:0px;\n';
printerFile = printerFile+'	color:#000000;\n';
printerFile = printerFile+'	background-color:#ffffff;\n';
printerFile = printerFile+'	height:100%;\n';
printerFile = printerFile+'}\n';
printerFile = printerFile+'-->\n';
printerFile = printerFile+'</style>\n';
printerFile = printerFile+'</head>\n';
printerFile = printerFile+ '<body>\n';

var printerfileEnd = '\n</body>\n</html>\n';


function textProps(aTextbox) {
	theStrings = aTextbox.getElementsByTagName('SPAN');
	for(j = 0; j < theStrings.length; j++) {
		thisString = theStrings[j];
		if(thisString.getAttribute('linkHref')) {
			if(thisString.getAttribute('linkHref') != 'undefined') {
				thisString.onmouseover = overString;
				thisString.onmouseout = outString;
				thisString.onmousedown = downString;
				thisString.onmouseup = upString;
/*				thisString.style.color = '#000099';*/
				thisString.style.textDecoration = 'underline';
				setCursor(thisString,'pointer');
			}
		}
	}
	var theString = aTextbox.innerHTML;
	if(theString.indexOf('_@LINKRES:') != -1) {
		var thePath = theString.split('_@LINKRES:');
		thePath = thePath[1];
		thePath = thePath.split('@_');
		thePath = thePath[0];
		var targetLayer = aTextbox;
		targetLayer.innerHTML = '';
		targetLayer.style.height = targetLayer.style.width = '1px';
		targetLayer.style.overflow = 'hidden';
		targetLayer.style.border = 'medium none';
		targetLayer.style.visibility = 'hidden';
		externalResources[externalResources.length] = new Array(targetLayer,thePath);
	}
	if(aTextbox.getAttribute('autoscroll')) {
		autoscrollBox = aTextbox;
		autoscrollBox.style.overflow = 'hidden';
	}
	drawGbox(aTextbox);
}

var dynSets = false;
function dynamicProps(aBox) {
	theDinamicFrame = aBox;
	if(!dynSets) {
		dynZoneBottomOffset = 0;
		dynZoneRightOffset = 0;
		if(theDinamicFrame.getAttribute('brs')) {
			dynZoneRightOffset = parseInt(theDinamicFrame.getAttribute('rval'));
			if(!dynZoneRightOffset) {dynZoneRightOffset = 0;}
			dynZoneBottomOffset = parseInt(theDinamicFrame.getAttribute('bval'));
			if(!dynZoneBottomOffset) {dynZoneBottomOffset = 0;}
		} else if(theDinamicFrame.getAttribute('trs')) {
			dynZoneRightOffset = parseInt(theDinamicFrame.getAttribute('rval'));
			if(!dynZoneRightOffset) {dynZoneRightOffset = 0;}
		} else if(theDinamicFrame.getAttribute('bls')) {
			dynZoneBottomOffset = parseInt(theDinamicFrame.getAttribute('bval'));
			if(!dynZoneBottomOffset) {dynZoneBottomOffset = 0;}
		}
		dynSets = true;
	}
	setCursor(aBox,'default');
}
function collectItemsByDynamicId(aDynId) {
	var itemsArray = new Array();
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var isValid = false;
		try {
			aNode.getAttribute('dynID');
			isValid = true;
		} catch(e) {
		}
		if(isValid) {
			if(aNode.getAttribute('dynamicId')) {
				var myDynId = aNode.getAttribute('dynamicId');
/* 				alert(myDynId+' : '+aDynId) */
				if(myDynId.indexOf(aDynId) != -1) {
					itemsArray[itemsArray.length] = aNode;
				}
			}
		}
	}
	return itemsArray;
}
function setDinFrame(aDynId) {
	theDinamicFrame = null;
	destinationLayer = null;
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var isValid = false;
		try {
			aNode.getAttribute('dynID');
			isValid = true;
		} catch(e) {
		}
		if(isValid) {
			if(aNode.getAttribute('dynID') && (aNode.getAttribute('dynID') == aDynId)) {
				theDinamicFrame = aNode;
				destinationLayer = aNode;
				addrefToTracingIDs(aDynId);
				break;
			}
		}
	}
}
function addrefToTracingIDs(aDynId) {
	if(tracingIDs.indexOf(aDynId) == -1) {
		tracingIDs = tracingIDs+aDynId;
	}
}

var dataAlreadyLoaded = false;
var externalResources = new Array();
var externalResourceIndex = 0;
function loadExternalData() {
	if(dataAlreadyLoaded) {return;}
	externalResourceIndex = 0;
	callExternalData();
}
var destinationLayer = null;
function callExternalData() {
	if(externalResourceIndex < externalResources.length) {
		var thisRes = externalResources[externalResourceIndex];
		externalResourceIndex++;
		destinationLayer = thisRes[0];
		destinationPath = thisRes[1];
		loadFile(destinationPath);
	} else {
		dataAlreadyLoaded = true;
		if(mustRedraw) {
			mustRedraw = false;
			manageWebpageContents();
		}
		var pName = trimLangID(pageName);
		if((pName.indexOf('_') != -1) && (pName.indexOf('my_') == -1)) {
			theID = pName.split('_');
			theID = theID[0];
		} else {
			theID = pName;
		}
		theID = 'page:'+theID;
		var whatItem = getItemByUID(theID);
		if(whatItem && ((whatItem.getAttribute('btype')) && (whatItem.getAttribute('btype') == 'pushbutton'))) {
			setButtonpict(whatItem,1);
			whatItem.setAttribute('lockedpict','1');
		}
		if(theDinamicFrame) {
			setTimeout('dynamicAutoload()',10);
		} else {
			canCloseLoadFiles = true;
			theDinamicFrame = null
			closeLoadfiles();
		}
	}
}
var searchLoc = '';
var searchIndex = 0;
var searchArray = null;
function dynamicAutoload() {
	if(window.location.search) {
		var theSearch = window.location.search;
		if(theSearch.indexOf('?') != -1) {
			searchArray = theSearch.split('?');
		} else {
			searchArray = new Array(theSearch);
		}
		searchIndex++;
		theSearch = searchArray[searchIndex];
		if(theSearch && (theSearch.indexOf('=') != -1)) {
			if(theSearch != searchLoc) {
				searchLoc = theSearch;
				if(searchLoc.indexOf('=') != -1) {
					var dynPage = searchLoc.split('=')[1];
				} else {
					var dynPage = searchLoc;
				}
				if(theDinamicFrame) {
					theDinamicFrame.setAttribute('linkHref',dynPage);
				}
			}
		}
	}
	if(theDinamicFrame.getAttribute('linkHref')) {
		destinationLayer = theDinamicFrame;
		var defaultPath = destinationLayer.getAttribute('linkHref');
		destinationLayer.removeAttribute('linkHref');
		destinationLayer.removeAttribute('linkType');
		destinationLayer.removeAttribute('linkmode');
		loadFile(defaultPath);
	}
}
var loadfileConnexionLayer = null;
var loadfilePath = '';
var loadedPaths = '';
function loadFile(destinationPath) {
	if(theDinamicFrame) {
		loadedPaths = '';
	}
	loadfileConnexionLayer = document.getElementById('_socket');
	if(destinationPath.indexOf('/') != -1) {destinationPath = '';}
	if(loadfileConnexionLayer && destinationPath && (loadedPaths.indexOf(destinationPath) == -1)) {
		pageLoaded = false;
		loadfileConnexionLayer.style.display = 'block';
		destinationPath = myAbsolutePath+destinationPath;
		loadedPaths = loadedPaths+destinationPath;
		loadfilePath = destinationPath;
/* 		if(theBrowserName != 'explorer') {loadfileConnexionLayer.src = 'about:blank';} */
		loadfileConnexionLayer.src = destinationPath;
	}
}
var canCloseLoadFiles = false;
function closeLoadfiles() {
	if(canCloseLoadFiles) {
		if(loadfileConnexionLayer) {
			if(pageLoaded) {
				if(theBrowserName != 'explorer') {loadfileConnexionLayer.src = 'about:blank';}
			}
			loadfileConnexionLayer.style.display = 'none';
			loadfileConnexionLayer = null;
		}
	} else {
		canCloseLoadFiles = true;
	}
}
var importingNodes = null;
var importingNodesIndex = 0;
var dTop = 0;
var dLeft = 0;
function importExternalData(newData) {
	if(destinationLayer) {
		dTop = parseInt(destinationLayer.style.top);
		dLeft = parseInt(destinationLayer.style.left);
		destinationLayer.innerHTML = newData;
		importingNodes = destinationLayer.childNodes;
		importingNodes = onlyValidNodes(importingNodes);
/* 		importingNodes = bubbleSortByTops(importingNodes); */
		if(theDinamicFrame/* && destinationLayer && (theDinamicFrame == destinationLayer)*/) {
			var targetID = theDinamicFrame.getAttribute('dynID');
			var theLinkedItems = collectItemsByDynamicId(targetID);
			for(var i = 0; i < theLinkedItems.length; i++) {
				var thisItem = theLinkedItems[i];
				thisItem.parentNode.removeChild(thisItem);
			}
			tracingIDs = tracingIDs.split(targetID);
			tracingIDs = tracingIDs[0]+targetID;
			thisItem = null;
/* 			if(theBrowserName == 'explorer') { */
/* 				pageweb.focus() */
/* 			} else { */
/* 				document.body.scrollTop = 0; */
/* 			} */
			objectCollection = new Array();
			for(var i = 0; i < pageweb.childNodes.length; i++) {
				aWebpageObj = pageweb.childNodes[i];
				var myType = false;
				try {
					var myType = aWebpageObj.getAttribute('btype');
				} catch(e) {
				}
				if(myType) {
					objectCollection[objectCollection.length] = aWebpageObj;
				}
			}
			objectCollection = bubbleSortByTops(objectCollection);
		}
		importingNodesIndex = 0;
		setTimeout('doExternaldataLoad()',1);
	}
}
var tracingIDs = '';
var dynZoneBottomOffset = 0;
var dynZoneRightOffset = 0;
function doExternaldataLoad() {
	if(importingNodesIndex < importingNodes.length) {
		var aNode = importingNodes[importingNodesIndex];
		importingNodesIndex++;
		var isValid = false;
		try {
			aNode.getAttribute('btype');
			if(aNode.getAttribute('btype')) {
				isValid = true;
			}
		} catch(e) {
		}
		if(isValid) {
			if(aNode && ((aNode.getAttribute('btype')) && (aNode.getAttribute('btype') != 'pagebkg'))) {
				currentObject = pageweb.appendChild(aNode/* .cloneNode(true) */);
				if(theDinamicFrame/* && destinationLayer && (theDinamicFrame == destinationLayer)*/) {
					currentObject.setAttribute('dynamicId',tracingIDs);
/* 					currentObject.setAttribute('title',tracingIDs); */
/*					alert(tracingIDs)*/
				}
				var aTop = parseInt(currentObject.style.top);
				var aLeft = parseInt(currentObject.style.left);
				var aHeight = parseInt(currentObject.style.height);
				var aWidth = parseInt(currentObject.style.width);
				var itemTop = (dTop+aTop);
				var itemLeft = (dLeft+aLeft);
				var itemBotton = itemTop+aHeight;
				var itemRight = itemLeft+aWidth;
				var itemBotton = itemBotton+dynZoneBottomOffset;
				var itemRight = itemRight+dynZoneRightOffset;
				if(currentObject.getAttribute('brs')) {
					objRightOffset = parseInt(currentObject.getAttribute('rval'));
					if(!objRightOffset) {objRightOffset = 0;}
					currentObject.setAttribute('rval',objRightOffset+dynZoneRightOffset);
					objBottomOffset = parseInt(currentObject.getAttribute('bval'));
					if(!objBottomOffset) {objBottomOffset = 0;}
					currentObject.setAttribute('bval',objBottomOffset+dynZoneBottomOffset);
				} else if(currentObject.getAttribute('trs')) {
					objRightOffset = parseInt(currentObject.getAttribute('rval'));
					if(!objRightOffset) {objRightOffset = 0;}
					currentObject.setAttribute('rval',objRightOffset+dynZoneRightOffset);
				} else if(currentObject.getAttribute('bls')) {
					objBottomOffset = parseInt(currentObject.getAttribute('bval'));
					if(!objBottomOffset) {objBottomOffset = 0;}
					currentObject.setAttribute('bval',objBottomOffset+dynZoneBottomOffset);
				}
				if(itemBotton > parseInt(pageweb.style.height)) {
					pageweb.style.height = itemBotton+'px';
					pageweb.setAttribute('mh',itemBotton);
					mustRedraw = true;
				}
				if(itemRight > parseInt(pageweb.style.width)) {
					pageweb.style.width = itemRight+'px';
					pageweb.setAttribute('mw',itemRight);
					mustRedraw = true;
				}
				currentObject.style.top = itemTop+'px';
				currentObject.style.left = itemLeft+'px';
				var myZindex = parseInt(currentObject.style.zIndex)+100;
				currentObject.style.zIndex = (pageweb.childNodes.length)+myZindex;
				objectCollection[objectCollection.length] = currentObject;
				if(currentObject.getAttribute('originaltop')) {
					var aTop = parseInt(currentObject.getAttribute('originaltop'));
					var itemTop = (dTop+aTop);
					currentObject.setAttribute('originaltop',itemTop+'px');
				}
				if(currentObject.getAttribute('originalleft')) {
					var aLeft = parseInt(currentObject.getAttribute('originalleft'));
					var itemLeft = (dLeft+aLeft);
					currentObject.setAttribute('originalleft',itemLeft+'px');
				}
				drawItem();
			}
		}
		setTimeout('doExternaldataLoad()',1);
	} else {
		pageLoaded = true;
		if(destinationLayer) {
			var myDinID = destinationLayer.getAttribute('dynID');
			addrefToTracingIDs(myDinID);
			destinationLayer.innerHTML = '';
			destinationLayer = null;
		}
		if(objectCollection) {
			objectCollection = bubbleSortByTops(objectCollection);
		}
		setTimeout('callExternalData()',1);
	}
}

function overString(evt) {
	if(theBrowserName == 'explorer') {
		aString = event.srcElement;
	} else {
		aString = evt.target;
	}
	if(aBrowser.indexOf('safari') != -1) {
		aString = evt.target.parentNode;
	}
	if(aString.getAttribute('linkHref')) {
		window.status = aString.getAttribute('linkHref');
		if(aString.getAttribute('linkType') && (aString.getAttribute('linkType') == 'togglevisibility')) {
			var targetItem = getItemByUID(aString.getAttribute('linkHref'));
			if(targetItem) {
				if(targetItem.getAttribute('showatstartup')) {
					showItem(targetItem);
				}
			}
		}
	}
}
function outString(evt) {
	if(theBrowserName == 'explorer') {
		aString = event.srcElement;
	} else {
		aString = evt.target;
	}
	if(aBrowser.indexOf('safari') != -1) {
		aString = evt.target.parentNode;
	}
	if(aString.getAttribute('linkHref')) {
		window.status = '';
		hideItem();
	}
}
function downString(evt) {
	if(theBrowserName == 'explorer') {
		aString = event.srcElement;
	} else {
		aString = evt.target;
	}
	if(aBrowser.indexOf('safari') != -1) {
		aString = evt.target.parentNode;
	}
}
function upString(evt) {
	if(theBrowserName == 'explorer') {
		aString = event.srcElement;
	} else {
		aString = evt.target;
	}
	if(aBrowser.indexOf('safari') != -1) {
		aString = evt.target.parentNode;
	}
	if(aString.getAttribute('linkHref')) {
		theLink = aString.getAttribute('linkHref');
		theMode = aString.getAttribute('linkmode');
		theType = aString.getAttribute('linkType');
		if(theMode == 'd') {
			var aDynId = aString.getAttribute('targetzone');
			setDinFrame(aDynId);
		}
		loadPage(theLink,theMode,theType);
	}
}

var checkedButton = false;
function buttonSetup(aButton) {
	if(!checkedButton) {
		checkedButton = true;
	}
	aButton.onmouseover = overButton;
	aButton.onmouseout = outButton;
	aButton.onmousedown = downButton;
	aButton.onmouseup = upButton;
	setCursor(aButton,'pointer');
	if(aButton.getAttribute('ispulldownbutton')) {
		var targetMenu = findLinkedItemByRefID(aButton);
		if(targetMenu) {
			var nowTime = new Date();
			nowTime = nowTime.getTime();
			targetMenu.setAttribute('refID',nowTime);
			aButton.setAttribute('refID',nowTime);
		}
	}
	drawGbox(aButton);
}

function overButton(evt) {
	if(theBrowserName == 'explorer') {
		aButton = event.srcElement;
	} else {
		aButton = evt.target;
	}
	while(!aButton.getAttribute('btype') && (aButton != document.body)) {aButton = aButton.parentNode;}
	if(aButton.getAttribute('btype') != 'pushbutton'){return;}
	setButtonpict(aButton,1);
	if(aButton.getAttribute('ispulldownbutton')) {
		var targetMenu = findLinkedItemByRefID(aButton);
		if(targetMenu) {
			showPulldownMenu(aButton,targetMenu);
			return;
		}
	}
	if(aButton.getAttribute('linkHref')) {
		if(aButton.getAttribute('linkHref') != 'undefined') {
			window.status = aButton.getAttribute('linkHref');
			if(aButton.getAttribute('linkType') && (aButton.getAttribute('linkType') == 'togglevisibility')) {
				var targetItem = getItemByUID(aButton.getAttribute('linkHref'));
				if(targetItem) {
					if(targetItem.getAttribute('showatstartup')) {
						showItem(targetItem);
					}
				}
			}
		}
	}
}
function outButton(evt) {
	if(theBrowserName == 'explorer') {
		aButton = event.srcElement;
	} else {
		aButton = evt.target;
	}
	while(!aButton.getAttribute('btype') && (aButton != document.body)) {aButton = aButton.parentNode;}
	if(aButton.getAttribute('btype') != 'pushbutton'){return;}
	if(!displayedPageMenuButton) {
		setButtonpict(aButton,0);
	} else {
		if(aButton != displayedPageMenuButton) {
			setButtonpict(aButton,0);
		}
	}
	if(aButton.getAttribute('linkHref')) {
		window.status = '';
		hideItem();
	}
}
function downButton(evt) {
	if(theBrowserName == 'explorer') {
		aButton = event.srcElement;
	} else {
		aButton = evt.target;
	}
	while(!aButton.getAttribute('btype') && (aButton != document.body)) {aButton = aButton.parentNode;}
	if(aButton.getAttribute('btype') != 'pushbutton'){return;}
	setButtonpict(aButton,2);
}
function upButton(evt) {
	if(theBrowserName == 'explorer') {
		aButton = event.srcElement;
	} else {
		aButton = evt.target;
	}
	while(!aButton.getAttribute('btype') && (aButton != document.body)) {aButton = aButton.parentNode;}
	if(aButton.getAttribute('btype') != 'pushbutton'){return;}
	setButtonpict(aButton,1);
	if(aButton.getAttribute('linkHref')) {
		if(aButton.getAttribute('linkHref') != 'undefined') {
			theLink = aButton.getAttribute('linkHref');
			theMode = aButton.getAttribute('linkmode');
			theType = aButton.getAttribute('linkType');
			if(theMode == 'd') {
				var aDynId = aButton.getAttribute('targetzone');
				setDinFrame(aDynId);
			}
			loadPage(theLink,theMode,theType);
		}
	}
}

var displayedPageMenu = null;
var displayedPageMenuLayer = null;
var displayedPageMenuButton = null;
function showPulldownMenu(aButton,aMenu) {
	displayedPageMenuButton = aButton;
	var theTop = parseInt(aButton.style.top);
	var theLeft = parseInt(aButton.style.left);
	var theBottom = theTop+parseInt(aButton.style.height);
	var theRight = theLeft+parseInt(aButton.style.width);
	displayedPageMenu = aMenu;
	var theLock = document.createElement('IMG');
	theLock.src = 'a.gif';
	theLock.style.position = 'absolute';
	theLock.style.zIndex = 1000;
	theLock = displayedPageMenu.appendChild(theLock);
	theLock.style.top = aButton.style.top;
	theLock.style.left = aButton.style.left;
	theLock.style.height = aButton.style.height;
	theLock.style.width = aButton.style.width;
	displayedPageMenu.style.zIndex = 990;
	displayedPageMenu.setAttribute('canBeHidden','1');
	displayedPageMenu.style.top = displayedPageMenu.style.left = 0+'px';
	displayedPageMenu.style.width = pageweb.style.width;
	displayedPageMenu.style.height = pageweb.style.height;
	displayedPageMenuLayer = displayedPageMenu.getElementsByTagName('DIV')[0];
	if(theBrowserName == 'explorer') {
		displayedPageMenu.getElementsByTagName('IMG')[0].onmouseover = hidePulldownMenu;
		displayedPageMenuLayer.onclick = hidePulldownMenu;
	} else {
		displayedPageMenu.getElementsByTagName('IMG')[0].addEventListener('mouseover',hidePulldownMenu,false);
		displayedPageMenuLayer.addEventListener('click',hidePulldownMenu,false);
	}
	if(displayedPageMenuLayer.getAttribute('dsplpos') == 'bottom') {
		displayedPageMenuLayer.style.top = theBottom+'px';
		displayedPageMenuLayer.style.left = theLeft+'px';
	} else if(displayedPageMenuLayer.getAttribute('dsplpos') == 'right') {
		displayedPageMenuLayer.style.top = theTop+'px';
		displayedPageMenuLayer.style.left = theRight+'px';
	}
}
function hidePulldownMenu() {
	if(displayedPageMenu && displayedPageMenu.getAttribute('canBeHidden')) {
		displayedPageMenu.style.width = 1+'px';
		displayedPageMenu.style.height = 1+'px';
		setButtonpict(displayedPageMenuButton,0);
		displayedPageMenuButton = null;
	}
}

function findLinkedItemByRefID(anItem) {
	if(anItem.getAttribute('refID')) {
		var theRefID = anItem.getAttribute('refID');
		var tempList = new Array();
		var theNodes = pageweb.childNodes;
		for(var i = 0; i < theNodes.length; i++) {
			var aNode = theNodes[i];
			if(aNode.tagName == 'DIV') {
				if(aNode.getAttribute('refID') && (aNode.getAttribute('refID') == theRefID) && (aNode != anItem) && (aNode.getAttribute('btype') != 'pushbutton')) {
					return aNode;
				}
			}
		}
	}
	return null;
}

var toggleTimer = null;
var toggleTimerOn = false;
var currentVisibleItem = null;
function showItem(anItem) {
	if(anItem.getAttribute('showatstartup') == '0') {
		anItem.style.top = anItem.getAttribute('originaltop');
		anItem.style.left = anItem.getAttribute('originalleft');
		currentVisibleItem = anItem;
	} else if(anItem.getAttribute('showatstartup') == '1') {
		if(anItem.getAttribute('imhidden')) {
			anItem.style.top = anItem.getAttribute('savedtop');
			anItem.style.left = anItem.getAttribute('savedleft');
			anItem.removeAttribute('imhidden');
			currentVisibleItem = anItem;
		} else {
			if(!anItem.getAttribute('savedtop')) {
				anItem.setAttribute('savedtop',anItem.style.top);
				currentVisibleItem = anItem;
			} else {
				anItem.style.top = '-10000px';
				anItem.setAttribute('imhidden','1');
				currentVisibleItem = null;
			}
			if(!anItem.getAttribute('savedleft')) {
				anItem.setAttribute('savedleft',anItem.style.left);
				currentVisibleItem = anItem;
			} else {
				anItem.style.left = '-10000px';
				anItem.setAttribute('imhidden','1');
				currentVisibleItem = null;
			}
		}
	}
	if(lastShownItem && currentVisibleItem && (lastShownItem != currentVisibleItem)) {
		if(toggleTimerOn) {clearTimeout(toggleTimer);}
		toggleTimerOn = false;
		lastShownItem.style.top = '-10000px';
		lastShownItem.style.left = '-10000px';
		if(lastShownItem.getAttribute('showatstartup') == '1') {
			lastShownItem.setAttribute('imhidden','1');
		}
		lastShownItem = null;
	}
}
var lastShownItem = null;
function hideItem() {
	if(currentVisibleItem) {
		lastShownItem = currentVisibleItem;
		currentVisibleItem = null;
		if(toggleTimerOn) {clearTimeout(toggleTimer);}
		toggleTimer = setTimeout('hideCurrentdisplayedItem()',350);
		toggleTimerOn = true;
	}
}
function hideCurrentdisplayedItem() {
	toggleTimerOn = false;
	if(lastShownItem && (lastShownItem != currentVisibleItem)) {
		lastShownItem.style.top = '-10000px';
		lastShownItem.style.left = '-10000px';
		if(lastShownItem.getAttribute('showatstartup') == '1') {
			lastShownItem.setAttribute('imhidden','1');
		}
		lastShownItem = null;
	}
}

function getItemByUID(anUID) {
	var thisItem = null;
	var theNodes = pageweb.childNodes;
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		if(aNode.tagName && (aNode.tagName == 'DIV')) {
			if(aNode.getAttribute('item_uID') && (aNode.getAttribute('item_uID') == anUID)) {
				return aNode;
			}
		}
	}
	return thisItem;
}

function checkCommand(aCommand) {
	if(aCommand == 'logmanager') {
		return true;
	} else if(aCommand == 'logguest') {
		return true;
	} else if(aCommand == 'settryout') {
		return true;
	} else if(aCommand == 'setsmart') {
		return true;
	} else if(aCommand == 'setmy') {
		return true;
	} else if(aCommand == 'setpro') {
		return true;
	} else if(aCommand == 'setdataweb') {
		return true;
	} else if(aCommand == 'seteshop') {
		return true;
	} else if(aCommand.indexOf(';') != -1) {
		return true;
	} else {
		return false;
	}
}
var whatCommand = '';
function loadCommand(theLink) {
	whatCommand = theLink;
	var validCommand = checkCommand(whatCommand);
	if(validCommand) {
		aSocket = window.open('http://www.clicktoweb.com/untitled/com/actions.html','actionswin','toolbars=0,top=10000,left=10000,width=1,height=1');
/* 		aSocket = window.open('http://server001.clicktoweb.com/com/actions.html','actionswin','toolbars=0,top=10000,left=10000,width=100,height=100'); */
	}
}

var winMode = 'a';
function loadPage(theLink,theMode,theType) {
	if(theType == 'action') {
		if(theLink == 'closewindow') {
			try {
				if((!parent.opener) || (!parent.opener.winMode)) {theLink = 'goback';}
			} catch(e) {
			}
		}
		if(theLink == 'sendform') {
			sendForm();
		} else if(theLink == 'sendmail') {
			sendmail();
		} else if(theLink == 'goback') {
			window.history.go(-1);
		} else if(theLink == 'closewindow') {
			window.close();
		} else {
			loadCommand(theLink);
		}
	} else {
		if(!theMode) {theMode = 'a';}
		aWin = null;
		winMode = theMode;
		if(theMode == 'a') {
			window.location.href = theLink;
		} else if(theMode == 'b') {
			aWin = window.open(theLink);
		} else if(theMode == 'c') {
			aWin = window.open(theLink,'window','toolbars=0,resizable=1,statusbar=1,scrollbars=1');
		} else if(theMode == 'd') {
			if(theDinamicFrame) {
				destinationLayer = theDinamicFrame;
				loadFile(theLink);
			}
		}
		if(aWin) {setTimeout('aWin.focus()',350);}
	}
}

function setButtonpict(aButton,buttonState) {
	try {
		if(aButton) {
			if(aButton.getAttribute('lockedpict')) {return;}
			aButton.getElementsByTagName('IMG')[0].style.top = (-1000)+'px';
			aButton.getElementsByTagName('IMG')[1].style.top = (-1000)+'px';
			aButton.getElementsByTagName('IMG')[2].style.top = (-1000)+'px';
			aButton.getElementsByTagName('IMG')[buttonState].style.top = 0+'px';
		}
	} catch(e) {
	}
}

function getFlashlink(moviename) {
	pageweb = document.getElementById('databox').childNodes[0];
	var theBoxes = pageweb.childNodes;
	var tempBoxes = new Array()
	for(var i = 0; i < theBoxes.length; i++) {
		var theBox = theBoxes[i];
		if((theBox.tagName) && (theBox.tagName.toLowerCase() == 'div')) {
			tempBoxes[tempBoxes.length] = theBox;
		}
	}
	theBoxes = tempBoxes;
	for(var i = 0; i < theBoxes.length; i++) {
		var theBox = theBoxes[i];
		if(theBox.getAttribute('medianame')) {
			theName = theBox.getAttribute('medianame');
			if(theName == moviename) {
				theLink = theBox.getAttribute('linkHref');
				theMode = theBox.getAttribute('linkmode');
				theType = theBox.getAttribute('linkType');
				if(theMode == 'd') {
					var aDynId = theBox.getAttribute('targetzone');
					setDinFrame(aDynId);
				}
				if(theLink) {loadPage(theLink,theMode,theType);}
				return;
			}
		}
	}
}


var statConnexionLayer = null;
function statPage() {
	if(!webName) {return;}
	statConnexionLayer = document.getElementById('_socket');
	if(statConnexionLayer) {
		statConnexionLayer.style.display = 'block';
		statsPath = 'http://'+baseServer+'/stats.php?statdata='+webName+':'+pageName;
		if(theBrowserName != 'explorer') {statConnexionLayer.src = 'about:blank';}
		statConnexionLayer.src = statsPath;
		setTimeout('statsOk()',1000);
	}
}
function statsOk() {
	if(statConnexionLayer) {
		if(theBrowserName != 'explorer') {statConnexionLayer.src = 'about:blank';}
		statConnexionLayer.style.display = 'none';
		statConnexionLayer = null;
	}
}


function getOs() {
	if(navigator.appVersion.toLowerCase().indexOf('mac') != -1) {
		return 'MacOs';
	} else {
		return 'WinOs';
	}
}

function getBversion() {
	theVersion = navigator.appVersion.toLowerCase();
	if(theVersion.indexOf('msie 5.') != -1) {
		if(theVersion.indexOf('mac') != -1) {
			return 'ok';
		} else {
			return 'bad';
		}
	} else {
		return 'ok';
	}
}

function deUcode(uString) {
	if(uString == '') {return uString;}
	txtStr = '';
	charCodesList = uString.split('_');
	for(k = 0; k < charCodesList.length; k++) {
		aCode = charCodesList[k];
		theTxtChar = String.fromCharCode(parseInt(aCode));
		txtStr = txtStr+theTxtChar;
	}
	return txtStr;
}

function bubbleSortByTops(thisList) {
	for(i = 0; i < thisList.length; i++) {
		for(j = i+1; j < thisList.length; j++) {
			jItem = thisList[j];
			iItem = thisList[i];
			if(parseInt(jItem.style.top) < parseInt(iItem.style.top)) {
				dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
}


function bubbleSortByTabIndex(thisList) {
	for(i = 0; i < thisList.length; i++) {
		for(j = i+1; j < thisList.length; j++) {
			jItem = thisList[j];
			iItem = thisList[i];
			if((jItem.getAttribute('tabIndex')) && (iItem.getAttribute('tabIndex'))) {
				if(parseInt(jItem.getAttribute('tabIndex')) < parseInt(iItem.getAttribute('tabIndex'))) {
					dummy = thisList[i];
					thisList[i] = thisList[j];
					thisList[j] = dummy;
				}
			}
		}
	}
	return thisList;
}


function docGetWidth() {
	if(navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
		return document.body.clientWidth;
	} else {
		if(navigator.appVersion.toLowerCase().indexOf('safari') != -1) {
			return window.innerWidth;
		} else {
			return document.body.offsetWidth;
		}
	}
}
function docGetHeight() {
	if(navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
		return document.body.clientHeight;
	} else {
		return window.innerHeight;
	}
}

function trimLangID(aPagename) {
	if(!aPagename) {return;}
	var pagenameLangIdentifierString = '|'+aPagename.substring(0,3)+'|';
	if(alllangsStrings.indexOf(pagenameLangIdentifierString) != -1) {
		pagenamePageIdentifier = aPagename.substring(3,(aPagename.length));
		return pagenamePageIdentifier;
	}
	return aPagename;
}

function addOption(menuObject,optionValue,optionLabel,optionSelected) {
	menuLength = menuObject.length;
	optionLabel = convertTxt(optionLabel);
	menuObject.options[menuLength] = new Option(optionLabel,optionValue);
	if(optionSelected) {
		menuObject.options[menuLength].setAttribute('selected',true);
	}
}

function setCursor(whatObj,newCursor) {
	try {
		whatObj.style.cursor = newCursor;
	} catch(e) {
	}
}


function checkTextField(aTxtField) {
	var alertString = convertTxt(defaultAlertString);
	if(aTxtField.getAttribute('errorstring')) {
		var errString = aTxtField.getAttribute('errorstring');
		errString = convertTxt(errString);
		alertString = alertString+'\n\n'+errString;
	}
	var invalidChars = alwaysForbiddenChars.split('');
	var myvalue = aTxtField.value;
	if(myvalue) {
		for(var j = 0; j < invalidChars.length; j++) {
			var anInvalidChar = invalidChars[j];
			if(myvalue.indexOf(anInvalidChar) != -1) {
				alert(alwaysforbiddenAlertString);
				aTxtField.select();
				return false;
			}
		}
	}
	if(aTxtField.getAttribute('ismandatory') && (aTxtField.getAttribute('ismandatory') == '1')) {
		var fieldValue = aTxtField.value;
		if(!fieldValue) {
			alert(alertString);
			aTxtField.select();
			return false;
		}
		if(aTxtField.getAttribute('allowedchars')) {
			var theAllowedChars = aTxtField.getAttribute('allowedchars');
			var theUsedChars = fieldValue.split('');
			for(var j = 0; j < theUsedChars.length; j++) {
				var aChar = theUsedChars[j];
				if(theAllowedChars.indexOf(aChar) == -1) {
					alert(alertString);
					aTxtField.select();
					return false;
				}
			}
		}
		if(aTxtField.getAttribute('mandatorychars')) {
			var theMandatorychars = aTxtField.getAttribute('mandatorychars');
			var theUsedChars = theMandatorychars.split('');
			for(var j = 0; j < theUsedChars.length; j++) {
				var aChar = theUsedChars[j];
				if(fieldValue.indexOf(aChar) == -1) {
					alert(alertString);
					aTxtField.select();
					return false;
				}
			}
/* 		if(aTxtField.getAttribute('forbiddenchars')) { */
/* 			var theMandatorychars = aTxtField.getAttribute('mandatorychars'); */
/* 			var theUsedChars = theMandatorychars.split(''); */
/* 			for(var j = 0; j < theUsedChars.length; j++) { */
/* 				var aChar = theUsedChars[j]; */
/* 				if(fieldValue.indexOf(aChar) == -1) { */
/* 					alert(alertString); */
/* 					aTxtField.select(); */
/* 					return false; */
/* 				} */
/* 			} */
			if(theMandatorychars == '@.') {
				var validMail = performMailaddressCheck(fieldValue);
				if(!validMail) {
					alert(alertString);
					aTxtField.select();
					return false;
				}
			}
		}
	}
	return true;
}

function performMailaddressCheck(aMailAddress) {
	if(aMailAddress.length < 10) {
		return false;
	}
	if(aMailAddress.indexOf('@') < 2) {
		return false;
	}
	if(aMailAddress.indexOf('@.') != -1) {
		return false;
	}
	if(aMailAddress.indexOf('.@') != -1) {
		return false;
	}
	mailCheck = aMailAddress.split('@');
	if(mailCheck.length != 2) {
		return false;
	}
	mailCheck = aMailAddress.split('.');
	mailCheck = mailCheck[mailCheck.length-1];
	if(mailCheck.length < 2) {
		return false;
	}
	return true;
}

function onlyValidNodes(nodesList) {
	var theNodes = new Array();
	for(var nodesLoop = 0; nodesLoop < nodesList.length; nodesLoop++) {
		var aNode = nodesList[nodesLoop];
		if(aNode.tagName) {
			theNodes[theNodes.length] = aNode;
		}
	}
	return theNodes;
}

function drawPopup(aPopup) {
	var anArray = new Array();
	var popupData = aPopup.getAttribute('formule');
	popupData = popupData.split(':');
	for(var i = 1; i < popupData.length; i++) {
		anArray[anArray.length] = popupData[i];
	}
	var aPopup = makePopUp(aPopup);
	var optionSelected = true;
	for(var i = 0; i < anArray.length; i++) {
		var anItemName = anArray[i];
		addOption(aPopup,anItemName,anItemName,optionSelected);
		optionSelected = false;
	}
}
function makePopUp(refItem) {
	var targetContainer = refItem.parentNode;
	var itemTop = refItem.style.top;
	var itemLeft = refItem.style.left;
	var itemWidth = refItem.style.width;
	var itemHeight = refItem.style.height;
	var itemZindex = refItem.style.zIndex;
	var itemTabIndex = refItem.getAttribute('tabIndex');
	var itemName = refItem.name;
	var newItem = document.createElement('SELECT');
	newItem = targetContainer.insertBefore(newItem,refItem);
	targetContainer.removeChild(refItem);
	refItem = null;
	newItem.style.position = 'absolute';
	newItem.style.display = 'block';
	newItem.style.fontSize = '14px';
	if(theBrowserName == 'safari') {
		itemLeft = (parseInt(itemLeft)-5)+'px';
	}
	newItem.style.top = itemTop;
	newItem.style.left = itemLeft;
	newItem.style.zIndex = itemZindex;
	newItem.setAttribute('tabIndex',itemTabIndex);
	newItem.name = itemName;
	return newItem;
}

function convertTxtList(anArray) {
	for(var j = 0; j < anArray.length; j++) {
		anArray[j] = convertTxt(anArray[j]);
	}
	return anArray;
}
var txtConverter = null;
function convertTxt(txtStr) {
	if(!txtConverter) {
		txtConverter = document.createElement('SPAN');
		txtConverter = document.body.appendChild(txtConverter);
		txtConverter.style.visibility = 'hidden';
	}
	txtConverter.innerHTML = txtStr;
	txtStr = txtConverter.innerHTML;
	return txtStr;
}
function nobreakTxt(txtString) {
	if(txtString.indexOf(' ') != -1) {
		txtString = txtString.split(' ');
		txtString = txtString.join('&nbsp;');
	}
	if(txtString.indexOf('-') != -1) {
		txtString = txtString.split('-');
		txtString = txtString.join('&nbsp;');
	}
	return txtString;
}

function donothing() {return false;}
window.oncontextmenu = donothing;


window.onresize = manageWebpageContents;
