var OrderDirection = '';
var OrderBy = '';
var OrderOlder = '';
function SubmitRegisterForm(ClickFormName, SubmitType)
{
	var SendRequestMessage = 'Sending. Please wait...';
	SubmitFormAjax(ClickFormName, SubmitType, SubmitURL, SendRequestMessage);
}
function SubmitLoginForm(ClickFormName, SubmitType)
{
	var SendRequestMessage = 'Sending. Please wait...';
	SubmitFormAjax(ClickFormName, SubmitType, SubmitURL, SendRequestMessage);
}
function SubmitForgotForm(ClickFormName, SubmitType)
{
	var SendRequestMessage = 'Sending. Please wait...';
	SubmitFormAjax(ClickFormName, SubmitType, SubmitURL, SendRequestMessage);
}
function SubmitMemInfoForm(ClickFormName, SubmitType)
{
	var SendRequestMessage = 'Sending. Please wait...';
	SubmitFormAjax(ClickFormName, SubmitType, SubmitURL, SendRequestMessage);
}
function SubmitChangePassForm(ClickFormName, SubmitType)
{
	var SendRequestMessage = 'Sending. Please wait...';
	SubmitFormAjax(ClickFormName, SubmitType, SubmitURL, SendRequestMessage);
}
function SubmitNewQuoteForm(ClickFormName, SubmitType)
{
	var SendRequestMessage = 'Sending. Please wait...';
	SubmitFormAjax(ClickFormName, SubmitType, SubmitURL, SendRequestMessage);
}
function StartingGetList(ShowPage)
{
	var SendRequestMessage = 'Loading. Please wait...';
	SubmitListAjax('items_list', SubmitURL, 'action=ajax_list_quotes&page='+ShowPage+'&order='+OrderBy+'&direction='+OrderDirection, SendRequestMessage);
}
function StartingGetBookList(ShowPage)
{
	var SendRequestMessage = 'Loading. Please wait...';
	SubmitListAjax('items_list', SubmitURL, 'action=ajax_list_books&page='+ShowPage+'&order='+OrderBy+'&direction='+OrderDirection, SendRequestMessage);
}
function StartingGetMessages(ShowPage)
{
	var SendRequestMessage = 'Loading. Please wait...';
	SubmitListAjax('items_list', SubmitURL, 'action=ajax_ListQuotesMessages&page='+ShowPage+'&id='+QuoteID, SendRequestMessage);
}
function StartingGetBooksMessages(ShowPage)
{
	var SendRequestMessage = 'Loading. Please wait...';
	SubmitListAjax('items_list', SubmitURL, 'action=ajax_ListBooksMessages&page='+ShowPage+'&id='+QuoteID, SendRequestMessage);
}
function ChangeStatus(SelectedItem)
{
	var SendRequestMessage = 'Changing. Please wait...';
	SubmitListAjax('items_list', SubmitURL, 'action=ajax_change_status&id='+SelectedItem, SendRequestMessage);
}
function SubmitCommentForm(ClickFormName, SubmitType)
{
	var SendRequestMessage = 'Sending. Please wait...';
	SubmitFormAjax(ClickFormName, SubmitType, SubmitURL, SendRequestMessage);
}
function LoadengCityList(FormName)
{
	if (FormName == 'collection')
	{
		var SelectedCountry = document.getElementById('collection_country').value;
		document.getElementById('collection_zone').options.length=0;
		for (var i=0; i<cityArray[SelectedCountry].length; i++) {document.getElementById('collection_zone').options[i] = new Option(cityArray[SelectedCountry][i][0], cityArray[SelectedCountry][i][1], cityArray[SelectedCountry][i][2], cityArray[SelectedCountry][i][3]);}
	}
	else
	{
		var SelectedCountry = document.getElementById('delivery_country').value;
		document.getElementById('delivery_zone').options.length=0;
		for (var i=0; i<cityArray[SelectedCountry].length; i++) {document.getElementById('delivery_zone').options[i] = new Option(cityArray[SelectedCountry][i][0], cityArray[SelectedCountry][i][1], cityArray[SelectedCountry][i][2], cityArray[SelectedCountry][i][3]);}
	}
}
function ChangeOrder(OrderClick)
{
	if (OrderBy == OrderClick) 
	{
		if (OrderDirection == '') {OrderDirection = 'DESC';}
		else {OrderDirection = '';}
	}
	else
	{
		OrderBy = OrderClick;
		OrderDirection = '';
	}
	StartingGetList('1');
}
function ChangeBookOrder(OrderClick)
{
	if (OrderBy == OrderClick) 
	{
		if (OrderDirection == '') {OrderDirection = 'DESC';}
		else {OrderDirection = '';}
	}
	else
	{
		OrderBy = OrderClick;
		OrderDirection = '';
	}
	StartingGetBookList('1');
}
function StartReloadList(ReloadListData)
{
	if (ReloadListData == 'reload_image') {document.getElementById('captcha_image').src = SubmitURL+'?action=get_captcha&image='+document.getElementById('image_id').value;}
	else if (ReloadListData == 'request_list_logged') {window.location = SubmitURL+'?action=member_quotes';}
	else if (ReloadListData == 'items_list') {StartingGetList('1');}
	else if (ReloadListData == 'reload_list_comment') 
	{
		document.getElementById('post_comment').style.visibility = 'hidden';
		document.getElementById('post_comment').style.display = 'none';
		StartingGetMessages('1');
	}
	else if (ReloadListData == 'reload_list_book_comment') 
	{
		document.getElementById('post_comment').style.visibility = 'hidden';
		document.getElementById('post_comment').style.display = 'none';
		StartingGetBooksMessages('1');
	}
}
function ChangeVisible(FormType, FormName)
{
	if (document.getElementById(FormType+'_'+FormName).checked)
		document.getElementById(FormType+'_'+FormName+'_box').style.visibility = 'visible';
	else
		document.getElementById(FormType+'_'+FormName+'_box').style.visibility = 'hidden';
}
function ChnageGoodsType()
{
	if (document.getElementById('goods').checked)
	{
		document.getElementById('form_pallets').style.visibility = 'visible';
		document.getElementById('form_pallets').style.display = 'inline';
		document.getElementById('form_full_container').style.visibility = 'hidden';
		document.getElementById('form_full_container').style.display = 'none';
	}
	else
	{
		document.getElementById('form_pallets').style.visibility = 'hidden';
		document.getElementById('form_pallets').style.display = 'none';
		document.getElementById('form_full_container').style.visibility = 'visible';
		document.getElementById('form_full_container').style.display = 'inline';
	}
}
function ShowCommentForm()
{
	if (document.getElementById('post_comment').style.visibility == 'hidden')
	{
		document.getElementById('post_comment').style.visibility = 'visible';
		document.getElementById('post_comment').style.display = 'inline';
	}
	else
	{
		document.getElementById('post_comment').style.visibility = 'hidden';
		document.getElementById('post_comment').style.display = 'none';
	}
}