
var objSelRow = null;
var objSelTable = null;
var SelectedID = -1;

var colHighlight = '#e5e5ff';
var colSelected = '#c0c0ff';
var colList = "#f0f0f0";

function GetObj(id) {
        if (document.getElementById) { x = document.getElementById(id); }
        else if (document.all) { x = document.all[id]; }
        else if (document.layers) {  x = document.layers[id]; }
        return x
}

function IsMSIE() {
      var ua = window.navigator.userAgent
      var msie = ua.indexOf ( "MSIE " )

      if ( msie > 0 )      // If Internet Explorer, return version number
         return true;//parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
      else                 // If another browser, return 0
         return false;

}


function InTab( obj, dat ) {
   var s = ';'+dat.toLowerCase()+';';
	var i = s.indexOf( ';'+obj.toLowerCase()+';' );
	if (i > -1) {
	   return true;
	} else {
	   return false;
	}
}

function HasVal( obj, dat ) {
   if (dat) {
	   var s = ';'+dat.toLowerCase()+';';
	   return (s.indexOf( ';'+obj.toLowerCase()+'=' ) > -1);
	} else {
	   return false;
	}
}

function GetVal( obj, dat, def ) {
	var s = ';'+dat.toLowerCase()+';';
	var i = s.indexOf( ';'+obj.toLowerCase()+'=' );
	if (i > -1) {
	   dat = ';'+dat+';';
		s = dat.substr(i+1+obj.length+1);
		i = s.indexOf( ';' );
		if ( i > -1 ) {
			s = s.substr(0,i);
		}
	} else {
	   s = '';
	}
	if ((s == '') && (def)) { s = def; }
	return s;
}

function GetValSep( obj, dat, def, sep ) {
   var s = ""
	if ((dat) && (dat != '')) { 
	   s = sep+dat.toLowerCase()+sep;
		var i = s.indexOf( sep+obj.toLowerCase()+'=' );
		if (i > -1) {
		   dat = sep+dat+sep;
			s = dat.substr(i+1+obj.length+1);
			i = s.indexOf( sep );
			if ( i > -1 ) {
				s = s.substr(0,i);
			}
		} else {
		   s = '';
		}
		if ((s == '') && (def)) { s = def; }
	}
	return s;
}

function SetObjVal( obj, dat, def, sep ) {
   if (GetObj(obj)) {GetObj(obj).value = GetValSep(obj,dat,def,sep);}
}

function PrintVal( obj, dat ) {
   document.write( GetVal( obj, dat ) );
}

function DoObjColor(obj,col) {
	obj.bgColor = col;
	obj.style.backgroundColor = col;
}

function DoRowColor(obj,col) {
	DoObjColor(obj,col);
}

function DoHighlightObj(obj,val) {
	if ((obj) && (obj != objSelRow)) {
		if (val) {
			DoObjColor(obj,colHighlight);
		} else {		
			DoObjColor(obj,colList);
		}
	}
}

function DoHighlightRow(obj,val) {
	if ((obj) && (obj != objSelRow)) {
		if (val) {
			obj.className='RowHighLight';
		} else {		
			//obj.className='';		
			obj.className='RowNormal';	
		}
	}
}

function GetRowTable( obj ) {
   if ((obj) && (obj.tagName) && (obj.tagName == 'TR')) {
		obj = obj.parentNode;
		if (!obj) { return null; }
		if ((obj.tagName) && (obj.tagName == 'TABLE')) {			
			return obj;
		} else {
			obj = obj.parentNode;
			if (!obj) { return null; }
			if ((obj) && (obj.tagName) && (obj.tagName == 'TABLE')) {			
				return obj;				
			} else {
				obj = obj.parentNode;
				if (!obj) { return null; }
				if ((obj) && (obj.tagName) && (obj.tagName == 'TABLE')) {			
					return obj;				
				} else {
					obj = obj.parentNode;
					if (!obj) { return null; }
					if ((obj) && (obj.tagName) && (obj.tagName == 'TABLE')) {			
						return obj;				
					} else { return null; }				
				}
			}
		}
	} else { return null; }
}

function SelRow(e) {
	if (objSelRow) {
      objSelRow.className='RowNormal';	
   }
   objSelRow = e;	
   if (objSelRow) {
		objSelRow.className='RowSelected';	
		objSelTable = GetRowTable( e );
      SelectedID = parseInt(objSelRow.id,10);
		if (GetObj('tbSelectOrgInfo')) {			
			DisplayDataOrg( objSelRow.getAttribute('info') );
		} 
		if (GetObj('tbSelectPersonInfo')) {			
			DisplayDataPerson( objSelRow.getAttribute('info') );
		} 
		if ((parent) && (parent.GetObj) && (parent.GetObj('adminselorg'))) {
			parent.SetRemoteButtons(SelectedID);
		}
   } else {
     objSelRow = null;
     SelectedID = -1;
	  objSelTable = null;
   }
	SetButtons();
}

function SelRowNone() {
	SelRow(null);
}

function SelectTableRowByID(id,tObj) {
   if (id == -1) {
      SelRow(null);
   } else {
      //var tObj = GetObj(tab);
      if ((tObj) && (tObj.rows)) {
         yr = -1;
         for (r = 0; r < tObj.rows.length; r++) {
            if ('' + tObj.rows[r].id == '' + id) {
               yr = r;
            }
         }
         if (yr == -1) {
            SelRow(null);
         } else {
            SelRow(tObj.rows[yr]);
            SetScroll(yr);
         }
      }
   }
}

function CenterRow( r ) {
	if (GetObj('ListDiv')) {
	   var objSelTable = GetRowTable( r );
	   aDiv = GetObj('ListDiv');
      var sScrTop = r.rowIndex * r.clientHeight;
      sScrTop = sScrTop - ((aDiv.clientHeight - r.clientHeight) / 2);
      aDiv.scrollTop = sScrTop ;
	}
}


function SelTableRow(tabid,rowid) {
	var tab = GetObj(tabid);
	//SelectTableRowByID(rowid,tab);
	var i = 0;
	if (tab) {
	   for (i = 0; i < tab.rows.length; i++) {
			if ( (tab.rows[i].id) && (tab.rows[i].id == rowid) ) {
				SelRow(tab.rows[i]);
				CenterRow(tab.rows[i]);	
				break;
			}
		}
	}
}

function SetButtons() {
	
	if (GetObj('btPresentationEdit')) {SetButtonEnabled( GetObj('btPresentationEdit'),((objSelRow) && (objSelTable) && (objSelTable.id == 'tbPresentations')) );}
	if (GetObj('btPresentationDelete')) {SetButtonEnabled( GetObj('btPresentationDelete'),((objSelRow) && (objSelTable) && (objSelTable.id == 'tbPresentations')) );}
	
	if ( GetObj('tbAdminPerson') ) {
		if ( parent.GetObj('btEdit') ) {SetButtonEnabled( parent.GetObj('btEdit'),((objSelRow) && (objSelTable) && (objSelTable.id == 'tbAdminPerson')) );}
		if ( parent.GetObj('btDelete') ) {SetButtonEnabled( parent.GetObj('btDelete'),((objSelRow) && (objSelTable) && (objSelTable.id == 'tbAdminPerson')) );}
		if ( parent.GetObj('btRegOK') ) {SetButtonEnabled( parent.GetObj('btRegOK'),((objSelRow) && (objSelRow.Status) && ((objSelRow.Status == '') || (objSelRow.Status == '0') || (objSelRow.Status == '3')) && (objSelTable) && (objSelTable.id == 'tbAdminPerson')) );}
		if ( parent.GetObj('btRegNo') ) {SetButtonEnabled( parent.GetObj('btRegNo'),((objSelRow) && (objSelRow.Status) && ((objSelRow.Status == '2') || (objSelRow.Status == '0') || (objSelRow.Status == '')) && (objSelTable) && (objSelTable.id == 'tbAdminPerson')) );}
		if ( parent.GetObj('Person_ID') ) { parent.GetObj('Person_ID').value = SelectedID;}
		if ( parent.GetObj('UserID') ) { parent.GetObj('UserID').value = objSelRow.UserID;}
	}
	if ( GetObj('tbAdminOrg') ) {
		if ( parent.GetObj('btEdit') ) {SetButtonEnabled( parent.GetObj('btEdit'),((objSelRow) && (objSelTable) && (objSelTable.id == 'tbAdminOrg')) );}
		if ( parent.GetObj('btDelete') ) {SetButtonEnabled( parent.GetObj('btDelete'),((objSelRow) && (objSelTable) && (objSelTable.id == 'tbAdminOrg')) );}
		if ( parent.GetObj('Org_ID') ) { parent.GetObj('Org_ID').value = SelectedID;}
	}
}

function SetButtonEnabled(e,val) {
   if (e) {
      e.disabled = (!val);
      if (e.children[0]) {
         SetImageEnabled(e.children[0],val);
      }
   }
}

