// JavaScript Document
//pagination
function pager_gotoPageSeo(page_url,obj_id,t_pg,last_option)
{
	document.getElementById(obj_id)
	var pg_n=document.getElementById(obj_id).value;
	pg_n=parseInt(pg_n);
	pg_n=t_pg-pg_n+1;
	if (!pg_n || pg_n<=0 || pg_n>t_pg)	pg_n=t_pg;
	if (pg_n!=t_pg)	page_url+=(last_option+pg_n+"/");
	window.location.href=page_url;
}
function pager_gotoPage(page_url,obj_id,t_pg,last_option)
{
	document.getElementById(obj_id)
	var pg_n=document.getElementById(obj_id).value;
	pg_n=parseInt(pg_n);
	if (!pg_n || pg_n<=0 || pg_n>t_pg)	pg_n=1;
	page_url+=[page_url.indexOf("?")==-1?"?":"&"]+last_option+"="+pg_n;
	window.location.href=page_url;
}
//end pagination
//state city select
function load_state(country,id,prefix)
{
	//value 0 US 1 CA
	document.getElementById('city_'+id).innerHTML='';
	fm_getAjaxContent(document.getElementById('state_'+id),site_f_root+"ajax.php?option=4&id="+id+"&prefix="+prefix+"&country="+country.options[country.selectedIndex].value,0);	
}
function load_city(state,id,prefix)
{
	//value 0 US 1 CA
	if (state.options[state.selectedIndex].value==-1)
		document.getElementById('city_'+id).innerHTML='';
	else	fm_getAjaxContent(document.getElementById('city_'+id),site_f_root+"ajax.php?option=4&id="+id+"&prefix="+prefix+"&state="+state.options[state.selectedIndex].value,0);	
}
//end state city select
var cur_address_showing='';
function show_address(obj,id,name)
{
	if (!cur_address_showing)	cur_address_showing=document.getElementById('first_address');
	cur_address_showing.style.color="#000000";
	obj.style.color='#FF0000';
	cur_address_showing=obj;
	document.getElementById('google_map_iframe').src=site_f_root+"map.php?id="+id+"&name="+name;
	return false;
}
function addReviewBox(obj,id,is_premium)
{
	var width=300;
	var height=460;
	fm_contenBoxMaker('print_view',-1,obj,new Array(width,height),"<iframe  name='showing_card' src=\""+site_f_root+"add_review.php?company_id="+id+"&is_premium="+is_premium+"\" frameborder=0 scrolling='no' allowtransparency='true' width='"+width+"px' height='"+height+"px'></iframe>",0,1);
	return false;
}
function cpa_reviews(company_id,is_premium)
{
	fm_contenBoxMaker('reviews_box',site_f_root+"ajax.php?option=9&company_id="+company_id+"&is_premium="+is_premium,new Object(),new Array(400,500),"",0,1);
	return false;
}
function go_city(obj_id)
{
	var obj=document.getElementById(obj_id);	
	window.location.href=obj.options[obj.selectedIndex].value;
	return false;
}