//###
var pageLoaded, cartLoader,dbItemsColorSet,exportTips,alwaysVATexempt,VATexemptVATnumber,theMandatoryItemsArray,showCustomizedRefs,itemsRealPricesArray,dbData,numItemsInfos,hasNumitemsOptions,printWindow,pageFullHeight,showConfigCaddyInfos,secureShopping,theLand,readDoc,siteVersions,savedBodyScroll,dloadTarget,handleCustomDBitem,dbLoading,theDBcontainer,hideEmptyFields,shippingZones,hilitedButton,searchResultsLayer,loadedPage,loadingPage,pricingMode,formPictures,newClientType,shopAccess,sysAccessCode,inscriptionBehaviour,currentSelectedForumUser,mod_printer,memberMailBox,getUserAccess,agifAbsolutePath,supportLib,caddyActionItems,caddyArticleID,caddyProductID,currencyName,currencyID,currencyCode,defaultDeliveryMode,defaultPaymentMode,hasDeliveryOptions,hasPaymentOptions,getDBheaders,accountsBDheaders,salesdataBDheaders,allDBheaders,translatedDBheaders,formTarget,formTop,formLeft,formWidth,formHeight,theOrderPage,orderLoaded,cartLoaded,theShoppingChart,requiredFieldAlert,forbiddenCharsAlert,alwaysForbiddenChars,defaultAlertString,mappedDBitems,shopDrawn,shopType,shopBehavior,shopLib,shopAllowed,searchResultFile,searchDBfile,contactsResultFile,forumCode,contactsCode,forumPage,contactsPage,contactsStarted,startForum,forumResultFile,dbMultiprintAllowed,dbSortOrder,dbShowSearches,dbFineSearches,initShopVars,lastShownItem,pageName,pageGlobalName,shopCode,membersCode,inscriptionCode,favoritesCode,pageweb,myAbsolutePath,userRef,tracingIDs,xmlhttp,ecomm_xmlhttp,drawLoop,webName,thePageBkg,objectCollection,currentObject,currentObjectIndex,theBrowserName,theBrowserVersion,alllangsStrings,allLangsNames,userLang,localStrings,shoponline,caddyInfos,isCaddyContentsRead,isCaddyContentsDeleting,keepHcentered,keepVcentered,keepOnTop,theDinamicFrame,mailnotifyAddress,mailSubject,documentPath,replyPath,dontReplyPath,showSentmailConfirmation,drawPageTimer,drawPageTimerOn,communityTimer,communityTimerOn,communicationLayer,loadfileConnexionLayer,loadfilePath,loadedPaths,cartItemsMaster,favoritesItemsMaster,orderHistoryBox,admindataLayer,memberslistLayer,clientslistLayer,paymentsLayer,paymentsMask,isPaimentCanceled,cartItemsList,orderReportContainer,lockTheBack,checkUserAccess,accessType,accessLogg,accessPass,drawAdminaccountInterface,toManageYourShopStr,isGettingShopResources,memberBonus,eMemberUniqueID,currentMemberUniqueID,paypalBusinessID,paypalBusinessName,paypalReturnpath,paypalCancelreturnpath,paypalNotifypath,paypalActive,dlogLightBkgColor,dlogDarkBkgColor,listItemDefaultColor,listItemHiliteBkgColor,listItemSelectedColor,listItemSelectedBkgColor,genericLinkColor,defaultLang,baseServer,eMembersPlugin,eCommunityPlugin,eCommunityRunning,eResellersPlugin,eRepresentantsPlugin;

document.write('<script src="scripts.js?'+(new Date().getTime())+'" type="text/javascript" charset="iso-8859-1"></script>');

var embedFlashStr = '<embed src="flashmoviename.swf" allowFullScreen="true" menu="false" quality="high" bgcolor="#FFFFFF"  WIDTH="ITEMWIDTH" HEIGHT="ITEMHEIGHT" wmode="transparent" FLASHVARS=" xmlURL=" TYPE="application/x-shockwave-flash"></embed>';
var embedMovieStr = '<embed src="quicktimemoviename.mov" width="ITEMWIDTH" height="ITEMHEIGHT" controller="true" loop="false" autostart="false"></embed>';

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

function shopIt() {
	return true;
};
function initializeCommonVariables() {
	theBrowserVersion = navigator.userAgent.toLowerCase();
	if(theBrowserVersion.indexOf('safari') != -1) {
		theBrowserName = 'safari';
	} else if(theBrowserVersion.indexOf('firefox') != -1) {
		theBrowserName = 'firefox';
	} else if(theBrowserVersion.indexOf('msie') != -1) {
		theBrowserName = 'explorer';
	} else {
		theBrowserName = 'unknown';
	}
	exportTips = localizeString('To export the data, copy the selected text here below, then paste it in your favorite spreadsheet software.');
	theMandatoryItemsArray = null;
	showCustomizedRefs = false;
	pageLoaded = false;
	itemsRealPricesArray = null;
	dbData = null;
	numItemsInfos = null;
	hasNumitemsOptions = 'yes';
	dbItemsColorSet = '#333333';
	printWindow = null;
	pageFullHeight = 'no';
	readDoc = null;
	dloadTarget = 'file';
	dbLoading = null;
	shippingZones = new Array();
	alwaysVATexempt = '';
	VATexemptVATnumber = '';
	hilitedButton = 2;
	hideEmptyFields = false;
	searchResultsLayer = null;
	theDBcontainer = null;
	loadedPage = null;
	loadingPage = null;
	pricingMode = 'ht';
	shopAccess = 'all';
	newClientType = 'Client';
	inscriptionBehaviour = 'manual';
	currentSelectedForumUser = null;
	mod_printer = false;
	sysAccessCode = false;
	contactsStarted = false;
	contactsPage = false;
	contactsCode = false;
	forumPage = false;
	forumCode = false;
	startForum = function() {return true;};
	supportLib = false;
	getUserAccess = function() {return getCookie('MyAccess');};
	memberMailBox = '';
	formPictures = null;
	caddyProductID = '';
	caddyArticleID = '';
	caddyActionItems = 0;
	currencyName = 'Euro';
	currencyID = 'EUR';
	currencyCode = '&euro;';
	hasPaymentOptions = 'yes';
	hasDeliveryOptions = 'yes';
	defaultPaymentMode = 'online';
	defaultDeliveryMode = 'shipping';
	accountsBDheaders = new Array('USERID','LOGIN','PASSWORD','PARRAINAGE','BIZTYPE','BIZNAME','BIZVATNUM','NAME','FIRSTNAME','EMAIL','PHONE','FAX','STREET','POSTCODE','CITY','LAND','BIRTHDATE','NATIONALITY','PROFESSION','ACTIVITY','JOB','HOBBY','HOWKNOWN','NOTES','GETNEWS','BONUSPROCENT','PROFILING','PICTURE');
	salesdataBDheaders = new Array('USERID','DATE','REFERENCE','ACCOUNTID','REPRESENTANTID','PARRAINNAME','PARRAINID','PARRAINCODE','HTAMOUNT','TTCAMOUNT','BONUSAMOUNT','BONUSSTATUS');
	allDBheaders = new Array('USERID','DATE','REFERENCE','ACCOUNTID','REPRESENTANTID','PARRAINNAME','PARRAINID','PARRAINCODE','HTAMOUNT','TTCAMOUNT','BONUSAMOUNT','BONUSSTATUS','LOGIN','PASSWORD','PARRAINAGE','BIZTYPE','BIZNAME','BIZVATNUM','NAME','FIRSTNAME','EMAIL','PHONE','FAX','STREET','POSTCODE','CITY','LAND','BIRTHDATE','NATIONALITY','PROFESSION','ACTIVITY','JOB','HOBBY','HOWKNOWN','NOTES','GETNEWS','BONUSPROCENT','PROFILING','PICTURE');
	translatedDBheaders = new Array('user ID','Date','Reference','Customer name','Representative name','Parrain name','Parrain ID','Parrain code','Amount (w/o taxes)','Amount (All-In)','Bonus amount','Bonus status','Login','Password','Sponsorship','Business type','Business name','VAT number','Name','First name','E-mail address','Telephone','Fax','Address','Zip code','City','Country','Birth date','Nationality','Profession','Activity','Function','Hobbies','Known by','Remarks','News','Bonus percentage','Profiling','Picture');
	formTarget = '';
	formTop = 0;
	formLeft = 0;
	formWidth = 0;
	formHeight = 0;
	theOrderPage = false;
	orderLoaded = false;
	cartLoaded = false;
	theShoppingChart = false;
	isCaddyContentsRead = false;
	isCaddyContentsDeleting = false;
	localStrings = null;
	shopAllowed = false;
	contactsResultFile = 'my_contactsresult.html';
	searchResultFile = 'my_searchresult.html';
	searchDBfile = '';
	forumResultFile = 'my_forumresult.html';
	eCommunityRunning = false;
	eCommunityPlugin = 'no';
	eMembersPlugin = 'no';
	eResellersPlugin = 'no';
	eRepresentantsPlugin = 'no';
	memberBonus = 0;
	defaultLang = 'fr';
	baseServer = 'webmanager.clicktoweb.com';
	dlogLightBkgColor = '#eeeeee';
	dlogDarkBkgColor = '#aaaaaa';
	listItemDefaultColor = '#000000';
	listItemHiliteBkgColor = '#eeeeee';
	listItemSelectedColor = '#ffffff';
	listItemSelectedBkgColor = '#555555';
	genericLinkColor = '#0000ff';
	paypalBusinessID = '';
	paypalBusinessName = '';
	paypalReturnpath = '';
	paypalCancelreturnpath = '';
	paypalNotifypath = '';
	paypalActive = '0';
	cartItemsMaster = null;
	favoritesItemsMaster = null;
	orderHistoryBox = null;
	admindataLayer = null;
	memberslistLayer = null;
	clientslistLayer = null;
	paymentsLayer = null;
	paymentsMask = null;
	isPaimentCanceled = false;
	cartItemsList = null;
	orderReportContainer = null;
	checkUserAccess = null;
	lockTheBack = true;
	accessType = 'User';
	accessLogg = '';
	accessPass = '';
	drawAdminaccountInterface = null;
	toManageYourShopStr = '';
	isGettingShopResources = null;
	eMemberUniqueID = '0-000-0000';
	currentMemberUniqueID = '0-000-0000';
	dbMultiprintAllowed = false;
	savedBodyScroll = null;
	dbSortOrder = 'up';
	dbShowSearches = '1';
	dbFineSearches = '1';
	shopBehavior = 'none';
	shopType = 'none';
	shopDrawn = false;
	shopCode = false;
	membersCode = false;
	inscriptionCode = false;
	favoritesCode = false;
	shopLib = false;
	pageweb = null;
	thePageBkg = null;
	pageName = '';
	pageGlobalName = '';
	userRef = '';
	drawLoop = 0;
	lastShownItem = null;
	alllangsStrings = '|ab_|af_|sq_|am_|hy_|as_|ay_|az_|ba_|eu_|bn_|br_|bg_|be_|km_|ca_|zh_|co_|hr_|cs_|da_|nl_|en_|eo_|et_|fo_|fj_|fi_|fr_|fy_|gl_|ka_|de_|el_|kl_|gn_|gu_|ha_|he_|hi_|hu_|is_|id_|ik_|ga_|it_|ja_|jv_|kn_|ks_|kk_|rw_|ky_|ko_|rn_|lo_|la_|lv_|ln_|lt_|mk_|mg_|ms_|ml_|mt_|mi_|mr_|mo_|ne_|no_|oc_|or_|pl_|pt_|pa_|qu_|rm_|ro_|ru_|sm_|sg_|sa_|gd_|sr_|sh_|st_|tn_|sn_|sd_|si_|ss_|sk_|sl_|es_|su_|sw_|sv_|tl_|ta_|tt_|te_|th_|bo_|ti_|to_|ts_|tr_|tk_|uk_|ur_|uz_|vi_|vo_|cy_|wo_|xh_|yi_|yo_|zu_|';
	allLangsNames = '|Abkhazian|Afrikaans|Albanian|Amharic|Armenian|Assamese|Aymara|Azerbaijani|Bashkir|Basque|Bengali|Breton|Bulgarian|Byelorussian|Cambodian|Catalan|Chinese|Corsican|Croatian|Czech|Danish|Dutch|English|Esperanto|Estonian|Faroese|Fijian|Finnish|French|Frisian|Galician|Georgian|German|Greek|Greenlandic|Guarani|Gujarati|Hausa|Hebrew|Hindi|Hungarian|Icelandic|Indonesian|Inupiak|Irish|Italian|Japanese|Javanese|Kannada|Kashmiri|Kazakh|Kinyarwanda|Kirghiz|Korean|Kurundi|Laothian|Latin|Latvian|Lingala|Lithuanian|Macedonian|Malagasy|Malay|Malayalam|Maltese|Maori|Marathi|Moldavian|Nepali|Norwegian|Occitan|Oriya|Polish|Portuguese|Punjabi|Quechua|Rhaeto-romance|Romanian|Russian|Samoan|Sangho|Sanskrit|Scots gaelic|Serbian|Serbo-croatian|Sesotho|Setswana|Shona|Sindhi|Singhalese|Siswati|Slovak|Slovenian|Spanish|Sundanese|Swahili|Swedish|Tagalog|Tamil|Tatar|Telugu|Thai|Tibetan|Tigrinya|Tonga|Tsonga|Turkish|Turkmen|Ukrainian|Urdu|Uzbek|Vietnamese|Volapuk|Welsh|Wolof|Xhosa|Yiddish|Yoruba|Zulu|';
	userLang = '';
	tracingIDs = '';
	shoponline = false;
	caddyInfos = false;
	keepHcentered = false;
	keepVcentered = false;
	keepOnTop = false;
	theDinamicFrame = null;
	objectCollection = new Array();
	mappedDBitems = new Array();
	currentObject = null;
	currentObjectIndex = 0;
	mailnotifyAddress = '';
	mailSubject = '';
	webName = '';
	documentPath = window.location.href;
	replyPath = window.location.href;
	if(documentPath.indexOf('&gclid=') != -1) {
		documentPath = documentPath.split('&gclid=')[0];
		replyPath = replyPath.split('&gclid=')[0];
	}
	dontReplyPath = false;
	showSentmailConfirmation = false;
	drawPageTimer = null;
	drawPageTimerOn = false;
	communityTimer = null;
	communityTimerOn = false;
	communicationLayer = 'iframe';
	loadfileConnexionLayer = null;
	loadfilePath = '';
	loadedPaths = '';
	myAbsolutePath = '';
	var pathParts = documentPath.split('/');
	for(var i = 0; i < (pathParts.length)-1; i++) {
		thisPart = pathParts[i];
		myAbsolutePath = myAbsolutePath+thisPart+'/';
	}
	agifAbsolutePath = myAbsolutePath+'a.gif';
	pageName = pathParts[(pathParts.length)-1];
	if(!pageName) {
		pageName = 'index.html';
	}
	try {
		if(pageContext) {
			var docPath = documentPath.split(pageName);
			var newPath = pageContext+'?page='+pageName;
			docPath = docPath.join(newPath);
			window.location.href = docPath;
			return false;
		}
	} catch(e) {
	}
	pageGlobalName = trimLangID(pageName);
	if((pageGlobalName == 'my_shop.html') || (pageGlobalName == 'my_order.html') || (pageGlobalName == 'my_members.html')) {
		shoplibCheck();
	}
	if(pageGlobalName == 'my_inscription.html') {
		if(!inscriptionCode) {
			addScriptFile('my_shop/my_inscription.js');
		}
	}
};
function initializeCustomVariables() {
	
};
function initXmlHttpRequest() {
	var xmlhttp = null;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = null;
		}
	}
	if(!xmlhttp && typeof XMLHttpRequest != undefined) {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
};

if(top == self) {
	var timeDef = nowTimeID();
	initializeCommonVariables();
	initializeCustomVariables();
	document.write('<script src="siteprefs.js'+timeDef+'" type="text/javascript" charset="iso-8859-1"></script>');
	if(hilitedButton) {
		hilitedButton = parseInt(hilitedButton);
	}
	if(memberBonus) {
		memberBonus = parseFloat(memberBonus);
	}
	xmlhttp = initXmlHttpRequest();
	ecomm_xmlhttp = initXmlHttpRequest();
	if(xmlhttp) {
		communicationLayer = 'xmlhttp';
		shopAllowed = true;
	}
};

function manageWebpageContents() {
	if(top != self) {
		if(top.loadfilePath && (self.location.href.indexOf(top.loadfilePath) != -1)) {
			webBox = document.body.getElementsByTagName('DIV')[0];
			var pageweb = webBox.getElementsByTagName('DIV')[0];
			var thePrintOrigin = '';
			if(pageweb.getAttribute('printorigin')) {
				var thePrintOrigin = pageweb.getAttribute('printorigin');
			}
			var dWidth = parseInt(pageweb.getAttribute('dw'));
			var dHeight = parseInt(pageweb.getAttribute('dh'));
			theData = pageweb.innerHTML;
			top.importExternalData(theData,dWidth,dHeight,thePrintOrigin);
			top.loadfilePath = '';
		}
	} else {
		var webBox = document.body.getElementsByTagName('div')[0];
		if(webBox.getAttribute('dlang')) {
			defaultLang = webBox.getAttribute('dlang');
		}
		if(webBox.getAttribute('slang')) {
			userLang = webBox.getAttribute('slang');
			if(!userLang) {
				userLang = defaultLang;
			}
			if(currentLang != userLang) {
				currentLang = userLang;
				addScriptFile('my_langs/strings_'+userLang+'.js');
			}
			setStrings(userLang);
		}
		var alreadyChosenLang = getCookie('alreadychosen');
		if(!alreadyChosenLang) {
			setCookie('alreadychosen', 'alreadychosen', '', '', '', '');
		}
		var uLang = getCookie('userlang');
		if(uLang) {
			if(uLang != userLang) {
				if(!alreadyChosenLang) {
					choosedLang(uLang);
				}
			}
		}
		if(webBox.getAttribute('wname')) {
			webName = webBox.getAttribute('wname');
		}
		handlePNG();
		pageRedraw();
	}
};

function pageRedraw() {
	if(drawPageTimerOn) {
		clearTimeout(drawPageTimer);
	}
	drawPageTimer = setTimeout('drawPage()',0);
	drawPageTimerOn = true;
};

var currentLang = '';
function drawPage() {
	drawPageTimerOn = false;
	displayTimerOn = false;
	try {
		var webBox = document.body.getElementsByTagName('div')[0];
	} catch(e) {
		return;
	}
	if(webBox.getAttribute('hcenter')) {
		keepHcentered = true;
	}
	if(webBox.getAttribute('vcenter')) {
		keepVcentered = true;
	}
	pageweb = webBox.getElementsByTagName('DIV')[0];
	pageweb.style.position = 'absolute';

	if(pageGlobalName == 'my_members.html') {
/*		lockScreen();*/
	}

	if(pageweb.style.backgroundColor) {
		document.body.style.backgroundColor = pageweb.style.backgroundColor;
	}
	var bkgImg = pageweb.getElementsByTagName('img')[0];
	if(bkgImg && ((bkgImg.getAttribute('btype')) && (bkgImg.getAttribute('btype') == 'pagebkg'))) {
		if(bkgImg.style.backgroundColor) {
			document.body.style.backgroundColor = bkgImg.style.backgroundColor;
		}
	}
	
	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 = parseInt(docGetWidth());
	docH = parseInt(docGetHeight());
	minW = parseInt(pageweb.getAttribute('mw'));
	minH = parseInt(pageweb.getAttribute('mh'));	
	if(docW < minW) {
		docW = minW;
	}
	if(docH < minH) {
		docH = minH;
	}
	if(keepVcentered) {
		var myTop = parseInt((docH-minH)/2);
 		if(myTop < 0) {
 			myTop = 0;
 		}
		pageweb.style.top = myTop+'px';
	} else {
 		if((!keepHcentered) || (pageFullHeight && (pageFullHeight == 'yes'))) {
			pageweb.style.height = (docH-0)+'px';
		} else {
			pageweb.style.height = minH+'px';
		}
	}
	if(keepHcentered) {
		var myLeft = parseInt((docW-minW)/2);
		if(myLeft < 0) {
			myLeft = 0;
		}
		pageweb.style.left = myLeft+'px';
 		if((!keepVcentered) || (keepOnTop && (keepOnTop == '1'))) {
			pageweb.style.top = 0+'px';
		}
	} else {
 		if(theBrowserName == 'safari') {
 			if(docH == minH) {
 				pageweb.style.width = (docW-15)+'px';
 			} else {
 				pageweb.style.width = (docW-1)+'px';
 			}
 		} else {
 			pageweb.style.width = (docW-1)+'px';
 		}
	}
	
	readPageItems();
	
	pageweb.style.visibility = 'visible';
	
	if(top.appID && (top.appID == 'adminaccount')) {
		if(drawAdminaccountInterface) {drawAdminaccountInterface();}
	}
};

function readPageItems() {
	objectCollection = new Array();
	if(thePageBkg) {
		objectCollection[objectCollection.length] = thePageBkg;
	}
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		aNode = theNodes[i];
		var myType = aNode.getAttribute('btype');
		if(myType) {
			objectCollection[objectCollection.length] = aNode;
		}
		if(aNode.getAttribute('tablelayout')) {
			var myNodes = aNode.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;
	theMandatoryItemsArray = new Array();
	currentObjectIndex = 0;
	drawLoop = 0;
	setTimeout('drawObjects()',0);
};

function drawObjects() {
	if(objectCollection) {
		if(currentObjectIndex < objectCollection.length) {
			currentObject = objectCollection[currentObjectIndex];
			currentObjectIndex++;
			drawItem();
		} else {
			if(eCommunityPlugin == 'yes') {
				dumpUserInfos();
			}
			drawPageBkg();
			drawRedAsterisks();
			setTimeout('dynamicAutoload()',0);
		}
	}
};

function removeStartupScreen() {
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = theNodes.length; i > 0; i--) {
		aNode = theNodes[(i-1)];
		if(aNode.getAttribute('item_uID')) {
			var myUid = aNode.getAttribute('item_uID');
			if(myUid == 'startup') {
				aNode.parentNode.removeChild(aNode);
			}
		}
	}
};

