function derle(no){
	var categories = document.getElementById("categories");
	// var catbox = new Array()
	var icon = new Array()
	var bga = new Array()
	var permission = new Array()
	var catlink = new Array()
	var subcat = new Array()
	for (var i=1;i<no+1;i++){
		// catbox[i] = document.getElementById("categorybox"+i);
		 icon[i] = document.getElementById("icon"+i).value;
		 bga[i] = document.getElementById("bg"+i).value;
		 permission[i] = document.getElementById("permissions"+i).value;
		 catlink[i] = document.getElementById("category"+i).value;
		 subcat[i] = document.getElementById("subcategory"+i).value;
	}
		var osman = '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="636" height="60" class="genel">'
					 for (var z=1;z<no+1;z++){
						if (z%3==1){
						 	osman += '<tr>'
						}
						osman += '<td width="51" height="50" align="center" valign="top">' +icon[z]+ '</td><td width="160" height="50" valign="top"><table width="158" class="genel"><tr>'
        				osman += '<td width="100%" height="20" align="right" background="' +bga[z]+ '" />' +permission[z]+ '</td></tr>'
						osman += '<tr><td height="15" valign="top">' + catlink[z] + '</td></tr><tr><td height="50" valign="top">' + subcat[z] +'</td></tr></table></td>'
						if (z%3==3){
						 	osman += '</tr>'
						}
					}
					osman += '</table>';
					categories.innerHTML = osman;
}

function dopingdc(no,onek){
	var dcategories = document.getElementById(onek+"categories");
	var icon = new Array()
	var bga = new Array()
	var permission = new Array()
	var catlink = new Array()
	for (var i=1;i<no+1;i++){
		 icon[i] = document.getElementById(onek+"icon"+i).value;
		 bga[i] = document.getElementById(onek+"bg"+i).value;
		 permission[i] = document.getElementById(onek+"permissions"+i).value;
		 catlink[i] = document.getElementById(onek+"category"+i).value;
	}

	var yazilacak = '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="636" class="genel">'
				    yazilacak += '<tr><td width="25"></td><td width="187"></td><td width="25"></td><td width="187"></td><td width="25"></td><td width="187"></td></tr>'
					for (var z=1;z<no+1;z++){
						if (z%3==1){
							yazilacak += '<tr>'
						}
						yazilacak += '<td width="4%" height="24" align="center">' +icon[z]+ '</td><td width="29%" height="24"><table width="100%" class="genel" border="0" style="border-collapse: collapse" cellpadding="0" cellspacing="0"><tr>'
						yazilacak += '<td width="74%" height="24">' +catlink[z]+ '</td><td width="26%" align="center" height="24" background="' +bga[z]+ '">' + permission[z] + '</td></tr></table></td>'
						if (z%3==3){
						 	yazilacak += '</tr>'
						}		
					}				
					yazilacak += '</table>'
					dcategories.innerHTML = yazilacak;
					yazilacak='';
}					
function dopingimg(imgkutu,no){
	var dimages = document.getElementById(imgkutu);
	var bga = new Array()
	var permission = new Array()
	var image = new Array()
	for (var i=1;i<no+1;i++){
		 bga[i] = document.getElementById("imagebg"+i).value;
		 permission[i] = document.getElementById("imagepermission"+i).value;
		 image[i] = document.getElementById("image"+i).value;
	}
	var yazilacak = '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" width="630" class="genel">'
					yazilacak += '<tr><td width="154"></td><td width="154"></td><td width="154"></td><td width="154"></td></tr>'
					for (var z=1;z<no+1;z++){
						if (z%4==1){
							yazilacak += '<tr>'
						}
					yazilacak += '<td width="154" height="166" align="center" background="' +bga[z]+ '">' + '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" width="152" height="146" class="genel">'
					yazilacak += '<tr><td width="129" height="166" align="center" class="ufakyazilar">' +image[z]+ '</td><td width="20" height="166" align="center">' +permission[z]+ '&nbsp;</td>'
					//	if (z%4!=4){
							yazilacak += '<td width="3" height="166" align="center"></td>'
					//	}
					yazilacak += '</tr></table></td>'
						if (z%4==4){
							yazilacak += '</tr>'
						}
					}
					yazilacak += '</table>'
					dimages.innerHTML = yazilacak;
}