function SetImageEnabled(e,val) {
	var s = '' + e.src;
   var i = s.indexOf('_disabled');
   if (val) {
		if (i != -1) {
         s = s.substr(0,i) + s.substr(i+9);
         e.src = s;
      }
   } else {
      if (i == -1) {
         i = s.lastIndexOf('.');
         s = s.substr(0,i) + '_disabled' + s.substr(i);
         e.src = s;
      }
   }
}

function HideLayer(){
   GetObj('layNoClick').innerHTML="";
   GetObj('layTemp').innerHTML="";
	
	if (GetObj('ifComboBlocker')) {GetObj('ifComboBlocker').style.display = 'none';}
}

function HideMessLayer(){
   if (GetObj('messNoClick')) {
		GetObj('messNoClick').innerHTML="";
	} else {
	   GetObj('layNoClick').innerHTML="";
	}
   if (GetObj('messTemp')) {
		GetObj('messTemp').innerHTML="";
	} else {
      GetObj('layTemp').innerHTML="";
	}
	if (GetObj('ifComboBlocker')) {GetObj('ifComboBlocker').style.display = 'none';}
}

function ShowLayerCentered( what, obj, offLeft, offTop, useWidth, useHeight, mess ) {

   		
	if ((mess) && (GetObj('messTemp'))) {
	var idlayTemp = 'messTemp';	
	} else {
	var idlayTemp = 'layTemp';	
	}
	var objlayTemp = GetObj(idlayTemp);	
	objlayTemp.innerHTML=what;	
	
	var bMSIE = IsMSIE();
	
   var oX = 0;	
   var oY = 0;			
   var oNoL = 0;	
   var oNoT = 0;		
   var oNoW = 0;	
   var oNoH = 0;		
	var dims = totalElementXYOffset(objlayTemp);	
	
	
	if (!bMSIE) { 
	   var BorderTable = null;
		if (objlayTemp.getElementById) { BorderTable = objlayTemp.getElementById('tbBorderTable'); } else 
		if (objlayTemp.all) { BorderTable = objlayTemp.all['tbBorderTable']; } else
		if (objlayTemp.getElementsByTagName) { BorderTable = objlayTemp.getElementsByTagName('TABLE')[0];	}
		if (objlayTemp) {
			if (!useWidth) {useWidth = BorderTable.clientWidth;}
			if (!useHeight) {useHeight = BorderTable.clientHeight;}
		} else {
			if (!useWidth) {useWidth = dims.w;}
			if (!useHeight) {useHeight = dims.h;}
		}
	} else {	
	   if (!useWidth) {useWidth = dims.w;}
	   if (!useHeight) {useHeight = dims.h;}
	}
	if (obj) {
		var dimsc = totalElementXYOffset(obj);
		if (dimsc.h < document.body.clientHeight) {
		   oY = (dimsc.h - useHeight) / 2;
		} else {
			oY = (document.body.clientHeight - useHeight) / 2;
			oY = oY + document.body.scrollTop;			
		}
		//alert('oh: '+document.body.offsetHeight+' ch: '+document.body.clientHeight+' dech: '+document.documentElement.clientHeight+' sc: '+document.body.scrollTop+' oy: '+oY);
		if (dimsc.w < document.body.clientWidth) {
		   oX = (dimsc.w - useWidth) / 2;		   
		} else {
			oX = (document.body.clientWidth - useWidth) / 2;
			oX = oX + document.body.scrollLeft;
		}	
		//oNoT = dimsc.y;
		oNoH = dimsc.h;
		//oNoL = dimsc.x;
		oNoW = dimsc.w;
		/*oNoW = document.body.clientWidth;
		oNoH = document.body.clientHeight;*/
		//alert('pl: '+oX+'pt: '+oY+'ow: '+dimsc.w+' oh: '+dimsc.h+' lw: '+useWidth+' lh: '+useHeight+' cw: '+document.body.clientWidth+' ch: '+document.body.clientHeight);
	} else {
	   oY = (document.body.clientHeight - useHeight) / 2;
	   oX = (document.body.clientWidth - useWidth) / 2;
	   //oY = (document.body.offsetHeight - useHeight) / 2;
	   //oX = (document.body.offsetWidth - useWidth) / 2;
		oNoW = document.body.offsetWidth;
		oNoH = document.body.offsetHeight;
	}	
	
	if (bMSIE) {
		if (GetObj('dtop')) {
		   oNoW = GetObj('dtop').clientWidth;
		   oNoH = GetObj('dtop').clientHeight;
		}
	} else {	
		if (GetObj('dtop')) {
			dims = totalElementXYOffset(GetObj('dtop'));
			oNoW = dims.w;
			oNoH = dims.h;
			oNoL = dimsc.x;
		   oNoT = dimsc.y;
		}
	}
	
	if (offTop) { oY = oY + offTop; }
	if (offLeft) { oX = oX + offLeft; }	
	
	if (oX < 0) { oX = 0; }
	if (oY < 0) { oY = 0; }
   eval(idlayTemp+".style.left="+oX); 
	eval(idlayTemp+".style.top="+oY);
	
	/*var oNoClick = null;
	if ((mess) && (GetObj('messNoClick'))) {
		oNoClick = GetObj('messNoClick');
	} else
	if  (GetObj('layNoClick')) {
		oNoClick = GetObj('layNoClick');
	}
	
	if (oNoClick) {
		oNoClick.innerHTML = "<div class=DivNoClick style='left:"+oNoL+"px;top:"+oNoT+"px;width:"+oNoW+"px;height:"+oNoH+"px;' >&nbsp;</div>"; 
		oNoClick.style.left=oNoL; 
		oNoClick.style.top=oNoT;
	}*/
	
	var idNoClick = 'layNoClick';	
	
	if ((mess) && (GetObj('messNoClick'))) {
		idNoClick = 'messNoClick';
	}
	
	GetObj(idNoClick).innerHTML = "<div class=DivNoClick style='left:"+oNoL+"px;top:"+oNoT+"px;width:"+oNoW+"px;height:"+oNoH+"px;' >&nbsp;</div>"; 
   eval(idNoClick+".style.left="+oNoL); 
	eval(idNoClick+".style.top="+oNoT);
	
	if (GetObj('ifComboBlocker')) {
		var iframe = GetObj('ifComboBlocker');
		iframe.style.display = 'block';
		iframe.style.width = oNoW; //GetObj(idNoClick).style.width;
		iframe.style.height = oNoH; //GetObj(idNoClick).style.height;
		iframe.style.top = oNoT; //GetObj(idNoClick).style.top;
		iframe.style.left = oNoL;//GetObj(idNoClick).style.left;
		//alert(iframe.style.display);
		//iframe.style.zIndex = GetObj(idNoClick).style.top;
		//iframe.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
		//eval("ifComboBlocker.style.left="+oNoL); 
	   //eval("ifComboBlocker.style.top="+oNoT);
	}

	/*
	if ((mess) && (GetObj('messTemp'))) {
		GetObj('messNoClick').innerHTML = "<div class=DivNoClick style='left:"+oNoL+"px;top:"+oNoT+"px;width:"+oNoW+"px;height:"+oNoH+"px;' >&nbsp;</div>"; 
      eval("messNoClick.style.left="+oNoL); 
	   eval("messNoClick.style.top="+oNoT);
	} else {
	   GetObj('layNoClick').innerHTML = "<div class=DivNoClick style='left:"+oNoL+"px;top:"+oNoT+"px;width:"+oNoW+"px;height:"+oNoH+"px;' >&nbsp;</div>"; 
      eval("layNoClick.style.left="+oNoL); 
	   eval("layNoClick.style.top="+oNoT);
	}
	*/
	
	
}

function totalElementXYOffset(obj){
    var xOffset, yOffset, iHeight, iWidth, elParent;
    yOffset = 0;
    xOffset = 0;
    iWidth = 0;
    iHeight = 0;
    if(obj){
        if(typeof obj.offsetTop == 'number'){
            yOffset = obj.offsetTop||0;
            xOffset = obj.offsetLeft||0;
            iWidth = obj.offsetWidth||0;
            iHeight = obj.offsetHeight||0;
            elParent = obj.offsetParent;
            while(elParent){
                yOffset += elParent.offsetTop||0;
                xOffset += elParent.offsetLeft||0;
                elParent = elParent.offsetParent;
            }
        }else if(typeof obj.top == 'number'){ //some Net 4 DIVs
            yOffset = obj.top;
            xOffset = obj.left;
            iWidth = obj.width;
            iHeight = obj.height;
        }else if(typeof obj.y == 'number'){  //Net 4 IMG & A
            yOffset = obj.y;
            xOffset = obj.x;
            iWidth = 0;
            iHeight = 0;
        }else{      //information is not available
            return null;
        }
        return {x:xOffset,y:yOffset,w:iWidth,h:iHeight};
    }
}

var frDataInitiated = false;
var lastCheckRegisterMail = '';
var lastCheckOrg_name = '';

