function $(d)
{
    return document.getElementById(d);
}
function DIV(id,className,props)
{
	return C("DIV",id,className,props);
}
function BR()
{
	return C("BR");
}
function A(className,title,link)
{
	var a = C("A",null,className);
	if (title!=null)
		a.appendChild(TN(title));
	a.href = link;
	return a;
}

function RADIO(g,v)
{
	var r
	try{
	    r = document.createElement('<input type="radio" name="'+g+'" value="'+v+'" />'); //ie7 SO SO SO SO SO SILLY
	}catch(err){
	 	r = C("INPUT");
	 	r.type = "radio";
		r.name = g;
		r.value = v;
	}
	return r;
}

function P(text,className)
{
	var a = C("P",null,className);
	a.appendChild(TN(text));
	return a;
}
function LI(text,className)
{
	var a = C("LI",null,className);
	a.appendChild(TN(text));
	return a;
}
function TN(s)
{
	return document.createTextNode(s)
}
function IMG(src,w,h)
{
	var img = C("IMG");
	img.src = src;
	img.width = w;
	img.height = h;
	return img;
}
function C(tag,id,className,props)
{
	var d = document.createElement(tag);
	
	if (id!=null)
	{
		d.id = id;
		d.setAttribute('id',id);
	}
	
	if (className!=null)
	{
		d.className = className;
		d.setAttribute('class',className);
	}
	
	if (props != null)
		for (var p in props)
		{
			d[p] = props[p];
			d.setAttribute(p,props[p]);
		}
	return d;
}


function get_swf(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    } else {
        return document[movieName];
    }
}



//jsonp func//
(function(){
  var id = 0, head = document.getElementsByTagName('head')[0], global = this;
  global.getJSON = function(url, callback) 
  {
    var script = document.createElement('script');
    var token = '__jsonp' + id;
    global[token] = callback;
    var url1 = url.replace(/\?(&|$)/, '__jsonp' + id + '$1'); // replace ? with callback id
    script.src = url1+"&___t="+Math.random();
    script.onload = function() {
      script.parentNode.removeChild(script);
      script = null;
      delete global[token];
    };
    head.appendChild(script);
    id++;
  }
})();
