document.write('<script type="text/javascript" src="all_db.js"></script>');

function print_2d_array(array) 
{ 
	document.writeln ("<table border>") ;
	for (var row = 0; row < array.length; row++)
	{ 
		document.writeln (" <tr>");
			for (var col = 0; col < array[row].length; col++) 
				document.writeln (" <td>" + array[row][col] + "</td>"); 
		document.writeln (" </tr>"); 
	} 
	document.writeln ("</table>");
}

function print_array_type(array, type)
{
	document.writeln ("<table style='font-size:0.7em;'>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][3] == type){
			document.writeln (" <tr>");
			for (var col = 0; col < array[row].length; col++) 
				document.writeln (" <td>" + array[row][col] + "</td>"); 
			document.writeln (" </tr>"); 
		}
	} 
	document.writeln ("</table>");
}


function print_array_type_count(array, type, lines){ // added lines for line
	document.writeln ("<table border style='font-size:0.7em;'>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][3] == type &&  (lines > 0 || lines == "all") ){ //&&  (lines > 0 || lines == "all")
			document.writeln (" <tr style='background-color: green;'>");
			for (var col = 0; col < array[row].length; col++) 
				document.writeln (" <td>" + array[row][col] + "</td>"); 
			document.writeln (" </tr>"); 
			if (lines > 0 ) { lines--; } // added line for lines
		}
	} 
	document.writeln ("</table>");
	
}




function print_2d_array_nouveautes(array) 
{ 
var line = 0;
	document.writeln ("<table border=0 cellspacing=1 cellpadding=5>") ;
	for (var row = 0; row < array.length; row++)
	{ 
//			for (var col = 0; col < array[row].length; col++) 
//				document.writeln (" <td>" + array[row][col] + "</td>"); 

		if (line == 0){
		document.writeln (" <tr style='background-color: lightgreen;'>");
				document.writeln (" <td>" + array[row][5] + "</td>"); 
				document.writeln (" <td><a href='" + array[row][4] + "'>" + array[row][1] + "</a></td>"); 
				document.writeln (" <td>" + array[row][6] + "</td>"); 
		document.writeln (" </tr>"); 
				line++;
				}
				else{
		document.writeln (" <tr style='background-color: lightblue;'>");
				document.writeln (" <td>" + array[row][5] + "</td>"); 
				document.writeln (" <td><a href='" + array[row][4] + "'>" + array[row][1] + "</a></td>"); 
				document.writeln (" <td>" + array[row][6] + "</td>"); 
		document.writeln (" </tr>"); 
				line--;
				}

	} 
	document.writeln ("</table>");
}

//bibliotheque nouveautes - table
function bibliotheque_nouveautes_table(array, type, lines) 
{ 
var line = 0;
	document.writeln ("<table class='tbmain1' cellpadding='6' cellspacing='1'>") ;
	for (var row = 0; row < array.length; row++)
	{ 
		if  (array[row][2] == type && (lines > 0 || lines == "all") ){
			if (line == 0  ){
			document.writeln (" <tr style='background-color: #EBEBEB;'>");
					document.writeln (" <td width=125 align='center'>" + array[row][3] + "</td>"); 
					document.writeln (" <td><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a></td>"); 
					document.writeln (" <td width='60' align='center'>" + array[row][6] + "</td>"); 
			document.writeln (" </tr>"); 
					line++;
					}
					else  {
			document.writeln (" <tr style='background-color: #D4D4D4'>");
					document.writeln (" <td width=125 align='center'>" + array[row][3] + "</td>"); 
					document.writeln (" <td><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a></td>"); 
					document.writeln (" <td width='60' align='center'>" + array[row][6] + "</td>"); 
			document.writeln (" </tr>"); 
					line--;
					}
			if (lines > 0 ) { lines--; }
		}
	} 
	document.writeln ("</table>");
}




/*for nouveautes page without type option*/
function nouveautes_simple_list(array, lines) 
{ 
	document.writeln ("<ul type='square' style='margin-left:30px; margin-right:30px;'>") ;
	for (var row = 0; row < array.length; row++){ 
		if  (lines > 0 || lines == "all"){
					document.writeln (" <li><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a>&nbsp;-&nbsp;"); 
					document.writeln (" <em>" + array[row][3] + "</em>&nbsp;&nbsp;"); 
					document.writeln (array[row][6] + "</li>"); 
			if (lines > 0 ){ lines--; }
		}
	} 
	document.writeln ("</ul>");
}