function CheckRegisterMail() {
	if (!GetObj('Email')) { return false;}
	var email = GetObj('Email').value;
	if (email == '') { return false;}
	//if (email == lastCheckRegisterMail) { return false;}
	
	lastCheckRegisterMail = email;
	//if (!GetObj('Person_ID')) { return false;}
	//if (GetObj('Person_ID').value != '') { return false;}
	
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=checkregistermail&';
   lay += "Email=" + email +"&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'CheckRegisterMail';
	//alert(lay);
	iFr.src = lay;
	return false;
	
	/*var iFr = GetObj('frData');
	var lay = 'main.asp?proc=getsqlrecord&';
	var flds = "Person.*, org_name, Country, Department, VAT, Address1, Address2, City, State, ZIPCode";
   lay += "sql=" + "select "+flds+" from person left join Organisation ON Person.Org_ID=Organisation.Org_ID where Person.email like '"+email+"' &";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'CheckRegisterMail';
	iFr.src = lay;
	return false;*/
}

function CheckRegisterMailResult( info ) {
	//alert(info);
	if (info == '') { return false;}
	
   if (info != '') {	
      GetObj('btSelectPerson').disabled = false;
		SelectPerson( info );		
	} else {
	   FillPersonData( info );
	}
}

function FillPersonData( info ) {
	SetObjVal( 'Person_ID', info, '', 'þ' );
	SetObjVal( 'Org_ID', info, '', 'þ' );
	
	
	SetObjVal( 'Firstname', info, '', 'þ' );
	SetObjVal( 'Surname', info, '', 'þ' );
	SetObjVal( 'Title', info, '', 'þ' );
	SetObjVal( 'Profession', info, '', 'þ' );
	
	SetObjVal( 'Mobile', info, '', 'þ' );
	SetObjVal( 'Phone', info, '', 'þ' );
	SetObjVal( 'Fax', info, '', 'þ' );
	
	SetObjVal( 'Get_together_party', info, '', 'þ' );
	SetObjVal( 'OneDay', info, '', 'þ' );
	
	
	SetObjVal( 'Org_name', info, '', 'þ' );
	SetObjVal( 'Country', info, '', 'þ' );
	SetObjVal( 'Department', info, '', 'þ' );
	SetObjVal( 'VAT', info, '', 'þ' );
	SetObjVal( 'Address1', info, '', 'þ' );
	SetObjVal( 'Address2', info, '', 'þ' );
	SetObjVal( 'City', info, '', 'þ' );
	SetObjVal( 'State', info, '', 'þ' );
	SetObjVal( 'ZIPCode', info, '', 'þ' );
	
	var pres = GetValSep( 'Presentations', info, '', 'þ' );
	if (pres != '') {
	   //alert(pres);
		var arDB = pres.split(/\?/);
		var ar = '';
		var i = 0;
		//var pid = GetValSep( 'Person_ID', info, '', 'þ' );
		for (i = 0; i < arDB.length; i++) {
			ar = arDB[i].split(/\;/);
			AddPresentation( ar[0], ar[1], ar[2], ar[3] );
		}
		//pres = pres.replace(/\?/g,'ÿ');
	   //pres = pres.replace(/\;/g,'þ');
	}
	
	SetObjVal( 'Stand_Size', info, '', 'þ' );
}

function AddPresentation( pid, tit, typ, ses ) {

	var tab = GetObj('tbPresentations');

	oTR = tab.insertRow(-1);
	oTR.id = pid;
	oTR.style.cursor='Hand';
	oTR.onclick = function(){SelRow(this);}; 
	oTR.onmouseover = function(){DoHighlightRow(this,true);} 
	oTR.onmouseout = function(){DoHighlightRow(this,false);}
	oTR.ondblclick = function(){EditPresentation(0);}

	oTD = oTR.insertCell(-1);
	oTD.width = 300;
	oTD.innerHTML = tit;

	oTD = oTR.insertCell(-1);
	oTD.width = 100;
	if (typ == 1) {	oTD.innerHTML = 'Poster'; } else { oTD.innerHTML = 'Paper'; }

	oTD = oTR.insertCell(-1);
	oTD.style.borderRightWidth = 1;
	oTD.innerHTML = ses;
}

function CheckOrg_name2(obj) {
	if (!obj) { obj = GetObj('Org_name'); }
	if (!obj) { return false;}
	var Org_name = obj.value;
	if (Org_name == '') { return false;}
	//if (Org_name == lastCheckOrg_name) { return false;}
	
	lastCheckOrg_name = Org_name;
	
	var iFr = GetObj('frData');
	if (!iFr) { alert('fel'); return false; }
	var lay = 'main.asp?proc=getsqlrecord&';
   lay += "sql=" + "select * from Organisation wxhxexrxe Org_name like '"+Org_name+"' &";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'CheckOrg_name';
	alert(lay);
	iFr.src = lay;
	return false;
}



function SelectOrgID() {
	var iFr = GetObj('frData');
	if (!iFr) { alert('fel'); return false; }
	var lay = 'main.asp?proc=selectorgid&';
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'SelectOrgID';
	alert(lay);
	iFr.src = lay;
	return false;
}

function SelectOrgIDResult( info ) {
	if (info == '') { return false;}
	
	if (info.substr(0,7) == 'Error: ') {
		ShowMess( info.substr(7), 'Error' );
		return false;
	}
	var ar = info.split("ÿ");
   if (ar.length > 0) {	
	   GetObj('btSelectOrg').disabled = false;
		SelectOrg( info );	
	} 
}

function CheckOrg_name(obj) {
	if (!obj) { obj = GetObj('Org_name'); }
	if (!obj) { return false;}
	var Org_name = obj.value;
	if (Org_name == '') { return false;}
	//if (Org_name == lastCheckOrg_name) { return false;}
	
	lastCheckOrg_name = Org_name;
	
	var iFr = GetObj('frData');
	if (!iFr) { alert('fel'); return false; }
	var lay = 'main.asp?proc=checkorg_name&';
   lay += "Org_name=" + Org_name + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'CheckOrg_name';
	//alert(lay);
	iFr.src = lay;
	return false;
}

function CheckOrg_nameResult( info ) {
	if (info == '') { return false;}
	
	if (info.substr(0,7) == 'Error: ') {
		ShowMess( info.substr(7), 'Error' );
		return false;
	}
	var ar = info.split("ÿ");
   if (ar.length > 0) {	
	   GetObj('btSelectOrg').disabled = false;
		SelectOrg( info );	
	} 
}

function GetSQL(sql) {
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=getsql&';
   //lay += "sql=\"" + sql + "\"&";
   lay += "sql=" + sql + "&";
   lay += "fieldnames=" + '1' + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'getsql';
	iFr.src = lay;
	return false;
}

function CheckLogin() {
	if (!GetObj('UserID')) { return false;}
	if (!GetObj('Password')) { return false;}
	
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=login&';
   lay += "UserID=" + GetObj('UserID').value + "&";
   lay += "Password=" + GetObj('Password').value + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'CheckLogin';
	iFr.src = lay;
	return false;
}

function DoLogout() {	
	var lay = 'main.asp?proc=logout&';
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	window.location.href = lay;
	return false;
}

function DoChangePassword() {
	//if (!GetObj('CurrPass')) { return false;}
	if (!GetObj('NewPass1')) { return false;}
	if (!GetObj('NewPass2')) { return false;}
	
	if (GetObj('NewPass1').value != GetObj('NewPass2').value) {
		alert( '[New password] and [Confirm new password] are different' );
		return false;
	}
	
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=changepassword&';
   //lay += "Person_ID=" + GetObj('Person_ID').value + "&";
   //lay += "UserID=" + GetObj('Email').value + "&";
   //lay += "Password=" + GetObj('CurrPass').value + "&";
   lay += "NewPassword=" + GetObj('NewPass1').value + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'ChangePassword';
	iFr.src = lay;
	return false;
}

function DoChangeUserID() {
	if (!GetObj('NewEmail')) { return false;}
	
	if (GetObj('NewEmail').value == GetObj('Email').value) {
		HideLayer();
		return false;
	}
	
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=changeuserid&';
   lay += "NewUserID=" + GetObj('NewEmail').value + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'ChangeUserID';
	iFr.src = lay;
	return false;
}

function DoDeletePerson() {
	HideLayer();
	if (!GetObj('Person_ID')) { return false;}
	
	if (GetObj('Person_ID').value == '') {
		HideLayer();
		return false;
	}
	
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=deleteperson&';
   lay += "Person_ID=" + GetObj('Person_ID').value + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	
	alert(lay);
	iFr.init = 1;
	iFr.proc = 'DeletePerson';
	iFr.src = lay;
	return false;
}

function DeletePersonResult( info ) {
	if (info == '') {
	   ShowMess( 'OK - Person has been deleted' );
	} else {
	   ShowMess( info );
	}
}


function ChangePasswordResult( info ) {
	//alert(info);
	if (info == '') {
	   HideLayer();
		ShowMess( 'OK - password has been changed.' );
	} else if (info.substr(0,6) == 'Mail: ') {
	   HideLayer();
		ShowMess( info.substr(6), 'Mail' );
	} else {
	   ShowMess( info );
	}
}



