//<![CDATA[

window.addEvent('domready', function() {

	// Set height for bottom divs to align - min height will be window size
	function colHeight() {

		var topPart=0;//$('topmost_box').getSize().size.y+50+$('upper_box').getSize().size.y; // + margins etc

		var constY=0;//$('pathway').getSize().size.y; //+$('footer').getSize().size.y;

		maxY=$('center_box').getSize().size.y+constY;

		// Adjust bottom
		if ($('mainbody').getSize().size.y+300>$('center_box').getSize().size.y) {
			// To make sure we do not end in never-ending loop...
			beforeHeight=$('center_box').getSize().size.y;
			$('center_box').setStyle('height', ($('mainbody').getSize().size.y-356+654)+"px");
			if (beforeHeight!=$('center_box').getSize().size.y) colHeight();
		}

		pxLeftOfCenter=window.getWidth()/2-150;
		leftAdjust=pxLeftOfCenter-(Math.ceil(pxLeftOfCenter/300)*300);
		// make sure background on desktop fills entire window
		if (window.getHeight()-$('center_box').getSize().size.y>0) $('desktop').setStyle('height', (window.getHeight())+"px")
		else $('desktop').setStyle('height', ($('center_box').getSize().size.y)+"px")

		// exco_link scroll to botttom of window
		exco_scroller=window.getHeight()+window.getScrollTop()-$('exco_link').getSize().size.y-topPart-1; // 1 is to "hover" it above bottom
		if ((lessFull=window.getHeight()-maxY)>0) exco_scroller-=lessFull;

		// dont set negative height
		if (exco_scroller<0) exco_scroller=0;

		$('exco_scroll').setStyle('height', exco_scroller+"px");

	}
	colHeight();
	
	addEvent('resize', function(e) { colHeight(); });
	addEvent('scroll', function(e) { colHeight(); });
	addEvent('load', function(e) { colHeight(); });
	
	// Styling not possible with CSS - alternative to changing code

	// Fake newsmail - just another "contact me page"
	var newsmail1=$ES('#contact_text');
	var newsmail2=$ES('#newsmailpage');
	if (newsmail1!="" && newsmail2!="") {
		$$('.componentheading').setStyles({'display':"none"});
		$$('label[for=contact_subject],label[for=contact_text],input[id=contact_subject],textarea[id=contact_text]').setStyles({'display':'none'});
		document.emailForm.contact_subject.value ="Tilmelding til nyhedsbrevet For kvinder";
		document.emailForm.text.value ="Jeg vil gerne modtage dit nyhedsbrev!";
	}

	// No hat and box on contact page... plus fix for IE7 and too little height on contact form...
	var contact1=$ES('.contact_email');
	if (contact1!="") {
		$('main_box_hylde').setStyle('background', "none");
		$('hattehylde').setStyle('display', "none");
		$('kasse').setStyle('display', "none");
		//$$('.componentheading').setStyles({'display':"none"});
		$$('.contentheading').setStyles({'display':"block"});
	}

	// com_letterman - move ok button up and right
	var letterman1=$ES('input[name=Itemid]');
	if (letterman1!="") {
		//var letterman2=$ES('input[value=OK]').setStyles({'position':'relative', 'top':'-25px', 'margin-right':'8px;', 'float':'right'});
	}
	// Login page from com_login
	var login1=$ES('input[name=username],input[name=passwd]', '.inputbox').setStyles({'border':'1px solid #646464', 'width':'75px', 'margin-left':10, 'margin-right':10});
	if (login1!="") $$('input[name=submit]').setStyles({'position':'relative', 'top':30, 'padding':0, 'margin':0});

	// Search page from com_search
	var search1=$ES('select[id=search_ordering]', '.inputbox').setStyles({'height':'15px', 'border':'1px solid #7f9db9', 'font-size':'9px', 'width':'120px'});
	if (search1!="") {
		$$('input[name=searchword]').setStyles({'border':'1px solid #7f9db9', 'line-height':'40px'});
		$$('label[for=search_ordering],[for=searchphraseany]').setStyles({'line-height':'40px'});
		var search2=$ES('select[name=limit]', '.inputbox').setStyles({'height':'15px', 'border':'1px solid #646464', 'font-size':'9px'});
		$$('div[align=center]').setStyles({'margin-bottom':'15px'});

	}

	/* DomReady Event fires when all Elements are ready, but not images. */
	window.addEvent('domready', function() {
 
 
	// ------------Other domready functions...
	});
 
	/* Load Event fires when the whole page is loaded, included all images */
	window.addEvent('load', function() {


	// ------------Other load functions... 
	});

});

//]]>
