
var APP = Class.create({
	
	/// tabs, horizontal
	tab_h_select: function(id,scope) {
		if(!$('box_tab__'+id)) return false;
		$$('.tab_scope_'+scope).each(function(i){
			if(i.id=="tab_h_item__"+id) {
				if(!i.hasClassName("active"))
					i.addClassName("active")
			} else {
				if(i.hasClassName("box_tab")) {
					if(i.id=="box_tab__"+id)	i.show()
					else						i.hide()
				} else i.removeClassName("active")
			}
		})
	},
	
	_jc_init: function(j,id) {
		var iii = 0
		var tr=false
		j.each(function(xx){
			tld=xx[0]
			price=xx[1]
			iso=xx[3]
			tr = new Element('tr')
			var td = new Element('td')
			var a = new Element('a', {'href':'/domains/tld/'+tld})
			var img = new Element('img', {'src':'/img/flag/mini/'+iso+'.png' })
			a.appendChild( img )
			td.appendChild( a )
			tr.appendChild( td )
			tr.appendChild( new Element('td').update("name.<strong><a href='/domains/!/"+tld+"'>"+tld+"</a></strong>") )
			tr.appendChild( new Element('td').update(price).setStyle({'textAlign':'right'}) )
			var a = new Element('a', {'href':'/domains/tld/'+tld}).update("Infos")
			var td = new Element('td')
			td.appendChild( a )
			tr.appendChild( td )
			$('jc_'+id).appendChild(tr)
		})

	},
	
	jc_init: function(j) {
		j = j.evalJSON()
		this._jc_init(j.tops,'tops')
		this._jc_init(j.euro,'euro')
		this._jc_init(j.asia,'asia')
		this._jc_init(j.america,'america')
	}
})

app = new APP();