function drawPageBkg() {
	if(thePageBkg) {
		var bkgFixed = true;
		if(theBrowserName == 'explorer') {
			var arVersion = navigator.appVersion.split("MSIE");
			var version = parseFloat(arVersion[1]);
			if(version < 7.0) {
				bkgFixed = false;
			}
		}
		if(bkgFixed) {
			thePageBkg.style.position = 'fixed';
		}
		if(keepHcentered || keepVcentered) {
			docW = parseInt(docGetWidth());
			docH = parseInt(docGetHeight());
			if(docW > parseInt(pageweb.style.width)) {
				thePageBkg.style.width = '100%';
			} else {
				if(bkgFixed) {
					thePageBkg.style.width = '100%';
				} else {
					thePageBkg.style.width = pageweb.style.width;
				}
			}
			if(docH > parseInt(pageweb.style.height)) {
				thePageBkg.style.height = '100%';
			} else {
				if(bkgFixed) {
					thePageBkg.style.height = '101%';
				} else {
					thePageBkg.style.height = pageweb.style.height;
				}
			}
		}
	}
};
function drawItem() {
	var theType = null;
	if(currentObject) {
		theType = currentObject.getAttribute('btype');
	}
	if(!theType) {
		drawObjects();
		return;
	}
	if(theType == 'dbbox') {
		shoponline = true;
		currentObject.style.border = 'medium none';
		currentObject.style.display = 'none';
		if(currentObject.getAttribute('sortorder')) {
			dbSortOrder = currentObject.getAttribute('sortorder');
		}
		if(currentObject.getAttribute('showsearches')) {
			dbShowSearches = currentObject.getAttribute('showsearches');
		}
		if(currentObject.getAttribute('finesearches')) {
			dbFineSearches = currentObject.getAttribute('finesearches');
		}
		if(currentObject.getAttribute('shopbehavior')) {
			shopBehavior = currentObject.getAttribute('shopbehavior');
		}
		if(currentObject.getAttribute('searchresultfile')) {
			searchResultFile = currentObject.getAttribute('searchresultfile');
		}
		if(currentObject.getAttribute('searchdbfile')) {
			searchDBfile = currentObject.getAttribute('searchdbfile');
		}
		if(currentObject.getAttribute('multiprinter')) {
			dbMultiprintAllowed = true;
		}
		if(currentObject.getAttribute('hideemptyfields')) {
			hideEmptyFields = true;
		}
		if(currentObject.getAttribute('text_color')) {
			dbItemsColorSet = currentObject.getAttribute('text_color');
		}
		loadShopFile();
	}
	if(currentObject.getAttribute('formule')) {
		var myOption = currentObject.getAttribute('formule');
		if(myOption.indexOf('MENU:') == 0) {
			drawPopup(currentObject);
		}
	}
	if(theType == 'pagebkg') {
		if(keepHcentered || keepVcentered) {
			if(currentObject.parentNode != document.body) {
				currentObject = document.body.insertBefore(currentObject,document.body.childNodes[0]);
			}
			thePageBkg = currentObject;
		} else {
			currentObject.style.width = pageweb.style.width;
			currentObject.style.height = pageweb.style.height;
		}
	} else if(theType == 'graphicbox') {
		useAsBkg(currentObject);
		drawGbox(currentObject);
		imgAdjust(currentObject);
	} else if(theType == 'mediabox') {
		drawGbox(currentObject);
	} else if(theType == 'pushbutton') {
		if(!currentObject.getAttribute('setting_up')) {
			currentObject.setAttribute('setting_up','1');
			buttonSetup(currentObject);
		}
		drawGbox(currentObject);
	} else if((theType == 'pictbox') || (theType == 'contentsbox')) {
		if(!currentObject.getAttribute('setting_up')) {
			currentObject.setAttribute('setting_up','1');
			pictProps(currentObject);
			if(theType == 'pictbox') {
				imgAdjust(currentObject);
			}
		}
		useAsBkg(currentObject);
		drawGbox(currentObject);
	} else if(theType == 'textbox') {
		if(!currentObject.getAttribute('setting_up')) {
			currentObject.setAttribute('setting_up','1');
			textProps(currentObject);
		}
		drawGbox(currentObject);
	} else if(theType == 'contentsbox') {
		drawGbox(currentObject);
	} else if(theType == 'dynamicbox') {
		if(!currentObject.getAttribute('setting_up')) {
			currentObject.setAttribute('setting_up','1');
			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 = userRef = 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);
		if(currentObject.getAttribute('ismandatory')) {
			if(pageGlobalName.indexOf('my_') == -1) {
				appendRedAsterisk(currentObject);
			}
		}
		if(currentObject.type == 'checkbox') {
		}
		if(currentObject.type == 'radio') {
			if(!currentObject.onclick) {
				currentObject.onclick = clickedRadio;
			}
		}
	} 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);
			}
		}
	}
	var dbCustomItem = false;
	var myId = currentObject.getAttribute('item_uID');
	if(myId && (myId.indexOf('dbitem') == 0)) {
		dbCustomItem = true;
	}
	var theUid = currentObject.getAttribute('item_uID');
	if(theUid && (theUid.indexOf('tooltip:') == 0)) {
		theUid = theUid.split(':')[1];
		currentObject.setAttribute('title',theUid);
	} else if(theUid && (theUid == '_international_')) {
		currentObject.removeAttribute('item_uID');
		makeLangSwitcherMenu(currentObject);
	} else if(theUid && (theUid.indexOf('file:') == 0)) {
	} else if(theUid && (theUid == 'top_anchor')) {
		var theLabel = currentObject.getElementsByTagName('span')[0];
		if(theLabel) {
			theLabel.style.cursor = 'pointer';
			theLabel.onclick = toTop;
			currentObject.removeAttribute('item_uID');
		}
	} else if(theUid && (theUid == '_CADDY_BOX_')) {
		if(!cartItemsMaster) {
			cartItemsMaster = currentObject;
			cartItemsMaster.innerHTML = '';
			theCaddySheetsList = new Array();
		}
	} else if(theUid && (theUid == '_FAVORITES_BOX_')) {
		if(!favoritesItemsMaster) {
			favoritesItemsMaster = currentObject;
			favoritesItemsMaster.innerHTML = '';
			favoritesDB = new Array();
		}
	} else if(theUid && (theUid == '_username_')) {
		currentObject.getElementsByTagName('span')[0].innerHTML = ' ';
	}
	
	var isLinkedMedia = currentObject.getAttribute('linkedmedia');
	if(isLinkedMedia) {
		var isInited = currentObject.getAttribute('inited');
		if(!isInited) {
			currentObject.style.display = 'none';
		}
	}

	
	if((currentObject.style.visibility != 'visible') && (!dbCustomItem) && (!currentObject.getAttribute('isdbitem'))) {
		currentObject.style.visibility = 'visible';
	}

	if(theUid && (theUid == 'HIDDEN')) {
		currentObject.style.visibility = 'hidden';currentObject.style.display = 'none';
	}
	
	if(myAbsolutePath.indexOf('/users/') != -1) {
		readProps(currentObject);
	}
	if(drawLoop < 30) {
		drawLoop++;
		drawObjects();
	} else {
		drawLoop = 0;
		setTimeout('drawObjects()',0);
	}
};

function useAsBkg(anItem) {
	var bkgInfos = anItem.getAttribute('item_uID');
	if(bkgInfos && (bkgInfos.indexOf('bkg:') == 0)) {
		anItem.setAttribute('asbkg',1);
		var thePict = anItem.getElementsByTagName('img')[0];
		thePict.style.zIndex = '3';
		if(anItem.style.backgroundColor) {
			thePict.style.backgroundColor = anItem.style.backgroundColor;
		}
		var asBkgItem = document.body.insertBefore(thePict,document.body.childNodes[0]);
		var theProps = bkgInfos.split(':');
		for(var i = 1; i < theProps.length; i++) {
			var aProp = theProps[i];
			aProp = aProp.split(' ');
			var inf = aProp[0];
			var val = aProp[1];
			if(inf == 'top') {
				asBkgItem.style.top = val;
				asBkgItem.style.bottom = '';
			} else if(inf == 'left') {
				asBkgItem.style.left = val;
				asBkgItem.style.right = '';
			} else if(inf == 'width') {
				asBkgItem.style.width = val;
			} else if(inf == 'height') {
				asBkgItem.style.height = val;
			} else if(inf == 'bottom') {
				asBkgItem.style.bottom = val;
				asBkgItem.style.top = '';
			} else if(inf == 'right') {
				asBkgItem.style.right = val;
				asBkgItem.style.left = '';
			}
		}
	}
};

