function getContentHeight() {
	return document.viewport.getHeight();
}

function getContentWidth() {
	return document.viewport.getWidth();
}


var contentHeight = 0;
var contentWidth = 0;
function onResizeFunc(imagearr) {

	
	newContentHeight = getContentHeight();
	newContentWidth = getContentWidth() + 30;
	//get bg object
	
	var imgWidth;
	var imgHeight;

	//check for window resize
	if (contentHeight !=  newContentHeight || contentWidth !=  newContentWidth) {
		//window has been resized
		contentWidth = newContentWidth;
		contentHeight = newContentHeight;
		if (contentWidth/contentHeight > 1200/900) {
			//overheight
			imgWidth = contentWidth;
			imgHeight = contentWidth*900/1200;
		} else {
			//overwidth
			imgWidth = contentHeight*1200/900;
			imgHeight = contentHeight;
		}
		imagearr.each(
			function(imgobj) {
			
				var objnum = imgobj.id.substring(3,4);
			
				var ydiff = (newContentHeight - imgHeight)/2*.9;
				ydiff = ydiff.round();
				if (ydiff) {
					//new Effect.Move(imgobj, {x: 0, y: ydiff, mode: 'absolute', duration:0 });
					$('bgd' + objnum).style.top = ydiff + 'px';
					$('bgd' + objnum).style.left = '-30px';
				}
				var xdiff = (newContentWidth - imgWidth)/2;
				if (xdiff) {
					//new Effect.Move(imgobj, {x: xdiff, y: 0, mode: 'absolute', duration:0.2 });
					$('bgd' + objnum).style.top = '0px';
					$('bgd' + objnum).style.left = (xdiff - 30) + 'px';

				}
				//imgobj.style.display='block';
				imgobj.width = imgWidth;
  				imgobj.height = imgHeight;
				
				$('bgd' + objnum).style.width = '';
				$('bgd' + objnum).style.height = '';
				
			}
		);
		

	}
	return true;
}




var browser = new Array();
function getBrowser() {
	/*
	* original version by Kristof Lipfert
	* http://www.lipfert-malik.de/webdesign/tutorial/bsp/browser_js_test.html
	*/
	if (browser['id']) {
		return browser;
	}

	if(document.ids) {
		x='nc4';
	} else if( document.all && !document.getElementById ) {
		x='ie4';
	} else if( window.opera && !document.createElement ) {
		x='op5';
	} else if( window.opera && window.getComputedStyle )  {
	       if(document.createRange) {
				x='op8';
	        } else if(window.navigate) {
				x='op7.5';
			} else  {
				x='op7.2';
			}
	} else if( window.opera && document.compatMode ) {
		x='op7';
	} else if( window.opera && document.releaseEvents ) {
		x='op6';
	} else if( document.contains && !window.opera ) {
		x='kq3';
	} else if (window.XML) {
		
		if (window.postMessage) {
			x='ff3';
		} else if(window.external) {
			x='ff2';

		} else {
			x='ff1';
		}
	} else if( window.getSelection && window.atob ) {
		x='nn7';
	} else if( window.getSelection && !document.compatMode ) {
		x='nn6';
	} else if( window.clipboardData && document.compatMode ) {
		x='ie6';
	} else if( window.clipboardData ){
		x='ie5';
	    if( !document.createDocumentFragment ) {
			x+='.5';
		}
	    if( document.doctype && !window.print ) {
			x+='m';
		}
	} else if( document.getElementById && !document.all ) {
		x='op4';
	} else if( document.images && !document.all ) {
		x='nn3';
	} else if(document.clientWidth&&!window.RegExp) {
		x='kq2';
	} else  {
		x='???';
	}
	try {
		os = navigator.platform;
		os = os.toLowerCase();
	} catch (e) {
		os = '???';
	}
	browser['app_name'] = x.substring(0,2);
	browser['app_ver'] = x.substring(2);
	browser['os_name']= os.substring(0,3);
	browser['os_ver'] = os.substring(3);
	browser['id'] = browser['app_name'] + browser['app_ver'] + browser['os_name'];
	return browser;
}


