
	//var gwps = new wps.base();
	var gwps = '';
	var navWidth = (parseInt(280) + parseInt(105));
	var headerHeight = 180;
	var quoteObj = '';
	var deactivating = new $H({});
	var intiableObjects = new Array();
	
	function startMe(){
		try{
			gwps = new wps.base();
			var nodeCount = $$('div.mainContent');
		}catch(e){
			setTimeout(startMe, 1000);
			return;
		}
		if (nodeCount ==0 || (!$('main'))) {
			setTimeout(startMe, 1000);
			return;
		}
		
		wps.forceReloading = true; // try to disable this in production
		resizeScreen();
		if (gwps.is_ie()){
			var screenSize = Element.getDimensions(document.body);
			var absBottom = screenSize.height;
			var absRight = screenSize.width;
			// set maincontainer width on MSIE:
			$('main').setStyle({height:absBottom, width:absRight,overflow:'hidden'})
			// set transparency on MSIE
			if ($$('.trans1').length > 0){
				$$('div.p-shadow .overflow').each(
					function(elem){
						Element.setOpacity(elem, 0.85);
					}
				)
			}
			$$('div.navtrans').each(
				function(elem){
					Element.setOpacity(elem, 0.75);
				}
			)
		}
		$('main').style.display="block";
		gwps.addEvent(window, 'resize', resizeScreen);
		startObjects();
		quoteObj = new wps.quotes($H({}));
		quoteObj.setQuotes(quotes);
		setTimeout(function(){quoteObj.draw()}, 1500);
		
	}
	
	function startSurveyPage(){
		wps.forceReloading = true; // try to disable this in production
		startObjects();
	}
	
	function startObjects(){
		$A(intiableObjects).each(
			function(obj){
				obj.init();
			}
		)
	}
	
	function resizeScreen(maximize){
		if (!maximize) maximize =false;
		var screenSize = Element.getDimensions(document.body);
		var absBottom = screenSize.height;
		var absRight = screenSize.width;
		// set content-container width & height	
		var mainContent = $$('div.mainContent')[0];
		if ($('navigationContainer')){
			var width = (absRight -  parseInt(navWidth)) ;
		}else{
			var width = (absRight ) ;
		}
		if (parseInt(absRight) > 1000){
			width = width - 80;
		}

		mainContent.style.width = width + 'px';
		var overflower = $('overflow');
		overflower.style.width = (width -35) + 'px';
		$('waiter').style.left =(width -45) + 'px';
		if (maximize){
			var height = (absBottom - headerHeight)  ;
			overflower.style.height = (height -20) + 'px'	
		}else{
			var height = parseInt(overflower.offsetHeight)+50;
			if (height > (absBottom - headerHeight)){
				var height = (absBottom - headerHeight)  ;
				if (gwps.is_ie()){
					overflower.style.height = (height -20) + 'px'
				}else{
					overflower.style.height = (height -20) + 'px'
				}
			}
		} 
		mainContent.style.height = (height)  + 'px';
		overflower.style.overflowY = "auto";

		if ($('toolbar')){
			// set position of toolbar:
			if ($('toolbar').childNodes.length > 1) {
				var toolTop = absBottom -  ($('toolbar').childNodes.length * 60)  + 60;
			}else{
				var toolTop = absBottom -  60;
			}
			$('toolbar').style.top = toolTop + 'px';
		}
		var bgContainer = $('bgContainer');
		if (gwps.is_ie7()){
			if (parseInt(bgContainer.offsetHeight) < absBottom){
				bgContainer.style.height = absBottom;
				bgContainer.style.width = 'auto';
			}
		}
		// set position/width/heigth of quotes:
		$('quotes').style.width = (absRight - 380) + 'px';
		$('quoteShadow').style.width = (absRight - 380) + 'px';
	}
	
	function makeActive(event){
		var elem = Event.element(event);
		if ((!elem) || (elem.className == 'itemActive') || (!parseInt(elem.getAttribute('id'))) ) return;
		var id = parseInt(elem.getAttribute('id'));
		deactivating.set(id, false); 
		//$A(elem.childNodes).each(function(elem){if (elem.nodeName=="A") { elem.style.textDecoration='underline' } });
		new Effect.Appear($('shadow_' + id), {duration:'0.15'});
		var trans = $(id + '_trans');
		if (trans){
			if (gwps.is_ie()){
				Element.setOpacity(trans, '0.99');
			}else{
			 	Element.setStyle(trans, { opacity: '0.99' });
			}
		}
	}
	
	function makeInActive(event){
		var elem = Event.element(event);
		if ((!elem) || (elem.className == 'itemActive') || (!parseInt(elem.getAttribute('id'))) ) return;
		deactivating.set(parseInt(elem.getAttribute('id')), true);
		setTimeout(function(){_makeInActive(elem)}, 90);		
	}
	
	function _makeInActive(elem){
		var id = elem.getAttribute('id'); 
		id = parseInt(id);
		if (!deactivating.get(id)) return;
		//$A(elem.childNodes).each(function(elem){if (elem.nodeName=="A") { elem.style.textDecoration='none' } });
		new Effect.Fade($('shadow_' + id), {duration:'0.10'});
		var trans = $(id + '_trans');
		if (trans){
			if (gwps.is_ie()){
				Element.setOpacity(trans, '0.75');
			}else{
			 	Element.setStyle(trans, { opacity: '0.75' });
			}
		}
	}