function drawGbox(anItem) {
	if(anItem.getAttribute('asbkg')) {
		anItem.parentNode.removeChild(anItem);
		return;
	}
	var theContainer = anItem.parentNode;
	if(!theContainer) {
		return;
	}
	try {
		var pageW = theContainer.offsetWidth;
	} catch(e) {
		var pageW = parseInt(theContainer.style.width);
	}
	try {
		var pageH = theContainer.offsetHeight;
	} catch(e) {
		var pageH = parseInt(theContainer.style.height);
	}
	var boxT = parseInt(anItem.style.top);
	var boxL = parseInt(anItem.style.left);
	try {
		var boxW = anItem.offsetWidth;
	} catch(e) {
		var boxW = parseInt(anItem.style.width);
	}
	try {
		var boxH = anItem.offsetHeight;
	} catch(e) {
		var boxH = parseInt(anItem.style.height);
	}
	
	var locktopleft = anItem.getAttribute('tls');
	var locktopright = anItem.getAttribute('trs');
	var lockbottomleft = anItem.getAttribute('bls');
	var lockbottomright = anItem.getAttribute('brs');
	var rightoffset = parseInt(anItem.getAttribute('rval'));
	if(!rightoffset) {
		rightoffset = 0;
	}
	var bottomoffset = parseInt(anItem.getAttribute('bval'));
	if(!bottomoffset) {
		bottomoffset = 0;
	}
	
	if(anItem.getAttribute('btype') && (anItem.getAttribute('btype') == 'textbox')) {
		var YpadVal = parseInt(anItem.style.paddingTop);
		if((!YpadVal) || (YpadVal < 0)) {
			YpadVal = 0;
		}
		var leftpadVal = parseInt(anItem.style.paddingLeft);
		if((!leftpadVal) || (leftpadVal < 0)) {
			leftpadVal = 0;
		}
		var rightpadVal = parseInt(anItem.style.paddingRight);
		if((!rightpadVal) || (rightpadVal < 0)) {
			rightpadVal = 0;
		}
		var XpadVal = leftpadVal+rightpadVal;
	} else {
		var YpadVal = 0;
		var XpadVal = 0;
	}
	
	hcentered = anItem.getAttribute('hcenter');
	vcentered = anItem.getAttribute('vcenter');
	
	if((locktopleft) && (locktopright) && (!lockbottomleft) && (!lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
	} else if((locktopleft) && (!locktopright) && (lockbottomleft) && (!lockbottomright)) {
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (!locktopright) && (!lockbottomleft) && (lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((!locktopleft) && (!locktopright) && (!lockbottomleft) && (lockbottomright)) {
		if(!vcentered) {
			newVal = pageH-(boxH+bottomoffset);
			if(newVal < 0) {
				newVal = 0;
			}
			anItem.style.top = newVal+'px';
		}
		if(!hcentered) {
			newVal = pageW-(boxW+rightoffset);
			if(newVal < 0) {
				newVal = 0;
			}
			anItem.style.left = newVal+'px';
		}
	} else if((!locktopleft) && (locktopright) && (lockbottomleft) && (!lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((!locktopleft) && (!locktopright) && (lockbottomleft) && (lockbottomright)) {
		if(!vcentered) {
			newVal = pageH-(boxH+bottomoffset);
			if(newVal < 0) {
				newVal = 0;
			}
			anItem.style.top = newVal+'px';
		}
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
	} else if((!locktopleft) && (locktopright) && (!lockbottomleft) && (!lockbottomright)) {
		if(!hcentered) {
			newVal = pageW-(boxW+rightoffset);
			if(newVal < 0) {
				newVal = 0;
			}
			anItem.style.left = newVal+'px';
		}
	} else if((!locktopleft) && (!locktopright) && (lockbottomleft) && (!lockbottomright)) {
		if(!vcentered) {
			newVal = pageH-(boxH+bottomoffset);
			if(newVal < 0) {
				newVal = 0;
			}
			anItem.style.top = newVal+'px';
		}
	} else if((!locktopleft) && (locktopright) && (!lockbottomleft) && (lockbottomright)) {
		if(!hcentered) {
			newVal = pageW-(boxW+rightoffset);
			if(newVal < 0) {
				newVal = 0;
			}
			anItem.style.left = newVal+'px';
		}
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((!locktopleft) && (locktopright) && (lockbottomleft) && (lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (locktopright) && (lockbottomleft) && (!lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (locktopright) && (!lockbottomleft) && (lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (!locktopright) && (lockbottomleft) && (lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	} else if((locktopleft) && (locktopright) && (lockbottomleft) && (lockbottomright)) {
		newVal = pageW-(boxL+rightoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.width = (newVal-XpadVal)+'px';
		newVal = pageH-(boxT+bottomoffset);
		if(newVal < 10) {
			newVal = 10;
		}
		anItem.style.height = (newVal-YpadVal)+'px';
	}
	if(hcentered) {
		anItem.style.left = parseInt((pageW-parseInt(anItem.style.width))/2)+'px';
	}
	if(vcentered) {
		anItem.style.top = parseInt((pageH-parseInt(anItem.style.height))/2)+'px';
	}
	if(anItem.getAttribute('btype') && (anItem.getAttribute('btype') == 'pushbutton')) {
		var myW = parseInt(anItem.style.width);
		var myH = parseInt(anItem.style.height);
		var aTD = anItem.getElementsByTagName('TD')[0];
		if(aTD) {
			var leftOffset = parseInt(aTD.style.paddingLeft);
			if(isNaN(leftOffset)) {
				leftOffset = 0;
			}
			var theLabel = aTD.getElementsByTagName('span')[0];
			myW = myW-leftOffset;
			if(aTD.style.width != myW) {
				aTD.style.width = myW+'px';
			}
			if(aTD.style.height != myH) {
				aTD.style.height = myH+'px';
			}
		}
	}
};

function textProps(anItem) {
	theStrings = anItem.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.textDecoration = 'underline';
				setCursor(thisString,'pointer');
			}
		}
	}
	if(anItem.getAttribute('item_uID')) {
		var myUid = anItem.getAttribute('item_uID');
		if(myUid == '_FORUM_BOX_') {
			if(!forumCode) {
				addScriptFile('my_shop/my_forum.js');
			}
			if(anItem.getAttribute('forumresultfile')) {
				forumResultFile = anItem.getAttribute('forumresultfile');
			}
			forumPage = true;
		}
		if(myUid == '_CONTACTS_BOX_') {
			contactsPage = true;
			anItem.id = myUid;
			if(!contactsCode) {
				addScriptFile('my_shop/my_contacts.js');
			}
			if(anItem.getAttribute('contactsresultfile')) {
				contactsResultFile = anItem.getAttribute('contactsresultfile');
			}
		}
		if(myUid == '_NEWMEMBERS_BOX_') {
			anItem.id = myUid;
		}
	}
	var theString = anItem.innerHTML;
	var hiliteColor = hiliteString(anItem);
	if(hiliteColor) {
		hiliteColor = ' style="color:'+hiliteColor+';" ';
	}
	if(theString.indexOf('_FAV_') != -1) {
		var joinString = '<span id="num_fav"'+hiliteColor+'>0</span>';
		theString = theString.split('_FAV_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
	}
	if(theString.indexOf('_###_') != -1) {
		var joinString = '<span id="num_items"'+hiliteColor+'>0</span>';
		theString = theString.split('_###_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('_$$$_') != -1) {
		var joinString = '<span id="num_money"'+hiliteColor+'>0,00</span>';
		theString = theString.split('_$$$_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('_@@@_') != -1) {
		var joinString = '<span id="num_bonis"'+hiliteColor+'>0,00</span>';
		theString = theString.split('_@@@_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('_%%%_') != -1) {
		var joinString = '<span id="num_taxes"'+hiliteColor+'>0,00</span>';
		theString = theString.split('_%%%_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('_SSS_') != -1) {
		var joinString = '<span id="num_shipping"'+hiliteColor+'>0,00</span>';
		theString = theString.split('_SSS_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('_£££_') != -1) {
		var joinString = '<span id="num_full_money"'+hiliteColor+'>0,00</span>';
		theString = theString.split('_£££_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('_TTT_') != -1) {
		var joinString = '<span id="num_full_money"'+hiliteColor+'>0,00</span>';
		theString = theString.split('_TTT_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('.$.') != -1) {
		var joinString = currencyCode;
		theString = theString.split('.$.');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
		caddyInfos = true;
	}
	if(theString.indexOf('_ref_code_') != -1) {
		joinString = '<span id="web_order_ref_code">--</span>';
		theString = theString.split('_ref_code_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
	}
	if(theString.indexOf('_0rder_d@te_') != -1) {
		joinString = '<span id="web_order_date">--</span>';
		theString = theString.split('_0rder_d@te_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
	}
	if(theString.indexOf('_0rder_time_') != -1) {
		joinString = '<span id="web_order_time">--</span>';
		theString = theString.split('_0rder_time_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
	}
	if(theString.indexOf('_y0ur_IP_@ddress_') != -1) {
		joinString = '<span id="web_order_IPaddress">--</span>';
		theString = theString.split('_y0ur_IP_@ddress_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
	}
	if(theString.indexOf('_$ho%Ch@rt_') != -1) {
		if(!cartItemsMaster) {
			cartItemsMaster = anItem;
			cartItemsMaster.innerHTML = '';
			theCaddySheetsList = new Array();
		}
	}
	if(theString.indexOf('_FAVORITES_BOX_') != -1) {
		if(!favoritesItemsMaster) {
			favoritesItemsMaster = anItem;
			favoritesItemsMaster.innerHTML = '';
			favoritesDB = new Array();
		}
	}
	if(theString.indexOf('_0rder_rep0rt_') != -1) {
		orderReportContainer = anItem;
		orderReportContainer.innerHTML = '<div style="text-align:center;margin-top:5px;color:#3d3d3d;font-size:14px;">Loading ...</div>';
	}
	if(theString.indexOf('_0rder$_hist0ry_') != -1) {
		orderHistoryBox = anItem;
		orderHistoryBox.innerHTML = '';
	}
	if(theString.indexOf('_@my_admin_account@_') != -1) {
		admindataLayer = anItem;
		admindataLayer.innerHTML = '';
	}
	if(theString.indexOf('_@tips_box@_') != -1) {
		tipsboxLayer = anItem;
		tipsboxLayer.innerHTML = '';
	}
	if(theString.indexOf('_@RESELLERS_LIST@_') != -1) {
		resellerslistLayer = anItem;
		resellerslistLayer.innerHTML = '';
	}
	if(theString.indexOf('_@MEMBERS_LIST@_') != -1) {
		memberslistLayer = anItem;
		memberslistLayer.innerHTML = '';
	}
	if(theString.indexOf('_@CLIENTS_LIST@_') != -1) {
		clientslistLayer = anItem;
		clientslistLayer.innerHTML = '';
	}
	if(theString.indexOf('_UUU_') != -1) {
		joinString = '<span id="num_users_online"'+hiliteColor+'>0</span>';
		theString = theString.split('_UUU_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
	}
	if(theString.indexOf('_MMM_') != -1) {
		joinString = '<span id="num_members_online"'+hiliteColor+'>0</span>';
		theString = theString.split('_MMM_');
		theString = theString.join(joinString);
		anItem.innerHTML = theString;
	}
	if(theString.indexOf('_@PAYMENTS_ZONE@_') != -1) {
		paymentsLayer = anItem;
		paymentsLayer.innerHTML = '';
		paymentsLayer.style.color = '#000000';
	}
	if(anItem.getAttribute('autoscroll')) {
		anItem.style.overflow = 'hidden';
		anItem.style.overflowX = 'hidden';
		anItem.style.overflowY = 'hidden';
		anItem.style.visibility = 'visible';
		autoscrollSetup(anItem);
	}
};
function hiliteString(aBox) {
	var hiliteColor = aBox.style.borderTopColor;
	var borderHeight = parseInt(aBox.style.borderTopWidth);
	if(!borderHeight) {
		borderHeight = 0;
	}
	if(hiliteColor && (borderHeight == 0)) {
		return hiliteColor;
	}
	return '';
};
function overString(evt) {
	if(theBrowserName == 'explorer') {
		var aString = event.srcElement;
	} else {
		var aString = evt.target;
	}
	if(theBrowserName == 'safari') {
		if(aString.nodeType == 3) {
			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') {
		var aString = event.srcElement;
	} else {
		var aString = evt.target;
	}
	if(theBrowserName == 'safari') {
		if(aString.nodeType == 3) {
			aString = evt.target.parentNode;
		}
	}
	if(aString.getAttribute('linkHref')) {
		window.status = '';
		hideItem();
	}
};
function downString(evt) {
	if(theBrowserName == 'explorer') {
		var aString = event.srcElement;
	} else {
		var aString = evt.target;
	}
	if(theBrowserName == 'safari') {
		if(aString.nodeType == 3) {
			aString = evt.target.parentNode;
		}
	}
};
function upString(evt) {
	if(theBrowserName == 'explorer') {
		var aString = event.srcElement;
	} else {
		var aString = evt.target;
	}
	if(theBrowserName == 'safari') {
		if(aString.nodeType == 3) {
			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);
	}
};

function pictProps(anItem) {
	if(anItem.getAttribute('linkHref')) {
		if(anItem.getAttribute('linkHref') != 'undefined') {
			setCursor(anItem,'pointer');
			anItem.onmouseover = overPict;
			anItem.onmouseout = outPict;
			anItem.onmouseup = upPict;
		}
	} else if(anItem.getAttribute('zoomImg')) {
		setCursor(anItem,'pointer');
		var zoompict = anItem.getElementsByTagName('IMG')[1];
		if(!zoompict) {
			zoompict = anItem.getElementsByTagName('IMG')[0];
		}
		zoompict.onclick = zoomThisImg;
		zoompict.setAttribute('title','Click to zoom');
	} else if(anItem.getAttribute('printid')) {
		if(anItem.getAttribute('isprinter')) {
			setCursor(anItem,'pointer');
			if(anItem.getAttribute('printicon')) {
				anItem.onclick = printthispage;
			} else {
				anItem.onclick = printthistext;
			}
		}
	}
};

function zoomThisImg(evt) {
	if(theBrowserName == 'explorer') {
		var aPict = event.srcElement;
	} else {
		var aPict = evt.target;
	}
	zoomPicture(aPict);
};
function overPict(evt) {
	if(theBrowserName == 'explorer') {
		var aPict = event.srcElement.parentNode;
	} else {
		var 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') {
		var aPict = event.srcElement.parentNode;
	} else {
		var aPict = evt.target.parentNode;
	}
	if(aPict.getAttribute('linkHref')) {
		window.status = '';
		hideItem();
	}
};
function upPict(evt) {
	if(theBrowserName == 'explorer') {
		var aPict = event.srcElement.parentNode;
	} else {
		var 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 aNum = 0;
var checkedButton = false;
function buttonSetup(anItem) {
	var thePicts = anItem.getElementsByTagName('img');
	for(var i = 0; i < thePicts.length; i++) {
		var aPict = thePicts[i];
		var thisWidth = aPict.style.width;
		if(!thisWidth) {
			aPict.style.width = 'auto';
		}
		var anSrc = aPict.src;
		anSrc = anSrc.toLowerCase();
		if(anSrc.indexOf('.png') != -1) {
			handleThisPng(aPict);
		}
	}
	if(!checkedButton) {
		checkedButton = true;
	}
	anItem.onmouseover = overButton;
	anItem.onmouseout = outButton;
	anItem.onmousedown = downButton;
	anItem.onmouseup = upButton;
	setCursor(anItem,'pointer');
	if(anItem.getAttribute('ispulldownbutton')) {
		var targetMenu = findLinkedItemByRefID(anItem);
		if(targetMenu) {
			var nowTime = new Date();
			nowTime = nowTime.getTime();
			nowTime = nowTime+aNum;
			aNum++;
			targetMenu.setAttribute('refID',nowTime);
			anItem.setAttribute('refID',nowTime);
		}
	}
	var myHref = anItem.getAttribute('linkHref');
	if(myHref && (myHref == 'logtosystem')) {
		if(!sysAccessCode) {
			addScriptFile('my_shop/my_sys_access.js');
		}
	}
};
function overButton(evt) {
	if(theBrowserName == 'explorer') {
		var aButton = event.srcElement;
	} else {
		var 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) {
			if(targetMenu.getAttribute('btype') && (targetMenu.getAttribute('btype') == 'cleanbox')) {
				showPulldownMenu(aButton,targetMenu);
			} else {
			}
			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') {
		var aButton = event.srcElement;
	} else {
		var 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') {
		var aButton = event.srcElement;
	} else {
		var 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') {
		var aButton = event.srcElement;
	} else {
		var aButton = evt.target;
	}
	while(!aButton.getAttribute('btype') && (aButton != document.body)) {
		aButton = aButton.parentNode;
	}
	if(aButton.getAttribute('btype') != 'pushbutton') {
		return;
	}
	if(aButton.getAttribute('ismenuitem')) {
		depressMenuButtons(aButton);
	}
	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);
		}
	} else {
		var myUid = aButton.getAttribute('item_uID');
		if(myUid) {
			if(myUid == '_forgotten_password_') {
				forgetPassword();
			}
		}
	}
};

function forgetPassword() {
	var promptString = convertTxt(localizeString('Insert here the e-mail address to which the password will be sent'));
	var defaultAnswer = convertTxt(localizeString('Your e-mail address'));
	var userChoice = prompt(promptString,defaultAnswer);
	if(userChoice) {
		var isValidMailAddress = performMailaddressCheck(userChoice);
		if(isValidMailAddress) {
			myPath = myAbsolutePath+'my_shop/db_data/password_recovery.php?email='+userChoice;
			xmlhttp.open('GET',myPath,true);
			if(theBrowserName == 'safari') {
				xmlhttp.setRequestHeader('If-Modified-Since','01-Mar-90 00:00:01 GMT');
			}
			xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			xmlhttp.setRequestHeader('Referer',documentPath);
			xmlhttp.onreadystatechange = function() {
				if(xmlhttp.readyState == 4) {
					var theData = xmlhttp.responseText;
					var theStatus = xmlhttp.status;
					handlePasswordRecovery(theStatus,theData,userChoice);
				}
			};
		 	xmlhttp.send(null);
		} else {
			var alertString = convertTxt(localizeString('Invalid e-mail address'));
			alert(alertString);
		}
	}
};

function handlePasswordRecovery(whichStatus,thisData,mailAddress) {
	if(whichStatus == '200') {
		if(thisData.indexOf('\n') != -1) {
			thisData = thisData.split('\n');
			thisData = thisData.join('');
		}
		
		if(thisData == '-1') {
			var alertString = convertTxt(localizeString('User unknown'));
			alert(alertString);
			return;
		}
		
		var alertString = convertTxt(localizeString('Password has been sent to : |EMAIL|'));
		alertString = alertString.split('|EMAIL|');
		alertString = alertString.join(mailAddress);
		alert(alertString);

		thisData = convertTxt(thisData);

		dontReplyPath = true;
		mailAddresses = mailAddress;
		mailSubject = convertTxt(localizeString('Forgotten password'));
		mailData = convertTxt(localizeString('This email was sent automatically in response to your request concerning the loss of your password. |N||N|The password associated with your e-mail address is : |PASSWORD| |N||N||N|Best regards'));
		mailData = mailData.split('|PASSWORD|');
		mailData = mailData.join(thisData);
		mailData = mailData.split('|N|');
		mailData = mailData.join('<br>');
		aConnexionLayer = document.getElementById('_socket');
		aConnexionLayer.style.display = 'block';
		if(theBrowserName != 'explorer') {
			aConnexionLayer.src = 'about:blank';
		}
		aConnexionLayer.src = 'my_mailerdaemon.html';
	} else {
		var alertString = convertTxt(localizeString('Cannot retrieve the password for this member.'));
		alert(alertString);
	}
};

function clickedRadio(evt) {
	if(theBrowserName == 'explorer') {
		var anItem = event.srcElement;
	} else {
		var 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 dynSets = false;
var dynZones = new Array();
var dynZoneBottomOffset = 0;
var dynZoneRightOffset = 0;
function dynamicProps(aBox) {
	theDinamicFrame = aBox;
	dynZones[dynZones.length] = theDinamicFrame;
		var dzRightOffset = 0;
		var dzBottomOffset = 0;
		if(theDinamicFrame.getAttribute('brs')) {
			dzRightOffset = parseInt(theDinamicFrame.getAttribute('rval'));
			if(!dzRightOffset) {
				dzRightOffset = 0;
			}
			dzBottomOffset = parseInt(theDinamicFrame.getAttribute('bval'));
			if(!dzBottomOffset) {
				dzBottomOffset = 0;
			}
		} else if(theDinamicFrame.getAttribute('trs')) {
			dzRightOffset = parseInt(theDinamicFrame.getAttribute('rval'));
			if(!dzRightOffset) {
				dzRightOffset = 0;
			}
		} else if(theDinamicFrame.getAttribute('bls')) {
			dzBottomOffset = parseInt(theDinamicFrame.getAttribute('bval'));
			if(!dzBottomOffset) {
				dzBottomOffset = 0;
			}
		}
		dynZoneBottomOffset = dynZoneBottomOffset+dzBottomOffset;
		dynZoneRightOffset = dynZoneRightOffset+dzRightOffset;
		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];
		if(aNode.getAttribute('dynamicId')) {
			var myDynId = aNode.getAttribute('dynamicId');
			if(myDynId.indexOf(aDynId) != -1) {
				itemsArray[itemsArray.length] = aNode;
			}
		}
	}
	return itemsArray;
};
function setDinFrame(aDynId) {
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		if(aNode.getAttribute('dynID') && (aNode.getAttribute('dynID') == aDynId)) {
			theDinamicFrame = aNode;
			addrefToTracingIDs(aDynId);
			break;
		}
	}
};
function addrefToTracingIDs(aDynId) {
	if(tracingIDs.indexOf(aDynId) == -1) {
		tracingIDs = tracingIDs+aDynId;
	}
};

var DBsearchData = '';
var searchLoc = '';
var searchIndex = 0;
var searchArray = null;
function dynamicAutoload() {
	if(window.location.search) {
		var theSearch = window.location.search;
		 if(theSearch.indexOf('&gclid=') != -1) {
			theSearch = theSearch.split('&gclid=')[0];
		}
		 if(theSearch.indexOf('?search=') != -1) {
			var temp = theSearch.split('?search=');
			theSearch = temp[0];
			DBsearchData = 'search='+temp[1];
		} else if(theSearch.indexOf('?ref=') != -1) {
			var temp = theSearch.split('?ref=');
			theSearch = temp[0];
			DBsearchData = 'ref='+temp[1];
		}
		if(theSearch.indexOf('?page=') != -1) {
			searchArray = theSearch.split('?page=');
		} else {
			searchArray = new Array(theSearch);
		}
		searchIndex++;
		theSearch = searchArray[searchIndex];
		if(theSearch) {
			if(theSearch != searchLoc) {
				searchLoc = theSearch;
				if(searchLoc.indexOf('?page=') != -1) {
					var dynPage = searchLoc.split('?page=')[1];
				} else {
					var dynPage = searchLoc;
				}
				if(theDinamicFrame) {
					theDinamicFrame.setAttribute('linkHref',dynPage);
				}
			}
		}
	}
	if(theDinamicFrame && (theDinamicFrame.getAttribute('linkHref'))) {
		var defaultPath = theDinamicFrame.getAttribute('linkHref');
		theDinamicFrame.removeAttribute('linkHref');
		theDinamicFrame.removeAttribute('linkType');
		theDinamicFrame.removeAttribute('linkmode');
		loadFile(defaultPath);
	} else {
		window.name='';
		reflowDynZones();
		if(shoponline) {
			loadShopFile();
		}
		if(cartItemsMaster && (!cartLoaded)) {
			cartLoader();
		}
		if(theOrderPage && (!orderLoaded)) {
			loadOrder();
		}
		shoplibCheck();
		if((pageGlobalName == 'my_account.html') || (pageGlobalName == 'my_history.html') || (pageGlobalName == 'my_welcome.html') || (pageGlobalName == 'my_favorites.html') || (pageGlobalName == 'my_contacts.html') || (pageGlobalName == 'my_forum.html')) {
			if(membersCode) {
/*				lockScreen();*/
				membersSetup(pageGlobalName);
			}
		}
		if((pageGlobalName == 'my_admins.html') || (pageGlobalName == 'my_admin_account.html') || (pageGlobalName == 'my_admin_members.html') || (pageGlobalName == 'my_admin_history.html') || (pageGlobalName == 'my_admins_welcome.html') || (pageGlobalName == 'my_admin_cmrs.html')) {
			if(membersCode) {
/*				lockScreen();*/
				membersSetup(pageGlobalName);
			}
		}
		if(pageGlobalName == 'my_inscription.html') {
			lockScreen();
			if(inscriptionCode) {
				setTimeout('inscriptionSetup()',350);
			} else {
				addScriptFile('my_shop/my_inscription.js');
			}
		}
		if(pageGlobalName != 'my_shop.html') {
			hidedbPreload();
		}
		if(forumPage && startForum) {
			setTimeout('startForum()',350);
		}
		if(eCommunityPlugin && (!eCommunityRunning)) {
			setTimeout('eCommunityReport()',100);
		}
		if(contactsCode && contactsPage) {
			setTimeout('contactsSetup()',500);
		}
		if(loadedPage) {
			loadedPage(pageName);
		}
		if(loadedPage && sysAccessCode) {
			setTimeout("myDumpUserInfos('silent')",350);
		}
		loadPlugins();
		adjustLineHeights();
	}
};
function adjustLineHeights() {
	var theNodes = document.getElementsByTagName('span');
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		if((aNode.style.fontSize) && (!aNode.style.lineHeight)) {
			var aLineHeight = parseInt(aNode.style.fontSize);
			if(aLineHeight > 10) {
				aLineHeight = parseInt(aLineHeight*1.2);
				aNode.style.lineHeight = aLineHeight+'px';
			}
		}
	}
};

function loadShopFile() {
	if((communicationLayer == 'iframe') && (shopType != 'none')) {
		alert('You need a more recent browser');
	}
	shoplibCheck();
	if(!shopCode && !cartItemsMaster) {
		addScriptFile('my_shop/my_shop.js');
	} else {
		setTimeout('canLoadShop()',10);
	}
};
function addScriptFile(aPath) {
	if((aPath.indexOf('my_langs/strings') != -1) && localStrings) {
		return;
	}
	if(document.body) {
		var anItem = document.createElement('script');
		anItem.setAttribute('type','text/javascript');
		anItem.setAttribute('src',aPath);
		document.body.appendChild(anItem);
	}
};
function canLoadShop() {
	if(!shopLib) {
		setTimeout('canLoadShop()',10);
	} else {
		setTimeout('loadShop()',1);
	}
};
function shoplibCheck() {
	if(!shopLib) {
		addScriptFile('my_shop/shoplib.js');
	} else {
		if(!shoponline && (cartItemsMaster || caddyInfos) && (!orderLoaded)) {
			setTimeout('getShopitemsShoplist()',1000);
		}
	}
};
function loadFile(filePath) {
	unmapDBitems();
	sysAccessCode = false;
	lastMembersDataShown = false;
	activeContactsListLoaded = false;
	newmembersDisplayLayer = null;
	contactsDisplayLayer = null;
	theContactsDisplaySheet = null;
	theContactsPropsMenu = null;
	sheetsPerRow = 1;
	eCommunityRunning = false;
	lastIDs = new Array();
	newIDs = null;
	contactsStarted = false;
	contactsPage = false;
	forumStarted = false;
	forumPage = false;
	isForumSetup = false;
	dataTypeToGet = 'POSTS';
	theForumCommandBar = null;
	shopDrawn = false;
	shoponline = false;
	dbMultiprintAllowed = false;
	savedBodyScroll = null;
	isCaddyContentsRead = false;
	cartItemsMaster = null;
	favoritesItemsMaster = null;
	orderReportContainer = null;
	paymentsLayer = null;
	orderHistoryBox = null;
	admindataLayer = null;
	memberslistLayer = null;
	clientslistLayer = null;
	if(initShopVars) {
		initShopVars();
	}
	loadfilePath = filePath;
	if(filePath.indexOf('/') != -1) {
		var aPath = filePath.split('/');
		aPath = aPath[(aPath.length)-1];
		pageName = aPath;
	} else {
		pageName = filePath;
	}
	pageGlobalName = trimLangID(pageName);
	if(pageName.indexOf('?search=') != -1) {
		pageName = pageName.split('?search=')[0];
	}
	if(pageName.indexOf('?ref=') != -1) {
		pageName = pageName.split('?ref=')[0];
	}
	if((pageGlobalName == 'my_shop.html') || (pageGlobalName == 'my_order.html') || (pageGlobalName == 'my_members.html')) {
		shoplibCheck();
	}
	pressPathButtons();
	if(filePath.indexOf('?search=') != -1) {
		if(!DBsearchData) {
			DBsearchData = filePath.split('?search=')[1];
			DBsearchData = 'search='+DBsearchData;
			filePath = filePath.split('?search=')[0];
		}
	} else if(filePath.indexOf('?ref=') != -1) {
		if(!DBsearchData) {
			DBsearchData = filePath.split('?ref=')[1];
			DBsearchData = 'ref='+DBsearchData;
			filePath = filePath.split('?ref=')[0];
		}
	}
	if(communicationLayer == 'iframe') {
		loadfileConnexionLayer = document.getElementById('_socket');
		loadfileConnexionLayer.style.display = 'block';
		loadfileConnexionLayer.src = filePath;
	} else {
		loadHTMLdata(filePath,'webpage');
	}
};

function addImportedHTMLdata(htmlData) {
	if(!htmlData) {
		return;
	}
	if(htmlData.indexOf('<div') == -1) {
		return;
	}
	if(htmlData.indexOf('shopIt()') != -1) {
		htmlData = htmlData.split('shopIt()').join('');
	}
	theDinamicFrame.innerHTML = htmlData;
	var targetBox = theDinamicFrame.getElementsByTagName('DIV')[0].getElementsByTagName('DIV')[0];
	var thePrintOrigin = '';
	if(targetBox.getAttribute('printorigin')) {
		var thePrintOrigin = targetBox.getAttribute('printorigin');
	}
	var dWidth = parseInt(targetBox.getAttribute('dw'));
	var dHeight = parseInt(targetBox.getAttribute('dh'));
	theData = targetBox.innerHTML;
	theDinamicFrame.innerHTML = '';
	importExternalData(theData,dWidth,dHeight,thePrintOrigin);
	loadfilePath = '';
};
function importExternalData(newData,dataWidth,dataHeight,printOrigin) {
	
	var myLoc = getAbsoluteLocation(theDinamicFrame,pageweb);
	var dTop = myLoc[0];
	var dLeft = myLoc[1];
	
	if(printOrigin && (printOrigin.indexOf(':') != -1)) {
		var thePrintOrigin = printOrigin.split(':');
		var topOrigin = parseInt(thePrintOrigin[0]);
		var leftOrigin = parseInt(thePrintOrigin[1]);
		topOrigin = topOrigin-dTop;
		leftOrigin = leftOrigin-dLeft;
		thePrintOrigin = topOrigin+':'+leftOrigin;
		pageweb.setAttribute('printorigin',thePrintOrigin);
	}
	
	theDinamicFrame.innerHTML = newData;

	theDinamicFrame.style.width = dataWidth+'px';
	theDinamicFrame.style.height = dataHeight+'px';
	
	var newWidth = (dLeft+dataWidth);
	var newHeight = (dTop+dataHeight);
	var defaultWidth = parseInt(pageweb.getAttribute('dw'));
	var defaultHeight = parseInt(pageweb.getAttribute('dh'));
	if(newWidth < defaultWidth) {
		newWidth = defaultWidth;
	}
	if(newHeight < defaultHeight) {
		newHeight = defaultHeight;
	}

	
	pageweb.style.height = defaultHeight+'px';
	pageweb.style.width = defaultWidth+'px';

	pageweb.setAttribute('mh',defaultHeight);
	pageweb.setAttribute('mw',defaultWidth);
	
	removeStartupScreen();
	removeDynNodes();
		
	var scriptsHolder = document.createElement('div');
	
	var theScripts = theDinamicFrame.getElementsByTagName('script');
	for(var j = theScripts.length; j > 0; j--) {
		var aScript = theScripts[j-1];
		scriptsHolder.appendChild(aScript.parentNode);
	}
	
	var theNodes = onlyValidNodes(theDinamicFrame.childNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		aNode = importNode(aNode,dTop,dLeft);
		if(aNode.getAttribute('btype') && (aNode.getAttribute('btype') != "pagebkg")) {
			aNode.setAttribute('dynamicId',tracingIDs);
			aNode = pageweb.appendChild(aNode);
		}
	}
	var alreadyAddedScripts = '';
	var pageScripts = scriptsHolder.childNodes;
	for(var i = 0; i < pageScripts.length; i++) {
		var thisScript = pageScripts[i];
		var nodeContents = thisScript.innerHTML;
		if((nodeContents.indexOf('<SCRIPT') != -1) || (nodeContents.indexOf('<script') != -1)) {
			nodeContents = nodeContents.toLowerCase();
			if(nodeContents.indexOf('src="') != -1) {
				var scriptSrc = nodeContents.split('src="')[1];
				scriptSrc = scriptSrc.split('"')[0];
				if(alreadyAddedScripts.indexOf(scriptSrc) == -1) {
					if(scriptSrc) {
						alreadyAddedScripts = alreadyAddedScripts+scriptSrc;
						addScriptFile(scriptSrc);
						thisScript.innerHTML = '';
					}
				}
			} else {
				nodeContents = thisScript.getElementsByTagName('script')[0].innerHTML;
				eval(nodeContents);
			}
		} 
	}
	theDinamicFrame.style.zIndex = 1;
	theDinamicFrame.innerHTML = '';
	
	handlePNG();
	drawPage();
	
	if(loadingPage) {loadingPage(pageName);}
};

function docGetWidth() {
	if(theBrowserName == 'explorer') {
		return document.documentElement.clientWidth;
	} else {
		return window.innerWidth;
	}
};
function docGetHeight() {
	if(theBrowserName == 'explorer') {
		return document.documentElement.clientHeight;
	} else {
		return window.innerHeight;
	}
};

function toTop(evt) {
	if(theBrowserName == 'explorer') {
		document.documentElement.scrollTop = 0;
	} else {
		document.body.scrollTop = 0;
	}
};

var txtSizer = null;
function getTextSize(aString) {
	var newSize = new Array(0,0);
	aString = nobreakTxt(aString);
	if(!txtSizer) {
		txtSizer = document.createElement('SPAN');
		txtSizer = document.body.appendChild(txtSizer);
		txtSizer.style.position = 'absolute';
		txtSizer.style.top = '-1000000px';
		txtSizer.style.left = '0px';
	}
	txtSizer.innerHTML = aString;
	var myHeight = txtSizer.offsetHeight;
	var myWidth = txtSizer.offsetWidth;
	newSize = new Array(myWidth,myHeight);
	return newSize;
};

function ckeckkey(evt) {
	if(theBrowserName == 'explorer') {
		var aCode = event.keyCode;
		var anItem = event.srcElement;
	} else {
		var aCode = evt.keyCode;
		var anItem = evt.target;
	}
	
	if(aCode == 8) {
		if(lockTheBack && (anItem.tagName && ((anItem.tagName != 'INPUT') && (anItem.tagName != 'TEXTAREA')))) {
			return false;
		}
	} else if(aCode == 13) {
		if(checkUserAccess) {
			if(anItem.tagName && (anItem.tagName == 'INPUT')) {
				if(anItem.name && ((anItem.name == 'LOGIN') || (anItem.name == 'PASSWORD'))) {
					if(pageGlobalName != 'my_order.html') {
						checkUserAccess();
					}
				}
			}
		}
	}
};

function activateBackspaceKey() {
	lockTheBack=false;
};
function deactivateBackspaceKey() {
	lockTheBack=true;
};

var theScreenLock = null;
function lockScreen() {
	if(!theScreenLock) {
		theScreenLock = document.createElement('img');
		theScreenLock.setAttribute('ondragstart','return false');
		theScreenLock.src = 'a.gif';
		theScreenLock = document.body.appendChild(theScreenLock);
		theScreenLock.style.display = 'block';
		theScreenLock.style.zIndex = 1000000;
		theScreenLock.style.position = 'absolute';
	}
	theScreenLock.style.top = '0px';
	theScreenLock.style.left = '0px';
	theScreenLock.style.width = '100%';
	theScreenLock.style.height = parseInt(pageweb.style.height)+'px';
};
function unlockScreen() {
	if(theScreenLock) {
		theScreenLock.parentNode.removeChild(theScreenLock);
		theScreenLock = null;
	}
};

function nowTimeID() {
	var timeID = new Date();
	timeID = timeID.getTime();
	var timeString = '?'+timeID;
	return timeString;
};

function collectItemsByTargetZone(anID) {
	var itemsArray = new Array();
	var theNodes = pageweb.getElementsByTagName('div');
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		if(aNode.getAttribute('targetzone')) {
			var myID = aNode.getAttribute('targetzone');
			if(myID == anID) {
				if(aNode.getAttribute('btype') && (aNode.getAttribute('btype') == 'pushbutton')) {
					itemsArray[itemsArray.length] = aNode;
				}
			}
		}
	}
	return itemsArray;
};

function collectItemsByType(aType) {
	var itemsArray = new Array();
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		if(aNode.getAttribute('btype')) {
			var myType = aNode.getAttribute('btype');
			if(myType == aType) {
				itemsArray[itemsArray.length] = aNode;
			}
		}
	}
	return itemsArray;
};

function removeDynNodes() {
	var aDynId = theDinamicFrame.getAttribute('dynID');
	var theNodes = collectItemsByDynamicId(aDynId);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		aNode.parentNode.removeChild(aNode);
	}
	aNode = null;
	tracingIDs = tracingIDs.split(aDynId);
	tracingIDs = tracingIDs[0]+aDynId;
	recalculateContentsSize();
};

function recalculateContentsSize() {
	var pageBottom = parseInt(pageweb.getAttribute('dh'));
	var pageRight = parseInt(pageweb.getAttribute('dw'));
	var theNodes = onlyValidNodes(pageweb.childNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var myTop = aNode.offsetTop;
		var myLeft = aNode.offsetLeft;
		var myWidth = aNode.offsetWidth;
		var myHeight = aNode.offsetHeight;
		var myRightOffset = parseInt(aNode.getAttribute('rval'));
		if(aNode.getAttribute('brs') || aNode.getAttribute('trs')) {
			if(!myRightOffset) {
				myRightOffset = 0;
			}
			if(isNaN(myRightOffset)) {
				myRightOffset = 0;
			}
			var myRight = myLeft+myWidth+myRightOffset;
		}
		var myBottomOffset = parseInt(aNode.getAttribute('bval'));
		if(aNode.getAttribute('brs') || aNode.getAttribute('bls')) {
			if(!myBottomOffset) {
				myBottomOffset = 0;
			}
			if(isNaN(myBottomOffset)) {
				myBottomOffset = 0;
			}
			var myBottom = myTop+myHeight+myBottomOffset;
		}
		if(myBottom > pageBottom) {
			pageBottom = myBottom;
		}
		if(myRight > pageRight) {
			pageRight = myRight;
		}
	}
	pageweb.setAttribute('mh',pageBottom);
	pageweb.setAttribute('mw',pageRight);
};

function reflowDynZones() {
	dynZones = new Array();
	var theNodes = onlyValidNodes(pageweb.childNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var nodeType = aNode.getAttribute('btype');
		if(nodeType && (nodeType == 'dynamicbox')) {
			dynZones[dynZones.length] = aNode;
		}
	}
};

function setButtonEnabledState(aButton,aState) {
	if(aState == 'enabled') {
		aButton.setAttribute('enabled','1');
		setButtonTxtColor(aButton,'');
	} else {
		aButton.removeAttribute('enabled');
		setButtonTxtColor(aButton,'#888888');
	}
};
function setButtonTxtColor(aButton,aColor) {
	var theLabels = aButton.getElementsByTagName('SPAN');
	for(var i = 0; i < theLabels.length; i++) {
		var aLabel = theLabels[i];
		if(aColor) {
			if(aLabel.style.color && !aLabel.savedColor) {
				aLabel.savedColor = aLabel.style.color;
			}
			aLabel.style.color = aColor;
		} else {
			if(aLabel.savedColor) {
				aLabel.style.color = aLabel.savedColor;
			}
		}
	}
};

function pressPathButtons() {
	var anID = theDinamicFrame.getAttribute('dynID');
	var theNodes = collectItemsByTargetZone(anID);
	var theLoadFilePath = trimLangID(loadfilePath);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var theLinkHref = aNode.getAttribute('linkHref');
		theLinkHref = trimLangID(theLinkHref);
		if(theLoadFilePath.indexOf(theLinkHref) == 0) {
			if(aNode.getAttribute('ismenuitem')) {
				aNode = getLinkedPulldownButton(aNode);
			}
			if(aNode) {
				setButtonpict(aNode,hilitedButton);
				aNode.setAttribute('lockedpict','1');
			}
		} else {
			if(aNode.getAttribute('ismenuitem')) {
				aNode.removeAttribute('lockedpict');
				setButtonpict(aNode,0);
				aNode = getLinkedPulldownButton(aNode);
			}
			if(aNode && (aNode != displayedPageMenuButton)) {
				aNode.removeAttribute('lockedpict');
				setButtonpict(aNode,0);
			}
		}
	}
};
function getLinkedPulldownButton(anItem) {
	var theMenuLayer = anItem.parentNode.parentNode;
	var theButton = findLinkedItemByRefID(theMenuLayer);
	if(theButton) {
		return theButton;
	}
	return anItem;
};

function depressMenuButtons(anItem) {
	var theMenu = anItem.parentNode;
	var theNodes = onlyValidNodes(theMenu.childNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		setButtonpict(aNode,0);
	}
};

function setCursor(whatObj,newCursor) {
	try {
		whatObj.style.cursor = newCursor;
	} catch(e) {
	}
};
var theOverlappingItems = null;
function hideOverlappingItems(mainItem) {
	theOverlappingItems = new Array();
	var menuRect = getItemRect(mainItem);
	var theTop = menuRect[0];
	var theLeft = menuRect[1];
	var theBottom = menuRect[2];
	var theRight = menuRect[3];
	var theFrontItems = getFrontObjects();
	for(var i = 0; i < theFrontItems.length; i++) {
		var aFrontItem = theFrontItems[i];
		var itemRect = getItemRect(aFrontItem);
		var myTop = itemRect[0];
		var myLeft = itemRect[1];
		var myBottom = itemRect[2];
		var myRight = itemRect[3];
		if(((myTop > theTop) && (myTop < theBottom)) || ((myBottom < theBottom) && (myBottom > theTop))) {
			if(((myLeft > theLeft) && (myLeft < theRight)) || ((myRight < theRight) && (myRight > theLeft))) {
				theOverlappingItems[theOverlappingItems.length] = aFrontItem;
				aFrontItem.style.visibility = 'hidden';
			}
		}
	}
};
function restoreOverlappingItems() {
	for(var i = 0; i < theOverlappingItems.length; i++) {
		var aFrontItem = theOverlappingItems[i];
		aFrontItem.style.visibility = 'visible';
	}
};


function getFrontObjects() {
	var theObjects = new Array();
	var theSelects = document.getElementsByTagName('select');
	for(var i = 0; i < theSelects.length; i++) {
		var aSelect = theSelects[i];
		theObjects[theObjects.length] = aSelect;
	}
	var theNodes = onlyValidNodes(pageweb.childNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var myTagName = aNode.tagName.toLowerCase();
		 if(myTagName == 'div') {
			var myType = aNode.getAttribute('btype');
			if(myType == 'mediabox') {
				theObjects[theObjects.length] = aNode;
			}
		}
	}
	return theObjects;
};


function hideFrontObjects() {
	var theSelects = document.getElementsByTagName('select');
	for(var i = 0; i < theSelects.length; i++) {
		var aSelect = theSelects[i];
		aSelect.style.visibility = 'hidden';
	}
	var theNodes = onlyValidNodes(pageweb.childNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var myTagName = aNode.tagName.toLowerCase();
		 if(myTagName == 'div') {
			var myType = aNode.getAttribute('btype');
			if(myType == 'mediabox') {
				aNode.style.visibility = 'hidden';
			}
		}
	}
	if(searchResultsLayer) {
		var theNodes = searchResultsLayer.getElementsByTagName('div');
		for(var i = 0; i < theNodes.length; i++) {
			var aNode = theNodes[i];
			var myType = aNode.getAttribute('btype');
			if(myType == 'mediabox') {
				aNode.style.visibility = 'hidden';
			}
		}
	}
};
function restoreFrontObjects() {
	var theSelects = document.getElementsByTagName('select');
	for(var i = 0; i < theSelects.length; i++) {
		var aSelect = theSelects[i];
		aSelect.style.visibility = 'visible';
	}
	var theNodes = onlyValidNodes(pageweb.childNodes);
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var myTagName = aNode.tagName.toLowerCase();
		 if(myTagName == 'div') {
			var myType = aNode.getAttribute('btype');
			if(myType == 'mediabox') {
				aNode.style.visibility = 'visible';
			}
		}
	}
	if(searchResultsLayer) {
		var theNodes = searchResultsLayer.getElementsByTagName('div');
		for(var i = 0; i < theNodes.length; i++) {
			var aNode = theNodes[i];
			var myType = aNode.getAttribute('btype');
			if(myType == 'mediabox') {
				aNode.style.visibility = 'visible';
			}
		}
	}
};

function  getItemRect(anItem) {
	var theRect = getAbsoluteLocation(anItem,pageweb);
	var theTop = theRect[0];
	var theLeft = theRect[1];
	var theWidth = anItem.offsetWidth;
	var theHeight = anItem.offsetHeight;
	theRect[theRect.length] = theTop+theHeight;
	theRect[theRect.length] = theLeft+theWidth;
	return theRect;
};

function getAbsoluteLocation(aBoxObj,refObj) {
	var aBoxTop = getBoxAtop(aBoxObj);
	var aBoxLeft = getBoxAleft(aBoxObj);
	while(aBoxObj.parentNode != refObj) {
		aBoxObj = aBoxObj.parentNode;
		aBoxTop = aBoxTop+getBoxAtop(aBoxObj);
		aBoxLeft = aBoxLeft+getBoxAleft(aBoxObj);
		aBoxTop = aBoxTop-getBoxStop(aBoxObj);
		aBoxLeft = aBoxLeft-getBoxSleft(aBoxObj);
	}
	var aBoxLoc = new Array(aBoxTop,aBoxLeft);
	return aBoxLoc;
};
function getBoxAtop(aBoxObj) {
	var aValue = aBoxObj.offsetTop;
	if(isNaN(aValue)) {aValue = 0;}
	if(!aValue) {aValue = 0;}
	return aValue;
};
function getBoxAleft(aBoxObj) {
	var aValue = aBoxObj.offsetLeft;
	if(isNaN(aValue)) {
		aValue = 0;
	}
	if(!aValue) {
		aValue = 0;
	}
	return aValue;
};
function getBoxStop(aBoxObj) {
	var aValue = aBoxObj.scrollTop;
	if(isNaN(aValue)) {
		aValue = 0;
	}
	if(!aValue) {
		aValue = 0;
	}
	return aValue;
};
function getBoxSleft(aBoxObj) {
	var aValue = aBoxObj.scrollLeft;
	if(isNaN(aValue)) {
		aValue = 0;
	}
	if(!aValue) {
		aValue = 0;
	}
	return aValue;
};

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 getPageElements() {
	var theNodes = pageweb.childNodes;
	theNodes = onlyValidNodes(theNodes);
	return theNodes;
};

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 imgAdjust(anItem) {
	if(anItem.getAttribute('isdbitem')) {
		return;
	}
	var adjustImg = true;
	var theUid = anItem.getAttribute('item_uID');
	if(theUid && (theUid == '_international_')) {
		adjustImg = false;
	}
	randomBanner(anItem);
	var theImg = anItem.getElementsByTagName('IMG')[0];
	if(theImg) {
		if(adjustImg) {
			theImg.style.height = theImg.parentNode.style.height;
			theImg.style.width = theImg.parentNode.style.width;
		}
		var anSrc = theImg.src;
		anSrc = anSrc.toLowerCase();
		if(anSrc.indexOf('.png') != -1) {
			handleThisPng(theImg);
		}
	}
};

function loadPlugins() {
	var pageItems = getPageElements();
	for(var i = 0; i < pageItems.length; i++) {
		var aPageItem = pageItems[i];
		var theType = aPageItem.getAttribute('btype');
		if(theType == 'mediabox') {
			var resourcePath = aPageItem.getAttribute('linkedmedia');
			if(!resourcePath) {
				return;
			}
			var isInited = aPageItem.getAttribute('inited');
			if(isInited) {
				return;
			}
			aPageItem.setAttribute('inited','1');
			loadPlugin(aPageItem);
		}
	}
};

function loadPlugin(anItem) {
	var resourcePath = anItem.getAttribute('linkedmedia');
	var resourceFile = anItem.getAttribute('linkedmedia');
	var linkHref = anItem.getAttribute('linkHref');
	var linkMode = anItem.getAttribute('linkmode');
	var linkType = anItem.getAttribute('linkType');
	var dynamicBanner = anItem.cloneNode(false);
	dynamicBanner.style.visibility = 'hidden';
	var myTop = parseInt(dynamicBanner.style.top);
	var myLeft = parseInt(dynamicBanner.style.left);
	var myWidth = parseInt(dynamicBanner.style.width);
	var myHeight = parseInt(dynamicBanner.style.height);
	dynamicBanner.style.backgroundColor = '';
	if(resourcePath.indexOf('.swf') != -1) {
		var splitString = 'my_animations/';
		if(resourcePath.indexOf(splitString) == -1) {
			splitString = 'my_movies/';
		}
		if(resourcePath.indexOf(splitString) == -1) {
			return;
		}
		resourcePath = resourcePath.split(splitString)[1];
		resourcePath = splitString+resourcePath;
		resourceFile = resourceFile.split(splitString)[1];
		resourceFile = splitString+resourceFile;
		if(resourcePath.indexOf('//') != -1) {
			resourcePath = resourcePath.split('//');
			resourcePath = resourcePath.join('/');
		}
		var embedStr = embedFlashStr.split('flashmoviename.swf');
		var resPath = resourcePath.split('/');
		resPath[resPath.length-1] = '';
		resPath = resPath.join('/');
		resourcePath = resourcePath+'?path='+resPath;
	} else {
		resourcePath = resourcePath.split('my_movies/')[1];
		resourcePath = 'my_movies/'+resourcePath;
		var embedStr = embedMovieStr.split('quicktimemoviename.mov');
	}
	embedStr = embedStr.join(resourcePath);
	embedStr = embedStr.split('ITEMWIDTH');
	embedStr = embedStr.join(myWidth);
	embedStr = embedStr.split('ITEMHEIGHT');
	embedStr = embedStr.join(myHeight);
	resourceFile = resourceFile.split('.swf').join('.xml');
	embedStr = embedStr.split('xmlURL=');
	embedStr = embedStr.join('xmlURL='+resourceFile);
	dynamicBanner.innerHTML = embedStr;
	anItem.parentNode.appendChild(dynamicBanner);
	dynamicBanner.style.display = 'block';
	dynamicBanner.style.visibility = 'visible';
	if(linkHref) {
		anItem.setAttribute('linkHref',linkHref);
	}
	if(linkMode) {
		anItem.setAttribute('linkmode',linkMode);
	}
	if(linkType) {
		anItem.setAttribute('linkType',linkType);
	}
	if(resourcePath) {
		anItem.setAttribute('medianame',resourcePath);
	}
	anItem.setAttribute('btype','pictbox');
};

function randomBanner(anItem) {
	if(anItem.getAttribute('inited')) {
		return;
	}
	anItem.setAttribute('inited','1');
	var randomImg = anItem.getAttribute('item_uID');
	if(randomImg && (randomImg.indexOf('banner:') == 0)) {
		var randomLength = randomImg.split(':');
		var randomStart = randomLength[1];
		randomStart = parseInt(randomStart);
		var randomEnd = randomLength[2];
		if(!randomEnd) {
			randomEnd = randomStart;
			randomStart = 1;
		} else {
			randomEnd = parseInt(randomEnd);
		}
		try {
			var curBanner = (Math.round(Math.random()*(randomEnd-randomStart)))+randomStart;
			curBanner = parseInt(curBanner);
			var bannerPath = 'my_pictures/banners/banner'+curBanner+'.jpg';
			var theImg = anItem.getElementsByTagName('IMG')[0];
			if(theImg) {
				theImg.src = bannerPath;
			}
		} catch(e) {
		}
	}
};

function handlePNG() {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if((version >= 5.5) && (version < 7.0) && (document.body.filters))  {
		var thePicts = document.getElementsByTagName('img');
		for(var i = 0; i < thePicts.length; i++) {
			var img = thePicts[i];
			var anSrc = img.src;
			anSrc = anSrc.toLowerCase();
			if(anSrc.indexOf('.png') != -1) {
				handleThisPng(img);
			}
		}
	}
};
function handleThisPng(aPng) {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if((version >= 5.5) && (version < 7.0) && (document.body.filters))  {
		var alreadySet = aPng.getAttribute('img_src');
		if(alreadySet) {return;}
		var myT = aPng.style.top;
		var myL = aPng.style.left;
		var myW = aPng.clientWidth;
		var myH = aPng.clientHeight;
		var pngSrc = aPng.src;
		if(pngSrc.indexOf('?') != -1) {pngSrc = pngSrc.split('?')[0];}
		aPng.setAttribute('img_src',pngSrc);
		aPng.src = 'a.gif';
		if(!aPng.style.width || (aPng.style.width == 'auto') || (aPng.style.width.indexOf('px') == -1)) {
			aPng.style.width = myW+'px';
		}
		if(!aPng.style.height || (aPng.style.height == 'auto') || (aPng.style.height.indexOf('px') == -1)) {
			aPng.style.height = myH+'px';
		}
		aPng.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+pngSrc+'\', sizingMethod=\'scale\')';
	}
};

function ctwDBlinks(mainHref,aString) {
	var invalidChars = '({[]})\\| <>\t';
	var handledText = '';
	var textToHandle = aString;
	var aLink = '';
	var theLinks = '';
	var startingPoint = textToHandle.indexOf('?page=');
	var lastIndex = 0;
	while(startingPoint != -1) {
		aLink = '';
		startingPoint = textToHandle.indexOf('?page=');
		for(var j = startingPoint; j < textToHandle.length; j++) {
			var aChar = textToHandle.charAt(j);
			if(aChar && (invalidChars.indexOf(aChar) == -1)) {
				aLink = aLink+aChar;
			} else {
				break;
			}
		}
		if(aLink && (theLinks.indexOf(aLink) == -1)) {
			theLinks = theLinks+'|'+aLink;
		}
		handledText = handledText+textToHandle.substring(lastIndex,j);
		textToHandle = textToHandle.substring(j-1);
		lastIndex = j;
	}
	theLinks = theLinks.split('|');
	for(var i = 0; i < theLinks.length; i++) {
		var aLink = theLinks[i];
		if(aLink) {
			aString = aString.split(aLink);
			aLink = mainHref+aLink;
			aString = aString.join(aLink);
		}
	}
	return aString;
};

function httpLinks(txtString) {
	var invalidChars = '({[]})\\| <>\t';
	if(txtString.indexOf('?page=') != -1) {
		var mainHref = document.location.href;
		if(mainHref.indexOf('?page=') != -1) {
			mainHref = mainHref.split('?page=')[0];
		}
		var txtString = ctwDBlinks(mainHref,txtString);
	}
	var splitString = '';
	if(txtString.indexOf('http://') != -1) {
		var splitString = 'http://';
	} else if(txtString.indexOf('https://') != -1) {
		var splitString = 'https://';
	} else if(txtString.indexOf('my_files/') != -1) {
		var splitString = 'my_files/';
	}
	var temp = '';
	if(splitString) {
		var linksArray = new Array();
		tempString = txtString.split(splitString);
		for(var i = 0; i < tempString.length; i++) {
			temp = '';
			var aLink = tempString[i];
			for(var j = 0; j < aLink.length; j++) {
				var aChar = aLink.charAt(j);
				if(invalidChars.indexOf(aChar) == -1) {
					temp = temp+aChar;
				} else {
					aLink = temp;
					break;
				}
			}
			if(aLink) {
				var numChars = aLink.length-1;
				var lastChar = aLink.charAt(numChars);
				if((lastChar == '.') || (lastChar == ',')) {
					aLink = aLink.substring(0,numChars);
				}
				aLink = splitString+aLink;
				linksArray[linksArray.length] = aLink;
			}
		}
		var styleString ='';
		if(genericLinkColor) {
			styleString = ' style="color:'+genericLinkColor+';cursor:pointer;"';
		}
		for(var i = 0; i < linksArray.length; i++) {
			var aLink = linksArray[i];
			var linkText = linksArray[i];
			var splitLink = linksArray[i];
			var linkTarget = '_blank';
			if(aLink.indexOf('---') != -1) {
				var linkParts = aLink.split('---');
				aLink = linkParts[0];
				linkText = linkParts[1];
				splitLink = aLink+'---'+linkText;
				if(splitString.indexOf('my_files/') == -1) {
					linkTarget = '_self';
				}
				if(linkText.indexOf('_') != -1) {
					linkText = linkText.split('_');
					linkText = linkText.join(' ');
				}
			}
			var htmlLink = '<a href="'+aLink+'" target="'+linkTarget+'"'+styleString+'>'+linkText+'</a>';
			txtString = txtString.split(splitLink);
			txtString = txtString.join(htmlLink);
		}
	}
	return txtString;
};
function mailtoLinks(txtString) {
	if(txtString.indexOf('mailto:') != -1) {
		var linksArray = new Array();
		tempString = txtString.split('mailto:');
		for(var i = 0; i < tempString.length; i++) {
			var aLink = tempString[i];
			aLink = aLink.split(' ')[0];
			if(aLink.indexOf(')') != -1) {
				aLink = aLink.split(')')[0];
			}
			if(aLink) {
				linksArray[linksArray.length] = aLink;
			}
		}
		var styleString ='';
		if(genericLinkColor) {
			styleString = ' style="color:'+genericLinkColor+';cursor:pointer;"';
		}
		for(var i = 0; i < linksArray.length; i++) {
			var aLink = linksArray[i];
			var theLink = 'mailto:'+aLink;
			var htmlLink = '<a href="'+theLink+'"'+styleString+'>'+aLink+'</a>';
			txtString = txtString.split('mailto:'+aLink);
			txtString = txtString.join(htmlLink);
		}
	}
	return txtString;
};


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) {
	if(!menuObject) {
		return;
	}
	optionValue = ''+optionValue;
	optionLabel = ''+optionLabel;
	if(!optionValue) {
		return;
	}
	if(!optionLabel) {
		return;
	}
	menuLength = menuObject.length;
	if(optionValue.length == 2) {
		var check = '|'+optionValue+'_|';
		if(alllangsStrings.indexOf(check) != -1) {
			optionLabel = findVersionName(optionValue);
		}
	}
	optionLabel = convertTxt(optionLabel);
	if(optionLabel.indexOf('&amp;') != -1) {
		optionLabel = optionLabel.split('&amp;').join('&');
	}
	if(optionValue.indexOf('&amp;') != -1) {
		optionValue = optionValue.split('&amp;').join('&');
	}
	menuObject.options[menuLength] = new Option(optionLabel,optionValue);
	if(optionSelected) {
		menuObject.options[menuLength].setAttribute('selected',true);
	}
};

function drawPopup(anItem) {
	var anArray = new Array();
	var popupData = anItem.getAttribute('formule');
	popupData = popupData.split(':');
	for(var i = 1; i < popupData.length; i++) {
		anArray[anArray.length] = popupData[i];
	}
	var anItem = makePopUp(anItem);
	var optionSelected = true;
	for(var i = 0; i < anArray.length; i++) {
		var anItemName = anArray[i];
		addOption(anItem,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 dynID = refItem.getAttribute('dynamicId');
	var newItem = document.createElement('SELECT');
	newItem = targetContainer.insertBefore(newItem,refItem);
	refItem.style.display = 'none';
	refItem.name = '';
	if(dynID) {
		newItem.setAttribute('dynamicId',dynID);
	}
	newItem.style.position = 'absolute';
	newItem.style.display = 'block';
	newItem.style.visibility = 'visible';
	newItem.style.fontSize = '14px';
	newItem.style.top = itemTop;
	newItem.style.left = itemLeft;
	newItem.style.zIndex = itemZindex;
	newItem.setAttribute('tabIndex',itemTabIndex);
	newItem.name = itemName;
	return newItem;
};

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 = 100000;
	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';
	}
	hideOverlappingItems(displayedPageMenuLayer);
};
function hidePulldownMenu() {
	if(displayedPageMenu && displayedPageMenu.getAttribute('canBeHidden')) {
		displayedPageMenu.style.width = 1+'px';
		displayedPageMenu.style.height = 1+'px';
		setButtonpict(displayedPageMenuButton,0);
		displayedPageMenuButton = null;
		restoreOverlappingItems();
	}
};

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)) {
					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(currentVisibleItem) {currentVisibleItem.style.zIndex = 10000;}
	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;
	}
};

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 setOpacity(anObj,aValue) {
	if(!anObj) {
		return;
	}
	if(!aValue) {
		aValue = 100;
	}
	if(theBrowserName == 'explorer') {
		anObj.style.filter = 'alpha(opacity='+aValue+')';
	} else {
		anObj.style.opacity = aValue/100;
	}
};

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;
};

var theZoomLayer = null;
var theZoomPicture = null;
var theSourcePicture = null;
function zoomPicture(aPicture) {
	theSourcePicture = aPicture;
	theZoomPicture = document.createElement('img');
	theZoomPicture.onload = displayZoomedPicture;
	var pngSrc = theSourcePicture.getAttribute('img_src');
	if(pngSrc) {
		theZoomPicture.src = pngSrc;
	} else {
		theZoomPicture.src = aPicture.src;
	}
};
function displayZoomedPicture() {
	theZoomLayer = document.createElement('div');
	theZoomLayer.id = 'zoom_layer';
	var anImg = document.createElement('img');
	anImg.src = 'a.gif';
	anImg.style.width = anImg.style.height = '100%';
	anImg = theZoomLayer.appendChild(anImg);
	anImg.style.backgroundColor = 'gray';
	if(theBrowserName == 'explorer') {
		anImg.style.filter = "alpha(opacity=50)";
		var offsetTop = document.documentElement.scrollTop;
		var offsetLeft = document.documentElement.scrollLeft;
	} else if(theBrowserName == 'firefox') {
		anImg.style.opacity = 0.5;
		var offsetTop = self.pageYOffset;
		var offsetLeft = self.pageXOffset;
	} else {
		anImg.style.opacity = 0.5;
		var offsetTop = document.body.scrollTop;
		var offsetLeft = document.body.scrollLeft;
	}
	var viewHeight = docGetHeight();
	var viewWidth = docGetWidth();
	theZoomLayer = document.body.appendChild(theZoomLayer);
	theZoomLayer.style.zIndex = '1000000';
	theZoomLayer.style.display = 'block';
	theZoomLayer.style.position = 'absolute';
	theZoomLayer.style.overflow = 'hidden';
	theZoomLayer.style.overflowX = 'hidden';
	theZoomLayer.style.overflowY = 'hidden';
	theZoomLayer.style.top = theZoomLayer.style.left = '0px';
	if(keepHcentered) {
		theZoomLayer.style.width = '100%';
	} else {
		theZoomLayer.style.width = pageweb.style.width;
		viewWidth = parseInt(pageweb.getAttribute('dw'));
	}
	if(docH > parseInt(pageweb.style.height)) {
		theZoomLayer.style.height = docH+'px';
	} else {
		theZoomLayer.style.height = pageweb.style.height;
	}
	theZoomLayer.onclick = closeZoomLayer;
	var imgBox = document.createElement('div');
	imgBox = theZoomLayer.appendChild(imgBox);
	imgBox.style.display = 'block';
	imgBox.style.position = 'absolute';
	imgBox.style.overflow = 'hidden';
	imgBox.style.overflowX = 'hidden';
	imgBox.style.overflowY = 'hidden';
	imgBox.style.top = imgBox.style.left = '-100000px';
	imgBox.style.width = theZoomLayer.style.width;
	imgBox.style.height = theZoomLayer.style.height;
	imgBox.style.backgroundColor = 'white';
	imgBox.style.border = 'solid black 1px';
	theZoomPicture = imgBox.appendChild(theZoomPicture);
	var imgWidth = theZoomPicture.offsetWidth;
	var imgHeight = theZoomPicture.offsetHeight;
	var maxW = 800;
	var maxH = 600;
	if((imgWidth > maxW) || (imgHeight > maxH)) {
		while((imgWidth > maxW) || (imgHeight > maxH)) {
			imgWidth = imgWidth-(imgWidth*0.05);
			imgHeight = imgHeight-(imgHeight*0.05);
		}
		imgWidth = parseInt(imgWidth);
		imgHeight = parseInt(imgHeight);
		theZoomPicture.style.width = imgWidth+'px';
		theZoomPicture.style.height = imgHeight+'px';
	}
	imgBox.style.width = (imgWidth+20)+'px';
	imgBox.style.height = (imgHeight+40)+'px';
	var boxLeft = parseInt(((viewWidth-imgBox.offsetWidth)/2)+offsetLeft);
	var boxTop = parseInt(((viewHeight-imgBox.offsetHeight)/3)+offsetTop);
	if(boxLeft < 0) {
		boxLeft = 0;
	}
	if(boxTop < 0) {
		boxTop = 0;
	}
	imgBox.style.top = boxTop+'px';
	imgBox.style.left = boxLeft+'px';
	theZoomPicture.style.margin = '10px';
	theZoomPicture.style.marginTop = '30px';
	var anHeader = document.createElement('div');
	anHeader = imgBox.appendChild(anHeader);
	anHeader.style.display = 'block';
	anHeader.style.position = 'absolute';
	anHeader.style.top = anHeader.style.left = '0px';
	anHeader.style.width = imgBox.style.width;
	anHeader.style.height = 20+'px';
	anHeader.style.borderBottom = 'solid #999999 1px';
	anHeader.style.backgroundImage = 'url(my_pictures/images/dialog_button_on.png)';
	anHeader.style.textAlign = 'center';
	anHeader.style.lineHeight = 21+'px';
	anHeader.style.fontSize = 12+'px';
	anHeader.style.fontWeight = 'bold';
	var aPictBox = theSourcePicture.parentNode;
	var imgTitle = aPictBox.getAttribute('item_uID');
	var aLabel = document.createElement('span');
	aLabel = anHeader.appendChild(aLabel);
	if(imgTitle) {
		aLabel.innerHTML = imgTitle;
	} else {
		aLabel.innerHTML = 'Preview';
	}
	var closeBox = anHeader.cloneNode(true);
	closeBox = imgBox.appendChild(closeBox);
	closeBox.style.lineHeight = 20+'px';
	closeBox.style.width = '25px';
	closeBox.style.left = (imgWidth-5)+'px';
	closeBox.style.borderLeft = 'solid #aaaaaa 1px';
	closeBox.style.cursor = 'pointer';
	closeBox.setAttribute('title','Click to close');
	aLabel = closeBox.getElementsByTagName('span')[0].innerHTML = 'x';
	var anSrc = theZoomPicture.src;
	anSrc = anSrc.toLowerCase();
	if(anSrc.indexOf('.png') != -1) {
		handleThisPng(theZoomPicture);
	}
	hideFrontObjects();
};
function closeZoomLayer() {
	theZoomLayer = document.getElementById('zoom_layer');
	theZoomLayer.innerHTML = '';
	theZoomLayer.parentNode.removeChild(theZoomLayer);
	theZoomLayer = null;
	theZoomPicture = null;
	theSourcePicture = null;
	restoreFrontObjects();
	theZoomLayer = document.getElementById('zoom_layer');
	if(theZoomLayer) {closeZoomLayer();}
};

function unmapDBitems() {
	for(var i = mappedDBitems.length; i > 0; i--) {
		var aMappedItem = mappedDBitems[(i-1)];
		if(aMappedItem) {
			aMappedItem.parentNode.removeChild(aMappedItem);
		}
	}
	mappedDBitems = new Array();
};

function newTableSet(numRows,numCols) {
	var newTable = document.createElement('TABLE');
	var newTbody = document.createElement('TBODY');
	newTbody = newTable.appendChild(newTbody);
	for(var i = 0; i < numRows; i++) {
		var newRow = document.createElement('TR');
		newRow = newTbody.appendChild(newRow);
		for(var j = 0; j < numCols; j++) {
			var newCell = document.createElement('TD');
			newCell = newRow.appendChild(newCell);
		}
	}
	return newTable;
};

var theProgressLayer = null;
function showProgression(message,step,max) {
	if((step < 1) || (max < 1)) {
		return;
	}
	if(step == 0) {
		step = 1;
	}
	if(theBrowserName == 'explorer') {
		var offsetTop = document.documentElement.scrollTop;
		var offsetLeft = document.documentElement.scrollLeft;
	} else if(theBrowserName == 'firefox') {
		var offsetTop = self.pageYOffset;
		var offsetLeft = self.pageXOffset;
	} else {
		var offsetTop = document.body.scrollTop;
		var offsetLeft = document.body.scrollLeft;
	}
	var viewHeight = docGetHeight();
	var viewWidth = docGetWidth();
	if(!theProgressLayer) {
		theProgressLayer = makeProgressDlog();
	}
	if(!keepHcentered) {
		viewWidth = parseInt(pageweb.getAttribute('dw'));
	}
	theProgressLayer.style.height = pageweb.style.height;
	theProgressDlog = theProgressLayer.getElementsByTagName('div')[0];
	var dlogLeft = parseInt(((viewWidth-theProgressDlog.offsetWidth)/2)+offsetLeft);
	var dlogTop = parseInt(((viewHeight-theProgressDlog.offsetHeight)/2)+offsetTop);
	if(dlogLeft < 0) {
		dlogLeft = 0;
	}
	if(dlogTop < 0) {
		dlogTop = 0;
	}
	theProgressDlog.style.top = dlogTop+'px';
	theProgressDlog.style.left = dlogLeft+'px';
	var theLabel = document.getElementById('dlog_progress_message_label');
	if(message) {
		theLabel.innerHTML = message;
	}
	var theProgressBox = document.getElementById('dlog_progress_progress_box');
	var theProgressBar = document.getElementById('dlog_progress_progress_bar');
	if(theProgressBox && theProgressBar) {
		var progressLength = theProgressBox.offsetWidth;
		var progressStep = progressLength/max;
		var curProgress = parseInt(progressStep*step);
		theProgressBar.style.width = curProgress+'px';
	}
};
function makeProgressDlog() {
	theProgressLayer = document.createElement('div');
	var anImg = document.createElement('img');
	anImg.src = 'a.gif';
	anImg.style.width = anImg.style.height = '100%';
	anImg = theProgressLayer.appendChild(anImg);
	theProgressLayer = document.body.appendChild(theProgressLayer);
	theProgressLayer.style.zIndex = '1000000';
	theProgressLayer.style.display = 'block';
	theProgressLayer.style.position = 'absolute';
	theProgressLayer.style.overflow = 'hidden';
	theProgressLayer.style.overflowX = 'hidden';
	theProgressLayer.style.overflowY = 'hidden';
	theProgressLayer.style.top = theProgressLayer.style.left = '0px';
	if(keepHcentered) {
		theProgressLayer.style.width = '100%';
	} else {
		theProgressLayer.style.width = pageweb.style.width;
	}
	if(docH > parseInt(pageweb.style.height)) {
		theProgressLayer.style.height = '100%';
	} else {
		theProgressLayer.style.height = pageweb.style.height;
	}
	var theProgressDlog = document.createElement('div');
	theProgressDlog = theProgressLayer.appendChild(theProgressDlog);
	theProgressDlog.style.display = 'block';
	theProgressDlog.style.position = 'absolute';
	theProgressDlog.style.overflow = 'hidden';
	theProgressDlog.style.overflowX = 'hidden';
	theProgressDlog.style.overflowY = 'hidden';
	theProgressDlog.style.top = theProgressDlog.style.left = '-100000px';
	theProgressDlog.style.width = '400px';
	theProgressDlog.style.height = '100px';
	theProgressDlog.style.backgroundColor = '#eeeeee';
	theProgressDlog.style.border = 'solid black 1px';
	var anHeader = document.createElement('div');
	anHeader = theProgressDlog.appendChild(anHeader);
	anHeader.style.display = 'block';
	anHeader.style.position = 'absolute';
	anHeader.style.top = anHeader.style.left = '0px';
	anHeader.style.width = theProgressDlog.style.width;
	anHeader.style.height = 20+'px';
	anHeader.style.borderBottom = 'solid #999999 1px';
	anHeader.style.backgroundImage = 'url(my_pictures/images/dialog_button_on.png)';
	anHeader.style.textAlign = 'center';
	anHeader.style.lineHeight = 21+'px';
	anHeader.style.fontSize = 12+'px';
	anHeader.style.fontWeight = 'bold';
	var aLabel = document.createElement('span');
	aLabel = anHeader.appendChild(aLabel);
	aLabel.innerHTML = 'Progression';

	var msgBox = document.createElement('div');
	msgBox = theProgressDlog.appendChild(msgBox);
	msgBox.style.display = 'block';
	msgBox.style.position = 'absolute';
	msgBox.style.top = '25px';
	msgBox.style.left = '0px';
	msgBox.style.width = theProgressDlog.style.width;
	msgBox.style.height = 40+'px';
	msgBox.style.textAlign = 'center';
	msgBox.style.overflow = 'hidden';
	msgBox.style.overflowX = 'hidden';
	msgBox.style.overflowY = 'hidden';
	var aLabel = document.createElement('span');
	aLabel = msgBox.appendChild(aLabel);
	aLabel.id = 'dlog_progress_message_label';
	aLabel.innerHTML = '--';
	var progressBox = document.createElement('div');
	progressBox = theProgressDlog.appendChild(progressBox);
	progressBox.id = 'dlog_progress_progress_box';
	progressBox.style.display = 'block';
	progressBox.style.position = 'absolute';
	progressBox.style.border = 'solid #aaaaaa 1px';
	progressBox.style.backgroundColor = '#cccccc';
	progressBox.style.height = '15px';
	progressBox.style.width = '80%';
	progressBox.style.left = '10%';
	progressBox.style.bottom = '10px';
	progressBox.style.overflow = 'hidden';
	progressBox.style.overflowX = 'hidden';
	progressBox.style.overflowY = 'hidden';
	var progressBar = document.createElement('img');
	progressBar = progressBox.appendChild(progressBar);
	progressBar.src = 'my_pictures/images/dialog_button_off.png';
	progressBar.id = 'dlog_progress_progress_bar';
	progressBar.style.display = 'block';
	progressBar.style.position = 'absolute';
	progressBar.style.top = '-1px';
	progressBar.style.left = '0px';
	progressBar.style.width = '1px';
	progressBar.style.height = (parseInt(progressBox.style.height)+1)+'px';
	return theProgressLayer;
};
function discardProgression() {
	if(theProgressLayer) {
		theProgressLayer.parentNode.removeChild(theProgressLayer);
		theProgressLayer = null;
	}
};

function appendRedAsterisk(targetItem) {
	if(theMandatoryItemsArray) {
		theMandatoryItemsArray[theMandatoryItemsArray.length] = targetItem;
	}
};
function drawRedAsterisks() {
	if(!theMandatoryItemsArray) {
		return;
	}
	for(var i = 0; i < theMandatoryItemsArray.length; i++) {
		var anItem = theMandatoryItemsArray[i];
		appendRedAsterisks(anItem);
	}
};
function appendRedAsterisks(targetItem) {
	var myName = targetItem.name;
	if(!myName) {
		return true;
	}
	var topOffset = 7;
	var leftOffset = 10;
	if((targetItem.type == 'checkbox') || (targetItem.type == 'radio')) {
		var topOffset = 4;
		var leftOffset = 5;
	}
	var itemID = 'mandatory_'+myName;
	var mandatoryObject = document.getElementById(itemID);
	if(mandatoryObject) {
		return true;
	}
	var mandatoryObject = makeMandatoryObject();
	mandatoryObject.id = itemID;
	var myTop = parseInt(targetItem.style.top);
	var myLeft = parseInt(targetItem.style.left);
	mandatoryObject.style.top = (myTop-topOffset)+'px';
	mandatoryObject.style.left = (myLeft-leftOffset)+'px';
	mandatoryObject.style.zIndex = targetItem.style.zIndex;
	if(targetItem.getAttribute('brs')) {
		mandatoryObject.setAttribute('brs','1');
	}
	if(targetItem.getAttribute('bls')) {
		mandatoryObject.setAttribute('bls','1');
	}
	if(targetItem.getAttribute('trs')) {
		mandatoryObject.setAttribute('trs','1');
	}
	if(targetItem.getAttribute('tls')) {
		mandatoryObject.setAttribute('tls','1');
	}
	if(targetItem.getAttribute('rval')) {
		var newVal = parseInt(targetItem.getAttribute('rval'));
		newVal = newVal+topOffset;
		mandatoryObject.setAttribute('rval',newVal);
	}
	if(targetItem.getAttribute('bval')) {
		var newVal = parseInt(targetItem.getAttribute('bval'));
		newVal = newVal+leftOffset;
		if((theBrowserName == 'safari') || (theBrowserName == 'firefox')) {
			newVal = newVal+10;
		}
		mandatoryObject.setAttribute('bval',newVal);
	}
	objectCollection[objectCollection.length] = mandatoryObject;
	mappedDBitems[mappedDBitems.length] = mandatoryObject;
	mandatoryObject.setAttribute('dynamicId',tracingIDs);
};

function makeMandatoryObject() {
	var anObj = document.createElement('DIV');
	anObj = pageweb.appendChild(anObj);
	anObj.style.display = 'block';
	anObj.style.position = 'absolute';
	anObj.style.visibility = 'visible';
	anObj.style.top = '-50px';
	anObj.style.left = '-50px';
	anObj.style.width = '5px';
	anObj.style.height = '5px';
	anObj.style.fontSize = '12px';
	anObj.style.fontWeight = 'bold';
	anObj.style.color = '#aa0000';
	anObj.innerHTML = '<span>*<\/span>';
	anObj.setAttribute('btype','graphicbox'); 
	anObj.setAttribute('otype','graphicbox');
	anObj.setAttribute('isformitem','1');	
	return anObj;
};

var autoscrollBoxes = new Array();
var scrollBoxIndex = 0;
var autoscrollStarted = false;
function autoscrollSetup(aBox) {
	var autoscrollBox = aBox;
	var alreadyRunning = false;
	for(var i = 0; i < autoscrollBoxes.length; i++) {
		var aScrollBox = autoscrollBoxes[i];
		if(aScrollBox == autoscrollBox) {
			alreadyRunning = true;
			break;
		}
	}
	if(!alreadyRunning) {
		if((autoscrollBox.innerHTML.indexOf('<BR>') != -1) || (autoscrollBox.innerHTML.indexOf('<br>') != -1)) {
			var autoscrollDir = 'top';
		} else {
			var autoscrollDir = 'left';
		}
		autoscrollBox.setAttribute('autoscrollDir',autoscrollDir);
		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 padLeft = autoscrollBox.style.paddingLeft;
		if(padLeft) {padLeft = parseInt(padLeft);} else {padLeft = 0;}
		if(isNaN(padLeft)) {padLeft = 0;}
		var padRight = autoscrollBox.style.paddingRight;
		if(padRight) {padRight = parseInt(padRight);} else {padRight = 0;}
		if(isNaN(padRight)) {padRight = 0;}
		var padTop = autoscrollBox.style.paddingTop;
		if(padTop) {padTop = parseInt(padTop);} else {padTop = 0;}
		if(isNaN(padTop)) {padTop = 0;}
		boxW = boxW-((padLeft+padRight));
		boxH = boxH+padTop;
		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';
		newScrollBox.style.borderWidth = '0px';
		newScrollBox = newScrollBox.cloneNode(true);
		newScrollBox = autoscrollBox.appendChild(newScrollBox);
		if(autoscrollDir == 'left') {
			newScrollBox.style.left = boxW+'px';
		} else {
			newScrollBox.style.top = boxH+'px';
		}
		autoscrollBoxes[autoscrollBoxes.length] = autoscrollBox;
	}
	if(!autoscrollStarted) {
		autoscrollStarted = true;
		setTimeout('autoScroll()',350);
	}
};
var scrollOffset = 1;
function autoScroll() {
	var autoscrollBox = autoscrollBoxes[scrollBoxIndex];
	if(!autoscrollBox) {
		return;
	}
	var autoscrollDir = autoscrollBox.getAttribute('autoscrollDir');
	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';
				}
			}
		}
	}
	if(scrollBoxIndex < (autoscrollBoxes.length-1)) {
		scrollBoxIndex++;
	} else {
		scrollBoxIndex = 0;
	}
	var numScrolls = autoscrollBoxes.length;
	var scrollTimeout = parseInt(30/numScrolls);
	setTimeout('autoScroll()',scrollTimeout);
};


var winMode = 'a';
function loadPage(theLink,theMode,theType) {
	if(theType == 'action') {
		if(theLink == 'closewindow') {
			if((!parent.opener) || (!parent.opener.winMode)) {
				theLink = 'goback';
			}
		}
		if(theLink == 'sendform') {
			sendmail();
		} else if(theLink == 'goback') {
			window.history.go(-1);
		} else if(theLink == 'closewindow') {
			window.close();
		} else if(theLink == 'sendmail') {
			sendmail();
		} else if(theLink == 'logtosystem') {
			if(checkUserAccess) {
				checkUserAccess();
			}
		} else if(theLink == 'logoffsystem') {
			clearUserAccess();
		} else if(theLink == 'sendorder') {
			if(documentPath.indexOf('my_order.html') != -1) {
				readOrderForm();
			}
		} else if(theLink == 'printorder') {
			if(documentPath.indexOf('my_order.html') != -1) {
				printOrderForm();
			}
		} else if(theLink == 'clearcaddy') {
			if(documentPath.indexOf('my_shop.html') != -1) {
				clearCaddy();
			}
		}
	} 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) {
				loadFile(theLink);
			}
		}
		if(aWin) {
			setTimeout('aWin.focus()',350);
		}
	}
};

function getFlashresources(moviename) {
	var theBoxes = onlyValidNodes(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;
		}
	}
	var thePath = '';
	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) {
				thePath = theBox.getAttribute('linkedmedia');
				break;
			}
		}
	}
	if(thePath) {
		var mainPath = documentPath.split('/');
		mainPath.length = mainPath.length-1;
		mainPath = mainPath.join('/');
		mainPath = mainPath+'/';
		
		thePath = thePath.split('//');
		thePath = thePath.join('/');
		thePath = thePath.split(':/');
		thePath = thePath.join('://');
		thePath = thePath.split('/');
		thePath.length = thePath.length-1;
		thePath = thePath.join('/');
		thePath = thePath+'/';
		var loop = 0;
		while((mainPath.charAt(loop) == thePath.charAt(loop)) && (loop < thePath.length)) {
			loop++;
		}
		var flashRes = thePath.substring(loop);
		return flashRes;
	}
};

