
$(document).ready( function() {
	$('#offer_buttons li a').each(function(index){
		$(this).click(function(){
			$('#offer_buttons li').each(function(index2){
				if ( index2==index ) {
					$(this).addClass('active');
					$('#offer_item_'+index2).addClass('offer_item_active');
				} else {
					$(this).removeClass('active');
					$('#offer_item_'+index2).removeClass('offer_item_active');
				}
			});
		});
	});
});

// Forum UBB-code inserter function
function pS( text )
{
	var target = document.getElementById( 'message' );

	if ( target != null )
	{
		if ( typeof target.cursorPos != 'undefined' )
		{
			var cursorPos = target.cursorPos;
			cursorPos.text = cursorPos.text.charAt(cursorPos.text.length - 1) == ' ' ? text + ' ' : text;
		}
		else if ( typeof target.selectionStart != 'undefined' )
		{
			var sStart = target.selectionStart;
			var sEnd = target.selectionEnd;
			target.value = target.value.substr(0, sStart) + text + target.value.substr(sEnd, target.value.length);
			var nStart = sStart == sEnd ? sStart + text.length : sStart;
			var nEnd = sStart + text.length;
			target.setSelectionRange(nStart, nEnd);
		}
		else
		{
			target.value += text;
		}
		target.focus();
		storeCursor(target);
	}
}

var nurl = '';
function redirectdelay(u, s){
	nurl = u;
	setTimeout('redirecten()', (s*1000));
}
function redirecten(){
	window.location = nurl;
}
function getURL(v){
	location.href = v;
}
var imagetarget = '';
function selectImg(target,param){
	if(target){
		imagetarget = target;
	}
	var uri = '/portal/resourcemanager/popup/'+ (param ? param : '');
	var win = window.open(uri,'rm','width=800,height=600,scrollbars=1');
	if(!win){
		alert('popup blocked');
	}
}
function setImg(img){
	if(imagetarget == '' || imagetarget == 'f_edtmessage'){
		document.forms['replyfrm'].edtmessage.value+= '[resource]'+ img +'[/resource]';
	} else {
		e_preview = document.getElementById('rs_preview'+imagetarget);
		document.getElementById('rs_img'+imagetarget).value = img;
		document.getElementById('rs_hide'+imagetarget).checked = false;
		document.getElementById('rs_preview'+imagetarget).src = '/resource/'+img+'/thumb';
		document.getElementById('rs_preview'+imagetarget).style.display = 'block';
		imagetarget == '';
	}
}

function search(){
	f = document.forms['searchform'];
	q = f.query.value;
	c = f.selcat.options[f.selcat.selectedIndex].value;
	s = f.searchin.checked ? '&s='+ f.searchin.value : '';
	
	//window.location='?query='+q='&';

	var urlstring = window.location+'';
	var urlparts = urlstring.split('/');
	var type = urlparts[urlparts.length-1];
	switch(type){
		case 'pa':
		case 'sa':
			url_type = type;
			break;
		default:
			url_type = 'all';		
	}
	window.location = '/portal/portal/frontpage/all/'+ (c != '' ? c : 'all') + '/?query='+ q + s;
	
	// + url_type + '/' + s + '/' + q;
	//alert(location);
	//window.location = '/portal/portal/frontpage/'+ (c != '' ? c : 'all') + '/' + url_type + '/' + s + '/' +  '/' + q;
	/*

	window.location = '/portal/portal/frontpagesearch/' + q + (c != '' ? '/' + c : '');
	*/
}

var msg = '';
function check_if_phonenumber(t){
	v = t.value;
	error = false;
	act = document.getElementById('f_submit_activate');	
	act.disabled = true;
	if(v.length > 1 && v.substring(0,2) != '06'){
		if(v.length > 2 && v.substring(0,3) != '+31'){
			if(v.length > 3 && v.substring(0,4) != '0031'){
				error = true;
			} else {
				if(v.length > 3 && v.substring(0,4) == '0031'){
					t.value = '+31'+v.substring(4);
					t.className = '';
				}
			}
		} 
	} else {
		if(v.length > 1 && v.substring(0,2) == '06'){
			t.value = '+31'+v.substring(1);
			t.className = '';
		}
	}
	if(error){
		alert(msg);
		t.className = 'error';
		act.disabled = true;
	} else {
		if(v.length == '12' && v.substring(0,4) == '+316'){
			act.disabled = false;
		} else {
			act.disabled = true;
		}
	}
}
function setAction(v){
	if(v != 'upload_file'){
		file_found = false;
		inps = document.getElementsByTagName('INPUT');
		for(i=0;i<inps.length;i++){
			if(inps[i].type && inps[i].type == "checkbox" && inps[i].name.indexOf('list[]') != -1 && inps[i].checked == true){
				file_found = true;
			}
		}
		if(!file_found && msg != ''){
			alert(msg);
			return false;
		}
	}
	document.getElementById('f_action').value = v;
		
}

