var xmlHttp


// AJAX loader functions:
function getHeight() {
  var myHeight = 0;
  if( typeof( window.top.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.top.innerHeight;
  } else if( window.top.document.documentElement && window.top.document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = window.top.document.documentElement.clientHeight;
  } else if( window.top.body && window.top.body.clientHeight ) {
    //IE 4 compatible
    myHeight = window.top.document.body.clientHeight;
  }
  
  myHeight=myHeight+getScrollY();
  return myHeight;
}

function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.top.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.top.pageYOffset;
  } else if( window.top.document.body && window.top.document.body.scrollTop ) {
    //DOM compliant
    scrOfY = window.top.document.body.scrollTop;
  } else if( window.top.document.documentElement && window.top.document.documentElement.scrollTop ) {
    //IE6 standards compliant mode
    scrOfY = window.top.document.documentElement.scrollTop;
  }
  return scrOfY;
}




function showajaxloader()
{
	elaloader=locate_el('ajaxloader', window.parent.document);
	elaloader.style.visibility='visible';
	elaloader.style.height=getHeight().toString()+'px';
	elajaxloadertable=locate_el('ajaxloadertable', window.parent.document);
	elajaxloadertable.style.height=getHeight().toString()+'px';
	return 1;
}


function hideajaxloader()
{
	elaloader=locate_el('ajaxloader', window.parent.document);
	elaloader.style.visibility='hidden';
	return 1;
}


function showallbookmarks()
{
	elallbookmarks=locate_el('allbookmarks');
	if(elallbookmarks.style.visibility=="visible")
		{
			elallbookmarks.style.visibility="hidden";
		}
	else
		{
			elallbookmarks.style.visibility="visible";
		}
}



// AJAX main function
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}



// AJAX function used
// Account creation
function create_account()
{
	
	
	eltc1=locate_el('tipcont1');
	eltc2=locate_el('tipcont2');
	
	x='1';
	if(eltc1.checked)
		{
			x='1';
		}
	else if(eltc2.checked)
		{
			x='2';
		}
	
	elusername=locate_el('username');
	elpassword=locate_el('password');
	elpassword2=locate_el('password2');
	elemail=locate_el('email');
	elcode=locate_el('code');
	elagree=locate_el('agree');
	elnumefirma=locate_el('numefirma');
	elsediufirma=locate_el('sediufirma');
	elpunctdelucru=locate_el('punctdelucru');
	elcui=locate_el('cui');
	elcodj=locate_el('codj');
	elbanca=locate_el('banca');
	elcont=locate_el('cont');
	eltelefonfix=locate_el('telefonfix');
	eltelefonmobil=locate_el('telefonmobil');
	elfax=locate_el('fax');
	elpersoanarep=locate_el('persoanarep');
	elpersoanacontact=locate_el('persoanacontact');
	
	
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/createaccount.php";
	url=url+"?username="+elusername.value;
	url=url+"&tipcont="+x;
	url=url+"&password="+elpassword.value;
	url=url+"&password2="+elpassword2.value;
	url=url+"&email="+elemail.value;
	url=url+"&numefirma="+elnumefirma.value;
	url=url+"&sediufirma="+elsediufirma.value;
	url=url+"&punctdelucru="+elpunctdelucru.value;
	url=url+"&cui="+elcui.value;
	url=url+"&codj="+elcodj.value;
	url=url+"&banca="+elbanca.value;
	url=url+"&cont="+elcont.value;
	url=url+"&telefonfix="+eltelefonfix.value;
	url=url+"&telefonmobil="+eltelefonmobil.value;
	url=url+"&fax="+elfax.value;
	url=url+"&persoanarep="+elpersoanarep.value;
	url=url+"&persoanacontact="+elpersoanacontact.value;
	url=url+"&code="+elcode.value;
	if(elagree.checked)
		{		
			url=url+"&agree=1";
		}
	else
		{
			url=url+"&agree=0";
		}
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=verify_create_account;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function verify_create_account() 
{ 
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	responses=xmlHttp.responseText.split('#ER#');
	
	elerrors1=locate_el('errors1');
	elerrors2=locate_el('errors2');
	elerrors3=locate_el('errors3');
	elerrors4=locate_el('errors4');
	elnewaccbox=locate_el('newaccbox');

	
	if((responses[0]=='OK') || (responses[0]=='NOTOK'))
		{
			if(responses[0]=='OK')
				{
					elnewaccbox.innerHTML=responses[1];
				}
			
			if(responses[0]=='NOTOK')
				{
					elerrors1.innerHTML=responses[1];
				}
		}
	else
		{
			if(responses[0]!='No errors')
				{
					elerrors1.innerHTML=responses[0];
				}
			else
				{
					elerrors1.innerHTML='';	
				}
			if(responses[1]!='No errors')
				{
					elerrors2.innerHTML=responses[1];
				}
			else
				{
					elerrors2.innerHTML='';	
				}
			if(responses[2]!='No errors')
				{
					elerrors3.innerHTML=responses[2];
				}
			else
				{
					elerrors3.innerHTML='';	
				}
			if(responses[4]!='No errors')
				{
					elerrors4.innerHTML=responses[3];
				}
			else
				{
					elerrors4.innerHTML='';	
				}
		}
}
}