function getFlashlink(moviename) {
	var theBoxes = onlyValidNodes(pageweb.childNodes);
	for(var i = 0; i < theBoxes.length; i++) {
		var theBox = theBoxes[i];
		if(theBox.getAttribute('medianame')) {
			theName = theBox.getAttribute('medianame');
			if(theName.indexOf('?') != -1) {
				theName = theName.split('?')[0];
			}
			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 senderAddress = '';
var mailAddresses = '';
var mailSubject = '';
var mailData = '';
function sendmail() {
	var isValidForm = scanThisForm();
	if(!isValidForm) {
		return;
	}
	mailAddresses = mailnotifyAddress;
	if(!mailSubject) {
		mailSubject = localizeString('Message from the web 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;
			if(itemValue == ' ') {
				itemValue = '';anItem.value = '';
			}
			var myType = anItem.getAttribute('type');
			if(!myType) {
				myType = 'text';
			}
			if(!itemName) {
				itemName = myType+'_item_'+i;
			}
			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() {
	if(showSentmailConfirmation) {
		showSentmailConfirmation = false;
		if(mailAddresses.indexOf(':') != -1) {
			mailAddresses = mailAddresses.split(':')[0];
		}
		var alertString = '\n';
		alertString += localizeString('Your message has been sent to');
		alertString += ' : '+mailAddresses;
		alertString += '\n';
		alert(alertString);
	}
	senderAddress = '';
	mailAddresses = '';
	mailSubject = '';
	mailData = '';
	if(dontReplyPath) {
		dontReplyPath = false;
	} else {
		window.location.href = replyPath;
	}
};

function scanThisForm() {
	var theRadioButtons = new Array();
	var theCheckBoxes = new Array();
	var theTxtFields = new Array();
	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;
			if(itemValue == ' ') {
				itemValue = '';
				anItem.value = '';
			}
			var myType = anItem.getAttribute('type');
			if(!myType) {
				myType = 'text';
			}
			if(!itemName) {
				itemName = myType+'_item_'+i;
			}
			if(myType == 'radio') {
				theRadioButtons[theRadioButtons.length] = anItem;
			} else if(myType == 'checkbox') {
				theCheckBoxes[theCheckBoxes.length] = anItem;
			} else {
				theTxtFields[theTxtFields.length] = anItem;
			}
		}
	}
	var radioGroups = new Array();
	var radioGroupsNames = '';
	for(var i = 0; i < theRadioButtons.length; i++) {
		var anItem = theRadioButtons[i];
		if(anItem.getAttribute('ismandatory') && (anItem.getAttribute('ismandatory') == '1')) {
			var anItemName = anItem.name;
			var anItemCheckName = '|'+anItemName+'|';
			if(radioGroupsNames.indexOf(anItemCheckName) == -1) {
				radioGroupsNames = radioGroupsNames+anItemCheckName;
				radioGroups[radioGroups.length] = new Array(anItem);
			} else {
				for(var j = 0; j < radioGroups.length; j++) {
					var aRadioGroup = radioGroups[j];
					var radioName = aRadioGroup[0].name;
					if(radioName == anItemName) {
						aRadioGroup[aRadioGroup.length] = anItem;
						radioGroups[j] = aRadioGroup;
					}
				}
			}
		}
	}
	for(var i = 0; i < theTxtFields.length; i++) {
		var anItem = theTxtFields[i];
		var aName = anItem.getAttribute('namevalue');
		var aTest = checkTextField(anItem,aName);
		if(!aTest) {
			return false;
		}
	}
	for(var i = 0; i < theCheckBoxes.length; i++) {
		var anItem = theCheckBoxes[i];
		if(anItem.getAttribute('ismandatory') && (anItem.getAttribute('ismandatory') == '1')) {
			if(!anItem.checked) {
				var alertString = defaultAlertString;
				if(anItem.getAttribute('errorstring')) {
					var errString = anItem.getAttribute('errorstring');
					errString = convertTxt(errString);
					alertString = alertString+'\n\n'+errString;
				}
				alert(alertString);
				var myTop = parseInt(anItem.style.top);
				scrollTo(myTop-20);
				return false;
			}
		}
	}
	for(var i = 0; i < radioGroups.length; i++) {
		var anItem = radioGroups[i];
		var aTest = checkRadioGroup(anItem);
		if(!aTest) {
			return false;
		}
	}
	return true;
};
function checkRadioGroup(aRadioGroup) {
	var validCheck = false;
	var alertString = defaultAlertString;
	var errString = '';
	for(var j = 0; j < aRadioGroup.length; j++) {
		var aRadio = aRadioGroup[j];
		if(aRadio.checked) {
			validCheck = true;
		}
		if(aRadio.getAttribute('errorstring')) {
			errString = aRadio.getAttribute('errorstring');
			errString = convertTxt(errString);
		}
	}
	if(!validCheck) {
		if(errString) {
			alertString = alertString+'\n\n'+errString;
		}
		alert(alertString);
		var myTop = parseInt(aRadio.style.top);
		scrollTo(myTop-20);
		return false;
	}
	return validCheck;
};

function checkTextField(aTxtField,aFieldName) {
	var alertString = convertTxt(defaultAlertString);
	if(aTxtField.getAttribute('errorstring')) {
		var errString = aTxtField.getAttribute('errorstring');
		errString = convertTxt(errString);
		alertString = alertString+'\n\n'+errString;
	} else {
		if(!aFieldName) {
			aFieldName = aTxtField.name;
		}
		var errString = convertTxt(localizeString('The field "|field_name|" is not filled correctly'));
		errString = errString.split('|field_name|');
		errString = errString.join(aFieldName);
		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(forbiddenCharsAlert);
				aTxtField.select();
				return false;
			}
		}
	}
	var fieldValue = aTxtField.value;
	if((fieldValue == ' ') || (fieldValue == 'n.a.')) {
		fieldValue = '';
	}
	if(fieldValue || (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(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;
	}
	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 scrollTo(aValue) {
	if(theBrowserName == 'explorer') {
		document.documentElement.scrollTop = aValue;
	} else {
		document.body.scrollTop = aValue;
	}
};
//###
function getBodyTopScroll() {
	if(theBrowserName == 'explorer') {
		return document.documentElement.scrollTop;
	} else {
		return document.body.scrollTop;
	}
};
function getBodyLeftScroll() {
	if(theBrowserName == 'explorer') {
		return document.documentElement.scrollLeft;
	} else {
		return document.body.scrollLeft;
	}
};
//###


function printthistext(evt) {
	if(theBrowserName == 'explorer') {
		var thePrinter = event.srcElement.parentNode;
	} else {
		var 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') {
		var thePrinter = event.srcElement.parentNode;
	} else {
		var 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.removeAttribute('id');
				printNode.style.overflow = 'hidden';
				printNode.style.overflowX = 'hidden';
				printNode.style.overflowY = '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 = moveToTopLeft(pageBuffer);
	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();
};
function moveToTopLeft(aContainer) {
	var theNodes = aContainer.childNodes;
	theNodes = onlyValidNodes(theNodes);
	var theTop = 1000000;
	var theLeft = 1000000;
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		var aTop = parseInt(aNode.style.top);
		var aLeft = parseInt(aNode.style.left);
		if(aTop < theTop) {
			theTop = aTop;
		}
		if(aLeft < theLeft) {
			theLeft = aLeft;
		}
	}
	for(var i = 0; i < theNodes.length; i++) {
		var aNode = theNodes[i];
		try {
			aNode.style.top = (parseInt(aNode.style.top)-theTop)+'px';
			aNode.style.left = (parseInt(aNode.style.left)-theLeft)+'px';
		} catch(e) {}
	}
	return aContainer.innerHTML;
};

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>Print this page</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 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.style.visibility = 'hidden';*/
/*	}*/
/*	txtConverter.innerHTML = txtStr;*/
/*	txtStr = txtConverter.innerHTML;*/
/*	if(txtStr.indexOf('&amp;') != -1) {*/
/*		txtStr = txtStr.split('&amp;').join('&');*/
/*	}*/
/*	return txtStr;*/
/*};*/
function convertTxt(txtStr) {
//	return convertTxtIE(txtStr);
	if(!txtConverter) {
		txtConverter = document.createElement('span');
		if(document.body) {txtConverter = document.body.appendChild(txtConverter);}
		txtConverter.style.marginTop = '-1000000';
		txtConverter.style.marginLeft = '-1000000';
	}
	txtConverter.innerHTML = txtStr;
	txtStr = txtConverter.innerHTML;
	txtStr = correctHtmlEntities(txtStr);
	txtConverter.innerHTML = '';
	return txtStr;
};
function convertTxtAsText(txtStr) {
	if(!txtConverter) {
		txtConverter = document.createElement('span');
		if(document.body) {txtConverter = document.body.appendChild(txtConverter);}
		txtConverter.style.marginTop = '-1000000';
		txtConverter.style.marginLeft = '-1000000';
	}
	txtConverter.innerHTML = txtStr;
	txtStr = txtConverter.innerText;
	if(!txtStr) {txtStr = txtConverter.innerHTML;}
	txtStr = correctHtmlEntities(txtStr);
	txtConverter.innerHTML = '';
	return txtStr;
};
function convertAnyTxt(txtStr) {
	if(!txtConverter) {
		txtConverter = document.createElement('textarea');
		txtConverter = document.body.appendChild(txtConverter);
		txtConverter.style.marginTop = '-1000000';
		txtConverter.style.marginLeft = '-1000000';
	}
	txtConverter.value = txtStr;
	txtStr = txtConverter.value;
	txtConverter.value = '';
	return txtStr;
};
function correctHtmlEntities(aString) {
	if(aString.indexOf('&amp;') != -1) {
		aString = aString.split('&amp;');
		aString = aString.join('&');
	}
	if(aString.indexOf('&nbsp;') != -1) {
		aString = aString.split('&nbsp;');
		aString = aString.join(' ');
	}
	if(aString.indexOf('&quot;') != -1) {
		aString = aString.split('&quot;');
		aString = aString.join('"');
	}
	if(aString.indexOf('&lt;') != -1) {
		aString = aString.split('&lt;');
		aString = aString.join('<');
	}
	if(aString.indexOf('&gt;') != -1) {
		aString = aString.split('&gt;');
		aString = aString.join('>');
	}
	if(aString.indexOf('\n') != -1) {
		aString = aString.split('\n');
		aString = aString.join('');
	}
	var badChar = String.fromCharCode(65533);
	if(aString.indexOf(badChar) != -1) {
		aString = aString.split(badChar);
		aString = aString.join(' ');
	}
	return aString;
};
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 br2nl(txt) {
	if(txt.indexOf('<BR>') != -1) {txt = txt.split('<BR>').join('\n');}
	if(txt.indexOf('<br>') != -1) {txt = txt.split('<br>').join('\n');}
	return txt;
};
function nl2br(txt) {
	if(txt.indexOf('\n') != -1) {txt = txt.split('\n').join('&lt;br&gt;');}
	return txt;
};

function localizeString(aString) {
	var theString = ''+aString;
	if(!localStrings) {
		return theString;
	}

	var complementaryString = '';
	if(theString.indexOf('+') != -1) {
		var tempString = theString.split('+');
		theString = tempString[0];
		complementaryString = tempString[1];
	}

	for(var i = 0; i < localStrings.length; i++) {
		var theSearchString = localStrings[i][0];
		if(theSearchString == theString) {
			theString = localStrings[i][1];
			break;
		}
	}
	theString = theString+complementaryString;
	return convertTxt(theString);
};

function getCookie(name) {
	var cookies = document.cookie;
	var start = cookies.indexOf(name + '=');
	if(start == -1) {
		return null;
	}
	var len = start+name.length+1;
	var end = cookies.indexOf(';',len);
	if(end == -1) {
		end = cookies.length;
	}
	return unescape(cookies.substring(len,end));
};

function setCookie(name, value, expires, path, domain, secure) {
	value = escape(value);
	expires = (expires) ? ';expires='+expires.toGMTString() : '';
	path = (path) ? ';path='+path : '';
	domain = (domain) ? ';domain=' +domain : '';
	secure  = (secure) ? ';secure' : '';
	document.cookie = name + '=' + value + expires + path + domain + secure;
};

function deleteCookie(name, path, domain) {
	var expires = ';expires=Thu, 01-Jan-70 00:00:01 GMT';
	path = (path) ? ';path='+path : '';
	domain = (domain) ? ';domain=' +domain : '';
	if(getCookie(name)) {
		 document.cookie = name + '=' + expires + path + domain;
	}
};


var hexChrs = "0123456789abcdef";

function toHex(vin) {
return encodeBase64(vin);
	var rv = "";
	vin += '';
	for(var idx=0; idx < vin.length; idx++ ) {
		var byt = vin.charCodeAt(idx);
		var i = byt % 16;
		var j = (byt-i) / 16;
		rv += hexChrs.charAt(j);
		rv += hexChrs.charAt(i);
	}
	return rv;
};

function fromHex(vin) {
return decodeBase64(vin);
	var rv="";
	vin += '';
	var acc=0;
	for(var idx=0; idx < vin.length; idx++ ) {
		if(idx%2 == 0) {
			acc = hexChrs.indexOf(vin.charAt(idx)) * 16;
		} else {
			acc += hexChrs.indexOf(vin.charAt(idx));
			rv += String.fromCharCode(acc);
		}
	}
	return rv;
};


function loadHTMLdata(path,targetID) {
	var xmlhttp = initXmlHttpRequest();
	xmlhttp.open('GET',path,true);
	if(theBrowserName == 'safari') {
		xmlhttp.setRequestHeader('If-Modified-Since','01-Mar-90 00:00:01 GMT');
	}
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4) {
			var theData = xmlhttp.responseText;
			var theStatus = xmlhttp.status;
			handleLoadHTMLdata(theStatus,theData,targetID);
		}
	};
 	xmlhttp.send(null);
};
function handleLoadHTMLdata(reqStatus,reqData,targetID) {
	if(reqStatus == '200') {
		if(targetID == 'searchresult') {
			makeMasterResultItem(reqData);
		} else if(targetID == 'searchengine') {
			makeDBsearchInterface(reqData);
		} else if(targetID == 'webpage') {
			addImportedHTMLdata(reqData);
		} else if(targetID == 'forumresult') {
			makeForumResultItem(reqData);
		} else if(targetID == 'favoritesresult') {
			makeMasterFavoritesItem(reqData);
		} else if(targetID == 'contactsresult') {
			makeContactsResultItem(reqData);
		} else if(targetID == 'memberprofile') {
			makeMemberProfileSheet(reqData);
		} else if(targetID == 'shopdata') {
			var newData = formatShopData(reqData);
			if(newData) {
				initShop(newData);
			} else {
				var alertString = convertTxt(localizeString('Unknown data format'));
				alert(alertString);
			}
		}
	}
};

function importHTMLdata(aBox,path,targetID) {
	var xmlhttp = initXmlHttpRequest();
	xmlhttp.open('GET',path,true);
	if(theBrowserName == 'safari') {
		xmlhttp.setRequestHeader('If-Modified-Since','01-Mar-90 00:00:01 GMT');
	}
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4) {
			var theData = xmlhttp.responseText;
			var theStatus = xmlhttp.status;
			handleImportHTMLdata(theStatus,theData,aBox,targetID);
		}
	};
 	xmlhttp.send(null);
};
function handleImportHTMLdata(reqStatus,newData,aBox,targetID) {
	if(reqStatus == '200') {
		if(targetID == 'web_data') {
			aBox.removeAttribute('item_uID');

			aBox.innerHTML = newData;
			var targetBox = aBox.getElementsByTagName('DIV')[0].getElementsByTagName('DIV')[0];
			var thePrintOrigin = '';
			if(targetBox.getAttribute('printorigin')) {
				var thePrintOrigin = targetBox.getAttribute('printorigin');
			}
			var dWidth = parseInt(targetBox.getAttribute('dw'));
			var dHeight = parseInt(targetBox.getAttribute('dh'));
		
		
			newData = targetBox.innerHTML;
			aBox.innerHTML = newData;
		
			var dataHeight = dHeight;
			var dataWidth = dWidth;
			var dLeft = parseInt(aBox.style.left);
			var dTop = parseInt(aBox.style.top);
		
		
			aBox.style.width = dataWidth+'px';
			aBox.style.height = dataHeight+'px';
			
			var newWidth = (dLeft+dataWidth);
			var newHeight = (dTop+dataHeight);
			var defaultWidth = parseInt(pageweb.getAttribute('dw'));
			var defaultHeight = parseInt(pageweb.getAttribute('dh'));
			if(newWidth < defaultWidth) {
				newWidth = defaultWidth;
			}
			if(newHeight < defaultHeight) {
				newHeight = defaultHeight;
			}
			
			var dzRightOffset = 0;
			var dzBottomOffset = 0;
			var old_dynZoneBottomOffset = dynZoneBottomOffset;
			var old_dynZoneRightOffset = dynZoneRightOffset;
			if(aBox.getAttribute('brs')) {
				dzRightOffset = parseInt(aBox.getAttribute('rval'));
				if(!dzRightOffset) {
					dzRightOffset = 0;
				}
				dzBottomOffset = parseInt(aBox.getAttribute('bval'));
				if(!dzBottomOffset) {
					dzBottomOffset = 0;
				}
			} else if(aBox.getAttribute('trs')) {
				dzRightOffset = parseInt(aBox.getAttribute('rval'));
				if(!dzRightOffset) {
					dzRightOffset = 0;
				}
			} else if(aBox.getAttribute('bls')) {
				dzBottomOffset = parseInt(aBox.getAttribute('bval'));
				if(!dzBottomOffset) {
					dzBottomOffset = 0;
				}
			}
			dynZoneBottomOffset = dynZoneBottomOffset+dzBottomOffset;
			dynZoneRightOffset = dynZoneRightOffset+dzRightOffset;
		
			pageweb.style.height = defaultHeight+'px';
			pageweb.style.width = defaultWidth+'px';
		
			pageweb.setAttribute('mh',defaultHeight);
			pageweb.setAttribute('mw',defaultWidth);
			
			var theNodes = onlyValidNodes(aBox.childNodes);
			for(var i = 0; i < theNodes.length; i++) {
				var aNode = theNodes[i];
				aNode = importNode(aNode,dTop,dLeft);
				if(aNode.getAttribute('btype') && (aNode.getAttribute('btype') != "pagebkg")) {
					aNode.setAttribute('dynamicId',tracingIDs);
					pageweb.appendChild(aNode);
				}
			}
			
			dynZoneBottomOffset = old_dynZoneBottomOffset;
			dynZoneRightOffset = old_dynZoneRightOffset;
			
			aBox.style.zIndex = 1;
			aBox.innerHTML = '';
			
			handlePNG();
			drawPage();
		}
	}
};
function importNode(aNode,dTop,dLeft) {
	var aTop = parseInt(aNode.style.top);
	var aLeft = parseInt(aNode.style.left);
	if(isNaN(aTop)) {
		aTop = 0;
	}
	if(isNaN(aLeft)) {
		aLeft = 0;
	}
	var aHeight = parseInt(aNode.style.height);
	var aWidth = parseInt(aNode.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(aNode.getAttribute('brs')) {
		objRightOffset = parseInt(aNode.getAttribute('rval'));
		if(!objRightOffset) {
			objRightOffset = 0;
		}
		aNode.setAttribute('rval',objRightOffset+dynZoneRightOffset);
		objBottomOffset = parseInt(aNode.getAttribute('bval'));
		if(!objBottomOffset) {
			objBottomOffset = 0;
		}
		aNode.setAttribute('bval',objBottomOffset+dynZoneBottomOffset);
	} else if(aNode.getAttribute('trs')) {
		objRightOffset = parseInt(aNode.getAttribute('rval'));
		if(!objRightOffset) {
			objRightOffset = 0;
		}
		aNode.setAttribute('rval',objRightOffset+dynZoneRightOffset);
	} else if(aNode.getAttribute('bls')) {
		objBottomOffset = parseInt(aNode.getAttribute('bval'));
		if(!objBottomOffset) {
			objBottomOffset = 0;
		}
		aNode.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;
	}
	
	aNode.style.top = itemTop+'px';
	aNode.style.left = itemLeft+'px';
	var myZindex = parseInt(aNode.style.zIndex)+100;
	if(!myZindex) {myZindex = 0;}//###
	aNode.style.zIndex = (pageweb.childNodes.length)+myZindex;
	if(aNode.getAttribute('linktype') && (aNode.getAttribute('linktype') == 'togglevisibility')) {
		var linkHref = aNode.getAttribute('linkhref');
		var targetItem = getItemByUID(linkHref);
		if(targetItem) {
			myZindex = myZindex+10000;
			targetItem.style.zIndex = myZindex;
		}
	}
	
	if(aNode.getAttribute('originaltop')) {
		var aTop = parseInt(aNode.getAttribute('originaltop'));
		var itemTop = (dTop+aTop);
		aNode.setAttribute('originaltop',itemTop+'px');
	}
	if(aNode.getAttribute('originalleft')) {
		var aLeft = parseInt(aNode.getAttribute('originalleft'));
		var itemLeft = (dLeft+aLeft);
		aNode.setAttribute('originalleft',itemLeft+'px');
	}
	return aNode;
};


var hardSpace = String.fromCharCode(160);
function formatShopData(theData) {
	var tempData = new Array();
	theData = unescape(theData);
	theData = theData.split('\n');
	theData = theData.join('|new_line|');
	theData = theData.split('\t');
	theData = theData.join('|new_tab|');
	theData = convertTxt(theData);
	theData = theData.split('|new_line|');
	theData = theData.join('\n');
	theData = theData.split('|new_tab|');
	theData = theData.join('\t');
	if(theData.indexOf(hardSpace) != -1) {
		theData = theData.split(hardSpace);
		theData = theData.join(' ');
	}
	if(theData.indexOf('&nbsp;') != -1) {
		theData = theData.split('&nbsp;');
		theData = theData.join(' ');
	}
	if(theData.indexOf('\\') != -1) {
		theData = theData.split('\\');
		theData = theData.join('');
	}
	if(theData.indexOf('new Array()') != -1) {
		if(theData.indexOf('","') != -1) {
			var splitQuote = '"';
		} else {
			var splitQuote = "'";
		}
		var splitStart = 'new Array('+splitQuote;
		var splitEnd = splitQuote+')';
		var splitString = splitQuote+','+splitQuote;
		var theData = theData.split(';\n');
		for(var i = 0; i < theData.length; i++) {
			var aDBline = theData[i];
			if((aDBline.indexOf(splitStart) != -1) && (aDBline.indexOf(splitEnd) != -1)) {
				aDBline = aDBline.split(splitStart)[1];
				aDBline = aDBline.split(splitEnd)[0];
				aDBline = aDBline.split(splitString);
				tempData[tempData.length] = aDBline;
			}
		}
		return tempData;
	} else if((theData.indexOf('\n') != -1) && (theData.indexOf('\t') != -1)) {
		var theData = theData.split('\n');
		var tempData = new Array();
		for(var i = 0; i < theData.length; i++) {
			var aDBline = theData[i];
			if(aDBline) {
				aDBline = aDBline.split('\t');
				tempData[tempData.length] = aDBline;
			}
		}
		return tempData;
	} else {
		return '';
	}
};

function sortByInitialTopLefts(thisList) {
	var jItem = null;
	var iItem = null;
	var jTop = null;
	var iTop = null;
	var jLeft = null;
	var iLeft = null;
	var dummy = null;
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			jItem = thisList[j];
			iItem = thisList[i];
			jTop = parseInt(jItem.getAttribute('initialTop'));
			jLeft = parseInt(jItem.getAttribute('initialLeft'));
			iTop = parseInt(iItem.getAttribute('initialTop'));
			iLeft = parseInt(iItem.getAttribute('initialLeft'));
			if((jTop < iTop) || (jLeft < iLeft)) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};

function sortByLefts(thisList) {
	var jItem = null;
	var iItem = null;
	var jLeft = null;
	var iLeft = null;
	var dummy = null;
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			jItem = thisList[j];
			iItem = thisList[i];
			jLeft = parseInt(jItem.style.left);
			iLeft = parseInt(iItem.style.left);
			if(jLeft < iLeft) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};
function bubbleSort(thisList) {
	var jItem = null;
	var iItem = null;
	var dummy = null;
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			jItem = thisList[j];
			iItem = thisList[i];
			jItem = adaptDataType(jItem);
			iItem = adaptDataType(iItem);
			if(jItem < iItem) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};
function bubbleSortByKey(thisList,thisKey) {
	return bubbleSortArray(thisList,thisKey);
};
function bubbleSortByKeyReverse(thisList,thisKey) {
	return bubbleSortArrayReverse(thisList,thisKey);
};
function bubbleSortReverse(thisList) {
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			var jItem = thisList[j];
			var iItem = thisList[i];
			jItem = adaptDataType(jItem);
			iItem = adaptDataType(iItem);
			if(jItem > iItem) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};
function bubbleSortArray(thisList,thisKey) {
	var jItem = null;
	var iItem = null;
	var dummy = null;
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			jItem = thisList[j][thisKey];
			iItem = thisList[i][thisKey];
			jItem = adaptDataType(jItem);
			iItem = adaptDataType(iItem);
			if(jItem < iItem) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};
function bubbleSortArrayReverse(thisList,thisKey) {
	var jItem = null;
	var iItem = null;
	var dummy = null;
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			jItem = thisList[j][thisKey];
			iItem = thisList[i][thisKey];
			jItem = adaptDataType(jItem);
			iItem = adaptDataType(iItem);
			if(jItem > iItem) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};

function adaptDataType(newData) {
	var affectedFields = 'UP|NUM|AMOUNT|';
	if(newData.indexOf('|') != -1) {
		newData = newData.split('|');
		var info = newData[0];
		var value = newData[1];
		if(affectedFields.indexOf(info+'|') != -1) {
			var tempvalue = convertToNumericString(value);
			tempvalue = parseFloat(tempvalue);
			if(isNaN(tempvalue)) {
				newData = value;
			} else {
				newData = tempvalue;
			}
		}
	} else {
		var tempvalue = parseFloat(newData);
		if(!isNaN(tempvalue)) {
			newData = tempvalue;
		}
	}
	return newData;
};

function bubbleSortByTops(thisList) {
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			jItem = thisList[j];
			iItem = thisList[i];
			if(parseInt(jItem.style.top) < parseInt(iItem.style.top)) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};
function bubbleSortByInitalTops(thisList) {
	for(var i = 0; i < thisList.length; i++) {
		for(var j = i+1; j < thisList.length; j++) {
			jItem = thisList[j];
			iItem = thisList[i];
			if(parseInt(jItem.getAttribute('initialTop')) < parseInt(iItem.getAttribute('initialTop'))) {
				var dummy = thisList[i];
				thisList[i] = thisList[j];
				thisList[j] = dummy;
			}
		}
	}
	return thisList;
};
function bubbleSortByTabIndex(thisList) {
	for(var i = 0; i < thisList.length; i++) {
		for(var 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'))) {
					var dummy = thisList[i];
					thisList[i] = thisList[j];
					thisList[j] = dummy;
				}
			}
		}
	}
	return thisList;
};