function checkAll(div, t){
	var inps = document.getElementById(div).getElementsByTagName('INPUT');
	for(i=0;i<inps.length;i++){
		if(inps[i].type && inps[i].type == "checkbox"){
			inps[i].checked = t.checked;
		}
	}
}
function searchin(w){
  className = w.checked == true ? '' : 'hidden';
	var el = document.getElementById('searchin_'+w.value);
	if(el != null){
		el.className = className;
	}
}
function charsLeft(field, msglength) {
	if(!msglength){ msglength = 255; }
	var smsText = new String(); 
	smsText.value = field.value; 
	if (smsText.value.length > msglength) { 
		smsText.value = smsText.value.substring(0, msglength); 
		field.value = smsText.value; 
	} 
	/*var span = document.getElementsByTagName("SPAN");
	for(i=0;i<span.length;i++){
		if(span[i].id && span[i].id == "chrleft"){
			span[i].innerHTML =  (msglength - smsText.value.length);
		}
	}*/
	document.getElementById("chrleft").value =  (msglength - smsText.value.length);
}
function checklbheight(){
    var count=0;
    var chk = document.getElementsByTagName('INPUT');
    for(i=0;i<chk.length;i++){
        if(chk[i].type && chk[i].type == 'checkbox' && chk[i].name && chk[i].name.substring(0,3) == 'chk' && chk[i].checked){
            count++;
        }
    }
    var div = document.getElementsByTagName('DIV');
    for(i=0;i<div.length;i++){ 
    	if(div[i].className && div[i].className == 'frontpage_leftbar'){
			div[i].style.height = ((90 * count-3) > 0 ? (90 * count-3)+705 : 700) + 'px';
		}
	}
}
function check_chkbox(tempobj){
	basename = tempobj.name.substring(4);
	divel = document.getElementById('div_'+basename);
	txtel = document.getElementById('txt_'+basename);
	if(tempobj.checked == true){
		divel.style.display = 'block';
		txtel.disabled = false;
		txtel.focus();
	} else {
		if(txtel.value == ""){
			divel.style.display = 'none';
			txtel.value = '';
			txtel.disabled = true;
		}
		else {
			if(txtel.value != "" && confirm(msg)){
				divel.style.display = 'none';
				txtel.value = '';
				txtel.disabled = true;
			} else {
				tempobj.checked = true;
			}
		}
	}
    checklbheight();
}

function setQuoteContent(divId,ajaxIndex){
	var targetObj = document.getElementById(divId);
	if(targetObj == null){
		var txtareas = document.getElementsByTagName('TEXTAREA');
		for(i=0;i<txtareas.length;i++){
			if(txtareas[i].name == divId || txtareas[i].name == divId.substring(2)){
				targetObj = txtareas[i];
			}
		}
	}
	var msg = dynamicContent_ajaxObjects[ajaxIndex].response + '';
	targetObj.value += "[q]"+msg+"[/q]\n\n";
	targetObj.focus();
}

function setQuote(sid){
		var url = '/portal/forum/forum/?action=do_getpostmsgajax&post_id_str='+sid+'&random='+ Math.random();
	ajax_loadContent('edtmessage',url,true,'setQuoteContent(divId,ajaxIndex);');
}

function setHelp(divId,ajaxIndex){
		var targetObj = document.getElementById(divId);
		var deel = dynamicContent_ajaxObjects[ajaxIndex].response.split('|||');
		document.getElementById('helptitle').innerHTML = deel[0];
		document.getElementById(divId).innerHTML = deel[1];
}

function loadHelp(sid){
	var url = '/portal/help/help/?action=do_loadhelp_ajax&id='+sid+'&random='+ Math.random();
	ajax_loadContent('helpcontent',url,true,'setHelp(divId,ajaxIndex);');
}

function setHelpTopics(divId,ajaxIndex){
		var targetObj = document.getElementById(divId);
		targetObj.innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;
}

function searchHelpTopics(f){
	var url = '/portal/help/help/?action=do_searchhelp_ajax&search='+document.forms[f].search.value+'&random='+ Math.random();
	ajax_loadContent('helpresult',url,true,'setHelpTopics(divId,ajaxIndex);');
}