function ChangeChangeUserIDResult( info ) {
	if (info == '') {
	   ShowMess( 'OK - email has been changed.' );
	} else {
	   ShowMess( info );
	}
}

function DoSendNewPassword() {
	if (!GetObj('UserID')) { return false;}
	
	if (GetObj('UserID').value == '') {
		ShowMess('Please enter your email address');
		GetObj('UserID').focus();
		return false;
	}
	
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=sendnewpassword&';
   lay += "UserID=" + GetObj('UserID').value + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'SendNewPassword';
	iFr.src = lay;
	return false;
}

function SendNewPasswordResult( info ) {
	//alert(info);
	if (info == '') {
	   HideLayer();
		ShowMess( 'OK - a new password has been sent to your email address.' );
	} else if (info.substr(0,6) == 'Mail: ') {
	   HideLayer();
		ShowMess( info.substr(6), 'Mail', 600 );
	} else {
	   ShowMess( info );
	}
}

function OrgFilter() {
	//if (!obj) { obj = GetObj('Org_name'); }
	//if (!obj) { return false;}
	//var Org_name = obj.value;
	//if (Org_name == '') { return false;}
	
	
	var iFr = GetObj('frData');
	if (!iFr) { alert('fel'); return false; }
	var lay = 'main.asp?proc=orgfilter&';
   //lay += "Org_name=" + Org_name + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	iFr.init = 1;
	iFr.proc = 'OrgFilter';
	alert(lay);
	iFr.src = lay;
	return false;
}

function OrgFilterResult( info ) {
	if (info == '') { return false;}
	
	if (info.substr(0,7) == 'Error: ') {
		ShowMess( info.substr(7), 'Error' );
		return false;
	}
	var ar = info.split("ÿ");
   if (ar.length > 0) {	
		SelectOrg( info );	
	} 
}

function DataLoaded(iFr) {
	var info = '';
	if (iFr) {
		var init = iFr.init;
		var proc = iFr.proc;
		
		if (init > 0) {
			info = frames['frData'].document.body.innerHTML;
			if (proc == 'CheckRegisterMail') {
				CheckRegisterMailResult( info );
			} else 
			if (proc == 'CheckOrg_name') {
				CheckOrg_nameResult( info );
			} else 
			if (proc == 'SelectOrgID') {
				SelectOrgIDResult( info );
			} else 
			if (proc == 'CheckLogin') {
				CheckLoginResult( info );
			} else  
			if (proc == 'ChangePassword') {
				ChangePasswordResult( info );
			} else  
			if (proc == 'ChangeUserID') {
				ChangeChangeUserIDResult( info );
			} else   
			if (proc == 'DeletePerson') {
				DeletePersonResult( info );
			} else  
			if (proc == 'SendNewPassword') {
				SendNewPasswordResult( info );
			} else 
			if (proc == 'OrgFilter') {
				OrgFilterResult( info );
			} else 
			if (proc == 'RegOK') {
				RegOKResult( info );
			} else 
			if (proc == 'RegNo') {
				RegNoResult( info );
			} else 
			{
			
			alert('2:'+info);
			//var ar = info.split("\t");
			var ar = info.split("ÿ");
			alert('t:'+ar.length);
			
			}
		}
	}	
}

function DoSelectOrg( DoNew ) {
	if (DoNew) {
		FillOrgData( '' );
	} else {
		if (objSelRow) {
			var info = objSelRow.getAttribute('info');	
			FillOrgData( info );
		}
	}
	HideLayer();
	return false;
}

function DoSelectPerson( DoNew ) {
	if (DoNew) {
		FillPersonData( '' );
	} else {
	   if (objSelRow) {
			var info = objSelRow.getAttribute('info');

			if ( GetObj('CurrentYear') ) {
			   if ( '' + GetValSep( 'Year', info, '', 'þ' ) == '' + GetObj('CurrentYear').value ) {
					DoLogin(GetObj('Email').value);
					return false;
				}
			}
			
			FillPersonData( info );
		}
	}
	HideLayer();
	return false;
}

function DoSelectLoginPerson(  ) {
	
	if (objSelRow) {
		var info = objSelRow.getAttribute('info');
		
		var iFr = GetObj('frData');
		var lay = 'main.asp?proc=login&';
		lay += "Person_ID=" + GetValSep( 'Person_ID', info, '', 'þ' ) + "&";
		lay += "UserID=" + GetValSep( 'Email', info, '', 'þ' ) + "&";
		lay += 'cashkiller=' + Date.parse(new Date().toString());
		//window.location.href = lay;
		
		iFr.init = 1;
		iFr.proc = 'CheckLogin';
		iFr.src = lay;
		return false;
		
	}
	HideLayer();
	return false;
}

function DoRegOK( pid, uid ) {
	if ((GetObj('Person_ID').value == -1)) {
	   ShowMess("Please select the person you want to approve.");
	   return false;
	}
   if ((GetObj('UserID').value == '')) {
	   ShowMess("Please select the person you want to.");
	   return false;
	}
	
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=regok&';
	lay += "Person_ID=" + GetObj('Person_ID').value + "&";
	lay += "UserID=" + GetObj('UserID').value + "&";
	//lay += "Person_ID=" + pid + "&";
	//lay += "UserID=" + uid + "&";
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	
	iFr.init = 1;
	iFr.proc = 'RegOK';
	iFr.src = lay;
	return false;
}

function RegOKResult( info ) {	
	if (info == '') {
	   if (GetObj('btGet')) { GetObj('btGet').click(); }
	   DoMail('mail=PersonOK');
		//ShowMess( 'OK - email has been sent.' );
	} else if (info.substr(0,8) == 'Params: ') {
	   if (GetObj('btGet')) { GetObj('btGet').click(); }
	   DoMail('mail=PersonOK;'+info.substr(8));
	} else if (info.substr(0,6) == 'Mail: ') {
	   HideLayer();
		ShowMess( info.substr(6), 'Mail', 600 );
	   if (GetObj('btGet')) { GetObj('btGet').click(); }
	} else {	
		ShowMess( info );
		//DoMail( 'mail=NewPassword;password=info' );
	}
	
	
	
}

function DoRegNo( pid, uid ) {
	if ((GetObj('Person_ID').value == -1)) {
	   ShowMess("Please select the person you want to approve.");
	   return false;
	}
   if ((GetObj('UserID').value == '')) {
	   ShowMess("Please select the person you want to.");
	   return false;
	}
	var iFr = GetObj('frData');
	var lay = 'main.asp?proc=regno&';
	lay += "Person_ID=" + GetObj('Person_ID').value + "&";
	lay += "UserID=" + GetObj('UserID').value + "&";
	//lay += "Person_ID=" + pid + "&";
	//if (uid) { lay += "UserID=" + uid + "&"; }
	lay += 'cashkiller=' + Date.parse(new Date().toString());
	
	iFr.init = 1;
	iFr.proc = 'RegNo';
	iFr.src = lay;
	return false;
}

function RegNoResult( info ) {
	if (info == '') {
	   if (GetObj('btGet')) { GetObj('btGet').click(); }
		//ShowMess( 'OK' );
	} else {	
	   ShowMess( info );
	}
}

function FillOrgData( info ) {
	SetObjVal( 'Org_ID', info, '', 'þ' );
	
	SetObjVal( 'Country', info, '', 'þ' );
	SetObjVal( 'Department', info, '', 'þ' );
	SetObjVal( 'VAT', info, '', 'þ' );
	SetObjVal( 'Address1', info, '', 'þ' );
	SetObjVal( 'Address2', info, '', 'þ' );
	SetObjVal( 'City', info, '', 'þ' );
	SetObjVal( 'State', info, '', 'þ' );
	SetObjVal( 'ZIPCode', info, '', 'þ' );
}



function DisplayDataOrg( info ) {	
	if (!GetObj('cellInfo')) { return false; }
	
	var s = '';
	s += "<table>";	
	
	s += "	<tr><td>Org_name<br><b>"+GetValSep('Org_name',info,'','þ')+"</b></td></tr>";
	s += "	<tr><td>Department<br><b>"+GetValSep('Department',info,'','þ')+"</b></td></tr>";
	s += "	<tr><td>Country<br><b>"+GetValSep('Country',info,'','þ')+"</b></td></tr>";
	s += "	<tr><td>Street address<br><b>"+GetValSep('Address1',info,'','þ')+"</b></td></tr>";
	s += "	<tr><td>Postal address<br><b>"+GetValSep('Address2',info,'','þ')+"</b></td></tr>";
	s += "	<tr><td>City<br><b>"+GetValSep('City',info,'','þ')+"</b></td></tr>";
	s += "	<tr><td>ZIP/Postal Code<br><b>"+GetValSep('ZIPCode',info,'','þ')+"</b></td></tr>";
	
	s += "</table>";
	
   GetObj('cellInfo').innerHTML = s;
}

