var viewportwidth;
var viewportheight;


function setIESafeCSS( obj, style ) //style whould be a string
{
	obj.setAttribute('style', obj.getAttribute('style') + '; ' + style + '; ' );
}



//allows IE to use getElementsByClassName(). Other modern browsers have it built in
function setIEgetElementsByClassName()
{
	if (document.getElementsByClassName == undefined) {
		document.getElementsByClassName = function(className)
		{
			var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
			var allElements = document.getElementsByTagName("*");
			var results = [];
	
			var element;
			for (var i = 0; (element = allElements[i]) != null; i++) {
				var elementClass = element.className;
				if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
					results.push(element);
			}
	
			return results;
		}
	}
}



function setViewortDims()
{
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	
	if (typeof window.innerWidth != 'undefined')
	{
	  viewportwidth = window.innerWidth,
	  viewportheight = window.innerHeight
	}
	
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	
	else if (typeof document.documentElement != 'undefined'
	 && typeof document.documentElement.clientWidth !=
	 'undefined' && document.documentElement.clientWidth != 0)
	{
	   viewportwidth = document.documentElement.clientWidth,
	   viewportheight = document.documentElement.clientHeight
	}
	
	// older versions of IE
	
	else
	{
	   viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
	   viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	
	//console.log('Your viewport width is '+viewportwidth+'x'+viewportheight);
}




function concatHTMLCollection( htmlCol1, htmlCol2 )
{
	var arr = [];
	
	for( var i = 0; i < htmlCol1.length; i++ )
	{
		arr.push( htmlCol1[i] );
	}
	
	for( var j = 0; j < htmlCol2.length; j++ )
	{
		arr.push( htmlCol2[j] );
	}
	
	return arr;
}

