function ajaxObject()
{  
	try
	{    // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{    // Internet Explorer    
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{      
			try
			{        
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{        
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
	return xmlHttp;
}

function Debugger(output_name)
{
	this.outputName=output_name;
}

Debugger.prototype.start=function()
{
	this.handle=document.getElementById(this.outputName);
}

Debugger.prototype.dump=function(message)
{
	var div=document.createElement('div');
	div.innerHTML=message;
	this.handle.appendChild(div);
}

Debugger.prototype.clear=function()
{
	this.out.innerHTML='';
}

/*************************************************************************************/		

function ie()
{
	return document.all && navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1;
}
	
function in_array(a,v)
{
	var length=a.length;
	for(var i=0;i<length;i++)
	{	
		if(a[i]==v)
			return true;
	}
	return false;		
}
			

function _isset(e)
{
	return !(e==null);
}	



function var_toSource(a)
{
	var isArray=true && a.pop;
	var buf=[];
	var j=0;
	for(var i in a)
	{	
		var v=a[i];
		if(!_isset(v))
		{	
			continue;
		}	
		var type=typeof(v);
		if(type=='object')
			v=var_toSource(v);
		buf[j]=(!isArray ? i+':' : '')+(type=='string' ? '"'+v+'"' : v);
		j++;
	}	
	return (isArray ? '[' : '{')+buf.join(',')+(isArray ? ']' : '}');
}	

	
function windowInnerSize()
{
	if(self.innerWidth)
		return [self.innerWidth,self.innerHeight];
	else if(document.documentElement && document.documentElement.clientWidth)
		return [document.documentElement.clientWidth,document.documentElement.clientHeight];
	else if(document.body)
		return [document.body.clientWidth,document.body.clientHeight];
}

/************************************************************************************/

function findDescendant(p,d,stopclass)
{
	var i=0;
	var found=false;
	
	while(i<p.childNodes.length && !found)
	{
		if(p.childNodes[i]==d)
		{	
			found=true;
		}	
		else if(stopclass==null || !p.childNodes[i].className || p.childNodes[i].className.indexOf(stopclass)<0)
			found=findDescendant(p.childNodes[i],d,stopclass);
		i++;	
	}
	return found;
}

function findChild(p,c)
{	
	if(!p.childNodes)
		return false;
	
	for(var k=0;k<p.childNodes.length;k++)
	{	
		if(p.childNodes[k]==c)
			return true;
	}
	return false;	
}

function findAbsoluteOffset(el)
{
	var x=0;
	var y=0;
	
	var cur=el;
	while(cur.offsetParent)
	{
		x+=cur.offsetLeft;
		y+=cur.offsetTop;
		cur=cur.offsetParent;	
	}
	
	return [x,y];	
}

function getActualStyle(e,s)
{
	if(e.currentStyle)
	{
		var w=s.split('-');
		var str=w[0];
		for(var i=1;i<w.length;i++)
			str+=w[i].charAt(0).toUpperCase()+w[i].substr(1);
		return parseInt(e.currentStyle[str]);
	}
	else
	{
		return parseInt(document.defaultView.getComputedStyle(e,null).getPropertyValue(s));
	}	
}

	