/*for nouveautes page with type option - general*/
function nouveautes_simple_list1(array, type, lines) 
{ 
	document.writeln ("<ul type='square' style='margin-left:30px; margin-right:30px;'>") ;
	for (var row = 0; row < array.length; row++){ 
		if  (array[row][3] == type && (lines > 0 || lines == "all")){
					document.writeln (" <li><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a>&nbsp;"); 
					document.writeln ("<img src='" + array[row][7] + "'/>&nbsp;-&nbsp;"); 
					document.writeln (array[row][6] + "</li>"); 
			if (lines > 0 ){ lines--; }
		}
	} 
	document.writeln ("</ul>");
}

/*for nouveautes page with type option - sermon du vendredi*/
function nouveautes_simple_list_sermon(array, type, lines) 
{ 
	document.writeln ("<ul type='square' style='margin-left:30px; margin-right:30px;'>") ;
	for (var row = 0; row < array.length; row++){ 
		if  (array[row][3] == type && (lines > 0 || lines == "all")){
					document.writeln (" <li><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a>&nbsp;"); 
					document.writeln ("<img src='" + array[row][7] + "'/>&nbsp;-&nbsp;"); 
					document.writeln ("<em>d&eacute;livr&eacute; le&nbsp;" + array[row][11] + "</em></li>"); 
			if (lines > 0 ){ lines--; }
		}
	} 
	document.writeln ("</ul>");
}

/*for nouveautes page without type option - questions et reponses*/
function nouveautes_simple_list_questionsetreponses(array, lines) 
{ 
	document.writeln ("<ul type='square' style='margin-left:30px; margin-right:30px;'>") ;
	for (var row = 0; row < array.length; row++){ 
		if  (lines > 0 || lines == "all"){
					document.writeln (" <li><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a>&nbsp;-&nbsp;"); 
					document.writeln (array[row][6] + "</li>"); 
			if (lines > 0 ){ lines--; }
		}
	} 
	document.writeln ("</ul>");
}



//to check to which it corresponds
function nouveautes_table(array, type, lines) 
{
	document.writeln ("<table border style='font-size:0.7em;'>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][3] == type && (lines > 0 || lines == "all") ){
			document.writeln (" <tr style='background-color: green;'>");
				document.writeln (" <td width='80'>" + array[row][1] + "</td>"); 
				document.writeln (" <td>" + array[row][5] + "</td>"); 
				document.writeln (" <td>" + array[row][6] + "</td>"); 
			document.writeln (" </tr>"); 
			if (lines > 0 ) { lines--; }
		}
	} 
	document.writeln ("</table>");
}

//for articles - simple list
function print_array_type_nouveautes_simple(array, type) 
{
	document.writeln ("<ul type='square'>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][9] == type){
					document.writeln (" <li class='limarginleftbottom'><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a>"); 
					document.writeln ("<a href='" + array[row][5] + "'><img src='" + array[row][6] + "' width='13' height='13'></a></li>"); 
		}
	} 
	document.writeln ("</ul>");
}


//for all kind of videos - table
function videos_table(array, type, lines) 
{
	for (var row = 0; row < array.length; row++){
			if(array[row][3] == type && (lines > 0 || lines == "all") ){
				document.writeln ("<div id='div700x105box'><img src='" + array[row][4] + "' align=left hspace=30 vspace=20>"); 
//				document.writeln ("<h1 class='h1title5'><a class='title5' href=' " + array[row][5] + "'>");
				document.writeln ("<h1 class='h1title5'><a class='title5' href='videos.html?code=" + array[row][0] + "'>");
				document.writeln (array[row][1] + "</a></h1>");
				document.writeln ("<p class=p700widthboxtext>" + array[row][10] + "</p></div>"); 
			if (lines > 0 ) { lines--; }
		}
	} 
}

