var blk_1; // plans
var blk_1_pos;
var blk_1_index_id;

var blk_2; 
var blk_2_pos;
var blk_2_index_id;

function showhideTab(blk_id,div_id,index_div_id,ind_positon){
	// type1 == blk_1, type2 = blk_2
	var select_id;
	var select_id2;
	var select_pos;
	
	if ( blk_id == 1 ) {
		select_id = blk_1;
		blk_1 = div_id;
		
		select_id2 = blk_1_index_id;
		blk_1_index_id = index_div_id;
		
		select_pos = blk_1_pos;
		blk_1_pos = ind_positon;
	} else {
		select_id = blk_2;
		blk_2 = div_id;
		
		select_id2 = blk_2_index_id;
		blk_2_index_id = index_div_id;
		
		select_pos = blk_2_pos;
		blk_2_pos = ind_positon;
	}
	
	var b = document.getElementById(select_id2).className = select_pos + "_" + blk_id + "_tab_off";
	var a = document.getElementById(select_id);
	
	if ( a.style.display == "block" ) {
		a.style.display = "none";
	}

	document.getElementById(div_id).style.display = "block";
	document.getElementById(index_div_id).className = ind_positon + "_" + blk_id + "_tab_on";
	
	return false;
}

function goClass(t_id,nClass){
	document.getElementById(t_id).className = nClass;	
}


function preload_img(){

	preload_image_object = new Image();

	image_url = new Array();
	image_url[0] = "/images/get_free_quotes_b.png";
	image_url[1] = "/images/mouse_left_over.gif";
	image_url[2] = "/images/mouse_middle_over.gif";
	image_url[3] = "/images/mouse_right_over.gif";
	image_url[4] = "/images/02_mouse_left_over.gif";
	image_url[5] = "/images/02_mouse_middle_over.gif";
	image_url[6] = "/images/02_mouse_right_over.gif";
	image_url[7] = "/images/06_main_buttom_mid_over.gif";
	image_url[8] = "/images/06_main_buttom_mid_2_over.gif";
	image_url[9] = "/images/06_main_buttom_right_over.gif";
	image_url[10] = "/images/06_main_buttom_left_over.gif";

	var i = 0;
	for(i=0; i<image_url.length; i++) {
		preload_image_object.src = image_url[i];
	}
}
preload_img();

// left col form
function goPlan(){
	if ( document.getElementById("plan_radio").checked == true) { 
		location.href = '/quote/individual_quote.php';
	} else if ( document.getElementById("group_radio").checked == true) { 
		location.href = '/quote/group_quote.php';
	} else if ( document.getElementById("travel_radio").checked == true) { 
		location.href = '/quote/travel_quote.php';
	} else if ( document.getElementById("teacher_radio").checked == true) { 
		location.href = '/quote/teacher_quote.php';
	}
}

function goCountry(){
	var clink = new Array;
	clink[1] = '1';  //China
	clink[2] = '2';  //Hong Kong
	clink[3] = '3';  //USA
	clink[4] = '4';  //UK
	var a = document.getElementById("countrylink") ;

	if ( a.selectedIndex != 0 ) {
		alert(a.selectedIndex);
		//alert(a.options[a.selectedIndex].value);
		//location.href = clink[a.selectedIndex];
	}
}

function goURL(t_link){
	location.href = t_link;
}

function selectbox (t_id, t_value ) {
	var a = document.getElementById(t_id);
	for (i=0;i<a.length;i++) {
		if ( t_value == a.options[i].value ) {
			a.options[i].selected = true;
			return false;
		}
	}
}

function checkbox( t_id, t_value ){
	if ( t_value != '' ) {
		document.getElementById(t_id).checked = true ;
	}
}


// pull donw menu
function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display= "block" 
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0) 
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}
// pull down menu end