$(function(){
	
	// jCycle - Home Slideshow
    $('div.slideshow ul').cycle({
		cleartypeNoBg: true,
		cleartype:  1,
        speed:  '1000',
        timeout: 5000
    });
	
	fixLayout();
});

function get_next_object_by_tag(_s_tag, _objparent)
{
	var arr_children = _objparent.getChildren();
	for(var i = 0; i < arr_children.length; i++)
	{
		if (arr_children[i].get('tag') == _s_tag)
			return arr_children[i];
	}

	//we didnt found any, so we check in our childrens:
	for(var i = 0; i < arr_children.length; i++)
	{
		var obj_tmp = get_next_object_by_tag(_s_tag, arr_children[i]);
		if (obj_tmp != null) return obj_tmp;
	}

	return null;
}

var fixLayout = function()
{
	//we first make sure the #searchcontainer is the same height as the #maincontent:
	if (
		$('#maincontent').length && 
		$('#searchcontainer').length
	)
	{
		//we get our sizes:
		var i_search_height = $('#searchcontainer').height();
		var i_main_height = $('#maincontent').height();

		//we then verify if the main is bigger than the search:
		if (i_main_height > i_search_height)
		{
			//we adjust the search height:
			$('#searchcontainer').css('height', i_main_height);
		}
	}

	//we first make sure the #searchcontainer is the same height as the #maincontent-interior:
	if (
		$('#maincontent-interior').length > 0 && 
		$('#searchcontainer').length > 0
	)
	{
		//we get our sizes:
		var i_search_height = $('#searchcontainer').height();
		var i_main_height = $('#maincontent-interior').height();

		//we then verify if the main is bigger than the search:
		if (i_main_height > i_search_height)
		{
			//we adjust the search height:
			$('#searchcontainer').css('height', i_main_height + 1);
		}
	}

}

sfHover = function() { 
	var sfEls = document.getElementsByTagName("LI"); 
		for (var i=0; i<sfEls.length; i++) { 
			sfEls[i].onmouseover=function() { 
			this.className+=" sfhover"; 
		} 
		sfEls[i].onmouseout=function() { 
			this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); 
		} 
	} 
}

if (window.attachEvent)
{
    window.attachEvent("onload", sfHover);
}


