var g_item_type2=0;var g_item_type3=0;function item_category_onchange(form_id,select_em,item_type,item_type2,tier_db,tier_current)
{var form_id_full='omchat_'+form_id;if(tier_db>=0)tier_current++;tier_db++;var catid_parent=parseInt(select_em.options[select_em.selectedIndex].value);var em_parent=getElement(form_id_full+'_category_select_container');if(catid_parent==0&&tier_db>0)
{item_category_select_tiers_remove(form_id,item_type,tier_current);}
else
{item_category_select_tiers_remove(form_id,item_type,tier_current);var div_new=document.createElement('div');div_new.id=form_id_full+'_category_select_container_'+tier_current;div_new.className='select_container';var select_em=document.createElement('select');select_em.appendChild(new Option('Loading...',0));div_new.appendChild(select_em);em_parent.appendChild(div_new);xmlhttp_request('/CMS/php/xml_item_category_select_html_fetch.php','form_id='+encodeURIComponent(form_id)+'&item_type='+item_type+'&catid_parent='+catid_parent+'&tier_db='+tier_db+'&tier_current='+tier_current,'POST',item_category_select_html_fetch_show_processxml,xmlhttp_error,true,true);}}
function item_category_select_html_fetch_show_processxml(xml)
{var items=xml.documentElement.getElementsByTagName('item');var form_id=getNodeValue(items.item(0),'form_id');var form_id_full='omchat_'+form_id;var item_type=parseInt(getNodeValue(items.item(0),'item_type'));g_item_type2=parseInt(getNodeValue(items.item(0),'item_type2'));g_item_type3=parseInt(getNodeValue(items.item(0),'item_type3'));var tier_current=getNodeValue(items.item(0),'tier');var html=getNodeValue(items.item(0),'html');var div_new=getElement(form_id_full+'_category_select_container_'+tier_current);div_new.innerHTML=html;switch(item_type)
{case OMCHAT_ITEM_TYPE_MARKETPLACE:var price_and_condition_container=getElement('omchat_marketplace_item_price_and_condition_info_container');var car_info_container=getElement('omchat_marketplace_item_car_info_container');var property_info_container=getElement('omchat_marketplace_item_property_info_container');var property_to_rent_info_container=getElement('omchat_marketplace_item_property_to_rent_info_container');var flatmate_info_container=getElement('omchat_marketplace_item_flatmate_info_container');switch(g_item_type2)
{case OMCHAT_ITEM_TYPE_MARKETPLACE_MERCHANDISE:property_info_container.style.display='none';property_to_rent_info_container.style.display='none';flatmate_info_container.style.display='none';price_and_condition_container.style.display='block';car_info_container.style.display='none';break;case OMCHAT_ITEM_TYPE_MARKETPLACE_AUTO:property_info_container.style.display='none';property_to_rent_info_container.style.display='none';flatmate_info_container.style.display='none';price_and_condition_container.style.display='block';car_info_container.style.display='block';break;case OMCHAT_ITEM_TYPE_MARKETPLACE_PROPERTY:car_info_container.style.display='none';property_info_container.style.display='block';switch(g_item_type3)
{case OMCHAT_ITEM_TYPE_PROPERTY_TO_RENT:price_and_condition_container.style.display='none';flatmate_info_container.style.display='none';property_to_rent_info_container.style.display='block';break;case OMCHAT_ITEM_TYPE_PROPERTY_FLATMATE:price_and_condition_container.style.display='none';property_to_rent_info_container.style.display='none';flatmate_info_container.style.display='block';break;default:property_to_rent_info_container.style.display='none';price_and_condition_container.style.display='block';break;}
break;}
break;}}
function item_category_select_tiers_remove(form_id,item_type,tier_current)
{var i,em_remove;var form_id_full='omchat_'+form_id;var em_parent=getElement(form_id_full+'_category_select_container');i=tier_current;while((em_remove=document.getElementById(form_id_full+'_category_select_container_'+(i++)))!=null)
{em_parent.removeChild(em_remove);}}