function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}
function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}
//=========================
function getY(theElement){
	if((document.all)||(document.getElementById)){
		var tempY=0;
		if(theElement.offsetParent != null){
			tempY+=getY(theElement.offsetParent);
		}
		tempY+=theElement.offsetTop;
		return parseInt(tempY);
	}else if(document.layers){
		return theElement.y;
	}
}
//=========================
function getX(theElement){
	if((document.all)|| (document.getElementById)){
		var tempX=0;
		if(theElement.offsetParent != null){
			tempX+=getX(theElement.offsetParent);
		}
		tempX+=theElement.offsetLeft;
		return parseInt(tempX);
	}else if(document.layers){
		return theElement.x;
	}
}
//=========================
function fsubmit(newaction){
	document.forms[0].method='post';
	document.forms[0].action=newaction;
	document.forms[0].search.value = document.forms[0].hsearch.value;
	document.forms[0].submit();
}
//=========================
function DrawPagesLinks(container, currPage, recsCount, pageSize, searchStr, pageID){
	if(pageID==null) pageID = 74;
	pageCount = Math.ceil(recsCount/pageSize);
	html='';
	if(currPage > 0){
		html = '<a href="#" onclick="fsubmit(\'index.php?id='+pageID+'&page='+(currPage-1)+'\');"><img src="img/left.gif" border="0"></a><img src="img/s.gif" width="15" height="1">';
	}
	for(var i=0;i<pageCount;i++){
		if(currPage!=i){
			html+='<a href="#" onclick="fsubmit(\'index.php?id='+pageID+'&page='+i+'\');">'+(i+1)+'</a>&nbsp;';
		}else{
			html+='<span class="activelink">'+(i+1)+'</span>&nbsp;';
		}
	}
	if(currPage < pageCount-1){
		html += '<img src="img/s.gif" width="11" height="1"><a href="#" onclick="fsubmit(\'index.php?id='+pageID+'&page='+(currPage+1)+'\');"><img src="img/right.gif" border="0"></a>';
	}
	container.innerHTML = html;
}
//=========================
function zoom(fname, copyright){
	window.open('modules/imgpreview.php?src='+fname+'&copyright='+escape(copyright),'wwo','width=500, height=450, status=no',true);	
}
//=========================
function zoomNearest(olink){
	var linkParent = olink.parentNode.childNodes[0];
	//alert(linkParent);
	var el;
	for(var i=0; i<linkParent.childNodes.length; i++){
		el = linkParent.childNodes[i];
		alert(el.nodeName);
		if(el.nodeName == 'IMG'){
			oncl = el.attributes.getNamedItem("onclick");
			alert("ONCLICK="+oncl.value);
			//alert(el.getAttribute('onclick'));
			//alert(el.attributes['onclick'].nodeName);
			// onclick="zoom('../img/01_N.gif', '')"
			var re=/zoom\('([a-zA-Z0-9.\/_ ])*', '([a-zA-Z0-9.\/_ ])*'\)/i
			var res = re.exec(el.onclick);
			alert(res);
		}
	}
	/*for(var el in linkParent.children){
		alert(el.nodeName);
	}*/
}
//=========================
function SetExtLinks(){
	for(var i=0;i<document.links.length;i++){
		if(document.links[i].href.indexOf('javascript:')==-1
		   && document.links[i].hostname!=location.hostname
		   && document.links[i].immune!='true'
		   && document.links[i].href.indexOf('mailto')==-1
		   && document.links[i].href.indexOf('daimler.com')==-1
		   && document.links[i].href.indexOf('daimlerchrysler.com')==-1
		   && document.links[i].href.indexOf('intra.corpintra.net')==-1){
			document.links[i].href = 'index.php?id=191&link='+escape(document.links[i].href);
		}
	}	
}
//=========================
function ImgOver(pic){
	pic.style.borderColor = '#3f9ac9 #3f9ac9 #3f9ac9 #3f9ac9';
}
function ImgOut(pic){
	pic.style.borderColor = '#263f6a #263f6a #263f6a #263f6a';
}
//=========================
function swProp(obj, pro1, pro2){
	if(obj)
	if(obj.getAttribute(pro2)!=null && obj.getAttribute(pro1)!=null){
		var temp = obj.getAttribute(pro1);
		obj.setAttribute(pro1, obj.getAttribute(pro2));
		obj.setAttribute(pro2, temp);
	}
}
function mover(link){
	document.Mem = new Array;
	oColl = link.getElementsByTagName('img');
	var img, temp;
	for(var i=0;i<oColl.length;i++){
		it = oColl[i];
		//if(it.tagName=='IMG' || it.tagName=='SPAN'){
		if(it.tagName=='IMG' ){
			swProp(it,'src','mo');
			if(document.all){
				swProp(it,'className','moclass');
			}else{
				swProp(it,'class','moclass');
			}
			document.Mem[0]=it;
		}
	}
}
function mout(){
	it = document.Mem[0];
	swProp(it,'src','mo');
	if(document.all){
		swProp(it,'className','moclass');
	}else{
		swProp(it,'class','moclass');
	}
}
//=========================
//gallery
function Gallery(){
	this.picarr = [];
	this.zoomarr = [];
	this.copyrightarr = [];
	this.CurrPic=0;
	this.currID = 0;
	this.imgpath='gallery';
	this.holder = 'picbox';
	this.countLabel = 'counterLabel';
	this.descSuff = 'desc';
	this.descSpan = 'descSpan';
	this.titleSuff = 't';
	this.titleSpan = 'titleSpan';
	
	this.GoToPic = GalleryGoToPic;
	this.NextPic = GalleryNextPic;
	this.Add = GalleryAdd;
	this.Preload = GalleryPreload;
}
function GalleryGoToPic(inPicID,inCorr){
	picID = parseInt(inPicID,10);
	corr = parseInt(inCorr,10);
	if(!isNaN(picID) && !isNaN(corr) && this.picarr[(picID+corr)]!=null){
		//document.images[this.holder].src=this.imgpath+'/'+this.picarr[picID];
		this.currID = picID+corr;
		//fadeOut(document.images[this.holder],this.imgpath+'/'+this.picarr[this.currID]);
		MM_swapImage(this.holder,'',this.imgpath+'/'+this.picarr[this.currID],0);
		clab = document.getElementById(this.countLabel);
		if(clab!=null){
			clab.innerHTML = this.currID+1;	
		}
		var dDiv = document.getElementById(this.descSuff+''+(this.currID+1));
		var dSpan = document.getElementById(this.descSpan);
		if(dDiv!=null && dSpan!=null){
			dSpan.innerHTML = dDiv.innerHTML;
		}
		var tDiv = document.getElementById(this.titleSuff+''+(this.currID+1));
		var tSpan = document.getElementById(this.titleSpan);
		if(tDiv!=null && tSpan!=null){
			tSpan.innerHTML = tDiv.innerHTML;
		}
		if(this.zoomarr[this.currID]!=''){
			document.images[this.holder].onclick = new Function('zoom(\'../'+this.imgpath+'/'+this.zoomarr[this.currID]+'\', \''+this.copyrightarr[this.currID]+'\')');
			document.images[this.holder].style.border = '1px solid #263f6a';
			
			document.images[this.holder].onmouseover = new Function ("this.style.border = '1px solid #3f9ac9';");
			document.images[this.holder].onmouseout = new Function ("this.style.border = '1px solid #263f6a';");
			
		}else{
			document.images[this.holder].onclick = null;
			document.images[this.holder].style.border = '1px solid white';
			document.images[this.holder].onmouseover = null;
			document.images[this.holder].onmouseout = null;
		}
	}
}
function GalleryNextPic(movePos){
	this.currID+=movePos;
	this.currID=(this.currID >= this.picarr.length)?0:this.currID;
	this.currID=(this.currID < 0)?this.picarr.length-1:this.currID;
	this.GoToPic(this.currID,0);
}
function GalleryAdd(name, copyright, zoom){
	this.picarr[this.picarr.length] = name;
	this.copyrightarr[this.copyrightarr.length] = (copyright!=null)?copyright:'';
	this.zoomarr[this.zoomarr.length] = (zoom!=null)?zoom:'';
}
function fadeOut(obj, nsrc) {
	/*if(document.all){
	    obj.style.filter="blendTrans(duration=1)";
		if ((obj.visibility != "hidden") && (obj.filters.blendTrans.status != 2)) {
	        obj.filters.blendTrans.Apply();
        	obj.onreadystatechange = new Function("if(this.readyState=='complete')this.filters.blendTrans.Play();");
		}
		obj.src = nsrc;
	}else{
		obj.src = nsrc;
	}*/
}
function GalleryPreload(){
	var t = new Array();
	for(var i=0; i< this.picarr.length;i++){
		t[i] = new Image();
		t[i].src = this.picarr[i];
	}
}
//-------------------------
function Alternate(oTable){
	if(oTable==null) return;
	rs = oTable.rows;
	for (i=0; i < rs.length; i++) {
		if(i % 2 ==0){
			rs[i].style.backgroundColor  = '#f3f4f5';
			imgs = rs[i].getElementsByTagName('img');
			if(imgs[0]!=null) imgs[0].src = 'img/g.gif';
		}else{
			rs[i].style.backgroundColor = '#ffffff';
		}
	}
}
// flash
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i){
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}else if(navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
//--- fonts
function FontSize(newSize){
	document.getElementById('size1').disabled=true;
	document.getElementById('size2').disabled=true;
	document.getElementById('size3').disabled=true;
	document.getElementById('size'+newSize).disabled=false;
}
//--- cookies
function GetCookie(name) {
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	if (start == -1) return null;
	var end = document.cookie.indexOf(";",len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len,end));
}
//-----------------------------------------
function SetCookie (name, value) { 
	var argv = SetCookie.arguments; 
	var argc = SetCookie.arguments.length; 
	var expires = (argc > 2) ? argv[2] : null; 
	var path = (argc > 3) ? argv[3] : null; 
	var domain = (argc > 4) ? argv[4] : null; 
	var secure = (argc > 5) ? argv[5] : false; 
	document.cookie = name + "=" + escape (value) 
	+ ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) 
	+ ((path == null) ? "" : ("; path=" + path)) 
	+ ((domain == null) ? "" : ("; domain=" + domain)) 
	+ ((secure == true) ? "; secure" : ""); 
} 
//-----------------------------------------
function CheckCookie(){
	//alert(GetCookie("dnshown"));
	if(GetCookie("dnshown")=="1"){
		document.getElementById('msg').style.visibility = 'hidden';
		document.getElementById('msg').style.top = -100;
	}else{
		var cc = document.getElementById('contentCell');
		var msg = document.getElementById('msg');
		msg.style.left = getX(cc);
		msg.style.top = getY(cc);
		msg.style.visibility = 'visible';
		//document.getElementById('msg').style.visibility = 'visible';
		var dt = new Date();
		dt.setDate(dt.getDate()+1);
		SetCookie("dnshown","1",dt,"/");
	}
}
//------------------------------------------
function DeleteCookie(name){
	var dt = new Date();
	dt.setDate(dt.getDate()-1);
	SetCookie(name,"",dt,"/");
}
//DeleteCookie("dnshown");
// Downloads
function HasChecked(oField){
  var res=false;
  if(!oField.length){
	 res = oField.checked;
  }else{
	  for(var i=0; i<oField.length; i++){
		  res = res || oField[i].checked;
	  }
  }
  return res;
}
//==============================
function StartDownload(frm, msg){
	var d = document.getElementById("alerts");
	var c = document.getElementById("alertsContents");
	if(d){
	  d.style.visibility = "hidden";
	  c.innerHTML = '';
	}
	if(HasChecked(frm.elements["fid[]"])){
		frm.action = frm.ownerDocument.location;
		if(frm.elements['modules']){
		  frm.elements['modules'].value = 'cart2';
		}
		frm.target = '_blank';
		frm.submit();
	}else{
	  /*if(d){
		c.innerHTML = msg;
		centerDiv("alerts");
		d.style.visibility = "visible";
	  }*/
	  AlertMsg(msg);
	}
	return false;
}
//=============================================
function FormAction(newact){
	document.forms[0].target = '_self';
  switch(newact){
	case 'loginOld': document.forms[0].action = location.href; break;
	case 'login':
		document.forms[0].fmode.value = 'login';
	// <protocol>//<host>[:<port>]/<pathname>[<hash>][<search>] 
	//var adr = 'https://'+location.host+location.pathname+location.search+location.hash;
	if(location.host!='localhost' && location.host!='192.168.1.13'){
		var adr = 'https://'+location.host.replace('www.','')+location.pathname+location.search.replace("logout=","nlo=")+location.hash;
			document.forms[0].action = adr;
			//alert(adr);
	}else{
		var adr = 'http://'+location.host+location.pathname+location.search.replace("logout=","nlo=")+location.hash;
			document.forms[0].action = adr;
	}
	break;
	case 'search':
		document.forms[0].action = 'index.php?id=74';
		document.forms[0].fmode.value = 'search';
	break;
	case 'advsearch':
		document.forms[0].action = 'index.php?id=100';
	break;
	case 'profile':
		document.forms[0].action = 'index.php?id=545';
		document.forms[0].fmode.value = 'profile';
	break;
	case 'cart':
		document.forms[0].action = 'index.php?id=982';
		document.forms[0].fmode.value = 'cart';
		//document.forms[0].target = '_blank';
	break;
	case 'dialog':
		document.forms[0].action = 'index.php?id=974';
	break;
	case 'forgotten':
		document.forms[0].action = 'index.php?id=546';
	break;
	default:
		document.forms[0].action = 'index.php?id=74';
		document.forms[0].fmode.value = 'search';
  }
}
//=================================================
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
//======================= rate ============================
function posRateForm(){
	oLink = document.getElementById('rateLnk');
	rf = document.getElementById('rateform');
	if(oLink && mf){
		rf.style.top = (getY(oLink)-121)+'px';
		rf.style.left = (getX(oLink)-178)+'px';
	}
}
function showRateForm(){
	hideMailForm();
	hideHelpForm();
	posRateForm();
	rf = document.getElementById('rateform');
	rf.style.visibility='visible';
}
function hideRateForm(){
	rf = document.getElementById('rateform');
	rf.style.visibility='hidden';
}
//======================= mail form =============================
function posMailForm(){
	oLink = document.getElementById('recommendLnk');
	mf = document.getElementById('mailform');
	if(oLink && mf){
		mf.style.top = (getY(oLink)-226)+'px';
		mf.style.left = (getX(oLink)-178)+'px';
	}
}
function showMailForm(){
	hideRateForm();
	hideHelpForm();
	posMailForm();
	mf = document.getElementById('mailform');
	mf.style.visibility='visible';
}
function hideMailForm(){
	mf = document.getElementById('mailform');
	mf.style.visibility='hidden';
}
//=============================================================
function posHelpForm(){
	oLink = document.getElementById('commentLnk');
	mf = document.getElementById('helpform');
	if(oLink && mf){
		mf.style.top = (getY(oLink)-226)+'px';
		mf.style.left = (getX(oLink)-178)+'px';
	}
}
function showHelpForm(){
	hideMailForm();
	hideRateForm();
	posHelpForm();
	mf = document.getElementById('helpform');
	mf.style.visibility='visible';
}
function hideHelpForm(){
	mf = document.getElementById('helpform');
	mf.style.visibility='hidden';
}
function posFontChanger(){
	if(fch = document.getElementById("fontChanger")){
		//fch.style.top = getY(document.images['underLang'])+ 26;
		fch.style.top = getY(document.images['underLang'])+ 66;
		fch.style.left = getX(document.images['underLang']) + 8;
		fch.style.visibility = 'visible';
	}
}
//window.onresize = new Function('posFontChanger();posMailForm();posRateForm();posHelpForm();MoveAll();');
//window.onresize = new Function('posMailForm();posRateForm();posHelpForm();MoveAll();');
//----------------------------------------------------------
function addQuickLink(pageID){
  sHREF = location.href;
  var res='';
  if(sHREF.indexOf('?')==-1){
	res = sHREF+'?modules=favorites2&act=insertfav&favID='+pageID;
  }else{
	sSearch = sHREF.substr(sHREF.indexOf('?')+1);
	pairs = sSearch.split('&');
	for(var i=0;i<pairs.length;i++){
	  vars = pairs[i].split('=');
	  if(vars[0]!='modules' && vars[0]!='act' && vars[0]!='favID' && vars[0]!='logout'){
		res+=(i==0)?'?'+pairs[i]:'&'+pairs[i];
	  }
	}
	var dr = (res.length==0)?'?':'&';
	res = sHREF.substr(0,sHREF.indexOf('?'))+res+dr+'modules=favorites2&act=insertfav&favID='+pageID;
  }
   window.location.replace(res);
  //window.location = res;
  return false;
}
//-------------------------------------------------------------
function addUpdateAlert(pageID){
  sHREF = location.href;
  var res='';
  if(sHREF.indexOf('?')==-1){
	res = sHREF+'?modules=alert&act=addtoalert&alertID='+pageID;
  }else{
	sSearch = sHREF.substr(sHREF.indexOf('?')+1);
	pairs = sSearch.split('&');
	for(var i=0;i<pairs.length;i++){
	  vars = pairs[i].split('=');
	  if(vars[0]!='modules' && vars[0]!='act' && vars[0]!='alertID' && vars[0]!='logout'){
		res+=(i==0)?'?'+pairs[i]:'&'+pairs[i];
	  }
	}
	var dr = (res.length==0)?'?':'&';
	res = sHREF.substr(0,sHREF.indexOf('?'))+res+dr+'modules=alert&act=addtoalert&alertID='+pageID;
  }
  window.location.replace(res);
  //window.location = res;
  return false;
}