function setMailNickname(nickname){
	fid = 'f_to';
	if(document.getElementById('f_importto')){
		fid = document.getElementById('f_importto').value;
	}
	var sendto = document.getElementById(fid).value;
	check = sendto+', ';
	// check if nickname is listed
	if(check.indexOf(nickname+', ') == -1){
		//document.getElementById(fid).value = sendto == "" ? nickname : sendto + ', ' + nickname;
		document.getElementById(fid).value = nickname;
	}
}
function searchNicknames(f){
	var url = '/portal/portal/register?action=do_search_nicknamesajax&search='+f.search.value+'&random='+ Math.random();
	ajax_loadContent('result',url,true,'setNickNameSearch(divId,ajaxIndex);');
}

function getPurchaseActionFee(price){
	var url = location.href + '?action=get_ajax_fee&price=' + price;
	ajax_loadContent('f_fee',url,true);
}

function setNickNameSearch(divId,ajaxIndex){
		var targetObj = document.getElementById(divId);
		targetObj.innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;
}

function loadSuggestion(f){
	var url = '/portal/portal/register?action=do_register_suggestionajax&nickname='+f.nickname.value+'&emailaddress='+f.emailaddress.value+'&random='+ Math.random();
	//ajax_loadContent('nickNameSuggestion',url);
	ajax_loadContent('nickNameSuggestion',url,true,'setNickNameSuggestion(divId,ajaxIndex);');
}

function setNickNameSuggestion(divId,ajaxIndex){
		var targetObj = document.getElementById(divId);
		targetObj.innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;
		targetObj.focus();
}

function setNickName(nick){

	document.getElementById('f_nickname').value = nick;
	document.getElementById('nickNameSuggestion').innerHTML = '';
}

var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop-1;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=170+this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
this.positionshim() //call iframe shim function
}
},

positionshim:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj.style.left
this.shimobject.style.top=this.dropmenuobj.style.top
}
this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
}
},

hideshim:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
if (window.createPopup && !window.XmlHttpRequest){ //if IE5.5 to IE6, create iframe for iframe shim technique
document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
this.shimobject=document.getElementById("iframeshim") //reference iframe object
}
}

}

function makeClickable(div){
	var bar = document.getElementById(div);
	if(bar){
		var divs = bar.getElementsByTagName("DIV");
		for(var i=0;i<divs.length;i++){
			if(divs[i].className && divs[i].className == "btn"){
				var a = divs[i].getElementsByTagName("A");
				if(a.length > 0){ 
					divs[i].onclick = function(){
						location.href=this.getElementsByTagName("A")[0].href; 
						
					}
					divs[i].onmouseover = function(){
						this.className = 'btnhover';
						if(typeof(this.getElementsByTagName("A")[0].onmouseover) == "function" && navigator.userAgent.indexOf("MSIE") != -1){
							this.getElementsByTagName("A")[0].onmouseover();
						}
						/*if(this.getElementsByTagName("A")[0].onmouseover != null){
							this.getElementsByTagName("A")[0].onmouseover();
						}*/
					}
					divs[i].onmouseout = function(){
						this.className = 'btn';
					}
				}
			}
		}
	}
}	
function showDiv(w){
		if(w == 'tree'){
			document.getElementById('treediv').style.display='block';
			document.getElementById('help').style.display='none';
		} else {
			document.getElementById('treediv').style.display='none';
			document.getElementById('help').style.display='block';
		}
}

var ul_active = 0;
var pid;
function setActiveOrder(order){
	var ul = document.getElementById("cartlist").getElementsByTagName("UL");
	// set hidden
	for(i=0;i<ul.length;i++){
		pid = ul[i].id.substring(8);
		ul[i].className = ul[i].id && ul[i].id == 'details_'+order ? '' : 'hidden';
		document.getElementById('gfx_'+pid).src= ul[i].id && ul[i].id != 'details_'+order ? '/gfx/plus.gif' : '/gfx/min.gif';
		if(ul[i].id && ul[i].id == 'details_'+order){ ul_active = i; }
	}
}

function wFormatValuta(amount) {
	return '&euro;&nbsp;'+parseFloat(amount).toFixed(2);
}

/**
	Updating the total price for a product in the cart
*/
function setPrice(what, oid){
	var pid = what.id.substring(2);
	var amount = document.getElementById('p_'+pid).value;
	var total = amount * what.value;
	document.getElementById('t_'+pid).innerHTML = wFormatValuta(total);
	updateTotal(oid);
}

function setShipping(what, oid){
	var price = document.getElementById('shipping_' + what.value).value;
	document.getElementById('shippingtotal_'+oid).innerHTML = wFormatValuta(price);
	document.getElementById('shippingtotal_intern_'+oid).value = price;
	updateTotal(oid);
}

