function handleTextField(tfield, op, deftext){
            switch(op){
		    case 'show' : if(tfield.value == '')
                                tfield.value=deftext;
		    break;
		    
                    case 'hide' : if(tfield.value == deftext)
				tfield.value='';
		    break;
	    }
        return true;
}

function toggle(el){
	var element = $('#'+el);
	if(element!==null){
		if (element.css('display')!=="block"){
			element.show(300);
			return false;
		}
		else{
			element.hide(300);
			return false;
		}
	}	
}

function notEmpty(el,errorcont,errormsg){
	field = $('#'+el);
	cont = $('#'+errorcont);
	if(field.val().length == 0){
		cont.html(errormsg);
		cont.fadeIn(250);
		cont.css('display','block');
		field.focus();
		return false;
	}
	else{
		cont.fadeOut(250);
		return true;
	}
}

function validMail(el,errorcont,errormsg){
	field = $('#'+el);
	cont = $('#'+errorcont);
	emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(!field.val().match(emailExp)){
		cont.html(errormsg);
		cont.fadeIn(250);
		cont.css('display','block');
		field.focus();
		return false;
	}
	else{
		cont.fadeOut(250);
		return true;
	}
}

function writeMail(el){
			var obj = document.getElementById(el);
                        var arrMail = ['hu','mail','rsmdtm','to','blog','@','.',':'];
                        obj.setAttribute('href',arrMail[1]+arrMail[3]+arrMail[7]+arrMail[4]+arrMail[5]+arrMail[2]+arrMail[6]+arrMail[0]);
                        obj.innerHTML=arrMail[4]+arrMail[5]+arrMail[2]+arrMail[6]+arrMail[0];
}

$(document).ready(function(){
           $("li.shareContainer div").css('display','none');
           $("li.trackBackCont div").css('display','none');
		   
		   //kommentform validálás
		   $('#commentform').submit(function(e){
			//alert('Esemény megtörtént');
			if(notEmpty('author','authorWarning','Kérjük adja meg nevét!')==false || validMail('email','emailWarning','Kérjük adjon meg érvényes email címet!')==false || notEmpty('comment','commentWarning','Kérjük írjon valamit!')==false){
				return false;
			}
			else{
			//alert('Ez igaz');
				return true;
			}
		   })
            writeMail('mail');
})

function divValt( hol, mit, kep ){
	elemek = new Array();
	elemek[1] = 'ado';
	elemek[2] = 'ber';
	elemek[3] = 'szamvitel';
	elemek[4] = 'konyvvizsgalat';
	var div = document.getElementById('con_'+mit);
	if( div.style.display!='block' )
	{
		hol.className = 'rh_Activ';
		hol.innerHTML = '<img name="img_'+mit+'" src="http://blog.rsmdtm.hu/wp-content/themes/dtm_theme/images/'+kep+'_over_hu.gif" title="" alt="" />';
		for( var i=1; i<=4; i++)
		{
			if( i!=mit )
			{
				document.getElementById('cona_'+i).className = 'rh';
				document.getElementById('con_'+i).style.display = 'none';
				document.getElementById('cona_'+i).innerHTML = '<img name="img_'+i+'" src="http://blog.rsmdtm.hu/wp-content/themes/dtm_theme/images/'+elemek[i]+'_out_hu.gif" title="" alt="" />';
			}
		}
		div.style.display = 'block';
	}
}

function showTab(argMaxIndex, argActualIndex)
{
	var linksObj = document.getElementById('tabChangers');
	var linkObj = false;
	var display =  'none';
	var blockObj;

	for (i=1;i<=argMaxIndex;i++){
		linkObj = document.getElementById('tabChange'+i);
		blockObj = document.getElementById('tab'+i);
		blockObj.style.display = 'none';
		if(linkObj.className.indexOf(' active') > -1){
			to = linkObj.className.indexOf(' active');
			linkObj.className = linkObj.className.substring(0,to);
		}
	}
	linkObj = document.getElementById('tabChange'+argActualIndex);
        linkObj.className += ' active';
	blockObj = document.getElementById('tab'+argActualIndex);
	blockObj.style.display = 'block';

	linksObj.style.display = 'block';
}



function iwiwshare_click() {u=location.href;t=document.title;window.open('http://iwiw.hu/pages/share/share.jsp?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'iwiwshare','toolbar=0,status=0,location=1, width=650,height=600,scrollbars=1');return false;}

