function hasClass(element, className)
{
	return !!element.className.match(new RegExp("\\b"+className+"\\b"));
}

function addClass(element, className) 
{
	if(!hasClass(element, className))
	{
		element.className += (element.className ? ' ' : '') + className;
	}
}
function removeClass(element, className) 
{
    element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').replace(/^\s+/, '').replace(/\s+$/, '');;
}

if(!document.all)
{
	HTMLElement.prototype.contains = function(obj)  
	{  
		return this.compareDocumentPosition(obj) & 16;
	}
}

var CancelBubble = function(e)
{
	e = e || window.event;
	if(document.all)
	{
		e.cancelBubble = true;
	}
	else
	{
		e.stopPropagation();
	}
	return e;
};

function getCurrentStyle(obj, prop) 
{
	if (obj.currentStyle) {
		return obj.currentStyle[prop];
	}
	else 
	{
		return getComputedStyle(obj, "").getPropertyValue(prop.toLowerCase());
	}
	return null;
}

function scrollX()
{
    return document.documentElement.scrollLeft || document.body.scrollLeft;
}

function findPosX(obj) 
{
	var curleft = 0;
	if (obj && obj.offsetParent) 
	{
		while (obj.offsetParent) 
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	return curleft;
}

function scrollY()
{
	return document.documentElement.scrollTop || document.body.scrollTop;
}

function findPosY(obj) 
{
	var curtop = 0;
	if (obj && obj.offsetParent) 
	{
		while (obj.offsetParent) 
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} 
	return curtop;
}

function convertImageSize(url, widthAndHeight)
{
	var index = url.lastIndexOf(".");
	return url.substring(0,index) + widthAndHeight + url.substr(index);
}

function SwitchVer(key)
{
	var obj = eval(Sjax("/Ajax/Cache.ashx", "key=" + key, "post", "changeversion"));
	return obj.ver;
}

function GetVer(key)
{	
	var obj = eval(Sjax("/Ajax/Cache.ashx", "key=" + key, "post", "getversion"));
	return obj.ver || 1;
}