// AJAX function used
// ADV arata categoriile
function adv_settype()
{
	elamt_type=locate_el('amt_type');
	
		
	
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/adv_settype.php";
	url=url+"?type="+elamt_type.options[elamt_type.selectedIndex].value;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=show_adv_settype;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function show_adv_settype() 
{ 
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	response=xmlHttp.responseText;
	
	eladv_cat=locate_el('adv_cat');

	
	eladv_cat.innerHTML=response;
	
}
}


// AJAX function used
// Account creation
function swith_acctype()
{
	eltc1=locate_el('tipcont1');
	eltc2=locate_el('tipcont2');
	
	x='1';
	if(eltc1.checked)
		{
			x='1';
		}
	else if(eltc2.checked)
		{
			x='2';
		}
		
	
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/swith_acctype"+x+".php";
	url=url+"?sid="+Math.random();
	
	xmlHttp.onreadystatechange=show_swith_acctype;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function show_swith_acctype() 
{ 
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	response=xmlHttp.responseText;
	
	elnewaccbox=locate_el('newaccbox');

	
	elnewaccbox.innerHTML=response;
	
}
}




// AJAX function used
// Account creation
function edit_account()
{
	elusername=locate_el('usernamed');
	elpassword=locate_el('password');
	elpassword2=locate_el('password2');
	elemail=locate_el('email');
	elnumefirma=locate_el('numefirma');
	elsediufirma=locate_el('sediufirma');
	elpunctdelucru=locate_el('punctdelucru');
	elcui=locate_el('cui');
	elcodj=locate_el('codj');
	elbanca=locate_el('banca');
	elcont=locate_el('cont');
	eltelefonfix=locate_el('telefonfix');
	eltelefonmobil=locate_el('telefonmobil');
	elfax=locate_el('fax');
	elpersoanarep=locate_el('persoanarep');
	elpersoanacontact=locate_el('persoanacontact');
	
	
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/editaccount.php";
	url=url+"?username="+elusername.value;
	url=url+"&password="+elpassword.value;
	url=url+"&password2="+elpassword2.value;
	url=url+"&email="+elemail.value;
	url=url+"&numefirma="+elnumefirma.value;
	url=url+"&sediufirma="+elsediufirma.value;
	url=url+"&punctdelucru="+elpunctdelucru.value;
	url=url+"&cui="+elcui.value;
	url=url+"&codj="+elcodj.value;
	url=url+"&banca="+elbanca.value;
	url=url+"&cont="+elcont.value;
	url=url+"&telefonfix="+eltelefonfix.value;
	url=url+"&telefonmobil="+eltelefonmobil.value;
	url=url+"&fax="+elfax.value;
	url=url+"&persoanarep="+elpersoanarep.value;
	url=url+"&persoanacontact="+elpersoanacontact.value;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=verify_edit_account;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function verify_edit_account() 
{ 
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	responses=xmlHttp.responseText.split('#ER#');
	
	elerrors1=locate_el('errors1');
	elerrors2=locate_el('errors2');
	elerrors3=locate_el('errors3');
	elerrors4=locate_el('errors4');
	elnewaccbox=locate_el('newaccbox');

	
	if((responses[0]=='OK') || (responses[0]=='NOTOK'))
		{
			if(responses[0]=='OK')
				{
					elnewaccbox.innerHTML=responses[1];
				}
			
			if(responses[0]=='NOTOK')
				{
					elerrors1.innerHTML=responses[1];
				}
		}
	else
		{
			if(responses[0]!='No errors')
				{
					elerrors1.innerHTML=responses[0];
				}
			else
				{
					elerrors1.innerHTML='';	
				}
			if(responses[1]!='No errors')
				{
					elerrors2.innerHTML=responses[1];
				}
			else
				{
					elerrors2.innerHTML='';	
				}
			if(responses[2]!='No errors')
				{
					elerrors3.innerHTML=responses[2];
				}
			else
				{
					elerrors3.innerHTML='';	
				}
			if(responses[4]!='No errors')
				{
					elerrors4.innerHTML=responses[3];
				}
			else
				{
					elerrors4.innerHTML='';	
				}
		}
}
}



