function closeStartDiv()
{
	var startDiv = o('startDiv');
	startDiv.innerHTML = '';
	startDiv.style.display = 'none';
	startDiv.style.zIndex = -1;
	var expires = new Date();
	expires.setTime(expires.getTime() + (1000 * 300));
	setCookie("showStartWin", "0", expires, "/");
	return false;
}
function showSelectWin()
{
	var showDiv = getCookie("showStartWin");
//	alert(showDiv);
	if(showDiv != 0)
	{
		var startDiv = o('startDiv');
		var w = getClientWidth();
		var h = getDocHeight();
		startDiv.style.width = w+'px';
		startDiv.style.height = h+'px';
		startDiv.style.display = 'block';
		startDiv.style.zIndex = 20;
	}
}
function showLLCardNumber()
{
	if(o('haveLLCard').checked)
		o('LLCardNumber').style.display = 'block';
	else
		o('LLCardNumber').style.display = 'none';
}
function checkReferer()
{
	var refererId = o('refererId').value;
	if(refererId == 9999)
	{
		o('companyNameTable').style.display = 'block';
	}
	else
	{
		o('companyNameTable').style.display = 'none';
	}
	if(refererId == 3)
	{
		o('cityNameMATable').style.display = 'block';
	}
	else
	{
		o('cityNameMATable').style.display = 'none';
	}
}
function  showCIP()
{
	if(o('clientIsParent').checked)
		o('clientIsParentTab').style.display = 'none';
	else
		o('clientIsParentTab').style.display = 'block';
}

