var global_rate = 0;
var global_special = "";

var is_Opera = (window.navigator.userAgent.search("Opera") != -1);
var is_IE = ((window.navigator.userAgent.search("MSIE") != -1) && !is_Opera);


function replaceFrm(val){
	$('extra_frame').contentWindow.location.replace(val);
}

function $(id){return document.getElementById(id);}

function set_calculate(){
	if ($('Car').value == ""){
		alert("Please select the type of car!");
		$('Car').focus();
		return false;
	}
	else if ($('FromCity').value == ""){
		alert("Please select the from city!");
		$('FromCity').focus();
		return false;
	}
	else if ($('ToCity').value == ""){
		alert("Please select the to city!");
		$('ToCity').focus();
		return false;
	}
	else {
		global_special = "";
		cal_rate($('FromAddress').value, $('FromCity').value, $('ToAddress').value, $('ToCity').value, $('Car').value);
		return true;
	}
}
function cal_rate(fa, fc, ta, tc, c){
	replaceFrm("http://www.sflimo.net/cal_rates.php?FromAddress="+fa+"&FromCity="+fc+"&ToAddress="+ta+"&ToCity="+tc+"&Car="+c);
}

function setCost(val){
	global_rate = val;
	try {
		afterCal();
	}
	catch(e){
		return;
	}
}

function setSpecial(val){
	global_special = val;	
}

function setAddVal(w, a, c){
	$(w+"Address").value = a;
	$(w+"City").value = c;
}

function rc(id){
	(new Image).src = 'rc.php?ID='+id;
	return true;
}

function open_p_win(lnk){
		window.open(lnk, '', 'width=200, height=50, scrolling=no, resize=no, status=no');
}