//===============================================================
function checkall(){
	frm = document.forms[0];
	if(checks = frm.elements["fid[]"]){
		if(checks.length){
			for(var i=0; i<checks.length; i++){
				checks[i].checked = true;
			}
		}else{
			checks.checked = true;
		}
	}
	/*if(f = document.getElementById("myDownloadsForm")){
		if(checks = f.getElementsByTagName("input")){
			//alert(checks.length);
			for(i=0; i< checks.length; i++){
				if(checks[i].type=='checkbox'){	
					checks[i].checked = true;
				}
			}
		}
	}*/
}
//================================================================
function removeSelected(){
	res = '';
	/*if(f = document.getElementById("myDownloadsForm")){
		if(checks = f.getElementsByTagName("input")){
			for(i=0; i< checks.length; i++){
				if(checks[i].type=='checkbox' && checks[i].checked){
					 res+=checks[i].value+',';
				}
			}
		}
	}*/
	frm = document.forms[0];
	if(checks = frm.elements["fid[]"]){
		if(checks.length){
			for(var i=0; i<checks.length; i++){
				if(checks[i].checked){
					res+=checks[i].value+',';
				}
			}
		}else{
			res+=checks[i].value+',';
		}
	}
	if(res.length){
		res = res.substr(0,res.length-1);
		//self.location = 'cart.php?act=removesel&fid='+res; //IE6 bug
		//remURL = 'cart.php?act=removesel&fid='+res;
		remURL = 'index.php?id=982&act=removesel&fid='+res;
		setTimeout(function(){	window.location = remURL;}, 0);
	}
}
//================================================================
function CreateExtLink(){
	if(oldOnLoad!= null && typeof(oldOnLoad) == "function"){
		oldOnLoad();
	}
	if(oLink = document.getElementById("extLink")){
		SRCH = document.location.search.split('&');
		for(var i=0;i<SRCH.length;i++){
			if(SRCH[i].indexOf('link=')!=-1){
				HRF = SRCH[i].replace('link=','');
				oLink.href = unescape(HRF);
				oLink.immune='true';
				oLink.innerHTML+=''+unescape(HRF);
				if(langLink = document.getElementById('langlink')){
					langLink.href+='&link='+HRF;
				}
				break;
			}
		}
	}
}
//==================================================================
function GetScrollTop(){
	if (document.documentElement){ 
		return document.documentElement.scrollTop;
	}else if (document.body && document.body.scrollTop){// IE5 or DTD 3.2
		return document.body.scrollTop;
	}
}
//==================================================================
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}else{
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}else{
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
//==================================================================
function centerDiv(divId) {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			if(contentElement = document.getElementById(divId)){
				var contentHeight = contentElement.offsetHeight;
				//var contentHeight = contentElement.style.height;
				if (windowHeight - contentHeight > 0) {
					contentElement.style.top = Math.round((windowHeight / 2) - (contentHeight / 2) + GetScrollTop())+ 'px';
				}else{
					//contentElement.style.position = 'static';
				}
			}
		}
	}
}
//==============================
function PageSize(){
	    var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}
		return [pageWidth,pageHeight];
	}
