$j = jQuery.noConflict(); 
$j('#wrap').css('display', 'none');
function setLayout(){
	
	var tmpHeight = $j('#wrap').height() - $j('#wrap_header').height() - $j('#wrap_footer').height() - 20;
	var heightLeftBox = $j('.leftbox').height(); 
	
	var minBrowserHeight = 700;
		
	(tmpHeight < minBrowserHeight) ? tmpHeight = minBrowserHeight : '';
	
	//alert(tmpHeight);
	
	//alert('browser: '+$j.browser.msie + ' - Version:' + $j.browser.version);
	//$j.browser.version == '7.0' || 
	if (( $j.browser.msie ) && ($j.browser.version == '7.0' || $j.browser.version == '6.0' ) && tmpHeight == minBrowserHeight)
		$j('#footer_top').css('margin-top','100px');
		
	if (( $j.browser.msie )&&( $j.browser.version == '7.0' ) && tmpHeight != minBrowserHeight)
		$j('#footer_top').css('margin-top','10px');
	
	$j('#body_left').height(Math.round(tmpHeight));
	$j('#body_right').height(Math.round(tmpHeight)-140);
	// teaserview
	$j(".teaser").height(tmpHeight);
	$j("#sliderTeaser").height(tmpHeight);
	//detailview
	$j(".rightbox").height(tmpHeight-140);
	
	// fade in
	$j('#wrap').fadeIn(800);
	if(heightLeftBox > 0 && heightLeftBox > tmpHeight) {
		$j(".rightbox").height(heightLeftBox - 140);
		$j('#body_left').height(heightLeftBox);
	}
	if ($j.browser.version == '7.0' || $j.browser.version == '6.0')
		setTimeout('setLayout();', 400); 
}
$j(document).ready(function(){

	//jQuery(document).pngFix();  
	setTimeout('setLayout();', 400); 
	window.onresize = function (evt) {
      setLayout();
   }
   
   // header handling
	var stringTitle = $j('#body_main h1').text();
	var tempWordArray = new Array();
			
	totalWordLength = stringTitle.length;
	(totalWordLength > 15) ? tempWordArray = stringTitle.split(' ') : tempWordArray[0]=stringTitle;

	if (tempWordArray.length === 1) {
		$j('#body_main h1').html('<span class="h1-first">' + tempWordArray[0] + '</span>');
	}else if (tempWordArray.length === 2) {
		$j('#body_main h1').html('<span class="h1-first">' + tempWordArray[0] + '</span><br /><span>' + tempWordArray[1] + '</span>');
	}else if (tempWordArray.length > 2) {
		var firstString = '';
		var secondString = '';
		
		for (intCount = 0; intCount < tempWordArray.length; intCount ++) {
			if (intCount < 2){
				firstString += tempWordArray[intCount]+' ';
			}else{
				secondString += tempWordArray[intCount]+' ';
			}
		}
		$j('#body_main h1').html('<span class="h1-first">'+firstString+'</span><br /><span>'+secondString+'</span>');
	}
});