function  showCAIMA()
{
	if(o('memberAddrIsClientAddr').checked)
	{
		o('clientAddrIsMemberAddr').style.display = 'none';
		o('citytab').style.display = 'none';
		o('RVtab').style.display = 'none';
		o('addrDetailTab').style.display = 'none';
	}
	else
	{
		o('clientAddrIsMemberAddr').style.display = 'block';
		o('citytab').style.display = 'block';
		o('RVtab').style.display = 'block';
		o('addrDetailTab').style.display = 'block';
	}
}
function getGroup()
{
	var shiftId = o('shiftList').value;
	var groupResA = new Array();
	var groupResAIndex = 0;
	if(shiftId != 0)
	{
		for(var i = 0; i < groupArray.length; i++)
		{
			if(groupArray[i])
			{
				var groupA = groupArray[i].split('|');
				if(groupA[1] == shiftId)
				{
					groupResA[groupResAIndex] = groupA[0]+'|'+groupA[2];
					groupResAIndex++;
				}
			}
		}
	}
	var groupList = o('groupList');
	var listSize = groupList.length;
	while(groupList.length != 0)
		groupList.remove(0);
	var y=document.createElement('option');
	y.value=0;
	if(groupResA.length > 0)
		y.text='Pasirinkite grupė';
	else
		y.text='Laisvų grupių nėra';
	try
	{
		groupList.add(y,null); // standards compliant
	}
	catch(ex)
	{
		groupList.add(y); // IE only
	}
	for(var i = 0; i < groupResA.length; i++)
	{
		var groupItem = groupResA[i].split('|');
		y=document.createElement('option');
		y.value=groupItem[0];
		y.text=groupItem[1];
		try
		{
			groupList.add(y,null); // standards compliant
		}
		catch(ex)
		{
			groupList.add(y); // IE only
		}
	}
}
function getCampDetails(id)
{
	var detDivs = o('campsDescrs').getElementsByTagName('div');
	for(var i = 0; i < detDivs.length; i++)
	{
		if((detDivs[i].id == 'campPrice'+id) || (detDivs[i].id == 'campDescr'+id))
			detDivs[i].style.display = 'block';
		else
			detDivs[i].style.display = 'none';
	}
}
function getShift()
{
	var campId = o('campList').value;
	getCampDetails(campId);
	var shiftResA = new Array();
	var shiftResAIndex = 0;
	if(campId != 0)
	{
		for(var i = 0; i < shiftArray.length; i++)
		{
			if(shiftArray[i])
			{
				var shiftA = shiftArray[i].split('|');
				if(shiftA[1] == campId)
				{
					shiftResA[shiftResAIndex] = shiftA[0]+'|'+shiftA[2]+'|'+shiftA[3]+'|'+shiftA[4];
					shiftResAIndex++;
				}
			}
		}
	}
	var shiftList = o('shiftList');
	var listSize = shiftList.length;
	var groupList = o('groupList');
	
	while(groupList.length != 0)
		groupList.remove(0);
	var y=document.createElement('option');
	y.value=0;
	y.text='Pasirinkite pamainą';
	try
	{
		groupList.add(y,null); // standards compliant
	}
	catch(ex)
	{
		groupList.add(y); // IE only
	}
	
	while(shiftList.length != 0)
		shiftList.remove(0);
	
	var y=document.createElement('option');
	y.value=0;
	if(shiftResA.length > 0)
		y.text='Pasirinkite pamainą';
	else
		if(campId == 0)
			y.text='Pasirinkite stovyklą';
		else
			y.text='Laisvų pamainų nėra';
	try
	{
		shiftList.add(y,null); // standards compliant
	}
	catch(ex)
	{
		shiftList.add(y); // IE only
	}
	for(var i = 0; i < shiftResA.length; i++)
	{
		var shiftItem = shiftResA[i].split('|');
		y=document.createElement('option');
		y.value=shiftItem[0];
		y.text=shiftItem[1]+' ('+shiftItem[2]+' - '+shiftItem[3]+')';
		try
		{
			shiftList.add(y,null); // standards compliant
		}
		catch(ex)
		{
			shiftList.add(y); // IE only
		}
	}
}
function showRCList()
{
	if(o('cityRadio').checked)
	{
		o('citytab').style.display = 'block';
		o('RVtab').style.display = 'none';
	}
	if(o('rajRadio').checked)
	{
		o('citytab').style.display = 'none';
		o('RVtab').style.display = 'block';
	}
	getCRList();
}
function showVillageInput()
{
	if(o('AddrRajon').value > 0)
	{
		o('inputVillageInput').readonly = false;
	}
	else
	{
		o('inputVillageInput').readonly = true;
	}
}
function getCRList()
{
	if(o('cityRadio').checked)
		getCityList();
	else
	{
		if(o('rajRadio').checked == false)
		{
			var cityList = o('AddrCity');
			var listSize = cityList.length;
			while(cityList.length != 0)
				cityList.remove(0);
			
			var y=document.createElement('option');
			y.value=0;
			y.text='Pasirinkite miestą arba rajoną';
			try
			{
				cityList.add(y,null); // standards compliant
			}
			catch(ex)
			{
				cityList.add(y); // IE only
			}
		}
	}
	if(o('rajRadio').checked)
		getRajonList();
	else
	{
		if(o('cityRadio').checked == false)
		{
			var cityList = o('AddrRajon');
			var listSize = cityList.length;
			while(cityList.length != 0)
				cityList.remove(0);
			
			var y=document.createElement('option');
			y.value=0;
			y.text='Pasirinkite miestą arba rajoną';
			try
			{
				cityList.add(y,null); // standards compliant
			}
			catch(ex)
			{
				cityList.add(y); // IE only
			}
		}
	}
}
function getRajonList()
{
	var id = o('AddrRegion').value;
		var rajonResA = new Array();
		var rajonResAIndex = 0;
		if(id != 0)
		{
			for(var i = 0; i < rajonArray.length; i++)
			{
				if(rajonArray[i])
				{
					var rajonA = rajonArray[i].split('|');
					if(rajonA[1] == id)
					{
						rajonResA[rajonResAIndex] = rajonA[0]+'|'+rajonA[2];
						rajonResAIndex++;
					}
				}
			}
		}
		var rajonList = o('AddrRajon');
		var listSize = rajonList.length;
		while(rajonList.length != 0)
			rajonList.remove(0);
	
		var y=document.createElement('option');
		y.value=0;
		if(rajonResA.length > 0)
			y.text='Pasirinkite rajoną';
		else
			if(id == 0)
				y.text='Pasirinkite apskritį';
			else
				y.text='Rajonų nėra';
		try
		{
			rajonList.add(y,null); // standards compliant
		}
		catch(ex)
		{
			rajonList.add(y); // IE only
		}
		for(var i = 0; i < rajonResA.length; i++)
		{
			var rajonItem = rajonResA[i].split('|');
			y=document.createElement('option');
			y.value=rajonItem[0];
			y.text=rajonItem[1];
			try
			{
				rajonList.add(y,null); // standards compliant
			}
			catch(ex)
			{
				rajonList.add(y); // IE only
			}
		}
}
function getCityList()
{
	var id = o('AddrRegion').value;
		var cityResA = new Array();
		var cityResAIndex = 0;
		if(id != 0)
		{
			for(var i = 0; i < cityArray.length; i++)
			{
				if(cityArray[i])
				{
					var cityA = cityArray[i].split('|');
					if(cityA[1] == id)
					{
						cityResA[cityResAIndex] = cityA[0]+'|'+cityA[2];
						cityResAIndex++;
					}
				}
			}
		}
		var cityList = o('AddrCity');
		var listSize = cityList.length;
		while(cityList.length != 0)
			cityList.remove(0);
	
		var y=document.createElement('option');
		y.value=0;
		if(cityResA.length > 0)
			y.text='Pasirinkite miestą';
		else
			if(id == 0)
				y.text='Pasirinkite apskritį';
			else
				y.text='Miestų nėra';
		try
		{
			cityList.add(y,null); // standards compliant
		}
		catch(ex)
		{
			cityList.add(y); // IE only
		}
		for(var i = 0; i < cityResA.length; i++)
		{
			var cityItem = cityResA[i].split('|');
			y=document.createElement('option');
			y.value=cityItem[0];
			y.text=cityItem[1];
			try
			{
				cityList.add(y,null); // standards compliant
			}
			catch(ex)
			{
				cityList.add(y); // IE only
			}
		}
}
