////////////////////////////////////////////////////
//	richer workflow								  //
// a hírcsoport hir itemeinek a hircsoport nevét  //
// hogy egyedi megjelenítés						  //
/***************************rUNTIME************************************************************/
if (document.addEventListener) {
  document.addEventListener("DOMContentLoaded", start, false);
}else{
	window.attachEvent("onload", start);
}
/*************************************************************************************************/
function start(){

var left_coloumn = document.getElementById("left_coloumn").offsetHeight;
var mainbox = document.getElementById("mainbox").offsetHeight;
var right_coloumn = document.getElementById("right_coloumn").offsetHeight;

var height = Math.max(left_coloumn,mainbox,right_coloumn);


	if (height > 800 && navigator.appVersion.toString().indexOf("MSIE 7.0") == -1 ){
		document.getElementById("footer_warp").style.marginTop = (height-750)+"px";
	}
	
	attachLinkToElement("header_grande_pictre","http://www.sztmsz.hu");
	
	clearTagsag();
	injectName();
	IE7();
	
	$('#konf_urlap_form .inputbox').val("");
	
	$('.lang_en a').attr('href','/en/news/renewed+website+1.html');
	
}



function attachLinkToElement(elem, href){
	var dhtml = document.getElementById(elem);
	if (document.addEventListener) {
	  dhtml.addEventListener("click", function(){window.location=href}, false);
	}else{
		dhtml.attachEvent("onclick", function(){window.location=href});
	}
	dhtml.style.cursor = "pointer";
}

function clearTagsag(){
	if ( $('.custom_2_hircsoport').length != 0 ) {
		var category_name = $('.newscategoryname').html();
		htmls = $('#mainbox_slice').html().replace(/even/gi,"");
		htmls = htmls.replace(/odd/gi,"");
		htmls = htmls.replace(/more2/gi,"more2 tagjaink_more");
		$('#mainbox_slice').html(htmls);
	}
}


function growMistake(msg){
	 $.blockUI({ 
            message: "<b>"+msg+"</b>", 
            fadeIn: 700, 
            fadeOut: 700, 
            timeout: 4000, 
            showOverlay: true, 
			cursor:    'default',
            centerY: true, 
            css: { 
                width: '350px', 
                border: '2px red solid', 
                padding: '15px', 
                backgroundColor: '#000', 
                '-webkit-border-radius': '6px', 
                '-moz-border-radius': '6px', 
                color: 'White' 
            },
			overlayCSS:  { 
				backgroundColor: '#000', 
				opacity:         0.3,
				cursor:    'pointer'
			}
        }); 
		$('.blockOverlay').attr('title','Kattintással bezárható').click($.unblockUI); 
}

/*richer validator*/
function TestDataCheck(){

	if(isValueNull("fm-surname"))
		return false;
	if(isValueNull("fm-firstname"))
		return false;
	if(isValueNull("fm-email"))
		return false;
	if(isValueNull("fm-telephone"))
		return false;
	if(isValueNull("fm-password"))
		return false;
	if(isValueNull("fm-repassword"))
		return false;
	
	//lets it go
	return true;
}

function isValueNull(id)
{
	if (document.getElementById(id).value.length == 0)
	{
		document.getElementById(id).focus();
		return true;
	}
	return false;
}

function highlightConferance(){

	if( document.getElementById('menuli27') ){
		var shtml = $('#menuli27').html().toString();
		if (shtml.indexOf("active_menu_header") == -1){
			var html = $('#menuli27').html();
			var html = html.toString();
			var toHTML = "<div id='active_menu_header'></div><div id='active_menu_slice'>"+html+"</div><div id='active_menu_bottom'></div>";	
		}
		$('#menuli27').html(toHTML);
	}
}
function highlightOSCARConferance(){

	if( document.getElementById('menuli52')){
		var fhtml = $('#menuli52').html().toString();
			if (fhtml.indexOf("active_menu_header") == -1){
				var html = $('#menuli52').html();
				var html = html.toString();
				var toHTML = "<div id='active_menu_header'></div><div id='active_menu_slice'>"+html+"</div><div id='active_menu_bottom'></div>";	
		}
		$('#menuli52').html(toHTML);
	}
}

function injectName(){
		var url = window.location.toString();
	
		
		if( url.indexOf('sztmsz+konferenciak') != -1 )
		{
			if( url.indexOf('/en/') != -1 )
			{
				$('#inject_name').html(" <h2> Members </h2>");
			}else{
				$('#inject_name').html(" <h2> Tagjaink </h2>");
			}
		}
		else if( url.indexOf('konfere') != -1 )
		{
			if( url.indexOf('/en/') != -1 )
			{
				$('#inject_name').html(" <h2> Sponsors </h2>");
			}else{
				$('#inject_name').html(" <h2> Szponzorok </h2>");
			}
		}
		else if( url.indexOf('mid=26') != -1 )
		{
			if( url.indexOf('/en/') != -1 )
			{
				$('#inject_name').html(" <h2> Sponsors </h2>");
			}else{
				$('#inject_name').html(" <h2> Szponzorok </h2>");
			}
		}
		else if( url.indexOf('mid=36') != -1 )
		{
			if( url.indexOf('/en/') != -1 )
			{
				$('#inject_name').html(" <h2> Sponsors </h2>");
			}else{
				$('#inject_name').html(" <h2> Szponzorok </h2>");
			}
		}
		else if( url.indexOf('oscar') != -1 )
		{
			if( url.indexOf('/en/') != -1 )
			{
				$('#inject_name').html(" <h2> Sponsors </h2>");
			}else{
				$('#inject_name').html(" <h2> Szponzorok </h2>");
			}
		}else{
			if( url.indexOf('/en/') != -1 )
			{
				$('#inject_name').html(" <h2> Members </h2>");
			}else{
				$('#inject_name').html(" <h2> Tagjaink </h2>");
			}
		}
		
		if( url.indexOf('en/?mod=mainpage&cla=mainpage&fun=access') != -1 )
		{
			$('.newscategoryname span').html("News");
		}
		if( url.indexOf('/en/') != -1 )
		{
			$('.loginbox form input.submit').css("background-image","url('templates/base/images/belep_en.jpg')");
		}
}

function IE7(){

	var url = window.location.toString();
	
	if( url.indexOf('?mod=mainpage&cla=mainpage&fun=access') != -1 &&  navigator.appVersion.toString().indexOf("MSIE 7.0") != -1)
	{
		$('.mainpage_upper div.odd').css("margin-top","0px");
	}
}


