var $S=new Object();
$S.select=function(f,d,s){
	var i=$('#'+f)[0];
	var n=1;
	i.length=1;
	i.options[n-1].text = 'Any';
	i.options[n-1].value = 0;
	for(var x in d){
		i.length=n+1;
		s==x?i.options[n].selected='true':null;
		i.options[n].text = d[x][0];
		i.options[n].value = x;
		n++;
	}
}
function CT(v,s){
	if (v==undefined||v==''||v==null)return;
	$('#modelid').attr( 'disabled', 'true' );
	$.get( installdir + 'ajax.php?action=gettype&tid=1&fid=' + v , 
		function(D){
			$('#modelid').removeAttr( 'disabled' );
			var A=D.split('#');
			var i=$('#modelid')[0];
			var n=1;
			i.length=1;
			i.options[0].text = 'Any';
			i.options[0].value = 0;
			 
			 
			for(var x in A){
				var ar = A[x].split('|');
				i.length=n+1;
				s==ar[0]?i.options[n].selected='true':null;
				i.options[n].text = ar[1];
				i.options[n].value = ar[0];
				n++;
			}
			
		}
	)
}
function Mnum(f,d,s,o){
	var i=$('#'+f)[0];
	var n=0;
	if (o!=null&&o!=undefined){
		i.length = 1;
		i.options[0].value = o.value;
		i.options[0].text = o.text;
		n++;
	}
	if ( d.order == 'desc' ) {
	for(var x = d.max; x>=d.min;x=x-d.amount){
		i.length=n+1;
		s==x?i.options[n].selected='true':null;
		i.options[n].value = i.options[n].text = x;
		n++;
	}
	} else {
	for(var x = d.min; x<=d.max;x=x+d.amount){
		i.length=n+1;
		s==x?i.options[n].selected='true':null;
		i.options[n].value = i.options[n].text = x;
		n++;
	}
	}
}