﻿function chkMail (sMail) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    return sMail.match(re);
}

function clearRadio(buttonGroup){
    for (i=0; i<buttonGroup.length; i++)
        if (buttonGroup[i].checked == true) buttonGroup[i].checked = false;
}

//
function chkNums (e) {
    var key;
    var keychar;
    
    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;
    
    keychar = String.fromCharCode(key);
    keychar = keychar.toLowerCase();
    
    // control keys
    if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
        return true;
    // numbers
    else if ((('0123456789').indexOf(keychar) > -1))
        return true;
    else
        return false;
}

// radio object check
function getCheckedValue(radioObj) {
	if(!radioObj)
		return '';
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return '';
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return '';
}

//fontsize
a_htm_tags = new Array (
	'h1', '18',
	'h2', '15',
	'h3', '13',
	'h4', '10',
	'p', '10',
	'li', '10',
	'dt', '10',
	'dl', '10',
	'th', '10',
	'td', '10',
	'caption', '10',
	'input', '10',
	'textarea', '10',
	'select', '10');
	
function font (o_this) {
	id = o_this.id;
	
	for (i=0; i<a_htm_tags.length; i+=2) {
		a_htm_tags_by_type = document.getElementsByTagName(a_htm_tags[i]);
		
		for (j=0; j<a_htm_tags_by_type.length; j++) {
			font_size = parseInt(a_htm_tags[i+1]);
			font_min = font_size;
			font_max = parseInt(font_min) + 5;
			
			if (a_htm_tags_by_type[j].style.fontSize)
				size = parseInt(a_htm_tags_by_type[j].style.fontSize.replace('pt',''));
			else
				size = font_size;
			if (id == 'inc' && size != font_max)
				size += 1;
			else if (id == 'dec' && size != font_min)
				size -= 1;
			a_htm_tags_by_type[j].style.fontSize = size + 'pt';
		}
	}
	/*
	p = document.getElementsByTagName('p');
		for (i=0; i<p.length; i++) {
			if (p[i].style.fontSize)
				size = parseInt(p[i].style.fontSize.replace('pt',''));
			else
				size = 10;
			if (id == 'inc' && size != font_max)
				size += 1;
			else if (id == 'dec' && size != font_min)
				size -= 1;
			p[i].style.fontSize = size + 'pt';
		}
	*/
}

// nyithato-csukhato tartalom
function show (oThis) {
	document.getElementById(oThis.id + '-content').style.display =
    document.getElementById(oThis.id + '-content').style.display == 'none' ? 'block' : 'none';

    if (document.getElementById(oThis.id).className == 'collapse-close')
        document.getElementById(oThis.id).className = 'collapse-open';
    else if (document.getElementById(oThis.id).className == 'collapse-open')
        document.getElementById(oThis.id).className = 'collapse-close';
}

//tabmenu
function tab (oThis) {
	var sId = oThis.id;
	
    if (sLastId != sId) {
        document.getElementById(sLastId).className = '';
        document.getElementById(sLastId + '-content').style.display = 'none';
    }
    sLastId = sId;

    document.getElementById(sId).className = 'active';
    document.getElementById(sId + '-content').style.display = 'block';
}

function wzTip(sWidth, sTip){
    Tip(sTip, WIDTH, parseInt(sWidth), PADDING, 7, DELAY, 0, FADEIN, 500, FADEOUT, 1000, FONTSIZE, '10px', TEXTALIGN, 'justify', FONTCOLOR, '#2d3d45', BGCOLOR, '#fff', BGIMG, 'img/base/bg.png', BORDERCOLOR, '#ccd4d9', OPACITY, 95, SHADOW, true, SHADOWWIDTH, 1, SHADOWCOLOR, '#7badb8');
}

///////////////////////////////////////////////////////////////////////
// ini
///////////////////////////////////////////////////////////////////////
var sBibliaTip;

$(document).ready(function() {
	sUCBTip = 'A UCB egy keresztyén média szolgálat, melynek az a célja, hogy Isten jó hírével és üzenetével elérje az embereket.';
	sBibliaTip = '<i>"Az vagy, amit eszel"</i> - ez egy általánosan elterjedt mondás. És valóban: a jó egészséghez kiegyensúlyozott étrend szükséges. Ugyanez alkalmazható a bibliaolvasásra, lelki táplálékunkra is. Ha hiszünk Isten Igéjében, akkor azt rendszeresen és kiegyensúlyozott módon kellene olvasnunk.' +
    '<br />A <b>Lelki táplálék Isten Igéjéből</b> kiegyensúlyozott táplálkozási tervet ad a teljes Biblia kiolvasására egy év alatt. Minden napra jut hús, zöldség és desszert is. Vasárnaponként különleges csemegét szolgálnak fel: egy kedvenc Bibliai idézetet és egy bátorító történetet a hitről és a csodáról.';
});