//==============================
function ResizeOverlay(){
	var arrayPageSize = PageSize();
	if(document.getElementById("alertsBG")){
		$('alertsBG').setStyle({width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
	}
}
//=============================================================
function ShowMsg(){
	ResizeOverlay();
	var al = document.getElementById("alerts");
	var ac = document.getElementById("alertsContents");
	var abg = document.getElementById("alertsBG");
	if(al && ac && ac.innerHTML.length>0){
		if(abg && abg.style.display == 'none'){
			new Effect.Appear(document.getElementById('alertsBG'), { duration: 0.3, from: 0.0, to: 0.8 });
		}
		centerDiv("alerts");
		al.style.visibility = 'visible';
	}
}
//==============================
function AlertMsg(msg){
	ResizeOverlay();
	var al = document.getElementById("alerts");
	var ac = document.getElementById("alertsContents");
	var abg = document.getElementById("alertsBG");
	if(al){
		if(abg && abg.style.display == 'none'){
			new Effect.Appear(document.getElementById('alertsBG'), { duration: 0.3, from: 0.0, to: 0.8 });
		}
		ac.innerHTML = msg;
		centerDiv("alerts");
		al.style.visibility = "visible";
	}
}
//==============================
function HideMsg(){
	var alr, alBG;
	if(alr = document.getElementById('alerts')){
		alr.style.visibility = 'hidden';
	}
	if(alBG = document.getElementById('alertsBG')){
		alBG.style.display = 'none';
	}
	
}