function DisplayDataPerson( info ) {	
	if (!GetObj('cellInfo')) { return false; }
	
	var s = '';
	s += "<table>";	
	
	if (GetValSep('Title',info,'','þ') != '') { s += "	<tr><td>Title<br><b>"+GetValSep('Title',info,'','þ')+"</b></td></tr>"; }
	if (GetValSep('Firstname',info,'','þ') != '') { s += "	<tr><td>First name<br><b>"+GetValSep('Firstname',info,'','þ')+"</b></td></tr>"; }
	if (GetValSep('Surname',info,'','þ') != '') { s += "	<tr><td>Surname<br><b>"+GetValSep('Surname',info,'','þ')+"</b></td></tr>"; }
	if (GetValSep('Profession',info,'','þ') != '') { s += "	<tr><td>Profession<br><b>"+GetValSep('Profession',info,'','þ')+"</b></td></tr>"; }
	if (GetValSep('Org_name',info,'','þ') != '') { s += "	<tr><td>Org_name<br><b>"+GetValSep('Org_name',info,'','þ')+"</b></td></tr>"; }
	if (GetValSep('Department',info,'','þ') != '') { s += "	<tr><td>Department<br><b>"+GetValSep('Department',info,'','þ')+"</b></td></tr>"; }
	if (GetValSep('City',info,'','þ') != '') { s += "	<tr><td>City<br><b>"+GetValSep('City',info,'','þ')+"</b></td></tr>"; }
	if (GetValSep('Country',info,'','þ') != '') { s += "	<tr><td>Country<br><b>"+GetValSep('Country',info,'','þ')+"</b></td></tr>"; }
	
	s += "</table>";
	
   GetObj('cellInfo').innerHTML = s;
}





function EditPresentationSave() {
	var i = GetObj('EditPresentationMode').value;
	if (!GetObj('PresentationTitle')) { return false; }
	if (!GetObj('PresentationType')) { return false; }
	if (!GetObj('PresentationSession')) { return false; }
	
	if (GetObj('PresentationTitle').value == '') { 
		alert('Title can not be left blank.');
		GetObj('PresentationTitle').focus();
	   return false; 
	}
	if (GetObj('PresentationType').value == '') { 
		alert('Type has to be selected.');
		GetObj('PresentationType').focus();
	   return false; 
	}
	if (GetObj('PresentationSession').value == '') {
		alert('Session has to be selected.'); 
		GetObj('PresentationSession').focus();
	   return false; 
	}
	
	if ((objSelRow) && (i == -1)) {				
		// Delete
		if (objSelRow) {
		   var tab = GetObj('tbPresentations');
			if (tab) {
				tab.deleteRow(objSelRow.rowIndex);
				SelRow(null);
			}
		}			
	} else 
	if ((objSelRow) && (i == 0)) {				
		// Edit
		objSelRow.cells[0].innerHTML = GetObj('PresentationTitle').value;
		if (GetObj('PresentationType').value == 1) {
			objSelRow.cells[1].innerHTML = 'Poster';
		} else {
			objSelRow.cells[1].innerHTML = 'Paper';
		}
		objSelRow.cells[2].innerHTML = GetObj('PresentationSession').value;				
	} else {
		// New
		var tab = GetObj('tbPresentations');

		oTR = tab.insertRow(-1);
		//alert(oTR);
		oTR.id = -1;
		oTR.style.cursor='Hand';
		oTR.onclick = function(){SelRow(this);}; 
		oTR.onmouseover = function(){DoHighlightRow(this,true);} 
		oTR.onmouseout = function(){DoHighlightRow(this,false);}
		oTR.ondblclick = function(){EditPresentation(0);}

		oTD = oTR.insertCell(-1);
		oTD.width = 300;
		oTD.innerHTML = GetObj('PresentationTitle').value;

		oTD = oTR.insertCell(-1);
		oTD.width = 100;
		if (GetObj('PresentationType').value == 1) {	oTD.innerHTML = 'Poster'; } else { oTD.innerHTML = 'Paper'; }

		oTD = oTR.insertCell(-1);
		oTD.style.borderRightWidth = 1;
		oTD.innerHTML = GetObj('PresentationSession').value;
	
		SelRow(oTR);
	}
	HideLayer();
	return false; 	
}

function EditExhibitorCrewSave() {
	var i = GetObj('EditExhibitorCrewMode').value;
	if (!GetObj('PresentationTitle')) { return false; }
	if (!GetObj('PresentationType')) { return false; }
	if (!GetObj('PresentationSession')) { return false; }
	
	if (GetObj('PresentationTitle').value == '') { 
		alert('Title can not be left blank.');
		GetObj('PresentationTitle').focus();
	   return false; 
	}
	if (GetObj('PresentationType').value == '') { 
		alert('Type has to be selected.');
		GetObj('PresentationType').focus();
	   return false; 
	}
	if (GetObj('PresentationSession').value == '') {
		alert('Session has to be selected.'); 
		GetObj('PresentationSession').focus();
	   return false; 
	}
	
	if ((objSelRow) && (i == -1)) {				
		// Delete
		if (objSelRow) {
		   var tab = GetObj('tbPresentations');
			if (tab) {
				tab.deleteRow(objSelRow.rowIndex);
				SelRow(null);
			}
		}			
	} else 
	if ((objSelRow) && (i == 0)) {				
		// Edit
		objSelRow.cells[0].innerHTML = GetObj('PresentationTitle').value;
		if (GetObj('PresentationType').value == 1) {
			objSelRow.cells[1].innerHTML = 'Poster';
		} else {
			objSelRow.cells[1].innerHTML = 'Paper';
		}
		objSelRow.cells[2].innerHTML = GetObj('PresentationSession').value;				
	} else {
		// New
		var tab = GetObj('tbPresentations');

		oTR = tab.insertRow(-1);
		//alert(oTR);
		oTR.id = -1;
		oTR.style.cursor='Hand';
		oTR.onclick = function(){SelRow(this);}; 
		oTR.onmouseover = function(){DoHighlightRow(this,true);} 
		oTR.onmouseout = function(){DoHighlightRow(this,false);}
		oTR.ondblclick = function(){EditPresentation(0);}

		oTD = oTR.insertCell(-1);
		oTD.width = 300;
		oTD.innerHTML = GetObj('PresentationTitle').value;

		oTD = oTR.insertCell(-1);
		oTD.width = 100;
		if (GetObj('PresentationType').value == 1) {	oTD.innerHTML = 'Poster'; } else { oTD.innerHTML = 'Paper'; }

		oTD = oTR.insertCell(-1);
		oTD.style.borderRightWidth = 1;
		oTD.innerHTML = GetObj('PresentationSession').value;
	
		SelRow(oTR);
	}
	HideLayer();
	return false; 	
}

function UpdateSessions() {
var sel = GetObj('PresentationSession');
var typ = GetObj('PresentationType').value;
var ar = new Array();
   /*alert(typ);
   alert(GetObj('Presentation_Paper_Sessions').value);
   alert(GetObj('Presentation_Poster_Sessions').value);*/
	sel.options.length = 0;	
	
	var oOption = document.createElement("OPTION");
	sel.options.add(oOption);
	oOption.innerHTML = '- Select session -';
	oOption.value = '';
	oOption.selected = true;	

		
	if ( typ == '' ) {
		
	}
	else if ( typ == 0 ) {
		ar = GetObj('Presentation_Paper_Sessions').value.split(';');
	}
	else if ( typ == 1 ) {
		ar = GetObj('Presentation_Poster_Sessions').value.split(';');
	}
	var i = 0;
	if (ar.length > 0) {
	   for (i = 0; i < ar.length; i++) {
		   var oOption = document.createElement("OPTION");
	      sel.options.add(oOption);
	      oOption.innerHTML = ar[i];
			oOption.value = ar[i];
		}
		GetObj('PresentationSession').disabled = false;
	} else {
		GetObj('PresentationSession').disabled = true;
	}
}

