function check_numeric(input_field){
	input_field.value= input_field.value.match(/\d*/);
}

function isEmail(input){ 
	var inputStr=input.value 
	if(window.RegExp && inputStr){ 
		var regstr1 = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)" 
		var regstr2 = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$" 
		var regExp1 = new RegExp(regstr1) 
		var regExp2 = new RegExp(regstr2) 
		var regExp3 = /[^a-zA-Z0-9\-_.@]/ 
		if(!(!regExp1.test(inputStr) && regExp2.test(inputStr) && !regExp3.test(inputStr)) || !(inputStr.indexOf("@")>=0)) {
			alert("Invalid entry.\n\nPlease enter a valid Email Address.");
			input.value=input.defaultValue;
			input.focus();
			return false;
		}; 
		return true;
	}
}

function calcHeight(elem){
	var the_height=document.getElementById(elem).contentWindow.document.body.scrollHeight;//find the height of the internal page
	document.getElementById(elem).style.height=the_height + 20;//change the height of the iframe
	//document.getElementById(elem).style.width='100%';
	//alert(elem + " - " + the_height);
}

function sendPost(user_id) {
	if (user_id==null) {
		user_id= '';
	}
	if (win.general_main){
		win.focus();
		a= document.searchForm;
		var url='';
		for (ii=0; ii<a.elements.length; ii++) {
			url+= a.elements[ii].name + '=' + a.elements[ii].value + '&';
		}
		win.general_main.location.href= 'list.php?user_id=' + user_id + '&' + url;
		delete url;
	}else {
		setTimeout('sendPost("' + user_id + '")', 100);
	}
}
function goSearch(user_id, lang_id) {
	win= window.open('frames.php?user_id=' + user_id + '&lang_id=' + lang_id, 'search_engine', 'width=640, height=640, left=50, top=50');
	sendPost(user_id);
	//setTimeout('sendPost(' + user_id + ')', 1000);
}

function sit2eur (sit, euro_rate) {
	return Math.round(sit / euro_rate);
}

function eur2sit (eur, euro_rate) {
	return Math.round(eur * euro_rate);
}

function add_to_basket(oglas_id) {
	event.srcElement.style.display='none';
	window.basket_dump.location.href= 'add_to_basket.php?id=' + oglas_id;
}