function arrayContainsString(anArray,aString) {
	aString = convertTxt(aString);
	for(var i = 0; i < anArray.length; i++) {
		var anItem = convertTxt(anArray[i]);
		if(anItem && aString && (anItem.indexOf(aString) == 0)) {
			return i;
			break;
		}
	}
	return -1;
};

function arrayContainsStringAsArray(anArray,aString) {
	aString = convertTxt(aString);
	var newArray = new Array();
	for(var i = 0; i < anArray.length; i++) {
		var anItem = convertTxt(anArray[i]);
		if(anItem && aString && (anItem.indexOf(aString) == 0)) {
			newArray[newArray.length] = i;
		}
	}
	return newArray;
};


function dumpUserInfos() {
	var uInfo = getUserAccess();
	if(uInfo) {
		uInfo = uInfo.split('|');
		accessType = uInfo[0];
		accessLogg = uInfo[1];
		accessPass = uInfo[2];
		currentMemberUniqueID = uInfo[3];
		orderFileName = uInfo[3];
		return currentMemberUniqueID;
	} else {
		accessType = 'User';
		currentMemberUniqueID = '0-000-0000';
		return currentMemberUniqueID;
	}
};


function appendPhotoUploadSet(srcItem) {
	var aFormPicture = srcItem;
	aFormPicture.innerHTML = '';
	aFormPicture.setAttribute('inited','1');
	formPictures[formPictures.length] = aFormPicture;
	var bbw = parseInt(aFormPicture.style.borderBottomWidth);
	if(!bbw) {
		bbw = 0;
	}
	var brw = parseInt(aFormPicture.style.borderRightWidth);
	if(!brw) {
		brw = 0;
	}
	var itemWidth = parseInt(aFormPicture.style.width);
	var itemHeight = parseInt(aFormPicture.style.height);
	var myTop = ((itemHeight-16)-bbw);
	var myLeft = ((itemWidth-40)-brw);
	var buttonsBar = document.createElement('div');
	buttonsBar = aFormPicture.appendChild(buttonsBar);
	buttonsBar.setAttribute('buttonsBar','1');
	buttonsBar.style.zIndex = 10000;
	buttonsBar.style.position = 'absolute';
	buttonsBar.style.display = 'block';
	buttonsBar.style.width = '40px';
	buttonsBar.style.height = '16px';
	buttonsBar.style.top = myTop+'px';
	buttonsBar.style.left = myLeft+'px';
	buttonsBar.style.backgroundColor = '#dddddd';
	buttonsBar.style.border = 'solid #aaaaaa 1px';
	buttonsBar.style.cursor = 'pointer';
	var activeShape = document.createElement('img');
	activeShape.src = 'a.gif';
	activeShape = buttonsBar.appendChild(activeShape);
	activeShape.style.position = 'absolute';
	activeShape.style.display = 'block';
	activeShape.style.top = '0px';
	activeShape.style.left = '0px';
	activeShape.style.width = '100%';
	activeShape.style.height = '100%';
	var aButton = document.createElement('div');
	aButton = buttonsBar.appendChild(aButton);
	aButton.style.position = 'absolute';
	aButton.style.display = 'block';
	aButton.style.top = '0px';
	aButton.style.left = '0px';
	aButton.style.width = '20px';
	aButton.style.height = '16px';
	aButton.style.lineHeight = '16px';
	aButton.style.textAlign = 'center';
	aButton.innerHTML = '<span style="font-weight:bold;font-size:12px;">+</span>';
	aButton.setAttribute('title',convertTxt(localizeString('Add or change the picture')));
	aButton.onclick = addFormPicture;
	activeShape = aButton.appendChild(activeShape);
	aButton = buttonsBar.appendChild(aButton.cloneNode(false));
	aButton.innerHTML = '<span style="font-weight:bold;font-size:12px;">-</span>';
	aButton.style.borderLeft = 'solid #aaaaaa 1px';
	aButton.style.left = '20px';
	aButton.setAttribute('title',convertTxt(localizeString('Delete this picture')));
	aButton.onclick = deleteFormPicture;
	activeShape = aButton.appendChild(activeShape.cloneNode(false));
};