function UpdateTypes(obj) {
	
	var objTypes = GetObj('Types');
	if (obj.id == 'Types') {
	
		GetObj('tdTypeDelegate').disabled = ((objTypes.value != 'd') && (objTypes.value != 'de'));
		GetObj('DelegateCategory').disabled = GetObj('tdTypeDelegate').disabled;
		GetObj('tdTypeExhibitor').disabled = ((objTypes.value != 'e') && (objTypes.value != 'de'));
		GetObj('ExhibitorCategory').disabled = GetObj('tdTypeExhibitor').disabled;
	
	}
	
	var objDelegate = GetObj('DelegateCategory');
	var objExhibitor = GetObj('ExhibitorCategory');
	
	var visPersonOrg = ( ((objTypes.value == 'd') && (objDelegate.value != '')) || ((objTypes.value == 'e') && (objExhibitor.value != '')) || ((objTypes.value == 'de') && (objTypes.value != '') && (objExhibitor.value != '')) );
	
	var div = GetObj('divPersonOrg');		
	if (visPersonOrg) {
		div.style.visibility = '';
		div.style.position = '';
	} else {					
		div.style.visibility = 'hidden';
		div.style.position = 'absolute';
	}	
	var div = GetObj('divPresentation');
	if ((visPersonOrg) && (!objDelegate.disabled) && (objDelegate.value == '2')) {
		div.style.visibility = '';
		div.style.position = '';
	} else {	
		div.style.visibility = 'hidden';
		div.style.position = 'absolute';		
	}	
	
	if ((objExhibitor.value == '2') && (objTypes.value == 'e')) {
		GetObj('laEmail').innerHTML = 'Email';
	} else {					
		GetObj('laEmail').innerHTML = 'Email *';
	}	
	/*if ((objExhibitor.value == '2') && (objTypes.value == 'e')) {
		GetObj('laEmail').innerHTML = 'Email';
		GetObj('laGet_together_party').innerHTML = 'Get together party';
	} else {					
		GetObj('laEmail').innerHTML = 'Email *';
		GetObj('laGet_together_party').innerHTML = 'Get together party *';
	}	*/
	var div = GetObj('divStand');
	if ( ((objTypes.value == 'e') || (objTypes.value == 'de')) && (objExhibitor.value == '1') ) {
		div.style.visibility = '';
		div.style.position = '';
	} else {	
		div.style.visibility = 'hidden';
		div.style.position = 'absolute';		
	}	
}

var FirstUnvalidId = '';

function SetRedOff( obj ) {
	if ((obj.parentNode.style.color == '#ff0000' ) || (obj.parentNode.style.color == 'rgb(255, 0, 0)' )) { 
	   obj.parentNode.style.color = ''; 
	}
}

function SetRed( obj ) {
	obj.parentNode.style.color = '#ff0000';
}

function CheckItem( obj, obj2 ) {
	var res = ((obj.disabled) || (obj.value != ''));
	if ((!res) && (obj2)) { res = ((obj2.disabled) || (obj2.value != '')); }
	if (!res) { 	   
		SetRed(obj); 
		if (FirstUnvalidId == '') { FirstUnvalidId = obj.id; }
		if (obj2) { SetRed(obj2); }
	}
	return res;
}

function SetAllRedOff() {
	SetRedOff( GetObj('Types') );
	SetRedOff( GetObj('DelegateCategory') );
	SetRedOff( GetObj('ExhibitorCategory') );
	SetRedOff( GetObj('Email') );
	SetRedOff( GetObj('Firstname') );
	SetRedOff( GetObj('Surname') );
	SetRedOff( GetObj('Get_together_party') );
	
	SetRedOff( GetObj('Org_name') );
	
	SetRedOff( GetObj('Address1') ); 
	SetRedOff( GetObj('Address2') );
	
	SetRedOff( GetObj('ZIPCode') );
	SetRedOff( GetObj('Country') );
}

function ValidateReg(obj) {
	FirstUnvalidId = '';
	SetAllRedOff();
	var res = true;
	if (!CheckItem( GetObj('Types') )) { res = false };
	if (!CheckItem( GetObj('DelegateCategory') )) { res = false };
	if (!CheckItem( GetObj('ExhibitorCategory') )) { res = false };	
	if (!CheckItem( GetObj('Firstname') )) { res = false };
	if (!CheckItem( GetObj('Surname') )) { res = false };	
	if (!CheckItem( GetObj('Org_name') )) { res = false };	
	if (!CheckItem( GetObj('Address1'), GetObj('Address2') )) { res = false };	
	if (!CheckItem( GetObj('ZIPCode') )) { res = false };
	if (!CheckItem( GetObj('Country') )) { res = false };
	
	if ((GetObj('ExhibitorCategory').value == '2') && (GetObj('Types').value == 'e')) { 
	
	} else { 
	   if (!CheckItem( GetObj('Email') )) { res = false }; 
		//if (!CheckItem( GetObj('Get_together_party') )) { res = false };
	}
	
	if (!CheckItem( GetObj('Get_together_party') )) { res = false };
	
	if ( (res) && (GetObj('Stand_Size')) && (GetObj('Stand_Size').value != '') && (isNaN(GetObj('Stand_Size').value)) ) {
		ShowMess('Only numerals allowed in booth size.');
		GetObj('Stand_Size').focus();
		return false;
	}
	
	if (!res) {
	   ShowMess('There are values missing.');
		if (FirstUnvalidId != '') { GetObj(FirstUnvalidId).focus(); }
	} else {
		SetPresentations();
		res = true;
	}
	return res;
}

function SetPresentations() {
	var oTab = GetObj('tbPresentations');
	if (oTab) {
		l = '';
		for (i = 0; i < oTab.rows.length; i++) {
			id = oTab.rows[i].id;
			tit = oTab.rows[i].cells[0].innerHTML;
	      typ = oTab.rows[i].cells[1].innerHTML;
	      ses = oTab.rows[i].cells[2].innerHTML;
			if (typ == 'Poster') {
				typ = 1;
			} else {
				typ = 0;
			}
			if ( l != '' ) {
				l += '\n';
			}
			l += id + ';' + tit + ';' + typ + ';' + ses;
		}
		GetObj('Presentations').value = l;
	}
}



function CheckLoginResult( info ) {
	if (info.substr(0,7) == 'Error: ') {
		ShowMess( info.substr(7), 'Error' );
	} else 
   if (info.substr(0,10) == 'Multiple: ') {
		SelectPerson( info.substr(10), true );
	} else {
	   if (GetObj('frAdminSimulate')) {
		   GetObj('frAdminSimulate').src = info;
		} else {
		   window.location.href = info;
		}
	}	
}

// Layers ************

function SelectOrg( info ) {
   var s = '';
	s += BorderStartVal('Size=1;Title=Select Organisation');
	s += "		<form onSubmit='return DoSelectOrg()'>\n";
	s += "<table width=600 height=300 border=0 >\n";
	s += "	<tr>\n";
	s += "		<td colspan=2 >\n";
	s += "		   Please check if your organisation is located in this list. If so select it and click [OK]. If not click [New].\n";
	s += "		</td >\n";
	s += "	</tr>\n";
	s += "	<tr>\n";
	s += "		<td height=100%>\n";
	
	s += "<table width=100% height=100% border=0 cellspacing=0 cellpadding=0 >\n";
	s += "	<tr>\n";
	s += "		<td height=1>\n";
	
   s += "	<table border='0' id='tbSelectOrgH' cellspacing=0 bgcolor='#808080' width=100% class=ListHeader >";
	s += "		<tr>";
	s += "			<td width='150' class=ListHeaderColumnSelected >Org_name</td>"; //
	s += "			<td width='150' class=ListHeaderColumn >Department</td>"; //
	s += "			<td width='*'  class=ListHeaderColumn style='border-right-width:1' >Country</td>";	//style='border-top:1 solid #808080;border-bottom:1 solid #808080;border-left:1 solid #808080;border-right:1 solid #808080;'
	s += "		</tr>";
	s += "	</table>";

	s += "		</td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";
	s += "		<td height=100% >\n";
	
	s += "	<div ID='myDiv' width=100% STYLE='width:100%;height:100%;overflow:auto;overflowY:100%;' onclick='SelRowNone()' >";// border-left:1 solid #808080;border-right:1 solid #808080
	s += "	<table border=0 id=tbSelectOrg cellspacing=0 cellpadding=1 width=100% bgcolor='#ffffff' class=List onclick='event.cancelBubble=true' >";
	
	var arDB = info.split('ÿ');
	var sRec = '';
	var r = 0;
	var bb = 0;
	for (r = 0; r < arDB.length; r++) {
	   sRec = arDB[r];
	   s += "<tr bgcolor=#ffffff id=" + GetValSep('Org_ID',sRec,'','þ') + " info='"+sRec+"' proc='"+sRec+"' style='CURSOR:Hand' onClick='SelRow(this)' onmouseover='DoHighlightRow(this,true)' onmouseout='DoHighlightRow(this,false)' ondblclick=DoEditVisit() >";	
		if (r == arDB.length-1) {bb = 1;}
		s += "<td width=150 id=BokdbCell  >" + GetValSep('Org_name',sRec,'','þ') +"&nbsp;</td>";	 // style='border-left:1 solid #808080;border-bottom:"+bb+" solid #808080;'      
		s += "<td width=150 id=BokdbCell  >" + GetValSep('Department',sRec,'','þ') +"&nbsp;</td>";
		s += "<td width=* id=BokdbCell style='border-right-width:1' >" + GetValSep('Country',sRec,'','þ') +"&nbsp;</td>";
		s += "</tr>";	
	}
	s += "	</table>";
	s += "	</div>";
	
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";
	s += "		<td height=1 >\n";
	
	s += "	<table border=0 cellspacing=1 cellpadding=0 bgcolor=#808080 width=100% class=tblBokade onclick='SelRowNone()' >";
	s += "		<tr>";
	s += "			<td bgcolor=cfedff align='Left' id=BokcellStatus >Antal: "+arDB.length+"</td>";
	s += "		</tr>";
	s += "	</table>";
	
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "</table>\n";
	
	s += "		</td>\n";	
	s += "		<td width=1 >\n";
	s += "	<table border=0 id=tbSelectOrgInfo cellspacing=0 width=200 height=100% bgColor=#D1E9F7 class=tblHeader >";
	s += "		<tr>";
	s += "			<td width=100% id=cellInfo style='border-left:1 solid #808080;border-right:1 solid #808080;border-top:1 solid #808080;border-bottom:1 solid #808080;' valign=top >&nbsp;</td>";
	s += "		</tr>";
	s += "	</table>";
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";	
	s += "		<td colspan=2 ><hr></td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";	
	s += "		<td colspan=2 align=right >\n";
	s += "			<input type=button style='width:60' value='New' onClick='DoSelectOrg(true)' >&nbsp;<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >\n";
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "</table>\n";
	s += "	</form>\n";
	s += BorderEndVal();	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 600 );
	
	if ((GetObj('Org_ID')) && (GetObj('Org_ID').value != '')) {
		SelTableRow( 'tbSelectOrg', GetObj('Org_ID').value );
	}
}