// display Questions and answers
function dspQanda(array, type, lines) 
{
	for (var row = 0; row < array.length; row++){
			if(array[row][3] == type && (lines > 0 || lines == "all") && array[row][0] == array[row][13]){
				document.writeln ("<div id='div700x105box'><img src='" + array[row][4] + "' align=left hspace=30 vspace=20>"); 
//				document.writeln ("<h1 class='h1title5'><a class='title5' href=' " + array[row][5] + "'>");
				document.writeln ("<h1 class='h1title5'><a class='title5' href='videos.html?code=" + array[row][0] + "'>");
				document.writeln (array[row][1] + "</a></h1>");
				document.writeln ("<p class=p700widthboxtext>" + array[row][10] + "</p></div>"); 
			if (lines > 0 ) { lines--; }
		}
	} 
}


function displayDars(code, array) 
{
//	document.write(code);
//	document.write(array);
	for (var row = 0; row < array.length; row++){
			if(array[row][0] == code){
				document.writeln ("<h1 class=h1videotitle align=center>" + array[row][1] +  "</h1>"); 
				document.writeln ("<div align=center>");
				document.writeln ("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='502' height='411' id='FLVPlayer'>");
				document.writeln ("<param name='movie' value='FLVPlayer_Progressive.swf' />");
                document.writeln ("<param name='salign' value='lt' />");
                document.writeln ("<param name='quality' value='high' />");
                document.writeln ("<param name='scale' value='noscale' />");
                document.writeln ("<param name='FlashVars' value='&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=" + array[row][12] +"&autoPlay=true&autoRewind=true' />");
                document.writeln ("<embed src='FLVPlayer_Progressive.swf' flashvars='&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=" + array[row][12] +"&autoPlay=true&autoRewind=true' quality='high' scale='noscale' width='502' height='411' name='FLVPlayer' salign='LT' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  /></object></div>");
				document.writeln ("<p align=left style='background-color: #ffffF0; padding: 10px; margin: 10px 0 0 0; border: 1px solid #ffffC0;'>");
				document.writeln ("<b>Nom:</b> " + array[row][3] + "<br />");
				document.writeln ("<b>Date:</b> " + array[row][11] + "<br />");
				document.writeln ("<b>Dur&eacute;e:</b> " + array[row][8] + "<br />");
				document.writeln ("<b>Description:</b> " + array[row][10] + "<br />");
				document.writeln ("</p>");
//				document.writeln ("<h1 class='h1title5'><a class='title5' href=' " + array[row][5] + "'>");
//				document.writeln ("<h1 class='h1title5'><a class='title5' href='dars.html?code=" + array[row][0] + "'>");
//				document.writeln (array[row][1] + "</a></h1>");
//				document.writeln ("<p class=p700widthboxtext>" + array[row][10] + "</p></div>"); 
//			if (lines > 0 ) { lines--; }
		}
	} 
}


function displayQanda(code, array) 
{
	var parent;
	var data;
	data = "";
	var part = 0;
	for (var row = 0; row < array.length; row++){
		if(array[row][0] == code ){
			parent = array[row][13];
		}
	} 

	for (var row = 0; row < array.length; row++){
		if(array[row][0] == code ){
			part++;
			document.writeln ("<h1 class=h1videotitle align=center>" + array[row][1] +  "</h1>"); 
			document.writeln ("<div align=center>");
			document.writeln ("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='502' height='411' id='FLVPlayer'>");
			document.writeln ("<param name='movie' value='FLVPlayer_Progressive.swf' />");
			document.writeln ("<param name='salign' value='lt' />");
			document.writeln ("<param name='quality' value='high' />");
			document.writeln ("<param name='scale' value='noscale' />");
			document.writeln ("<param name='FlashVars' value='&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=" + array[row][12] +"&autoPlay=true&autoRewind=true' />");
			document.writeln ("<embed src='FLVPlayer_Progressive.swf' flashvars='&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=" + array[row][12] +"&autoPlay=true&autoRewind=true' quality='high' scale='noscale' width='502' height='411' name='FLVPlayer' salign='LT' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  /></object></div>");
			document.writeln ("<p align=left style='background-color: #ffffF0; padding: 10px; margin: 10px 0 20px 0; border: 1px solid #ffffC0;'>");
			document.writeln ("<b>Nom:</b> " + array[row][3] + "<br />");
			document.writeln ("<b>Date:</b> " + array[row][11] + "<br />");
			document.writeln ("<b>Dur&eacute;e:</b> " + array[row][8] + "<br />");
			document.writeln ("<b>Description:</b> " + array[row][10] + "<br />");
			document.writeln ("</p>");
		} 
		else if( array[row][13] == parent ){
			part++;
			data += "<h1 align=center style='font-weight:normal; line-height:20px;'><a class='title5' href='videos.html?code=" + array[row][0] + "'>" + array[row][1] /*+" - Partie " + part */+ "</a></h1>";
		}

	} 
	document.writeln ( data );
}



