function search_results(id)
{
window.open("search_results_showid_2.asp?" + id,"popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width=680,height=700")
}

function edit_pic(id)
{
window.open("user_advert_edit_images.asp?" + id,"popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width=680,height=700")
}

function OnChange(dropdown)
{
    var myindex  = dropdown.selectedIndex
    var SelValue = dropdown.options[myindex].value
    var baseURL  ="<%=lastUrl%>?"+SelValue+"#searchresults"
    top.location.href = baseURL;
    
    return true;
}
function ChangeMunicipality2(dropdown)
{
    var myindex  = dropdown.selectedIndex
    var SelValue = dropdown.options[myindex].value
	var advertID = document.getElementById("advertid").value
    var baseURL  ="user_advert_edit.asp?advertID="+advertID+"&county="+SelValue+"#searchresults"
    top.location.href = baseURL;
    
    return true;
}

function PickAdvertType(dropdown)
{
    var myindex  = dropdown.selectedIndex
    var SelValue = dropdown.options[myindex].value
    var baseURL  ="user_advert.asp?adverttype="+SelValue+"#searchresults"
    top.location.href = baseURL;	
    
    
    return true;
}
function OnChangeSearch(dropdown)
{
    var myindex  = dropdown.selectedIndex
    var SelValue = dropdown.options[myindex].value
    var baseURL  ="search_results.asp?"+SelValue+"#searchresults"
    top.location.href = baseURL;
    
    return true;
}

function ChangeCounty(dropdown)
{
    var myindex  	= dropdown.selectedIndex
	var thisURL		= search.thisURL.value
	var advertType 	= document.getElementById('adverttype').selectedIndex;
	var advertType2 = document.getElementById('adverttype')[advertType].value;	
    var SelValue 	= dropdown.options[myindex].value
    var baseURL  	= thisURL+"?County="+SelValue+"&advertType="+advertType2+"#searchresults"
    top.location.href = baseURL;
    
    return true;
}

function ChangeAdvertType(dropdown)
{
    var myindex  			= dropdown.selectedIndex
	var thisURL				= search.thisURL.value
	var municipality	 	= document.getElementById('municipality').selectedIndex;
	var municipality2 		= document.getElementById('municipality')[municipality].value;	
	var county				= document.getElementById('county').value;
    var advertType 			= dropdown.options[myindex].value
    var baseURL  			= thisURL+"?county="+county+"&advertType="+advertType+"&municipality="+municipality2+"#searchresults"
    top.location.href 		= baseURL;
    
    return true;
}

function CreateAdvertType(dropdown)
{
    var myindex  			= dropdown.selectedIndex
	var thisURL				= search.thisURL.value
	var municipality 		= document.getElementById('myMunicipality').value;		
	var county				= document.getElementById('myCounty').value;
    var advertType 			= dropdown.options[myindex].value
    var baseURL  			= thisURL+"?myCounty="+county+"&createAdvertType="+advertType+"&myMunicipality="+municipality+"#searchresults"
    top.location.href 		= baseURL;
    
    return true;
}

function CreateCounty(dropdown)
{
    var myindex  			= dropdown.selectedIndex
	var thisURL				= search.thisURL.value
	var municipality 		= document.getElementById('myMunicipality').value;		
	var advertType			= document.getElementById('createAdvertType').value;
    var county 				= dropdown.options[myindex].value
    var baseURL  			= thisURL+"?myCounty="+county+"&createAdvertType="+advertType+"&myMunicipality="+municipality+"#searchresults"
    top.location.href 		= baseURL;
    
    return true;
}

function CreateSeekCounty(dropdown)
{
    var myindex  			= dropdown.selectedIndex
	var thisURL				= search.thisURL.value
	var advertType 			= document.getElementById('createAdvertType').value;
	var municipality 		= document.getElementById('myMunicipality').value;		
	var county 				= document.getElementById('myCounty').value;
    var SelValue 			= dropdown.options[myindex].value
    var baseURL  			= thisURL+"?myCounty="+county+"&createAdvertType="+advertType+"&myMunicipality="+municipality+"&seekCounty="+SelValue+"#searchresults"
    top.location.href 		= baseURL;
    
    return true;
}


function EditCounty(dropdown)
{
    var myindex  			= dropdown.selectedIndex
	var thisURL				= search.thisURL.value
	var municipality 		= document.getElementById('myMunicipality').value;	
	var seekMunicipality 	= document.getElementById('seekMunicipality').value;			
    var county 				= dropdown.options[myindex].value
	var advertID			= document.getElementById('advertID').value;
    var baseURL  			= thisURL+"?advertID="+advertID+"&myCounty="+county+"&myMunicipality="+municipality+"&seekMunicipality="+seekMunicipality+"#searchresults"
    top.location.href 		= baseURL;
    
    return true;
}

function EditSeekCounty(dropdown)
{
    var myindex  			= dropdown.selectedIndex
	var thisURL				= search.thisURL.value
	var municipality 		= document.getElementById('municipality2').value;		
	var seekMunicipality 	= document.getElementById('seekMunicipality').value;	
	var county 				= document.getElementById('myCounty').value;
	var advertID			= document.getElementById('advertID').value;	
    var SelValue 			= dropdown.options[myindex].value
    var baseURL  			= thisURL+"?advertID="+advertID+"&myCounty="+county+"&myMunicipality="+municipality+"&seekCounty="+SelValue+"&seekMunicipality="+seekMunicipality+"#searchresults"
    top.location.href 		= baseURL;
    
    return true;
}

function ShowDatesStart(value)
{	
	if(value=="Omgående")
		{
		document.getElementById('StartDate').style.display='none';
		}
	else if(value=="PickStartDate")
		{
		document.getElementById('StartDate').style.display='block';
		document.getElementById('StartDate').style.display='table-row';
		}
}

function ShowDatesEnd(value)
{	
	if(value=="Tillsvidare")
		{
		document.getElementById('EndDate').style.display='none';
		}
	else if(value=="PickEndDate")
		{
		document.getElementById('EndDate').style.display='block';
		document.getElementById('EndDate').style.display='table-row';
		}
}

function OnChangeSearch(dropdown)
{
    var myindex  = dropdown.selectedIndex
    var SelValue = dropdown.options[myindex].value
    var baseURL  ="search_results.asp?"+SelValue+"#searchresults"
    top.location.href = baseURL;
    
    return true;
}


