function deleteMessage(question, url) {
	if (confirm(question))
		window.location = url;

	return false;
}

function checkLongLat() {

	alert(input_1) ;
	alert(input_2) ;

	if (!/^[1-9]\d{2,4}([\.,]\d\d)?$/.test(input_1)) return false ;
	if (!/^[1-9]\d{2,4}([\.,]\d\d)?$/.test(input_2)) return false ;

	alert('here') ;

	input_1 = +input_1 ;
	input_2 = +input_2 ;

	if (input_1> 3e4) return false ;
	if (input_2> 3e4) return false ;

	return true
}
var curr_form = '' ;

function switchForm(id) {
	curr_form = id ;

	if (id=='type_coords_wgs') {
		document.getElementById('type_coords_wgs').checked = true ;

		document.getElementById('type_coords_dms').checked = false ;
	}
	else {
		document.getElementById('type_coords_wgs').checked = false ;
		document.getElementById('type_coords_dms').checked = true ;
	}
}

function previewMap() {
	if (curr_form=='type_coords_wgs') {
		var input_1 = document.getElementById('lat') ;
		var input_2 = document.getElementById('long') ;
		initGoogleMaps('',new Array(input_1.value,input_2.value),document.getElementById('google_map')) ;
	}
	else {
		string = "" ;
		string += "lat_min="+document.getElementById('lat_min').value+"&" ;
		string += "lat_sec="+document.getElementById('lat_sec').value+"&" ;
		string += "lat_degree="+document.getElementById('lat_degree').value+"&" ;
		string += "long_min="+document.getElementById('long_min').value+"&" ;
		string += "long_sec="+document.getElementById('long_sec').value+"&" ;
		string += "long_degree="+document.getElementById('long_degree').value+"&" ;

		request('get_gps_coords.php',string,false,setCoords);
	}
}

function setCoords(textResponse) {
	eval(textResponse) ;
	document.getElementById('lat').value=''+textResponseArray[0]+'' ;
	document.getElementById('long').value=''+textResponseArray[1]+'' ;
	initGoogleMaps('',new Array(textResponseArray[0],textResponseArray[1]),document.getElementById('google_map')) ;
}

function submitForm() {
	if (curr_form=='type_coords_wgs') {
		document.getElementById('form_coords_wgs').submit() ;
	}
	else {
		document.getElementById('form_coords_dms').submit() ;
	}
}

function checkLongLat() {
	var input_1 = document.getElementById('lat') ;
	var input_2 = document.getElementById('long') ;

	if (input_1.value=="" && input_2.value=="") {
		return true ;
	}
	if (isNaN(input_1.value)) {
		input_1.value = '' ;
		return false ;
	}
	else if (isNaN(input_2.value)) {
		input_2.value = '' ;
		return false ;
	}
	else {
		return true ;
	}
}


function makeDefaultWorkingHours() {
	var from_am_hour = document.getElementById('d1_am_from').value ;
	var to_am_hour = document.getElementById('d1_am_to').value ;
	var from_pm_hour = document.getElementById('d1_pm_from').value ;
	var to_pm_hour = document.getElementById('d1_pm_to').value ;

	for (i=0;i<7;i++) {
		if (i!=1) {
			document.getElementById('d'+i+'_am_from').value = from_am_hour ;
			document.getElementById('d'+i+'_am_to').value = to_am_hour ;
			document.getElementById('d'+i+'_pm_to').value = to_pm_hour ;
			document.getElementById('d'+i+'_pm_from').value = from_pm_hour ;
		}
	}
}

function copyRegFromAuthor() {
	var acontact = document.getElementById('acontact').value ;
	var aphone = document.getElementById('aphone').value ;
	var aemail = document.getElementById('aemail').value ;

	document.getElementById('bcontact').value = acontact ;
	document.getElementById('bphone').value = aphone ;
	document.getElementById('bemail').value = aemail ;

}

function boolConfirmation(what) {
	var bol = confirm(what) ;
	return bol ;
}

function linkConfirmation(what,where_yes,where_no) {
	var bol = confirm(what) ;
	if (bol) {
		document.location.href=where_yes ;
	}
	else if(where_no!="") {
		document.location.href=where_no ;
	}
}

function showTooltip(tooltipTxt,width,height) {
	window.open('http://www.firmosfera.pl/resources//hlp/'+tooltipTxt+'.jpg', 'previewimage_'+tooltipTxt, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,top=100,left=100,width='+(width+40)+',height='+(height+50));
}

function hideTooltip() {
	document.getElementById('pictureHolder').style.display='none' ;
}

function voteGuest(txt, where) {
	alert(txt) ;
	lobox(0, 'vhod');
	scrollTo(0,0) ;
	document.getElementById('wpage').value = "http://www.firmosfera.pl/company/"+where+".html" ;
}