var c_total_v 	= new Array (	7,286,200,176,120,165,206,75,129,109,123,111,43,52,99,128,111,110,98,135,112,78,118,64,77,227,93, 88,69,60,34,30,73,54,45,83,182,88,75,85,54,53,89,59,37,35,38,29,18,45,60,49,62,55,78,96,29,22,24,13, 14,11,11,18,12,12,30,52,52,44,28,28,20,56,40,31,50,40,46,42,29,19,36,25,22,17,19,26,30,20,15,21,11,8, 8,19,5,8,8,11,11,8,3,9,5,4,7,3,6,3,5,4,5,6 );
var c_start_v_id = new Array (	1,8,294,494,670,790,955,1161,1236,1365,1474,1597,1708,1751,1803,1902,2030,2141,2251,2349, 2484,2596,2674,2792,2856,2933,3160,3253,3341,3410,3470,3504,3534,3607,3661,3706,3789,3971, 4059,4134,4219,4273,4326,4415,4474,4511,4546,4584,4613,4631,4676,4736,4785,4847,4902,4980, 5076,5105,5127,5151,5164,5178,5189,5200,5218,5230,5242,5272,5324,5376,5420,5448,5476,5496, 5552,5592,5623,5673,5713,5759,5801,5830,5849,5885,5910,5932,5949,5968,5994,6024,6044,6059, 6080,6091,6099,6107,6126,6131,6139,6147,6158,6169,6177,6180,6189,6194,6198,6205,6208,6214, 6217,6222,6226,6231);

function loadchapverse(cbx){
	var chapindx = cbx.selectedIndex;
	var start_num = c_start_v_id[chapindx];
	var end_num = start_num + c_total_v[chapindx];
	var total_verses = end_num-start_num;
	build_verse_cbx(start_num, total_verses);
}

function clear_v_list_cbx(){
	while (qchapform.verse.options.length>1) {
		qchapform.verse.options[1] = null;	
	}
}

function build_verse_cbx(start_num,total_verses) {
	clear_v_list_cbx();	
	for (i = 1; i <= total_verses; i++) {
		qchapform.verse.options[i] = new Option(i, start_num);
	}	
	qchapform.verse.selectedIndex=1;
}


function loadchapverse(surah_cbx_id,ayah_cbx_id){
	var chapindx = document.getElementById(surah_cbx_id).selectedIndex;
	var start_num = c_start_v_id[chapindx];
	var end_num = start_num + c_total_v[chapindx];
	var total_verses = end_num-start_num;
	build_verse_cbx(ayah_cbx_id, start_num, total_verses);
}

function clear_list_cbx(ayah_cbx_id){
	versebx = document.getElementById(ayah_cbx_id);
	while (versebx.options.length>0) {
		versebx.options[0] = null;	
	}
}

function build_verse_cbx(ayah_cbx_id, start_num,total_verses) {
	clear_list_cbx(ayah_cbx_id);	
	versebx = document.getElementById(ayah_cbx_id);
	for (i = 0; i <total_verses; i++) {
		versebx.options[i] = new Option((i+1), (i+1));
	}	
	versebx.selectedIndex=1;
}