function EditPresentation( i ) {
   var s = '';
	var what = '';
	var dis = '';
	if (!i) { i = 0; }
	if (i == 1) { what = 'New'; }
	if (i == 0) { what = 'Edit'; }
	if (i == -1) { what = 'Delete'; dis = 'disabled' }
	
	
	
	s += BorderStartVal('Size=1;Title='+what+' Presentation');
	s += "		<form onSubmit='return EditPresentationSave()'>";
	s += "<table width=300 height=1 border=0 >";
	s += "	<tr>";
	s += "		<input type=hidden name=EditPresentationMode id=EditPresentationMode value="+i+" >";
	s += "		<td height=100%>";
	
	s += "			<table width=100% border=0  >\n";
	s += "				<tr>\n";
	s += "					<td "+dis+" colspan=2>\n";
   s += "						Title<br>\n";
   s += "						<input type=text id=PresentationTitle name=PresentationTitle style='width:100%' value='' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";	
	s += "				<tr>\n";
	s += "					<td "+dis+" >\n";
   s += "						Type<br>\n";
   s += "						<select id=PresentationType name=PresentationType style='width:100%' onChange='UpdateSessions()'>\n";
   s += "							<option value=''>Select type</option>\n";
   s += "							<option value=0>Paper</option>\n";
   s += "							<option value=1>Poster</option>\n";
   s += "						</select>\n";	
	s += "					</td>\n";
	s += "					<td "+dis+" >\n";
   s += "						Session<br>\n";
   s += "						<select id=PresentationSession name=PresentationSession disabled style='width:100%' >\n";
	s += "							<option value=''>- Select session -</option>\n";
   s += "						</select>\n";	
	s += "					</td>\n";
	s += "				</tr>\n";	
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "	<tr>";	
	s += "		<td ><hr></td>";
	s += "	</tr>";
	s += "	<tr>";	
	s += "		<td align=right >";
	s += "			<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Cancel' onClick='HideLayer()' >";
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	//alert(s);
	
	
	var id = '';
	var tit = '';
	var typ = '';
	var ses = '';
	if (i != 1) {
		id = objSelRow.id;
		tit = objSelRow.cells[0].innerHTML;
	   typ = objSelRow.cells[1].innerHTML;
		if (typ == 'Poster') {
			typ = 1;
		} else {
			typ = 0;
		}
	   ses = objSelRow.cells[2].innerHTML;
	}
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 300 );
	
	GetObj('PresentationTitle').value = tit;
	GetObj('PresentationType').value = typ;
	UpdateSessions();
	GetObj('PresentationSession').value = ses;
	
	GetObj('PresentationTitle').focus();
}

function EditExhibitorCrew( i ) {
   var s = '';
	var what = '';
	var dis = '';
	if (!i) { i = 0; }
	if (i == 1) { what = 'New'; }
	if (i == 0) { what = 'Edit'; }
	if (i == -1) { what = 'Delete'; dis = 'disabled' }
	
	
	
	s += BorderStartVal('Size=1;Title='+what+' Exhibitor Crew');
	s += "		<form onSubmit='return EditPresentationSave()'>";
	s += "<table width=300 height=1 border=0 >";
	s += "	<tr>";
	s += "		<input type=hidden name=EditPresentationMode id=EditPresentationMode value="+i+" >";
	s += "		<td height=100%>";
	
	s += "			<table width=100% border=0  >\n";
	s += "				<tr>\n";
	s += "					<td "+dis+" colspan=2>\n";
   s += "						Title<br>\n";
   s += "						<input type=text id=PresentationTitle name=PresentationTitle style='width:100%' value='' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";	
	s += "				<tr>\n";
	s += "					<td "+dis+" >\n";
   s += "						Type<br>\n";
   s += "						<select id=PresentationType name=PresentationType style='width:100%' onChange='UpdateSessions()'>\n";
   s += "							<option value=''>Select type</option>\n";
   s += "							<option value=0>Paper</option>\n";
   s += "							<option value=1>Poster</option>\n";
   s += "						</select>\n";	
	s += "					</td>\n";
	s += "					<td "+dis+" >\n";
   s += "						Session<br>\n";
   s += "						<select id=PresentationSession name=PresentationSession disabled style='width:100%' >\n";
	s += "							<option value=''>- Select session -</option>\n";
   s += "						</select>\n";	
	s += "					</td>\n";
	s += "				</tr>\n";	
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "	<tr>";	
	s += "		<td ><hr></td>";
	s += "	</tr>";
	s += "	<tr>";	
	s += "		<td align=right >";
	s += "			<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >";
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	//alert(s);
	
	
	var id = '';
	var tit = '';
	var typ = '';
	var ses = '';
	if (i != 1) {
		id = objSelRow.id;
		tit = objSelRow.cells[0].innerHTML;
	   typ = objSelRow.cells[1].innerHTML;
		if (typ == 'Poster') {
			typ = 1;
		} else {
			typ = 0;
		}
	   ses = objSelRow.cells[2].innerHTML;
	}
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 300 );
	
	GetObj('PresentationTitle').value = tit;
	GetObj('PresentationType').value = typ;
	UpdateSessions();
	GetObj('PresentationSession').value = ses;
	
	GetObj('PresentationTitle').focus();
}

function DoLogin(userid) {
   //alert(1);
	if (!userid) { userid = ''; }
	
	var s = '';	
	
	s += BorderStartVal('Size=1;Title=Login');
	s += "		<form name='frmLogin' id='frmLogin' onSubmit='return CheckLogin()' >\n";
	s += "<table height=1 width=200  border=0 cellspacing=0 cellpadding=0 >"; 
	s += "	<tr>";
	s += "		<td height=100%>\n";
	
	s += "			<table width=100% height=1 border=0  >\n";
	s += "				<tr>\n";
	s += "					<td colspan=2>\n";
   s += "						Username<br>\n";
   s += "						<input type=text id=UserID name=UserID style='width:100%' value='"+userid+"' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";	
	s += "				<tr>\n";
	s += "					<td colspan=2>\n";
   s += "						Password<br>\n";
   s += "						<input type=Password id=Password name=Password style='width:100%' value='' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";
	s += "				<tr>";	
	s += "					<td ><hr></td>";
	s += "				</tr>";
	s += "				<tr>";	
	s += "					<td align=right >";
	s += "						<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >";
	s += "					</td>";
	s += "				</tr>";
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 200 );
	if (GetObj('UserID').value != '') {
		GetObj('Password').focus();
	} else {
	   GetObj('UserID').focus();
	}
}

