function quickMenu( )
{
	element = document.getElementById('quickMenu');
	if ( !element ) return false;

	switch ( element.value )
	{
		case '1': window.location = root + "company/"+userCompany+"/add/car"; break;
		case '2': window.location = root + "company/"+userCompany+"/add/order"; break;
		case '3': window.location = root + "profile"; break;
		case '4': window.location = root + "profile/show/notifiers"; break;
		case '5': window.location = root + "profile/show/favorites"; break;
		case '6': window.location = root + "company/"+userCompany+"/show/cars"; break;
		case '7': window.location = root + "company/"+userCompany+"/show/orders"; break;
		case '8': window.location = root + "company/"+userCompany+"/show/offers"; break;
		case '9': window.location = root + "company/"+userCompany; break;
	}
}

function changeDestination( from )
{
	$('#AvailableCarsCityToId').val(from.value);
	$('#NeededCarsCityToId').val(from.value);
}

function specifierClick( element )
{
	if ( element.value == "Tarkenne" ) element.value = "";
}

function showItem( companyid, type, id )
{
	window.location = root + 'company/' + companyid + '/show/' + type + '/' + id;
}

function clearContactTextbox( element )
{
	var cleared = document.getElementById('ContactCleared');
	if ( cleared && cleared.value == 0 )
	{
		element.value = "";
		cleared.value = 1;
	}
}

function confirmDelete( items )
{
	return confirm('Tarjouspyynnön poistamisesta lähtee sähköpostilla tieto siihen vastanneille liikennöitsijöille.\nHaluatko varmasti poistaa tarjouspyynnön pysyvästi?');
}

function confirmDelete2( textstring )
{
	return confirm('Haluatko varmasti poistaa '+ textstring +' pysyvästi?');
}

function toggleEndDate()
{

	if(document.getElementById('rowEndDate1').style.display != 'none')
	{
		document.getElementById('rowEndDate1').style.display = 'none';
		document.getElementById('rowEndDate2').style.display = 'none';
		document.getElementById('rowEndDate3').style.display = 'none';
	}
	else
	{
		document.getElementById('rowEndDate1').style.display = 'table-row';
		document.getElementById('rowEndDate2').style.display = 'table-row';
		document.getElementById('rowEndDate3').style.display = 'table-row';
	}
}
function toggleContactCompany()
{
	for (var i=0; i < document.contact.company.length; i++)
	{
   		if (document.contact.company[i].checked)
		{
      		var rad_val = document.contact.company[i].value;
			var prev = document.getElementById('NeededCarsSelectedOffer').value;
			document.getElementById('NeededCarsSelectedOffer').value = rad_val;
      	}
   	}
	
	/*if(rad_val == 1)
	{
		document.getElementById('contant_company').style.display = 'none';
		document.getElementById('offer_'+prev).style.border = 'none';
	}
	else
	{
		document.getElementById('contant_company').style.display = 'block';
		document.getElementById('offer_'+rad_val).style.border = '1px solid #74a828';
		if(prev > 1) { document.getElementById('offer_'+prev).style.border = 'none'; }
	}*/
}
function toggleLoginWin(clickSrc){
	var div = document.getElementById("login_wrapper");
	if(div.style.display == 'none' || div.style.display == ''){
		div.style.display = "block";
	}
	else{
		div.style.display = "none";
	}
}
