var OMCHAT_ITEM_TYPE_MARKETPLACE=1;var OMCHAT_ITEM_TYPE_JOB=2;var OMCHAT_ITEM_TYPE_CV=3;var OMCHAT_ITEM_TYPE_COMPANY=4;var OMCHAT_ITEM_TYPE_MARKETPLACE_MERCHANDISE=1;var OMCHAT_ITEM_TYPE_MARKETPLACE_AUTO=2;var OMCHAT_ITEM_TYPE_MARKETPLACE_PROPERTY=3;var OMCHAT_ITEM_TYPE_MARKETPLACE_AUTO_CAR=1;var OMCHAT_ITEM_TYPE_PROPERTY_TO_RENT=1;var OMCHAT_ITEM_TYPE_PROPERTY_FLATMATE=2;var OMCHAT_ITEM_TYPE_DOCUMENT=10;var OMCHAT_ITEM_TYPE_CUSTOM=11;var OMCHAT_ITEM_TYPE_VERSION=12;var OMCHAT_ITEM_TYPE_QUOTE=20;function item_xml_query_general_get(form_id,item_type,itemid,progress_em)
{var query_extra='';var query_category='';var title,description_em,summary_em,date_expires_em,catid_em;var select_em,em;var form_id_full='omchat_'+form_id;var title_empty_text='Please give this item a title.';switch(item_type)
{case OMCHAT_ITEM_TYPE_JOB:title_empty_text='Please give this job a title.';break;case OMCHAT_ITEM_TYPE_CV:title_empty_text='Please enter the full name of the person this CV belongs to.';break;case OMCHAT_ITEM_TYPE_COMPANY:title_empty_text='Please enter the name of the business.';break;}
if((title=getElement(form_id_full+'_item_title').value).length==0)
{progress_em.innerHTML=title_empty_text;return'';}
if((summary_em=document.getElementById(form_id_full+'_item_summary'))!=null)
{query_extra+='&item_summary='+encodeURIComponent(summary_em.value);}
if((date_expires_em=document.getElementById('omchat_calendar_item_date_expires_value'))!=null)
{query_extra+='&item_date_expires='+date_expires_em.value;}
if(document.getElementById(form_id_full+'_category_select_0')!=null&&(query_category=item_xml_query_category_get(progress_em,form_id)).length==0)
{progress_em.innerHTML='Please select a category.';return'';}
query_extra+=query_category;select_em=document.getElementById(form_id_full+'_item_company');if(select_em!=null&&select_em.options[select_em.selectedIndex].value!='0')
{query_extra+='&companyid='+select_em.options[select_em.selectedIndex].value;}
else
{if((em=document.getElementById(form_id_full+'_item_company_name'))!=null)
{if(em.value.length>0)
query_extra+='&item_company_name='+encodeURIComponent(em.value);}}
if((description_em=document.getElementById(form_id_full+'_item_description'))!=null)
{query_extra+='&item_description='+encodeURIComponent(description_em.value);}
return(itemid>0?'item_itemid='+itemid+'&':'')+'item_title='+encodeURIComponent(title)+query_extra;}
function item_xml_query_location_get(progress_em,form_id)
{return location_query_get(form_id,' where this item is located.',progress_em,false);}
function item_xml_query_contact_info_get(form_id,item_type)
{var form_id_full='omchat_'+form_id;var contact_attention=getElement(form_id_full+'_item_contact_attention').value;var contact_email=getElement(form_id_full+'_item_contact_email').value;var contact_phone_cell=getElement(form_id_full+'_item_contact_phone_cell').value;var contact_phone_home=getElement(form_id_full+'_item_contact_phone_home').value;var contact_phone_work=getElement(form_id_full+'_item_contact_phone_work').value;var contact_phone_fax=getElement(form_id_full+'_item_contact_phone_fax').value;var query_string='&item_contact_attention='+encodeURIComponent(contact_attention);query_string+='&item_contact_email='+encodeURIComponent(contact_email)+'&item_contact_phone_home='+encodeURIComponent(contact_phone_home);query_string+='&item_contact_phone_cell='+encodeURIComponent(contact_phone_cell)+'&item_contact_phone_work='+encodeURIComponent(contact_phone_work)+'&item_contact_phone_fax='+encodeURIComponent(contact_phone_fax);return query_string;}