/**
	Update the total amount in the cart
*/
function updateTotal(pid){
	var ordertotal = 0;
	
	var ul = document.getElementById("cartlist").getElementsByTagName("UL");
	// Products
	td = ul[ul_active].getElementsByTagName("INPUT");
	for(i=0;i<td.length;i++){
		if(td[i].id){
			if(td[i].id.substring(0,2) == 'a_'){
				amount = parseFloat(td[i].value);
			}
			if(td[i].id.substring(0,2) == 'p_'){
				ordertotal+= parseFloat(td[i].value * amount);
			}
		}
	}
	// Products subtotal
	document.getElementById('productsubtotal_'+pid).innerHTML = wFormatValuta(ordertotal);
	
	ordertotal+= parseFloat(document.getElementById('extracosts_intern_'+pid).value);
	ordertotal+= parseFloat(document.getElementById('shippingtotal_intern_'+pid).value);

	// Total
	td = ul[ul_active].getElementsByTagName("SPAN");
	for(i=0;i<td.length;i++){
		if(td[i].id){
			if(td[i].id.substring(0,11) == 'ordertotal_'){
				td[i].innerHTML = wFormatValuta(ordertotal);
			}
		}
	}
	
	// Update total
	document.getElementById('ordertotal_intern_'+pid).value = ordertotal;
	
	updateCartTotal();
}

/**
	Update the total amount in the cart (of all orders)
*/
function updateCartTotal(){
	var carttotal = 0;
	td = document.getElementsByTagName("INPUT");
	for(i=0;i<td.length;i++){
		if(td[i].id && td[i].id.substring(0,18) == 'ordertotal_intern_'){
			carttotal+= parseFloat(td[i].value);
		}
	}
	document.getElementById('carttotal').innerHTML = wFormatValuta(carttotal);
}

function pngFix(){
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if ((version >= 5.5) && (document.body.filters)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
	      var img = document.images[i]
	      var imgName = img.src.toUpperCase()
	      if (imgName.substring(imgName.length-3, imgName.length) == "PHP")
	      {
	         var imgID = (img.id) ? "id='" + img.id + "' " : ""
	         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
	         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
	         var imgStyle = "display:inline-block;" + img.style.cssText 
	         if (img.align == "left") imgStyle = "float:left;" + imgStyle
	         if (img.align == "right") imgStyle = "float:right;" + imgStyle
	         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	         var strNewHTML = "<span " + imgID + imgClass + imgTitle
	         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
	         img.outerHTML = strNewHTML
	         i = i-1
	      }
	   }
	}
}

function hidebtns(el){
	if(el != '' && document.getElementById(el)){
		document.getElementById(el).style.display = 'none';
	}
}

var amount = 0;
var fl;
var txt_file = '';
var txt_desc = '';
var txt_name = '';
function setFileUploadOptions(c){
	if(amount <= c){
		fl = document.getElementById('f_filelist');	
	
		for(i=(amount*1+1);i<=c;i++){
			var div = document.createElement('div');
			div.id = 'div_' + i;
			div.style.width = '400px';
			
			var div1 = document.createElement('div');
				div1.className = 'w120 float';
			var	txt1 = document.createTextNode(txt_file);
			
			var ele = document.createElement('input');
				ele.type = 'file';
				ele.name = 'file[]';
				ele.size = '20';
			
			div1.appendChild(txt1);
			div.appendChild(div1);
			div.appendChild(ele);
			
			/*
			var new_br = document.createElement( 'br' );
			div.appendChild(new_br);
			
			var div1 = document.createElement('div');
				div1.className = 'w120 float';
			var	txt1 = document.createTextNode(txt_desc);
								
			var textarea = document.createElement( 'textarea' );
					textarea.name = 'desc_' + i;
					textarea.id = 'desc_' + i;
					textarea.cols = '29';
					textarea.rows = '3';
					
			div1.appendChild(txt1);
			div.appendChild(div1);
			div.appendChild(textarea);
			
			var new_br = document.createElement( 'br' );
			div.appendChild(new_br);
					
			var div1 = document.createElement('div');
				div1.className = 'w120 float';
			var	txt1 = document.createTextNode(txt_name);
		
			var input = document.createElement( 'input' );
			input.name = 'name_' + i;
			input.id = 'name_' + i;
			input.size = '36';
						
			div1.appendChild(txt1);
			div.appendChild(div1);
			div.appendChild(input);
			*/
			var new_br = document.createElement( 'br' );
			div.appendChild(new_br);
			
			var new_br = document.createElement( 'br' );
			div.appendChild(new_br);
			fl.appendChild(div);
	
		}
		amount = c;
	} else {
		while(amount != c){
			//alert(amount + '>=' + c);
			if(document.getElementById('div_'+amount)){
				fl.removeChild(document.getElementById('div_'+amount));
			}
			amount--;
		}
	}
}
/*window.onload = function(){
	makeClickable('topbar');
	makeClickable('dropmenuprofile');
	initTree();
	pngFix();
}*/