// Password recovery
function recover_password()
{
	elemail=locate_el('email');
	elcode=locate_el('code');

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/recoverpassword.php";
	url=url+"?email="+elemail.value;
	url=url+"&code="+elcode.value;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=verify_recover_password;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function verify_recover_password()
{ 
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	responses=xmlHttp.responseText.split('#ER#');
	elerrors1=locate_el('errors1');
	elerrors3=locate_el('errors3');
	elpassword_recovery_box=locate_el('password_recovery_box');

	
	if((responses[0]=='OK') || (responses[0]=='NOTOK'))
		{
			if(responses[0]=='OK')
				{
					elpassword_recovery_box.innerHTML=responses[1];
				}
			
			if(responses[0]=='NOTOK')
				{
					elerrors1.innerHTML=responses[1];
				}
		}
	else
		{
			if(responses[0]!='No errors')
				{
					elerrors1.innerHTML=responses[0];
				}
			else
				{
					elerrors1.innerHTML='';	
				}
			if(responses[1]!='No errors')
				{
					elerrors3.innerHTML=responses[1];
				}
			else
				{
					elerrors3.innerHTML='';	
				}
		}
}
}


// timer
//
function starttimer(ucn)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/req_timer.php";
	url=url+"?ucn="+ucn;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=updatetimer;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function updatetimer()
{
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	response=xmlHttp.responseText;

	elucn=locate_el('ucntime');
	
	eladdingpics=locate_el('timer', window.parent.document);
	
	
	eladdingpics.innerHTML=response;
	
	setTimeout('starttimer("'+elucn.value+'")',1000);
}
}




//display brands
function req_brands()
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	  
	eltype=locate_el('type');
	elcatsel=locate_el('catsel');
	 
	var url="./actions/req_brands.php";
	url=url+"?type="+eltype.options[eltype.selectedIndex].value;
	url=url+"&catsel="+elcatsel.value;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=display_brands;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function display_brands()
{
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	response=xmlHttp.responseText;

	elmarca=locate_el('marcaelement');
	
	elmarca.innerHTML=response;
}
}



//display pictures
function req_images(ucn)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/req_images.php";
	url=url+"?ucn="+ucn;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=display_pictures;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


//display extra pictures
function req_images_extra(ucn)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/req_images_extra.php";
	url=url+"?ucn="+ucn;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=display_pictures;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



//display extra pictures
function req_images_user(ucn)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/req_images_user.php";
	url=url+"?ucn="+ucn;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=display_pictures;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}




//delete pictures
function delpic(ofid, pid)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/delpic.php";
	url=url+"?ofid="+ofid;
	url=url+"&pid="+pid;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=display_pictures;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



//delete extra pictures
function delpic_extra(ofid, pid)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/delpic_extra.php";
	url=url+"?ofid="+ofid;
	url=url+"&pid="+pid;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=display_pictures;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



//delete extra pictures
function delpic_user(ofid, pid)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/delpic_user.php";
	url=url+"?ofid="+ofid;
	url=url+"&pid="+pid;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=display_pictures;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function display_pictures()
{
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	response=xmlHttp.responseText;

	eladdingpics=locate_el('addingpics', window.parent.document);
	
	
	eladdingpics.innerHTML=response;
}
}





//addbookmark
function acc_add_bookmark(ucn)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var url="./actions/addbookmark.php";
	url=url+"?ucn="+ucn;
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=refreshbookmarks;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function refreshbookmarks()
{
if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	hideajaxloader();
	response=xmlHttp.responseText;

	elbookmarks_items=locate_el('bookmarks_items', window.parent.document);
	eladdbooklink=locate_el('addbooklink', window.parent.document);
	
	eladdbooklink.innerHTML='<div id="bookmarks_addedok">Added to favorites...</div>';
	elbookmarks_items.innerHTML=response;
}
}