var currentFormPicture = null;
var forumPictureFileName = '';
var forumPicturePictureSize = '';
var forumPictureWindowSize = '';
function addFormPicture(evt) {
	if(theBrowserName == 'explorer') {
		var anItem = event.srcElement;
	} else {
		var anItem = evt.target;
	}
	while(!anItem.getAttribute('btype') && (anItem.getAttribute('btype') != 'contentsbox')) {
		anItem = anItem.parentNode;
	}
	currentFormPicture = anItem;
	var itemWidth = parseInt(anItem.style.width);
	var itemHeight = parseInt(anItem.style.height);
	forumPicturePictureSize = itemWidth+':'+itemHeight;
	var pictureID = anItem.getAttribute('pictureID');
	if(!pictureID) {
		var pictureID = new Date();
		pictureID = pictureID.getTime();
		anItem.setAttribute('pictureID',pictureID);
	}
	forumPictureFileName = pictureID;
	var sW = screen.availWidth;
	var sH = screen.availHeight;
	var wHeight = itemHeight+100;
	var wWidth = itemWidth+100;
	
	if(wHeight < 300) {
		wHeight = 300;
	}
	if(wWidth < 400) {
		wWidth = 400;
	}
	
	forumPictureWindowSize = wWidth+':'+wHeight;
	
	var wTop = parseInt((sH-wHeight)/3);
	var wLeft = parseInt((sW-wWidth)/2);
	var newWin = window.open('my_shop/upload_file.html','upload_file','toolbars=0,scrollbars=0,resizable=0,top='+wTop+',left='+wLeft+',width='+wWidth+',height='+wHeight+'');
	if(!newWin) {
		var alertString = convertTxt(localizeString('Popup window must be allowed'));
		alert(alertString);
	}
};
function deleteFormPicture(evt) {
	if(theBrowserName == 'explorer') {
		var anItem = event.srcElement;
	} else {
		var anItem = evt.target;
	}
	while(!anItem.getAttribute('btype') && (anItem.getAttribute('btype') != 'contentsbox')) {
		anItem = anItem.parentNode;
	}
	var pictureID = anItem.getAttribute('pictureID');
	if(!pictureID) {
		return;
	}
	var theImg = currentFormPicture.getElementsByTagName('img')[0];
	if(theImg) {
		theImg.parentNode.removeChild(theImg);
	}
	anItem.removeAttribute('fileName');
};