function SelectPerson( info, login ) {
   var s = '';
	s += BorderStartVal('Size=1;Title=Select Person');
	if (login) {
	   s += "		<form onSubmit='return DoSelectLoginPerson()'>\n";
	} else {
	   s += "		<form onSubmit='return DoSelectPerson()'>\n";
	}
	s += "<table width=600 height=300 border=0 >\n";
	s += "	<tr>\n";
	s += "		<td height=100%>\n";
	
	s += "<table width=100% height=100% border=0 cellspacing=0 cellpadding=0 >\n";
	s += "	<tr>\n";
	s += "		<td height=1>\n";
	
   s += "	<table border='0' id='tbSelectPersonH' cellspacing=0 bgcolor='#808080' width=100% class=ListHeader >";
	s += "		<tr>";
	s += "			<td width='150' class=ListHeaderColumnSelected >First name</td>"; 
	s += "			<td width='150' class=ListHeaderColumn >Surname/Family name</td>"; 
	s += "			<td width='*'  class=ListHeaderColumn style='border-right-width:1' >org_name</td>";	
	s += "		</tr>";
	s += "	</table>";

	s += "		</td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";
	s += "		<td height=100% >\n";
	
	s += "	<div ID='myDiv' width=100% STYLE='width:100%;height:100%;overflow:auto;overflowY:100%;' onclick='SelRowNone()' >";
	s += "	<table border=0 id=tbSelectPerson cellspacing=0 cellpadding=1 width=100% bgcolor='#ffffff' class=List onclick='event.cancelBubble=true' >";
	
	var arDB = info.split('ÿ');
	var sRec = '';
	var r = 0;
	var bb = 0;
	for (r = 0; r < arDB.length; r++) {
	   sRec = arDB[r];
	   s += "<tr bgcolor=#ffffff id=" + GetValSep('Person_ID',sRec,'','þ') + " info='"+sRec+"' style='CURSOR:Hand' onClick='SelRow(this)' onmouseover='DoHighlightRow(this,true)' onmouseout='DoHighlightRow(this,false)' ondblclick=DoEditVisit() >";	
		if (r == arDB.length-1) {bb = 1;}
		s += "<td width=150 id=BokdbCell  >" + GetValSep('Firstname',sRec,'','þ') +"&nbsp;</td>";	 
		s += "<td width=150 id=BokdbCell  >" + GetValSep('Surname',sRec,'','þ') +"&nbsp;</td>";
		s += "<td width=* id=BokdbCell style='border-right-width:1' >" + GetValSep('Org_name',sRec,'','þ') +"&nbsp;</td>";
		s += "</tr>";	
	}
	s += "	</table>";
	s += "	</div>";
	
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";
	s += "		<td height=1 >\n";
	
	s += "	<table border=0 cellspacing=1 cellpadding=0 bgcolor=#808080 width=100% class=tblBokade onclick='SelRowNone()' >";
	s += "		<tr>";
	s += "			<td bgcolor=cfedff align='Left' id=BokcellStatus >Antal: "+arDB.length+"</td>";
	s += "		</tr>";
	s += "	</table>";
	
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "</table>\n";
	
	s += "		</td>\n";	
	s += "		<td width=1 >\n";
	s += "	<table border=0 id=tbSelectPersonInfo cellspacing=0 width=200 height=100% bgColor=#D1E9F7 class=tblHeader >";
	s += "		<tr>";
	s += "			<td width=100% id=cellInfo style='border-left:1 solid #808080;border-right:1 solid #808080;border-top:1 solid #808080;border-bottom:1 solid #808080;' valign=top >&nbsp;</td>";
	s += "		</tr>";
	s += "	</table>";
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";	
	s += "		<td colspan=2 ><hr></td>\n";
	s += "	</tr>\n";
	s += "	<tr>\n";	
	s += "		<td colspan=2 align=right >\n";
	s += "			<input type=button style='width:60' value='New' onClick='DoSelectPerson(true)' >&nbsp;<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >\n";
	s += "		</td>\n";
	s += "	</tr>\n";
	s += "</table>\n";
	s += "	</form>\n";
	s += BorderEndVal();	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 600 );
	
	if ((GetObj('Person_ID')) && (GetObj('Person_ID').value != '')) {
		SelTableRow( 'tbSelectPerson', GetObj('Person_ID').value );
	}
}

function ChangePassword() {	
	var s = '';	
	
	s += BorderStartVal('Size=1;Title=Change password');
	s += "		<form name='frmLogin' id='frmLogin' onSubmit='return DoChangePassword()' >\n";
	s += "<table height=1 width=200  border=0 cellspacing=0 cellpadding=0 >"; 
	s += "	<tr>";
	s += "		<td height=100%>\n";
	
	s += "			<table width=100% height=1 border=0  >\n";
	/*s += "				<tr>\n";
	s += "					<td colspan=2>\n";
   s += "						Current password<br>\n";
   s += "						<input type=Password id=CurrPass name=CurrPass style='width:100%' value='' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";	*/
	s += "				<tr>\n";
	s += "					<td colspan=2>\n";
   s += "						New password<br>\n";
   s += "						<input type=Password id=NewPass1 name=NewPass1 style='width:100%' value='' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";	
	s += "				<tr>\n";
	s += "					<td colspan=2>\n";
   s += "						Confirm new password<br>\n";
   s += "						<input type=Password id=NewPass2 name=NewPass2 style='width:100%' value='' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";
	s += "				<tr>";	
	s += "					<td ><hr></td>";
	s += "				</tr>";
	s += "				<tr>";	
	s += "					<td align=right >";
	s += "						<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >";
	s += "					</td>";
	s += "				</tr>";
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 200 );
	//GetObj('CurrPass').focus();
	GetObj('NewPass1').focus();
}

function ChangeUserID() {	
	var s = '';	
	
	s += BorderStartVal('Size=1;Title=Change email');
	s += "		<form name='frmLogin' id='frmLogin' onSubmit='return DoChangeUserID()' >\n";
	s += "<table height=1 width=200  border=0 cellspacing=0 cellpadding=0 >"; 
	s += "	<tr>";
	s += "		<td height=100%>\n";
	
	s += "			<table width=100% height=1 border=0  >\n";
	s += "				<tr>\n";
	s += "					<td>\n";
   s += "						New email<br>\n";
   s += "						<input type=text id=NewEmail name=NewEmail style='width:100%' value='"+GetObj('Email').value+"' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";
	s += "				<tr>";	
	s += "					<td ><hr></td>";
	s += "				</tr>";
	s += "				<tr>";	
	s += "					<td align=right >";
	s += "						<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >";
	s += "					</td>";
	s += "				</tr>";
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 200 );
	GetObj('NewEmail').focus();
}

function SendNewPassword() {	
	var s = '';	
	
	s += BorderStartVal('Size=1;Title=Send new password');
	s += "		<form name='frmLogin' id='frmLogin' onSubmit='return DoSendNewPassword()' >\n";
	s += "<table height=1 width=200  border=0 cellspacing=0 cellpadding=0 >"; 
	s += "	<tr>";
	s += "		<td height=100%>\n";
	
	s += "			<table width=100% height=1 border=0  >\n";
	s += "				<tr>\n";
	s += "					<td>\n";
   s += "						Email<br>\n";
   s += "						<input type=text id=UserID name=UserID style='width:100%' value='' >\n";
	s += "					</td>\n";
	s += "				</tr>\n";
	s += "				<tr>";	
	s += "					<td ><hr></td>";
	s += "				</tr>";
	s += "				<tr>";	
	s += "					<td align=right >";
	s += "						<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >";
	s += "					</td>";
	s += "				</tr>";
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0 ); // 200
	GetObj('UserID').focus();
}

function DeletePerson() {	
	var s = '';	
	
	s += BorderStartVal('Size=1;Title=Delete person');
	s += "		<form name='frmLogin' id='frmLogin' onSubmit='return DoDeletePerson()' >\n";
	s += "<table height=1 width=200  border=0 cellspacing=0 cellpadding=0 >"; 
	s += "	<tr>";
	s += "		<td height=100%>\n";
	
	s += "			<table width=100% height=1 border=0  >\n";
	s += "				<tr>\n";
	s += "					<td >\n";
   s += "						Delete this person\n";
	s += "					</td>\n";
	s += "				</tr>\n";
	s += "				<tr>";	
	s += "					<td ><hr></td>";
	s += "				</tr>";
	s += "				<tr>";	
	s += "					<td align=right >";
	s += "						<input type=submit style='width:60' value='OK' >&nbsp;<input type=button style='width:60' value='Avbryt' onClick='HideLayer()' >";
	s += "					</td>";
	s += "				</tr>";
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, 200 );
}

function ShowMess( mess, title, width ) {	
	var s = '';	
	
	if ((title) && ('' + title != '')) {
		s += BorderStartVal('Size=1;Title='+title);
	} else {
	   s += BorderStartVal('Size=1;Title=Message');
	}
	var swidth = 'width=200';
	if (width) { swidth = 'width='+width; }
	s += "		<form name='frmLogin' id='frmLogin' onSubmit='return false' >\n";
	s += "<table height=1 "+swidth+"  border=0 cellspacing=0 cellpadding=0 >"; // width=200
	s += "	<tr>";
	s += "		<td height=100%>\n";
	
	s += "			<table width=100% height=1 border=0  >\n";
	s += "				<tr>\n";
	s += "					<td align=center >\n";
   s += "						"+mess;
	s += "					</td>\n";
	s += "				</tr>\n";
	s += "				<tr>";	
	s += "					<td ><hr></td>";
	s += "				</tr>";
	s += "				<tr>";	
	s += "					<td align=right >";
	s += "						<input type=submit style='width:60' name=btMessOK id=btMessOK value='OK' onClick='HideMessLayer()' >";
	s += "					</td>";
	s += "				</tr>";
	s += "			</table>\n";
	
	s += "		</td>";
	s += "	</tr>";
	s += "</table>";
	s += "	</form>";
	s += BorderEndVal();
	
	
	ShowLayerCentered( s, GetObj('ttop'), 0, 0, null, null, true ); // 200
	GetObj('btMessOK').focus();
}