// Accommodation offer editing
function editoffer()
{
	elucn=locate_el('ucn');
	elcategory=locate_el('category');
	eltipveh=locate_el('tipveh');
	elmodel=locate_el('model');
	eldsm=locate_el('dsm');
	eldatastop=locate_el('datastop');
	
	
	
	PrepareSave();
	eldescription=locate_el('DataTextarea');

	elprice=locate_el('price');
	
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var urltosend="./actions/editoffer.php";
	var url='';
	url=url+"ucn="+elucn.value;
	url=url+"&category="+elcategory.options[elcategory.selectedIndex].value;
	url=url+"&tipveh="+eltipveh.options[eltipveh.selectedIndex].value;
	url=url+"&model="+encodeURIComponent(elmodel.value);
	url=url+"&description="+encodeURIComponent(eldescription.value);
	url=url+"&price="+elprice.value;
	url=url+"&dsm="+eldsm.value;
	if(eldsm.value==1)
		{
			url=url+"&datastop="+eldatastop.options[eldatastop.selectedIndex].value;
		}




	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=verify_editoffer;
	xmlHttp.open("POST",urltosend,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.setRequestHeader("Content-Length", url.length);
	xmlHttp.setRequestHeader("Connection", "close"); 
	xmlHttp.send(url);
}

function verify_editoffer() 
{ 

if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	window.scroll(0, 0);
	hideajaxloader();
	responses=xmlHttp.responseText.split('#ER#');
	elerrors1=locate_el('errors1');
	elerrors2=locate_el('errors2');
	elerrors3=locate_el('errors3');
	elerrors4=locate_el('errors4');
	elerrors5=locate_el('errors5');
	elucn=locate_el('ucn');
	elnpid=locate_el('npid');
	eladdofferbox=locate_el('addofferbox');

	
	if((responses[0]=='OK') || (responses[0]=='NOTOK'))
		{
			if(responses[0]=='OK')
				{
					//eladdofferbox.innerHTML=responses[1];
					window.location='edit-my-offer-attributes?npid='+elnpid.value;
				}
			
			if(responses[0]=='NOTOK')
				{
					elerrors1.innerHTML=responses[1];
				}
		}
	else
		{
			if(responses[0]!='No errors')
				{
					elerrors1.innerHTML=responses[0];
				}
			else
				{
					elerrors1.innerHTML='';	
				}
			if(responses[1]!='No errors')
				{
					elerrors2.innerHTML=responses[1];
				}
			else
				{
					elerrors2.innerHTML='';	
				}
			if(responses[2]!='No errors')
				{
					elerrors3.innerHTML=responses[2];
				}
			else
				{
					elerrors3.innerHTML='';	
				}
			if(responses[3]!='No errors')
				{
					elerrors4.innerHTML=responses[3];
				}
			else
				{
					elerrors4.innerHTML='';	
				}
		}
}
}







// Accommodation extra offer editing
function editoffer_extra()
{
	elucn=locate_el('ucn');
	elcity=locate_el('city');
	elcategory=locate_el('category');
	elmaplocation=locate_el('maplocation');
	elextratitle=locate_el('extratitle');
	
	PrepareSave();
	eldescription=locate_el('DataTextarea');

	eltelephone=locate_el('telephone');
	elemail=locate_el('email');
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var urltosend="./actions/editoffer_extra.php";
	var url='';
	url=url+"ucn="+elucn.value;
	url=url+"&city="+elcity.options[elcity.selectedIndex].value;
	url=url+"&category="+elcategory.options[elcategory.selectedIndex].value;
	url=url+"&maplocation="+encodeURIComponent(elmaplocation.value);
	url=url+"&extratitle="+encodeURIComponent(elextratitle.value);
	url=url+"&description="+encodeURIComponent(eldescription.value);
	url=url+"&telephone="+encodeURIComponent(eltelephone.value);
	url=url+"&email="+encodeURIComponent(elemail.value);
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=verify_editoffer_extra;
	xmlHttp.open("POST",urltosend,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.setRequestHeader("Content-Length", url.length);
	xmlHttp.setRequestHeader("Connection", "close"); 
	xmlHttp.send(url);
}

function verify_editoffer_extra() 
{ 

if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	window.scroll(0, 0);
	hideajaxloader();
	responses=xmlHttp.responseText.split('#ER#');
	elerrors1=locate_el('errors1');
	elerrors2=locate_el('errors2');
	elerrors3=locate_el('errors3');
	elerrors4=locate_el('errors4');
	elerrors5=locate_el('errors5');
	elucn=locate_el('ucn');
	eladdofferbox=locate_el('addofferbox');

	
	if((responses[0]=='OK') || (responses[0]=='NOTOK'))
		{
			if(responses[0]=='OK')
				{
					eladdofferbox.innerHTML=responses[1];
				}
			
			if(responses[0]=='NOTOK')
				{
					elerrors1.innerHTML=responses[1];
				}
		}
	else
		{
			if(responses[0]!='No errors')
				{
					elerrors1.innerHTML=responses[0];
				}
			else
				{
					elerrors1.innerHTML='';	
				}
			if(responses[1]!='No errors')
				{
					elerrors2.innerHTML=responses[1];
				}
			else
				{
					elerrors2.innerHTML='';	
				}
			if(responses[2]!='No errors')
				{
					elerrors3.innerHTML=responses[2];
				}
			else
				{
					elerrors3.innerHTML='';	
				}
			if(responses[3]!='No errors')
				{
					elerrors4.innerHTML=responses[3];
				}
			else
				{
					elerrors4.innerHTML='';	
				}
			if(responses[4]!='No errors')
				{
					elerrors5.innerHTML=responses[4];
				}
			else
				{
					elerrors5.innerHTML='';	
				}
		}
}
}