function nullFormPicture(aPictureBox) {
	var theImg = aPictureBox.getElementsByTagName('img')[0];
	if(theImg) {
		theImg.parentNode.removeChild(theImg);
	}
	aPictureBox.removeAttribute('fileName');
};

function displayFormPicture(fileName) {
	if(currentFormPicture) {
		var theImg = currentFormPicture.getElementsByTagName('img')[0];
		if(theImg) {
			theImg.parentNode.removeChild(theImg);
		}
		var timeDef = nowTimeID();
		var theImg = document.createElement('span');
		theImg = currentFormPicture.insertBefore(theImg,currentFormPicture.firstChild);
		var imgTag = '<img src="my_shop/db_files/'+fileName+timeDef+'" onload="drawFormPicture(this)" style="visibility:hidden;">';
		theImg.innerHTML = imgTag;
		currentFormPicture.setAttribute('fileName',fileName);
		var thisPict = currentFormPicture.getElementsByTagName('img')[0];
		if(thisPict) {
			thisPict.onclick = zoomThisImg;
			setCursor(thisPict,'pointer');
			thisPict.setAttribute('title','Click to zoom');
		}
	}
};

function drawFormPicture(anImg) {
	anItem = anImg.parentNode;
	while(!anItem.getAttribute('btype') && (anItem.getAttribute('btype') != 'contentsbox')) {
		anItem = anItem.parentNode;
		currentFormPicture = anItem;
	}
	var maxW = currentFormPicture.offsetWidth;
	var maxH = currentFormPicture.offsetHeight;
	var theImg = currentFormPicture.getElementsByTagName('img')[0];
	theImg.style.position = 'absolute';
	theImg.style.display = 'block';
	var imgWidth = theImg.offsetWidth;
	var imgHeight = theImg.offsetHeight;
	if((imgWidth > maxW) || (imgHeight > maxH)) {
		while((imgWidth > maxW) || (imgHeight > maxH)) {
			imgWidth = imgWidth-(imgWidth*0.05);
			imgHeight = imgHeight-(imgHeight*0.05);
		}
		imgWidth = parseInt(imgWidth);
		imgHeight = parseInt(imgHeight);
		theImg.style.width = imgWidth+'px';
		theImg.style.height = imgHeight+'px';
	}
	var leftPos = parseInt((maxW-imgWidth)/2);
	var topPos = parseInt((maxH-imgHeight)/2);
	theImg.style.top = topPos+'px';
	theImg.style.left = leftPos+'px';
	theImg.style.visibility = 'visible';
};


function eCommunityReport() {
	if(eCommunityPlugin == 'yes') {
		if(!eCommunityRunning) {
			eCommunityRunning = true;
			if(communityTimerOn) {
				clearTimeout(communityTimer);
			}
			communityTimer = setTimeout('communityBasicInfos()',1000);
			communityTimerOn = true;
		}
	}
	if(eMembersPlugin == 'yes') { }
};
function communityBasicInfos() {
	communityTimerOn = false;
	var myVisitorID = getCookie('visitorID');
	var visitorInfo = '';
	if(accessType == 'User') {
		if(!myVisitorID) {
			myVisitorID = new Date();
			myVisitorID = myVisitorID.getTime();
			setCookie('visitorID',myVisitorID,'','','','');
			visitorInfo = 'reset-';
		}
	} else {
		if(currentMemberUniqueID != '0-000-0000') {
			myVisitorID = currentMemberUniqueID;
			setCookie('visitorID',myVisitorID,'','','','');
			visitorInfo = 'reset-';
		}
	}
	var timeID = new Date();
	timeID = timeID.getTime();
	var thePath = myAbsolutePath+'my_shop/my_community.php?visitorID='+visitorInfo+myVisitorID+'&tid='+timeID;
	if(communicationLayer == 'xmlhttp') {
		sendCommunityInfosToServer(thePath);
	} else {
		shopConnexionLayer = document.getElementById('_socket');
		shopConnexionLayer.style.display = 'block';
		shopConnexionLayer.src = thePath;
	}
};
function sendCommunityInfosToServer(path) {
	ecomm_xmlhttp.open('GET',path,true);
	if(theBrowserName == 'safari') {ecomm_xmlhttp.setRequestHeader('If-Modified-Since','01-Mar-90 00:00:01 GMT');}
	ecomm_xmlhttp.onreadystatechange = function() {
		if(ecomm_xmlhttp.readyState == 4) {
			var theData = ecomm_xmlhttp.responseText;
			var theStatus = ecomm_xmlhttp.status;
			handleCommunityInfosToServer(theStatus,theData);
		}
	};
 	ecomm_xmlhttp.send(null);
};
function handleCommunityInfosToServer(reqStatus,reqData) {
	if(reqStatus == '200') {
		if(reqData.indexOf('var numVisitors = ') != -1) {
			var theData = reqData.split('var numVisitors = ');
			var numVisitors = theData[1];
			numVisitors = numVisitors.split(';');
			numVisitors = numVisitors[0];
			theData = reqData.split('var numMembers = ');
			var numMembers = theData[1];
			numMembers = numMembers.split(';');
			numMembers = numMembers[0];
			showCommunityInfos(numVisitors,numMembers);
		} else if(reqData.indexOf('var membersData = ') != -1) {
			var membersData = new Array();
			var theData = reqData.split('\n');
			for(var i = 0; i < theData.length; i++) {
				var thisLine = theData[i];
				if(thisLine.indexOf('new Array("') != -1) {
					thisLine = thisLine.split('new Array("');
					thisLine = thisLine[1];
					thisLine = thisLine.split('");');
					thisLine = thisLine[0];
					thisLine = thisLine.split('","');
					membersData[membersData.length] = thisLine;
				}
			}
			if(contactsCode) {
				showMembersData(membersData);
			}
		} else if(reqData.indexOf('var contactsData = ') != -1) {
			var contactsData = new Array();
			var theData = reqData.split('\n');
			for(var i = 0; i < theData.length; i++) {
				var thisLine = theData[i];
				if(thisLine.indexOf('new Array("') != -1) {
					thisLine = thisLine.split('new Array("');
					thisLine = thisLine[1];
					thisLine = thisLine.split('");');
					thisLine = thisLine[0];
					thisLine = thisLine.split('","');
					thisLine = thisLine.join('\t');
					contactsData[contactsData.length] = thisLine;
				}
			}
			contactsData = contactsData.join('\n');
			showMembersIDs(contactsData);
		} else if(reqData.indexOf('var lastMembersData = ') != -1) {
			var contactsData = new Array();
			var theData = reqData.split('\n');
			for(var i = 0; i < theData.length; i++) {
				var thisLine = theData[i];
				if(thisLine.indexOf('new Array("') != -1) {
					thisLine = thisLine.split('new Array("');
					thisLine = thisLine[1];
					thisLine = thisLine.split('");');
					thisLine = thisLine[0];
					thisLine = thisLine.split('","');
					contactsData[contactsData.length] = thisLine;
				}
			}
			showlastMembersData(contactsData);
		}
	}
};
var communityNumCalls = 0;
function showCommunityInfos(numVisitors,numMembers) {
	if(numVisitors != -1) {
		var numVisitorsLabel = document.getElementById('num_users_online');
		if(numVisitorsLabel) {
			numVisitorsLabel.innerHTML = numVisitors;
		}
	}
	if(numMembers != -1) {
		var numMembersLabel = document.getElementById('num_members_online');
		if(numMembersLabel) {
			numMembersLabel.innerHTML = numMembers;
		}
	}
	communityNumCalls++;
	if(communityNumCalls < 2) {
		if(communityTimerOn) {
			clearTimeout(communityTimer);
		}
		communityTimer = setTimeout('communityBasicInfos()',120000);
		communityTimerOn = true;
	}
};


function handleError(errNum) {
	if(errNum == '404') {
		
	}
};

function y2k(number) {
	return (number < 1000) ? number + 1900 : number;
};
function padout(number) {
	return (number < 10) ? '0' + number : number;
};

function donothing() {
	return false;
};
/*window.oncontextmenu = donothing;*/
window.onresize = pageRedraw;
document.onkeydown = ckeckkey;




function showdbPreload() {
	if(!document.body) {
		return;
	}
	if(dbLoading) {
		return;
	}
	dbLoading = document.createElement('div');
	dbLoading = pageweb.appendChild(dbLoading);
	dbLoading.style.position = 'absolute';
	var masterItem = null;
	if(theDBcontainer) {
		masterItem = theDBcontainer;
	} else if(cartItemsMaster) {
		masterItem = cartItemsMaster;
	} else if(favoritesItemsMaster) {
		masterItem = favoritesItemsMaster;
	}
	if(masterItem) {
		var myTop = parseInt(masterItem.style.top);
		if(masterItem == theDBcontainer) {
			myTop = myTop+80;
		}
		myTop = myTop+20;
		dbLoading.style.top = myTop+'px';
		var myLeft = parseInt(masterItem.style.left);
		var myWidth = parseInt(masterItem.style.width);
		var myMiddle = myLeft+parseInt(myWidth/2);
		var newLeft = myMiddle-75;
		dbLoading.style.left = newLeft+'px';
	} else {
		dbLoading.style.top = '33%';
		dbLoading.style.marginTop = '-50px';
		dbLoading.style.left = '50%';
		dbLoading.style.marginLeft = '-75px';
	}
	dbLoading.style.width = '150px';
	dbLoading.style.height = '40px';
	dbLoading.innerHTML = '<img src="my_pictures/images/my_loading.gif" style="display:block;position:absolute;top:4px;left:4px;height:32px;width:32px;"><div style="display:block;position:absolute;top:0px;left:45px;height:40px;width:105px;line-height:40px;"><span style="font-size:12px;color:#333333;">Loading data...</span></div>';
	dbLoading.style.zIndex = '10000';
};
function hidedbPreload() {
	if(!dbLoading) {
		return;
	}
	dbLoading = pageweb.removeChild(dbLoading);
	dbLoading = null;
};

function findArrayItemIndex(anArray,aValue) {
	for(var i = 0; i < anArray.length; i++) {
		var anItem = anArray[i];
		if(anItem.indexOf(aValue) == 0) {
			return i;
			break;
		}
	}
	return -1;
};
function findArrayItemIndexAtCol(anArray,aKey,aValue) {
	for(var i = 0; i < anArray.length; i++) {
		var anItem = anArray[i][aKey];
		if(anItem == aValue) {
			return i;
			break;
		}
	}
	return -1;
};
function findArrayItemIndexAtColExclArobace(anArray,aKey,aValue) {
	var loop = -1;
	for(var i = 0; i < anArray.length; i++) {
		var anItem = anArray[i][aKey];
		if(anItem.indexOf('@') == -1) {
			loop++;
		}
		if(anItem == aValue) {
			return loop;
			break;
		}
	}
	return -1;
};



function makeLangSwitcherMenu(aContainer) {
	if(aContainer.getAttribute('versionsmenu')) {
		return;
	}
	aContainer.style.display = 'none';
	if(siteVersions && (siteVersions.indexOf('|') != -1)) {
		siteVersions = siteVersions.split('|');
		var numVersions = 0;
		for(var i = 0; i < siteVersions.length; i++) {
			var aVersion = siteVersions[i];
			if(aVersion) {
				numVersions++;
			}
		}
		if(numVersions < 2) {
			siteVersions = null;
			return;
		}
	} else {
		siteVersions = null;
		return;
	}
	setCursor(aContainer,'pointer');
	aContainer.setAttribute('versionsmenu','1');
	aContainer.innerHTML = '';
	aContainer.style.overflow = '';
	aContainer.style.overflowX = '';
	aContainer.style.overflowY = '';
	var siteLang = currentLang;
	var flagPath = myAbsolutePath+'my_pictures/international/'+siteLang+'.gif';
	var arrowPath = myAbsolutePath+'my_pictures/international/dropdown.gif';
	var flagImg = document.createElement('img');
	flagImg = aContainer.appendChild(flagImg);
	flagImg.onload = function() {
		fitPicture(aContainer,flagImg);
	};
	flagImg.src = flagPath;
	flagImg.style.zIndex = '1';
	flagImg.onclick = showLangsMenu;
	var titleString = convertTxt(localizeString('Site versions'));
	flagImg.setAttribute('title',titleString);
	aContainer.style.display = 'block';
};
var langsMenu = null;
function showLangsMenu(evt) {
	if(theBrowserName == 'explorer') {
		var anItem = event.srcElement;
	} else {
		var anItem = evt.target;
	}
	while(!anItem.getAttribute('versionsmenu')) {
		anItem = anItem.parentNode;
	}
	langsMenu = document.createElement('div');
	langsMenu = pageweb.appendChild(langsMenu);
	langsMenu.style.zIndex = '10000';
	langsMenu.style.display = 'block';
	langsMenu.style.position = 'absolute';
	langsMenu.style.top = anItem.style.top;
	langsMenu.style.fontSize = '12px';
	langsMenu.style.lineHeight = '12px';
	setCursor(langsMenu,'pointer');
	var text = '';
	var versions = new Array();
	for(var i = 0; i < siteVersions.length; i++) {
		var aVersion = siteVersions[i];
		var versionName = findVersionName(aVersion);
		if(versionName) {
			text = text+versionName+'<br>';
			versions[versions.length] = aVersion+':'+versionName;
		}
	}
	text = nobreakTxt(text);
	text = '<span style="font-size:12px;line-height:18px;">'+text+'&nbsp;</span>';
	menuSize = getTextSize(text);
	var menuWidth = menuSize[0]+40;
	var menuHeight = menuSize[1];
	langsMenu.style.width = menuWidth+'px';
	langsMenu.style.backgroundColor = '#fafafa';
	langsMenu.style.border = 'solid #777 1px';
	if((anItem.getAttribute('trs')) || (anItem.getAttribute('brs'))) {
		var newLeft = ((anItem.offsetLeft+anItem.offsetWidth)-langsMenu.offsetWidth);
		if((newLeft+langsMenu.offsetWidth) > pageweb.offsetWidth) {
			newLeft = pageweb.offsetWidth-langsMenu.offsetWidth;
		}
		langsMenu.style.left = newLeft+'px';
	} else {
		var newLeft = anItem.offsetLeft;
		if((newLeft+langsMenu.offsetWidth) > pageweb.offsetWidth) {
			newLeft = pageweb.offsetWidth-langsMenu.offsetWidth;
		}
		langsMenu.style.left = newLeft+'px';
	}
	var newMenu = '';
	var border = 'border-bottom:solid #ccc 1px;';
	versions = bubbleSort(versions);
	for(var i = 0; i < versions.length; i++) {
		var aVersion = versions[i];
		aVersion = aVersion.split(':');
		var versionValue = aVersion[0];
		var versionLabel = aVersion[1];
		var imgPath = myAbsolutePath+'my_pictures/international/'+versionValue+'.gif';
		if(i == versions.length-1) {
			border = '';
		}
		newMenu = newMenu+'<div value="'+versionValue+'" style="'+border+'width:100%;height:18px;line-height:18px;font-size:11px;padding-top:2px;" onmouseover="hiliteLangItem(this)" onmouseout="unhiliteLangItem(this)"><img src="'+imgPath+'" style="height:10px;width:14px;padding:0px 5px;">'+versionLabel+'</div>';
	}
	langsMenu.innerHTML = newMenu;
	langsMenu.onclick = chosenLang;
	document.onmouseup = function() {
		setTimeout('hideLangsMenu()',350);
	};
};
function hideLangsMenu() {
	if(langsMenu) {
		document.onmouseup = '';
		langsMenu.parentNode.removeChild(langsMenu);
		langsMenu = null;
	}
};

