function createObject() 
{
	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_type = new XMLHttpRequest();
	}
	return request_type;
}



function ajaxget(div, url, img) 
{
	if(img=="")
	{
		img = '';//'ajax-loader.gif';
	}
	var http = createObject();
	
	var nocache = Math.random();
	http.open('get', url+'&nocache='+nocache);
	http.onreadystatechange = function()
	{
		if(http.readyState == 4)
		{	
	
			document.getElementById(div).innerHTML = http.responseText;
			
		}
	}
	//document.getElementById(div).innerHTML = "<img src='images/"+img+"' style='margin-left:110px;margin-top:110px;'>";
	http.send(null);
}
function ajaxrun(div, url) 
{
	var http = createObject();
	
	var nocache = Math.random();
	http.open('get', url+'&nocache='+nocache);
	http.onreadystatechange = function()
	{
		if(http.readyState == 4)
		{	
	
			document.getElementById(div).innerHTML = http.responseText;
			
			doEval(document.getElementById('scriptelement').innerHTML );
			
		}
	}
	document.getElementById(div).innerHTML = "<img src='images/ajaxloader.gif' style='margin-left:195px;margin-top:110px;'>";
	http.send(null);
}

function ajaxrunPlayer(div, url) 
{
	var http = createObject();
	
	var nocache = Math.random();
	http.open('get', url+'&nocache='+nocache);
	http.onreadystatechange = function()
	{
		if(http.readyState == 4)
		{	
	
			document.getElementById(div).innerHTML = http.responseText;
			
			//doEval(document.getElementById('scriptelement').innerHTML );

			var so = new SWFObject('./player/securePlayer.swf','ply','415','266','9','#ffffff');
			so.addVariable('streamer', 'lighttpd');
			so.addVariable( 'skin', './player/skin.swf');
			so.addParam('allowfullscreen','true');
			so.addVariable('autostart','true');
			so.addParam('allowscriptaccess','always');
			so.addVariable('controlbar','bottom');
			so.addParam('wmode','opaque');
			so.addVariable('file','commercial.flv');
			so.addVariable('bufferlength','0.01');
			so.addVariable('streamer', 'rtmp://flashcc-05.crossmediaventures.com/sibaeDocuLink');
		//				so.addVariable('type', 'http');
			so.addVariable('type', 'rtmp');
			so.write('mediaspace');
			
		}
	}
	document.getElementById(div).innerHTML = "<img src='images/ajaxloader.gif' style='margin-left:195px;margin-top:110px;'>";
	http.send(null);
}


function ajaxpost(div, form, url) 
{
	var http2 = createObject();
    http2.open("POST", url, true);
	
	var query = '';
	form = document.forms[form];
	
	for(var x = 0 ; x < form.length; x ++)
	{
		if(form[x].length != undefined)
		{
			for(var y = 0 ; y < form[x].length; y ++)
			{	
				if(form[x][y].selected)
				{
					query = query + form[x].name + '=' + form[x][y].value +'&';
				}
			}
		}
		else
		{
			query = query + form[x].name + '=' + urlencode(form[x].value) +'&';	
		}
	}
	
	http2.onreadystatechange =  function()
	{
		if(http2.readyState == 4)
		{
			document.getElementById(div).innerHTML = http2.responseText;
		}
	}
	document.getElementById(div).innerHTML = "<img src='images/ajaxloader.gif' style='margin-left:195px;margin-top:110px;'>";
    http2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");    
    http2.send(query);


}

function doEval(code)
{
	if (window.execScript)
	{
		

		//alert(code);
		window.execScript( code ,''); // execScript doesn’t return anything
	}
	else
	{

		eval(code);

	}
}

function ajaxcurl(url) 
{

	var http = createObject();
	
	var nocache = Math.random();
	http.open('get', url);
	http.onreadystatechange = function()
	{
		if(http.readyState == 4)
		{	
	
			
			
		}
	}
	
	http.send(null);
}