// for books
function tb_table(array, type, lines) 
{
	for (var row = 0; row < array.length; row++){
			if(array[row][3] == type && (lines > 0 || lines == "all") ){
				document.writeln ("<div id='div700x200box'><img src='" + array[row][4] + "' align=left hspace=20 vspace=30 width=105 height=140>"); 
				document.writeln ("<h1 class='h1title5'><a class='title5' href=' " + array[row][5] + "'>");
				document.writeln (array[row][1] + "</a></h1>");
				document.writeln ("<p class=p700widthboxtext>" + array[row][10] + "</p></div>"); 
			if (lines > 0 ) { lines--; }
		}
	} 
}

//for questions and answers section - simple
function questionanswer_simple(array, type, lines) 
{
	for (var row = 0; row < array.length; row++){
			if(array[row][3] == type && (lines > 0 || lines == "all") ){
				document.writeln ("<a href=' " + array[row][5] + " '><p><strong>Question:&nbsp;</strong>" + array[row][1] + "</p></a>"); 
			if (lines > 0 ) { lines--; }
		}
	} 
}

//for questions and answers section - simple
function questionanswer_simple_nouveautes(array, type, lines) 
{
	document.writeln  ("<table style='border-style:solid; border-width=1px; '>");
	for (var row = 0; row < array.length; row++){
			if(array[row][2] == type && (lines > 0 || lines == "all") ){
				document.writeln ("<p>" + array[row][10] + "&nbsp;<a href=' " + array[row][5] + " '><strong>Question:&nbsp;</strong>" + array[row][1] + "</p></a>"); 
			if (lines > 0 ) { lines--; }
		}
	} 
}

//for questions and answers section nouveatues - table
function questionanswer_table_nouveautes(array, type, lines) 
{
	document.writeln ("<table>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][2] == type && (lines > 0 || lines == "all") ){
			document.writeln (" <tr valign=top>");
				document.writeln (" <td width=50px>" + array[row][10] + "</td>"); 
				document.writeln (" <td><a href='" + array[row][5] + "'><strong>Question:&nbsp;</strong>" + array[row][1] + "</a></td>"); 
			document.writeln (" </tr>"); 
		if (lines > 0 ) { lines--; }
		}
	} 
	document.writeln ("</table>");
}



//for sermons du vendredi - simple list
function sermons_du_vendredi_simple(array, type) 
{
	document.writeln ("<ul type='square'>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][3] == type){
			document.writeln ("<li class='limarginleftbottom'><a class='title5' href='" + array[row][5] + "'>" + array[row][1] + "</a>"); 
					document.writeln ("&nbsp;-&nbsp;<em>D&eacute;livr&eacute; le&nbsp;" + array[row][11] + "</em></li>"); 
		}
	} 
	document.writeln ("</ul>");
}


//majlis-e-amla one table for all
function majliseamla_table(array) 
{ 
	document.writeln ("<table bgcolor='#CCCCCC' width=690px>") ;
	for (var row = 0; row < array.length; row++){ 
		document.writeln ("<tr>");
				document.writeln (" <td width=300>" + array[row][0] + "</td>" + " <td width=390>" + array[row][1] + "&nbsp;Sahib</td>"); 
		document.writeln ("</tr>"); 
	} 
	document.writeln ("</table>");
}


//for majlis-e-amla individual data - table
function majliseamla_individual_table(array, type, lines)
{
	document.writeln ("<table width='700px'>") ;
	for (var row = 0; row < array.length; row++){
			if(array[row][5] == type && (lines > 0 || lines== "all") ){
			document.writeln ("<tr valign='top' height='120px'>");
				document.writeln ("<td width='80px'> <img src='" + array[row][4] + "'></td>"); 
				document.writeln ("<td>" + array[row][0] + "<br /><p><strong>Nom et Pr&eacute;nom:</strong>&nbsp;" + array[row][1] + " Sahib</p></td>"); 
			document.writeln ("</tr><tr><td colspan='2'><hr id='hrdatabasetables'></td></tr>"); 
			if (lines > 0) {lines--;}
		}
	} 
	document.writeln ("</table>");
}