function chosenLang(evt) {
	if(theBrowserName == 'explorer') {
		var anItem = event.srcElement;
	} else {
		var anItem = evt.target;
	}
	while(!anItem.getAttribute('value')) {
		anItem = anItem.parentNode;
	}
	var myValue = anItem.getAttribute('value');
	
	if(myValue) {
		var today = new Date();
		today = today.getTime();
		var timeOffset = 60*60*24*365*1000;
		var expirationdate = today+timeOffset;
		expirationdate = new Date(expirationdate);
		setCookie('userlang', myValue, expirationdate, '', '', '');
	} else {
		deleteCookie('userlang','','');
	}
	choosedLang(myValue);
};
function choosedLang(myValue) {
	var langPrefix = '';
	if(myValue && (myValue != defaultLang)) {
		langPrefix = myValue+'_';
	}
	var curPath = window.location.href;
	curPath = curPath.split('://');
	var protocol = curPath[0]+'://';
	curPath = curPath[1];
	curPath = curPath.split('/');
	for(var i = 0; i < curPath.length; i++) {
		var aPathItem = curPath[i];
		if(aPathItem.indexOf('.html') != -1) {
			aPathItem = trimLangID(aPathItem);
			if(aPathItem.indexOf('?page=') != -1) {
				aPathItem = aPathItem.split('?page=');
				for(var j = 0; j < aPathItem.length; j++) {
					var aPathPart = aPathItem[j];
					aPathPart = trimLangID(aPathPart);
					aPathItem[j] = aPathPart;
				}
				aPathItem = aPathItem.join('?page='+langPrefix);
			}
			aPathItem = langPrefix+aPathItem;
		}
		curPath[i] = aPathItem;
	}
	if(curPath[curPath.length-1] == '') {
		curPath[curPath.length-1] = langPrefix+'index.html';
	}
	curPath = protocol+curPath.join('/');
	window.location.href = curPath;
};

function hiliteLangItem(anItem) {
	anItem.style.backgroundColor = '#e0e6f6';
};
function unhiliteLangItem(anItem) {
	anItem.style.backgroundColor = '';
};

function findVersionName(versionStr) {
	var langsStrings = alllangsStrings.split('_');
	langsStrings = langsStrings.join('');
	langsStrings = langsStrings.split('|');
	var langsNames = allLangsNames.split('|');
	for(var i = 0; i < langsStrings.length; i++) {
		var langStr = langsStrings[i];
		if(langStr == versionStr) {
			return langsNames[i];
		}
	}
	return '';
};

function fitPicture(aContainer,aPicture) {
	var maxW = aContainer.offsetWidth;
	var maxH = aContainer.offsetHeight;
	aPicture.style.display = 'block';
	aPicture.style.position = 'absolute';
	var imgWidth = aPicture.offsetWidth;
	var imgHeight = aPicture.offsetHeight;
	if((imgWidth > maxW) || (imgHeight > maxH)) {
		while((imgWidth > maxW) || (imgHeight > maxH)) {
			imgWidth = imgWidth-(imgWidth*0.05);
			imgHeight = imgHeight-(imgHeight*0.05);
		}
		imgWidth = parseInt(imgWidth);
		imgHeight = parseInt(imgHeight);
		aPicture.style.width = imgWidth+'px';
		aPicture.style.height = imgHeight+'px';
	}
	var leftPos = parseInt((maxW-imgWidth)/2);
	var topPos = parseInt((maxH-imgHeight)/2);
	aPicture.style.top = topPos+'px';
	aPicture.style.left = leftPos+'px';
};



//TO HTML CONVERTER
var theChars = new Array('†','°','¢','£','§','•','¶','ß','®','©','™','´','¨','≠','Æ','Ø','∞','±','≤','≥','¥','µ','∂','∑','∏','π','∫','ª','º','Ω','æ','ø','¿','¡','¬','√','ƒ','≈','∆','«','»','…',' ','À','Ã','Õ','Œ','œ','–','—','“','”','‘','’','÷','◊','ÿ','Ÿ','⁄','€','‹','›','ﬁ','ﬂ','‡','·','‚','„','‰','Â','Ê','Á','Ë','È','Í','Î','Ï','Ì','Ó','Ô','','Ò','Ú','Û','Ù','ı','ˆ','˜','¯','˘','˙','˚','¸','˝','˛','&','"','<','>');
var theEntities = new Array('&nbsp;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&sup1;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&amp;','&quot;','&lt;','&gt;');
function toTabbedHtml(aString) {
	if((aString.indexOf('\t') != -1) && ((aString.indexOf('\n') != -1) || (aString.indexOf('<br>') != -1))) {
		var newlineChar = '';
		aString = aString.split('\t').join('_TABB_');
		if((aString.indexOf('\n') != -1)) {aString = aString.split('\n').join('_CRLF_'); newlineChar = '\n';}
		if((aString.indexOf('<br>') != -1)) {aString = aString.split('<br>').join('_CRLF_'); newlineChar = '<br>';}
		aString = toHtml(aString);
		aString = aString.split('_TABB_').join('\t');
		aString = aString.split('_CRLF_').join(newlineChar);
	}
	return aString;
};
function toHtml(aString) {
	aString = ''+aString;
	if(!aString) {return '';}
	aString = nl2br(aString);

	if(aString.indexOf('|||') != -1) {aString = aString.split('|||').join('_|_|_|_');}
	aString = convertChar2CP(aString);
	aString = convertCP2HexNCR(aString);
	if(aString.indexOf('_|_|_|_') != -1) {aString = aString.split('_|_|_|_').join('|||');}

	
	for(var i = 0; i < theChars.length; i++ ) {
		var aChar = theChars[i];
		var anEntity = theEntities[i];
		if(aString.indexOf(aChar) != -1) {
			aString = aString.split(aChar).join(anEntity);
		}
	}

	if(aString.indexOf('&amp;') != -1) {aString = aString.split('&amp;').join('&');}
	if(aString.indexOf('&nbsp;') != -1) {aString = aString.split('&nbsp;').join(' ');}
	if(aString.indexOf('&quot;') != -1) {aString = aString.split('&quot;').join('"');}
	if(aString.indexOf('\r') != -1) {aString = aString.split('\r').join('\n');}
	if(aString.indexOf('\n') != -1) {aString = aString.split('\n').join('');}
	
	return aString;
};
function convertCP2HexNCR(textString) {
	if(theBrowserName == 'explorer') {return textString;}
	var outputString = "";
	textString = textString.replace(/^\s+/, '');
	if(textString.length == 0) {return "";}
	textString = textString.replace(/\s+/g, ' ');
	var theHexas = 'aAbBcCdDeEfF0123456789';
	var listArray = textString.split('|||');
	for(var i = 0; i < listArray.length; i++) {
		if(theHexas.indexOf(listArray[i]) != -1) {
			outputString += listArray[i];
		} else {
			var n = parseInt(listArray[i], 16);
			if(isNaN(n) || ((n > 32) && (n < 256))) {
				outputString += listArray[i];
			} else {
				outputString += '&#x'+dec2hex(n)+';';
			}
		}
	}
	return outputString;
};
function dec2hex(textString) {
 var newText = (textString+0).toString(16).toUpperCase();
 return newText;
};
function convertChar2CP(textString) {
	if(theBrowserName == 'explorer') {return textString;}
	var outputString = "";
	var haut = 0;
	var n = 0;
	for(var i = 0; i < textString.length; i++) {
		var b = textString.charCodeAt(i);
		if(b < 256) {
			outputString += textString.charAt(i)+'|||';
		} else {
			if ((b < 0) || (b > 0xFFFF)) {
				outputString += ' _';
			}
			if(haut != 0) {
				if((0xDC00 <= b) && (b <= 0xDFFF)) {
					outputString += dec2hex(0x10000+((haut-0xD800) << 10) + (b-0xDC00))+'|||';
					haut = 0;
					continue;
				} else {
					outputString += ' _';
					haut = 0;
				}
			}
			if((0xD800 <= b) && (b <= 0xDBFF)) {
				haut = b;
			} else {
				outputString += dec2hex(b)+'|||';
			}
		}
	}
	return outputString.replace(/ $/, '');
};





function urlDecode(str) {
	str=str.replace(new RegExp('\\+','g'),' ');
	return unescape(str);
};
function urlEncode(str) {
	str=escape(str);
	str=str.replace(new RegExp('\\+','g'),'%2B');
	return str.replace(new RegExp('%20','g'),'+');
};


var baseChrs = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var binChrs = "01X";
function encodeBase64(vin) {
	vin = ''+vin;
	vin = toHtml(vin);
	var rv = "";
	var stepsiz = 3;
	for(var idx=0; idx < Math.ceil(vin.length / stepsiz); idx++) {
		rv += bitstoBase64(base256toBits(vin.substr(idx * stepsiz, stepsiz)));
	}
	return rv;
};

function decodeBase64(vin) {
	vin = ''+vin;
	var rv = "";
	var stepsiz = 4;
	for(var idx=0; idx < Math.ceil(vin.length / stepsiz); idx++) {
		rv += bitstoBase256(base64toBits(vin.substr(idx * stepsiz, stepsiz)));
	}
	return convertTxt(br2nl(rv));
};
function base256toBits( vin ) {
	if(validateRadix(vin, 256)) {
		var rv = "XXXXXXXXXXXXXXXXXXXXXXXX";
		function toBin8(n) {
			rv = "00000000" + n.toString(2);
			return rv.substr(rv.length-8);
		};
		for(var idx=0; (idx < vin.length && idx < 3); idx++) {
			rv = rv.replace(/XXXXXXXX/, toBin8(vin.charCodeAt(idx)));
		}
		return rv;
	}
};
function base64toBits( vin ) {
	if(validateRadix(vin, 64)) {
		var rv = "XXXXXXXXXXXXXXXXXXXXXXXX";
		function toBin6(n) {
			rv = "000000" + n.toString(2);
			return rv.substr(rv.length-6);
		};
		for(var idx=0; (idx < vin.length && idx < 4); idx++) {
			if(vin.charAt(idx) != "=") {
				rv = rv.replace(/XXXXXX/, toBin6(baseChrs.indexOf(vin.charAt(idx))));
			}
		}
		return rv;
	}
};
function bitstoBase64(vin) {
	var rv = "";
	var stepsiz = 6;
	for( var idx=0; idx < 4; idx++ ) {
		var grp = vin.substr(idx*stepsiz, stepsiz);
		if(grp.indexOf("X") != 0) {
			grp = grp.replace(/X/g, '0');
			rv += baseChrs.charAt(parseInt(grp, 2));
		} else {
			rv += "=";
		}
	}
	return rv;
};
function bitstoBase256(vin) {
	var rv = "";
	var stepsiz=8;
	for(var idx=0; idx < 3; idx++ ) {
		var grp = vin.substr(idx*stepsiz, stepsiz);
		if(grp.indexOf("X")==-1) {rv += String.fromCharCode(parseInt(grp, 2));}
	}
	return rv;
};

function validateRadix(vin,base) {
	// todo
	return true;
};




function isArray(a) {
    return isObject(a) && a.constructor == Array;
};
function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
};
function isFunction(a) {
    return typeof a == 'function';
};


//###
function blurInputs() {
	var anInput = document.createElement('input');
	anInput.style.borderWidth = '0px';
	anInput.style.width = '1px';
	anInput.style.height = '1px';
	anInput.style.position = 'absolute';
	anInput.style.top = getBodyTopScroll()+'px';
	anInput.style.left = getBodyLeftScroll()+'px';
	anInput = document.body.appendChild(anInput);
	anInput.focus();
	anInput = document.body.removeChild(anInput);
	anInput = null;
}
//###





var alwaysforbiddenAlertString = '';
var defaultAlertString = '';
var defaultMailSubject = '';
var noDataAvailableStr = '';
var historyHeadersArray = null;
var showStr = '';
var enteraPhonenumberStr = '';
var enteraMailaddressStr = '';
var subscrReqStr = '';
var makeNewMembStr = '';
var thankyouStr = '';
var subscrReqIsSuccessSentStr = '';
var youWillReceiveEtcStrr = '';
var youProvidedStr = '';
var thanksForSubscrStr = '';
var ourStaffStr = '';
var toManageYourShopStr = '';
var everyItemWhrereString = '';
var containsString = '';
var noDBdataString = '';
function setStrings(aLang) {
	if(aLang == 'fr') {/* french */
		alwaysforbiddenAlertString = convertTxt('Ce champ contient des caract&egrave;res interdits.');
		defaultAlertString = convertTxt('Les champs marqu&eacute;s d\'un ast&eacute;risque rouge sont obligatoires.');
		defaultMailSubject = convertTxt('Message depuis le site');
		noDataAvailableStr = convertTxt('Aucune donn&eacute;e &agrave; traiter n\'est disponible');
		historyHeadersArray = new Array('N&deg; Client','N&deg Ordre','Ref. Chargement','Ref. Facture','Date','Pays','Localit&eacute;','Code postal','Image','&nbsp;');
		showStr = 'Voir';
		enteraPhonenumberStr = convertTxt('Entrez un num&eacute;ro de t&eacute;l&eacute;phone');
		enteraMailaddressStr = convertTxt('Entrez un e-mail valide');
		subscrReqStr = convertTxt('Demande d\'inscription');
		makeNewMembStr = convertTxt('Veuillez cr&eacute;er un nouveau membre avec les donn&eacute;es suivantes');
		thankyouStr = convertTxt('Merci');
		subscrReqIsSuccessSentStr = convertTxt('La demande d\'inscription a bien &eacute;t&eacute; envoy&eacute;e');
		youWillReceiveEtcStrr = convertTxt('Vous allez recevoir votre nouveau Login et mot de passe dans l\'adresse mail');
		youProvidedStr = convertTxt('que vous avez fourni.');
		thanksForSubscrStr = convertTxt('Merci pour votre inscription');
		ourStaffStr = convertTxt('L\'&eacute;quipe Dandoy');
		toManageYourShopStr = convertTxt('Pour administrer votre E-Shop vous avez besoin d\'un PC windows based avec le navigateur Internet Explorer 6 ou ult&eacute;rieur.');
		
		dlogAddToCaddyTitleString = 'Ajouter au Panier';
		dlogArticleString = 'Article selectionn&eacute; :';
		dlogAddString = 'Ajouter&nbsp;';
		dlogItemsString = '&nbsp;&eacute;l&eacute;ments.';
		buttonCancelString = 'Annuler';
		buttonAddString = 'Ajouter au panier';
		buttonAddShowString = 'Ajouter et afficher le Panier';
		dlogHelpString = 'Inscrivez ci-dessous la quantit&eacute; souhait&eacute;e pour cet article.';
		validLabels = 'Genre : Marque : Type : Prix : ';
		showString = 'Afficher la fiche produit';
		buyString = 'Ajouter au panier';
		realShowAllString = 'Tout afficher';
		showAllString = '  '+realShowAllString;
		theOptionStrings = new Array('Normal','Exclusif','Nouveau','Occasion','Promo!');
		searchInprogressString = 'Recherche en cours ...';
		srShowingString = 'R&eacute;sultat de la r&eacute;cherche :';
		yourCartContainsString = 'Votre&nbsp;panier&nbsp;contient&nbsp;'
		yourCartItemsString = '&nbsp;&eacute;l&eacute;ments'
		yourCartForanamountString = 'Pour&nbsp;une&nbsp;valeur&nbsp;de&nbsp;'
		yourCartMoneyString = '&nbsp;&euro;&nbsp;(htva)'
		everyItemWhrereString = 'Afficher tous les &eacute;l&eacute;ments dont :';
		containsString = 'contient';
		
		noDBdataString = 'Aucune occasion n\'est disponible actuellement.';
	} else if(aLang == 'nl') {/* nederlands */
		alwaysforbiddenAlertString = 'Dit veld bevat ongeldige karakters.';
		defaultAlertString = 'De velden aangeduid met een rode ster zijn verplicht.';
		defaultMailSubject = 'Bericht vanaf the site';
		noDataAvailableStr = 'No data available';
		historyHeadersArray = new Array('Klant Nr','Orde Ref','Lading Ref','Facturatie Ref','Datum','Land','Stad','Postcode','Image','&nbsp;');
		showStr = 'Zien';
		enteraPhonenumberStr = 'Vul een telefoon nummer in';
		enteraMailaddressStr = 'Vul een geldig e-mail adres in';
		subscrReqStr = 'Inschrijvingsaanvraag';
		makeNewMembStr = 'Gelieve een nieuw lid aan te maken met de volgende gegevens';
		thankyouStr = 'Dank u';
		subscrReqIsSuccessSentStr = 'De inschrijvingsvraag werd met succes verzonden';
		youWillReceiveEtcStrr = 'U gaat uw nieuwe Login en wachtwoord ontvangen in het mailadres';
		youProvidedStr = 'dat u gegeven hebt.';
		thanksForSubscrStr = 'Dank u voor uw inschrijving';
		ourStaffStr = 'De Dandoy ploeg';
		toManageYourShopStr = 'Om uw E-Shop te beheren hebt u een windows based PC met Internet Explorer 6 of hoger nodig.';
		
		dlogAddToCaddyTitleString = 'Ajouter au Panier';
		dlogArticleString = 'Article selectionn&eacute; :';
		dlogAddString = 'Ajouter&nbsp;';
		dlogItemsString = '&nbsp;&eacute;l&eacute;ments.';
		buttonCancelString = 'Annuler';
		buttonAddString = 'Ajouter au panier';
		buttonAddShowString = 'Ajouter et afficher le Panier';
		dlogHelpString = 'Inscrivez ci-dessous la quantit&eacute; souhait&eacute;e pour cet article.';
		validLabels = 'Genre : Marque : Type : Prix : ';
		showString = 'Productfiche weergeven';
		buyString = 'Ajouter au panier';
		realShowAllString = 'Alles weergeven';
		showAllString = '  '+realShowAllString;
		theOptionStrings = new Array('Normaal','Exclusief','Nieuw','Occasie','Promo!');
		searchInprogressString = 'Recherche en cours ...';
		srShowingString = 'Zoekresultaat :';
		yourCartContainsString = 'Votre&nbsp;panier&nbsp;contient&nbsp;'
		yourCartItemsString = '&nbsp;&eacute;l&eacute;ments'
		yourCartForanamountString = 'Pour&nbsp;une&nbsp;valeur&nbsp;de&nbsp;'
		yourCartMoneyString = '&nbsp;&euro;&nbsp;(htva)'
		everyItemWhrereString = 'Alle elementen weergeven waarvan :';
		containsString = 'bevat';
		
		noDBdataString = 'Geen enkele gelegenheid is momenteel beschikbaar.';
	} else {/* default to english */
		alwaysforbiddenAlertString = 'This field contains invalid characters.';
		defaultAlertString = 'The fields marked with a red asterisk are mandatory.';
		defaultMailSubject = 'Message from the site';
		noDataAvailableStr = 'No data available';
		historyHeadersArray = new Array('Client Nr','Order Ref','Loading Ref','Invoice Ref','Date','Country','City','Zip code','Image','&nbsp;');
		showStr = 'Show';
		enteraPhonenumberStr = 'Enter a phone number';
		enteraMailaddressStr = 'Enter a valid e-mail address';
		subscrReqStr = 'Subscription request';
		makeNewMembStr = 'Please create a new Member with the following data';
		thankyouStr = 'Thank You';
		subscrReqIsSuccessSentStr = 'Subscription request was successfully sent';
		youWillReceiveEtcStrr = 'You will receive your new Login and Password into the e-mail address';
		youProvidedStr = 'you provided.';
		thanksForSubscrStr = 'Thank you for subscribing';
		ourStaffStr = 'The Dandoy staff';
		toManageYourShopStr = 'To manage your E-Shop you need a Windows-based PC with Internet Explorer 6 or better.';
		
		dlogAddToCaddyTitleString = 'Ajouter au Panier';
		dlogArticleString = 'Article selectionn&eacute; :';
		dlogAddString = 'Ajouter&nbsp;';
		dlogItemsString = '&nbsp;&eacute;l&eacute;ments.';
		buttonCancelString = 'Annuler';
		buttonAddString = 'Ajouter au panier';
		buttonAddShowString = 'Ajouter et afficher le Panier';
		dlogHelpString = 'Inscrivez ci-dessous la quantit&eacute; souhait&eacute;e pour cet article.';
		validLabels = 'Kind : Brand : Type : Price : ';
		showString = 'Show the product card';
		buyString = 'Ajouter au panier';
		realShowAllString = 'Show all';
		showAllString = '  '+realShowAllString;
		theOptionStrings = new Array('Normal','Exclusifve','New','Occasion','Promo!');
		searchInprogressString = 'Recherche en cours ...';
		srShowingString = 'Search result :';
		yourCartContainsString = 'Votre&nbsp;panier&nbsp;contient&nbsp;'
		yourCartItemsString = '&nbsp;&eacute;l&eacute;ments'
		yourCartForanamountString = 'Pour&nbsp;une&nbsp;valeur&nbsp;de&nbsp;'
		yourCartMoneyString = '&nbsp;&euro;&nbsp;(htva)'
		everyItemWhrereString = 'Show every item where :';
		containsString = 'contains';
		
		noDBdataString = 'No occasion is currently available.';
	}
}






function readProps(anObj) {
	var crlf = String.fromCharCode(13)+String.fromCharCode(10);
	var titleString = '';
	titleString += 'Unique ID : '+anObj.getAttribute('item_uID');
	titleString += crlf+crlf+'Descriptor : '+anObj.getAttribute('otype');
	titleString += crlf+crlf+'Link : '+anObj.getAttribute('linkHref');
	var isFormItem = anObj.getAttribute('isformitem');
	if(isFormItem) {
		titleString += crlf+crlf+'Form item : '+anObj.getAttribute('isformitem');
		titleString += crlf+'Object type : '+anObj.getAttribute('type');
		titleString += crlf+'Name : '+anObj.getAttribute('name');
		titleString += crlf+'Name Value : '+anObj.getAttribute('namevalue');
		titleString += crlf+'Value : '+anObj.getAttribute('value');
		titleString += crlf+'Item Value : '+anObj.getAttribute('itemvalue');
		titleString += crlf+'Tab Index : '+anObj.getAttribute('tabIndex');
		titleString += crlf+'Mandatory Field : '+anObj.getAttribute('ismandatory');
		titleString += crlf+'Allowed Chars : '+anObj.getAttribute('allowedchars');
		titleString += crlf+'Mandatory Chars : '+anObj.getAttribute('mandatorychars');
		titleString += crlf+'Forbidden Chars : '+anObj.getAttribute('forbiddenchars');
		titleString += crlf+'Error String : '+anObj.getAttribute('errorstring');
		titleString += crlf+'Unique ID : '+anObj.getAttribute('uniqueid');
		titleString += crlf+'Formule : '+anObj.getAttribute('formule');
	}
	anObj.setAttribute('title',titleString);
};


supportLib = true;
