var scrolltimer;
function picScroll(m, s) {
var s1 = 5;
var s2 = 15;
	var oDiv, oContent;
	speed = (s) ? s2 : s1 ;
	if(typeof m != "undefined") move = m;
	scrolltimer = null;

	BOX = document.getElementById('slider_box');
	SLIDER = document.getElementById('slider');

	if ((move == "dn") && ((SLIDER.offsetWidth + SLIDER.offsetLeft) > BOX.offsetWidth)) {
		SLIDER.style.left = (SLIDER.offsetLeft - speed) + 'px';
	} else {
		if ((move == "up") && (SLIDER.offsetLeft < 0)) {
			SLIDER.style.left = (SLIDER.offsetLeft + speed) + 'px';
		} else {
			if (move == "top") {
				SLIDER.style.left = 0 + 'px';
			}
		}
	}
	if(s){
		scrolltimer = setTimeout("picScroll(move, true)", 1);
	}else{
		scrolltimer = setTimeout("picScroll(move, false)", 1);
	}
}
function stopScroll() {
	clearTimeout(scrolltimer);
}

var playtimer;
function autoPlay(site,gid,next){
	loading(0);
	s = site;
	g = gid;
	n = next;
	playtimer = setTimeout("xajax_pic_player(s, g, n)", 5000);
}
function stopPlay() {
	if(playtimer){
		clearTimeout(playtimer);
	}
}

/* egyéb */
function loading(mode){
	if(mode==1){
		document.getElementById('loading').style.display = "none" ;
		document.getElementById('xpic').style.display = "block" ;
	}else{
		document.getElementById('loading').style.display = "block" ;
		document.getElementById('xpic').style.display = "none" ;
	}
}

function open_center_layer(element,x,y){
    
	document.getElementById(element).style.display = "none";
	leftpos = 0 ;
    toppos = 0 ;
	
	/* TOP */
	if(self.pageYOffset){
		yScroll = self.pageYOffset;
	}else if(document.documentElement && document.documentElement.scrollTop){
		yScroll = document.documentElement.scrollTop;
	}else if(document.body){
		yScroll = document.body.scrollTop;
	}
	if (self.innerHeight) {
		inheight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		inheight = document.documentElement.clientHeight;
	} else if (document.body) {
		inheight = document.body.clientHeight;
	}
	toppos = (yScroll + (inheight/2)) - y;

	
	/* LEFT */
    if (screen){
        leftpos = (document.body.clientWidth/2) - x ;
	}
	
	document.getElementById(element).style.left = leftpos+'px';
	document.getElementById(element).style.top = toppos+'px';
}

function print_open (block,args) {
    var moo = window.open('/_print.php?&block='+block+'&'+args, 'Nyomtatás', 'status=0,toolbar=0,location=0,menubar=1,resizable=1,scrollbars=1,directories=0,height=600,width=680');
}
function postcard_open (kid) {
    if(kid){
    	var klp = window.open('/_kepeslap.php?kid='+kid, 'Képeslap', 'status=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=1,directories=0,height=700,width=920');
	}
}

function showelement(element)
    {
    document.getElementById(element).style.display = "block" ;
    window.focus() ;
    }

function hideelement(element)
    {
    document.getElementById(element).style.display = "none" ;
    window.focus() ;
    }
function hideall(elements){
    var element = elements.split(',');
	for(i=0; i<element.length; i++)	{
		e = element[i];
		if(document.getElementById(e)){
			document.getElementById(e).style.display = "none" ;
		}
	}
    window.focus() ;
}  
function visible_element(element)
    {
    document.getElementById(element).style.visibility = "visible" ;
    window.focus() ;
    }

function invisible_element(element)
    {
    document.getElementById(element).style.visibility = "hidden" ;
    window.focus() ;
    }

// function for displaying ct network flash advertisements   
function showctflash(maindivid,divid,divclass,divstyle,objectid,movie,base,flashvars,bgcolor)
    {
    htmlcode = '<div id="'+divid+'" name="'+divid+'" class="'+divclass+'" style="'+divstyle+'"> ' ;
    htmlcode += '<object id="'+objectid+'" width="100%" height="100%" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" name="'+objectid+'" codebase="http://download.macromedia.com/pub/shockwave/cips/flash/swflash.cab#version=7,0,0,0">' ;
    htmlcode += '<param value="'+movie+'" name="movie"/>' ;
    htmlcode += '<param value="'+base+'" name="base"/>' ;
    htmlcode += '<param value="'+flashvars+'" name="FlashVars"/>' ;
    htmlcode += '<param value="best" name="quality"/>' ;
    htmlcode += '<param value="always" name="allowscriptaccess"/>' ;
    htmlcode += '<param value="'+bgcolor+'" name="bgcolor"/>' ;
    htmlcode += '<param value="transparent" name="wmode"/>' ;
    htmlcode += '<embed id="'+objectid+'" width="100%" height="100%" align="middle" bgcolor="'+bgcolor+'" type="application/x-shockwave-flash" wmode="transparent" ' ;
    htmlcode += 'pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" name="'+objectid+'" quality="best" ' ;
    htmlcode += 'flashvars="'+flashvars+'" ' ;
    htmlcode += 'base="'+base+'" ' ;
    htmlcode += 'src="'+movie+'"/>' ;
    htmlcode += '</object></div>' ;
    document.getElementById(maindivid).innerHTML = htmlcode ;
    }