// for collect data from database
function test(array, type, lines)
{
	document.writeln ("<table width=5000>") ;
	for (var row = 0; row < array.length; row++){
			if(array[row][3] == type && (lines > 0 || lines== "all") ){
			document.writeln ("<tr>");
				document.writeln ("<td>" + array[row][0] + "</td>"); 
				document.writeln ("<td>" + array[row][1] + "</td>"); 
				document.writeln ("<td>" + array[row][2] + "</td>"); 
				document.writeln ("<td>" + array[row][3] + "</td>"); 
				document.writeln ("<td>" + array[row][4] + "</td>"); 
				document.writeln ("<td>" + array[row][5] + "</td>"); 
				document.writeln ("<td>" + array[row][6] + "</td>"); 
				document.writeln ("<td>" + array[row][7] + "</td>"); 
				document.writeln ("<td>" + array[row][8] + "</td>"); 
				document.writeln ("<td>" + array[row][9] + "</td>"); 
				document.writeln ("<td>" + array[row][10] + "</td>"); 
				document.writeln ("<td>" + array[row][11] + "</td>"); 
				document.writeln ("<td>" + array[row][12] + "</td>"); 
			document.writeln ("</tr>"); 
			if (lines > 0) {lines--;}
		}
	} 
	document.writeln ("</table>");
}


//ramadhanpage general - table
function ramadhan_table(array, type) 
{
	document.writeln ("<ul type=square>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][9] == type){
					document.writeln ("<li class=articleslist><a class=articletitle href='" + array[row][5] + "'>" + array[row][1] + "</a></li>"); 
		}
	} 
	document.writeln ("</ul>");
}

//ramadhanpage sermon du vendredi - table
function ramadhan_sermonduvendredi_table(array, type) 
{
	document.writeln ("<ul type=square>") ;
	for (var row = 0; row < array.length; row++){
		if(array[row][9] == type){
					document.writeln ("<li class=articleslist><a class=articletitle href='" + array[row][5] + "'>" + array[row][1] + "</a>"); 
					document.writeln ("<img src='" + array[row][7] + "'>&nbsp;&nbsp;<em>" + array[row][11] + "</em></li>");
		}
	} 
	document.writeln ("</ul>");
}



// display Questions and answers
function dspNouveautes(array, lines) 
{
	for (var row = 0; row < array.length; row++){ 
		if  (lines > 0 || lines == "all"){
				document.writeln ("<div id='div500x120box'><img src='" + array[row][4] + "' align=left hspace=30 vspace=20>"); 
				document.writeln ("<h1 class='h1title5'><a class='title5' href=' " + array[row][5] + "'>");
				document.writeln (array[row][1] + "</a></h1>");
				document.writeln ("<p class=p500widthboxtext>" + array[row][10] + "</p></div>"); 
			if (lines > 0 ){ lines--; }
		}
	} 
}



// get parameters from url -- start


/*		
		var qsParm = new Array();
		function qs() {
		var query = window.location.search.substring(1);
//		document.write(query + "<br>");
		var parms = query.split('&');
//		document.write(parms[0] + "<br>");
//		document.write(parms[1] + "<br>");
			for (var i=0; i<parms.length; i++) {
				var pos = parms[i].indexOf('=');
//				document.write(parms[i].indexOf('=')); //  position of =
				if (pos > 0) {
					var key = parms[i].substring(0,pos);
//					document.write(key); //  position of =
					var val = parms[i].substring(pos+1);
//					document.write(val); //  position of =
					qsParm[key] = val;
//					document.write("qsParm = " + qsParm[key]); //  position of =
				}
			}
		}


qsParm['code'] = null;
		qsParm['desc'] = null;
		qsParm['name'] = null;
		qsParm['surname'] = null;

		if (qsParm['code'] && qsParm['desc'])
		document.write('You selected' + qsParm['code'] + ' : ' + qsParm['desc']);

		if (qsParm['name'] && qsParm['surname'])
		document.write('You selected' + qsParm['name'] + ' : ' + qsParm['surname']);
*/
// get parameters from url -- end


