function GetElementById(e)
	{
	if(typeof(e)!="string")
		{
			return e;
		}
	if(document.getElementById)
		{
			e=document.getElementById(e);
		}
	else
		{
			if(document.all)
			{
				e=document.all[e];
			}
			else
			{
			e=null;
			}
		}
			return e;
	}
	
function getElementsByClass(searchClass,node,tag)
	{
		var classElements=new Array();
		if(node==null)
		{
			node=document;
		}
		if(tag==null)
			{
				tag="*";
			}
		var els=node.getElementsByTagName(tag);
		var elsLen=els.length;
		var pattern=new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
			for(var i=0,j=0;
				i<elsLen;i++)
				{
				if(pattern.test(els[i].className))
					{
					classElements[j]=els[i];
					j++;
					}
				}
					return classElements;					
		}
				
function addLoadEvent(func)
	{
	var oldLoad=window.onload;
		if(typeof window.onload!="function")
			{
				window.onload=func;
			}
		else
			{
				window.onload=function()
				{
					oldLoad();
					func();
				};
			}
	}
		
function addResizeEvent(func)
	{
	var oldResize=window.onresize;
		if(typeof window.onresize!="function")
			{
				window.onresize=func;
			}
		else
			{
				window.onresize=function()
				{
					oldResize();
					func();
				};
			}
	}
		
function getCookie(c_name)
	{
		if(document.cookie.length>0)
		{
			c_start=document.cookie.indexOf(c_name+"=");
				if(c_start!=-1)
				{
					c_start=c_start+c_name.length+1;
					c_end=document.cookie.indexOf(";",c_start);
						if(c_end==-1)
						{
							c_end=document.cookie.length;
						}
						return unescape(document.cookie.substring(c_start,c_end));
				}
		}
		return"";
	}
		
function getWindowWidth()
	{
	var size=0;
		if(document.body&&document.body.clientWidth)
			{
				size=document.body.clientWidth;
			}
		else
			{
			if(window.innerWidth&&window.innerWidth>0)
				{
				size=window.innerWidth;
				}
			}
			return size;
	}
	
function getElementWidth(id)
	{
	var size=0;
		if(document.body&&document.body.clientWidth)
		{
			size=document.body.clientWidth;
		}
		else
		{
			if(window.innerWidth&&window.innerWidth>0)
			{
				size=window.innerWidth;
			}
		}
		var content=document.getElementById(id);
			if(content&&content.clientWidth&&content.clientWIdth>0)
			{
				size=content.clientWidth;
			}
			return size;
	}
	
function setDefault(name,val)
	{
		if(typeof(window[name])=="undefined"||window[name]==null)
		{
			window[name]=val;
		}
	}

function cancel(e)
	{
		if(e&&e.preventDefault)
		{
			e.preventDefault();
		}
		else
		{
			if(window.event)
			{
				window.event.returnValue=false;
				window.event.cancelBubble=true;
			}
		}
		return false;
	}

	String.prototype.trim=function()
		{
			return this.replace(/^\s+|\s+$/g,"");
		};
	
	String.prototype.lTrim=function()
		{
			return this.replace(/^\s+/g,"");
		};
		
	String.prototype.rTrim=function()
		{
			return this.replace(/\s+$/g,"");
		};
		
	String.prototype.left=function(len)
		{
			return(len>this.length)?this:this.substring(0,len);
		};
		
	String.prototype.right=function(len)
		{
			return(len>this.length)?this:this.substring(this.length-len);
		};
	
	String.prototype.beginsWith=function(t)
		{
			return(t.toLowerCase()==this.substring(0,t.length).toLowerCase());
		};
		
	String.prototype.endsWith=function(t)
		{
			return(t.toLowerCase()==this.substring(this.length-t.length).toLowerCase());
		};