// Accommodation extra offer editing
function editcomp()
{
	elucn=locate_el('ucn');
	elcity=locate_el('city');
	eladdress=locate_el('address');
	elcompany=locate_el('company');

	PrepareSave();
	eldescription=locate_el('DataTextarea');

	eltelephone=locate_el('telephone');
	elfax=locate_el('fax');
	elemail=locate_el('email');
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	 
	var urltosend="./actions/editcomp.php";
	var url='';
	url=url+"ucn="+elucn.value;
	url=url+"&city="+elcity.options[elcity.selectedIndex].value;
	url=url+"&address="+encodeURIComponent(eladdress.value);
	url=url+"&company="+encodeURIComponent(elcompany.value);
	url=url+"&description="+encodeURIComponent(eldescription.value);
	url=url+"&telephone="+encodeURIComponent(eltelephone.value);
	url=url+"&fax="+encodeURIComponent(elfax.value);
	url=url+"&email="+encodeURIComponent(elemail.value);
	url=url+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange=verify_editcomp;
	xmlHttp.open("POST",urltosend,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.setRequestHeader("Content-Length", url.length);
	xmlHttp.setRequestHeader("Connection", "close"); 
	xmlHttp.send(url);
}

function verify_editcomp() 
{ 

if (xmlHttp.readyState!=4)
{
	showajaxloader();
}
if (xmlHttp.readyState==4)
{
	window.scroll(0, 0);
	hideajaxloader();
	responses=xmlHttp.responseText.split('#ER#');
	elerrors1=locate_el('errors1');
	elerrors2=locate_el('errors2');
	elerrors3=locate_el('errors3');
	elerrors4=locate_el('errors4');
	elerrors5=locate_el('errors5');
	elucn=locate_el('ucn');
	eladdofferbox=locate_el('addofferbox');

	
	if((responses[0]=='OK') || (responses[0]=='NOTOK'))
		{
			if(responses[0]=='OK')
				{
					eladdofferbox.innerHTML=responses[1];
				}
			
			if(responses[0]=='NOTOK')
				{
					elerrors1.innerHTML=responses[1];
				}
		}
	else
		{
			if(responses[0]!='No errors')
				{
					elerrors1.innerHTML=responses[0];
				}
			else
				{
					elerrors1.innerHTML='';	
				}
			if(responses[1]!='No errors')
				{
					elerrors2.innerHTML=responses[1];
				}
			else
				{
					elerrors2.innerHTML='';	
				}
			if(responses[2]!='No errors')
				{
					elerrors3.innerHTML=responses[2];
				}
			else
				{
					elerrors3.innerHTML='';	
				}
			if(responses[3]!='No errors')
				{
					elerrors4.innerHTML=responses[3];
				}
			else
				{
					elerrors4.innerHTML='';	
				}
			if(responses[4]!='No errors')
				{
					elerrors5.innerHTML=responses[4];
				}
			else
				{
					elerrors5.innerHTML='';	
				}
		}
}
}




