﻿$(function () {
	media();
	font();
	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.';

	$('.expand').click(function(){ $(this).next('div').slideToggle() });
});

var sBibliaTip;

function media(){
	$('#maiige-mp3>div:first').click(function () { $('#maiige-mp3>div:last').toggleClass('hidden') });
	$('#maiige-mp3 a').media({ width: 300, height: 24 });
	$('#radio').fancybox({ width: 932, height: 381, type: 'iframe', scrolling: 'no' });
	$('#tv-content a').media({ width: 858, height: 500, autoplay: true, params: { allowfullscreen: 'true'} });
	$('#tv').fancybox({ transitionIn : 'none', transitionOut : 'none' });
}

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, keychar;
	if (window.event) key = window.event.keyCode;
	else if (e) key = e.which;
	else return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27)) return true;
	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 '';
}

function font(){
	var oFont = parseInt($('#content').css('font-size'));
	var oLine = parseInt($('#content').css('line-height'));
	$('#font').children('span').eq(1).click(function(){$('#content').css({'font-size': oFont + 'px', 'line-height': oLine + 'px'})});
	$('#font span:first').click(function(){
		var font = parseInt($('#content').css('font-size')) - 2;
		font = font > oFont ? font : oFont;
		var line = font == oFont ? oLine : parseInt($('#content').css('line-height')) - 2;
		$('#content').css({'font-size': font + 'px', 'line-height': line + 'px'});
	});
	$('#font span:last').click(function(){$('#content').css({'font-size': (parseInt($('#content').css('font-size')) + 2) + 'px','line-height': (parseInt($('#content').css('line-height')) + 2) + 'px'})});
}

// 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');}
