function wopen(url,name,w,h,r,s,st)
{
	var w=window.open(url,name,"width="+w+",height="+h+",resizable="+r+",toolbar=0,location=0,status="+st+",menubar=0,directories=0,left=150,top=150,scrollbars="+s);
}

var extended_search;


// @deprecated - wird aus dem select aufgerufen onchange="changeCity('FORM','FIELD','STARTLAND');"
function changeCity(formName,elementName,startLand)
{	
	if ((document.forms)&&(document.forms[formName]))
	{
		//if(elementName=='ad_s_city'){ //my
			
			var element = document.getElementById(elementName);
			var sindex = element.selectedIndex;
			var value  = element[sindex].value;
			var prefix = value.substring(0,5);
			var suffix = value.substring(6,value.length);
			
			//sindex=document.forms[formName].elements.ad_s_city.selectedIndex;
			//var v = document.forms[formName].elements.ad_s_city[sindex].value;
			//var prefix = v.substring(0,5);
			//var suffix = v.substring(6,v.length);
			
			alert(suffix + " " + prefix);
			
			//if (document.forms[formName].elements.ad_s_city[sindex].value=="1_1_1")
			if (prefix=="1_1_1")
			{
				if (navigator.appName.indexOf("WebTV")!='-1')
					window.location='/dynamic/core/search_city.jsp?country_id='+startLand+'&region_id=0&formName=' + formName + '&elementName=' + elementName + '&act=' + suffix;
				else
					wopen('/dynamic/core/search_city.jsp?country_id='+startLand+'&region_id=0&formName='+formName+'&elementName=' + elementName + '&act=' + suffix,'SearchCity',750,250,'no','no',0);
				
				document.forms[formName].elements.ad_s_city[0].selected=true;
			}
		//}
	}
}

function addSearchCity(cityValue,countryAndCityName,workForm,workElement,act,setCurrent)
{
	//if(workElement=='ad_s_city'){
	//	fcity=document.forms[workForm].ad_s_city;
	//}
	//if(workElement=='ad_s_city2'){
	//	fcity=document.forms[workForm].ad_s_city2;
	//}
	
	var fcity = document.getElementById(workElement);
	var flength = fcity.length;
	var fcurrent = flength-1;
	
	for (i=0;i<flength;i++)
	{
		if (fcity.options[i].value==cityValue)
		{
			fcity.options[i].selected=true;
			return 0;
		}
	}
	
	fcity.options[flength] = new Option("Выбрать другой город...","1_1_1_"+act);
	fcity.options[fcurrent].text = countryAndCityName;
	//fcity.options[fcurrent].value=countryID + "_" + regionID + "_" + cityValue;
	fcity.options[fcurrent].value = cityValue;
	
	if(setCurrent=='true'){
		fcity.options[fcurrent].selected=true;
	}
	
	//self.parent.setCookie('citys_'+countryID+'_'+regionID+'_'+cityValue, countryID+'_'+regionID+'_'+cityValue,'null');
	
	return true;
}

function goToContaktForm(changetype)
{
	if (changetype=='mail'){
		//window.opener.addSearchCity(vvalue,vtext,<%= request.getParameter("r") %>);
		//alert("Sie haben als Zeichensatz eingestellt: " + document.defaultCharset);
		window.opener.goToContaktForm1();
		window.close();
	}
}
