
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);


////// legordulo menu
var lmc = ''; var lmt = '';
var menuopen=0; var menuid = '';
var original_username = '';
var original_userpass = '';
var submenu_old = '';
var openeditem = 0;

var deftextsize = 2;
var textsizenow;
var textsizenow_am;
var textsizes = new Array();
textsizes[0] = '11px';
textsizes[1] = '12px';
textsizes[2] = '13px';
textsizes[3] = '14px';
textsizes[4] = '15px';

var textsizes_am = new Array();
textsizes_am[0] = '14px';
textsizes_am[1] = '16px';
textsizes_am[2] = '18px';
textsizes_am[3] = '20px';
textsizes_am[4] = '22px';
if(textsizenow > -1){}else{textsizenow = deftextsize}
if(textsizenow_am > -1){}else{textsizenow_am = deftextsize}


/// Browser detect

//alert(navigator.appName)

var browserType = navigator.appName

if (browserType == 'Microsoft Internet Explorer'){
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
}else if(browserType == 'Netscape'){
    var ua = navigator.userAgent;
    var re  = new RegExp("Firefox/([0-9]\.[0-9]{1,2})\.[0-9]{1,4}");
    
    if (re.exec(ua) != null){rv = RegExp.$1;}
	browserType = 'Firefox';
}else{
	browserType = 'none';
	rv = 0
}
 
var browserVersion = rv;

function legmenu_view(id, side){

	if(menuopen == 0 || menuid != id){
		
		menuid = id;
		openeditem = menuid;
		$('legcont').style.display = 'none';
		$('legcont').innerHTML = $('sub_'+menuid).innerHTML;
	
		posi = Position.positionedOffset($("menudiv_"+menuid));
		posi_cont = Position.positionedOffset($("container"));
		//$("menudiv_"+menuid).style.background = '#DDDFDF';
		 var pos = posi.toString();
	     var newPos = pos.replace(",", " ");
	     var tombPos = $w(newPos);
	     
	     var pos_c = posi_cont.toString();
	     var newPos_c = pos_c.replace(",", " ");
	     var tombPos_c = $w(newPos_c);
		 var mytop = 16
		 var myleft = 0
		 
		 if(navigator.appName == 'Microsoft Internet Explorer' && version == '4' ){
		 	mytop = 10
		 	myleft = 0
		 }
		 
	     switch (side)
			{
			case 'left': 
			 $("legcont").style.left = (parseInt(tombPos[0])-$("menudiv_"+menuid).offsetWidth) + "px";
			 $("legcont").style.top =  (parseInt(tombPos[1])) + "px";
			 $("legcont").style.width =  ($("menudiv_"+menuid).offsetWidth) + "px"; 
			  break
			case 'right': 
			 $("legcont").style.left = (parseInt(tombPos[0]) +myleft+ parseInt(tombPos_c[0])+$("menudiv_"+menuid).offsetWidth) + "px";
			 $("legcont").style.top =  (parseInt(tombPos[1])-30) + "px";
			 //$("legcont").style.width =  $("menudiv_"+menuid).offsetWidth + "px"; 
			  break
			default:
			 $("legcont").style.left = (parseInt(tombPos[0])-8) + parseInt(tombPos_c[0]) + "px";
			 $("legcont").style.top =  ((parseInt(tombPos[1])+mytop+$("menudiv_"+menuid).offsetHeight)) + "px";
			 //$("legcont").style.width =  $("menudiv_"+menuid).offsetWidth + "px"; 
			  break
			}
		 Effect.toggle('legcont','blind', { duration: 0.0});
		 menuopen=1;
	     
	}

}

function legmenu(id, timeo, side){
	clearTimeout(lmc);	
	lmt = setTimeout('legmenu_view('+id+', \''+side+'\');', 10);
}



function legmenu_close(){	
	//$("menudiv_"+openeditem).style.background = 'none';	
	menuopen=0;
	$('legcont').style.display = 'none';
	
}

function closemenu(){	
	clearTimeout(lmt); 
	lmc = setTimeout('legmenu_close();', 150); 
}
////// legordulo menu vege

function loginwrite(un, up){
	original_username = un;
	$('login_email').value = original_username;
	original_userpass = up;
	$('login_pass').value = original_userpass;
}



function unover(){
	if($('login_email').value == original_username){
		$('login_email').value = '';
	}
}

function unout(){
	if($('login_email').value.strip().length < 1){
		$('login_email').value = original_username;
	}
}

function upover(){
	if($('login_pass').value == original_userpass){
		$('login_pass').value = '';
	}
}

function upout(){
	if($('login_pass').value.strip().length < 1){
		$('login_pass').value = original_userpass;
	}
}

function viewsubmenu(item){
	//alert($(item).style.display)
	if(submenu_old !== item && submenu_old !== ''){
		//alert($(item).style.display)
		if($(submenu_old).style.display !== 'none'){
			Effect.BlindUp(submenu_old, { duration: 0.2});
		//Effect.toggle(submenu_old,'slide', { duration: 0.2});
		}
	}
	
	if($(item).style.display == 'none'){
	Effect.BlindDown(item, { duration: 0.3});
	}
	//Effect.toggle(item,'slide');
	submenu_old = item;
}


function sessiontextsize(num){
	$('centertd').setStyle({
	  fontSize: textsizes[num]
	});
}

function sessiontextsize_am(num){
	$('centertd').setStyle({
	  fontSize: textsizes_am[num]
	});
}

function textsize_plus(){
	if(textsizenow < (textsizes.length-1)){
		textsizenow++
		sessiontextsize(textsizenow)
		new Ajax.Request('/savetextsize.php?size='+textsizenow+'')
	}
}

function textsize_minus(){
	if(textsizenow > 0){
		textsizenow--
		sessiontextsize(textsizenow)
		new Ajax.Request('/savetextsize.php?size='+textsizenow+'')
	}
}

function textsize_plus_am(){
	if(textsizenow < (textsizes.length-1)){
		textsizenow_am++
		sessiontextsize_am(textsizenow_am)
		new Ajax.Request('/savetextsize.php?size='+textsizenow_am+'')
	}
}

function textsize_minus_am(){
	if(textsizenow > 0){
		textsizenow_am--
		sessiontextsize_am(textsizenow_am)
		new Ajax.Request('/savetextsize.php?size='+textsizenow_am+'')
	}
}

function piclinkhover(obj){
	var ihtm = obj.innerHTML
	if(ihtm.indexOf('_h') > 0){}else{
		var new_ihtm = ihtm.replace('.gif', '_h.gif')
		obj.innerHTML = new_ihtm
	}
}

function piclinkout(obj){
	var ihtm = obj.innerHTML
	if(ihtm.indexOf('_h') > 0){
		var new_ihtm = ihtm.replace('_h.gif', '.gif')
		obj.innerHTML = new_ihtm
	}
}

function onMyTextKeypress(event)
{
    if (Event.KEY_RETURN == event.keyCode) {
       // alert('Enter key was pressed.');
    }
    return true;
}

// highlight



// image

function imageAligns(divid){
	
	if(browserType !== 'Microsoft Internet Explorer' ){
		var elements = $(divid).getElementsByTagName('img');
		
		for(var n=0; n<elements.length; n++){
			if(elements[n].readAttribute('align') == 'left'){elements[n].style.marginLeft = '0px';}
			if(elements[n].readAttribute('align') == 'right'){elements[n].style.marginRight = '0px';}
		}
	}
}


//// lightbox
var img;
var lightboxOpen = false
var lightboxTitle
var currentPicture = ''

function showLightbox(imgurl, title){
	currentPicture = imgurl
	lightboxTitle = title;
	if(!lightboxOpen){
		showLoader()
		lightboxOpen = true
		img = document.createElement('img'); 
		img.id = 'lightboxloadimage'; 
		Event.observe(img, 'load', function(e){addToLightbox(e);},false); 
		//$('lightboxpica').appendChild(img); 
		img.src = imgurl; 
		
		$('ajaxmessage_curtain').style.height = $('myContent').getHeight() + 'px';
		$('ajaxmessage_curtain').style.display = 'block';
	}
}

function showLoader(){
	var scrollOffsets = document.viewport.getScrollOffsets();
	$('mylightbox').style.display = 'block';
	$('lightboxinfo').style.display = 'none';
	$('lightboxcontainer').style.width = '24px';
	$('lightboxcontainer').style.height = '24px';
	$('lightboxtable_centtd').style.width = '24px';
	$('lightboxtable_centtd').style.height = '24px';
	$('mylightbox').style.width = '90px';
	$('mylightbox').style.height = '60px';
	$('mylightbox').style.left = ((document.viewport.getWidth()/2)-62) + 'px';
	$('mylightbox').style.top = ((document.viewport.getHeight()/2) + scrollOffsets[1]) + 'px';
}

function closelightbox(){
	$('lightboxpica').innerHTML = '';
	$('lightbox_leftarrow').style.display = 'none';
	$('lightbox_rightarrow').style.display = 'none';
	$('mylightbox').fade({duration:0.2, afterFinish: function(){lightboxClosed()}})
	lightboxOpen = false
}

function lightboxClosed(){
	var scrollOffsets = document.viewport.getScrollOffsets();
	$('ajaxmessage_curtain').style.display = 'none';
	$('lightbox_leftarrow').style.display = 'none';
	$('lightbox_rightarrow').style.display = 'none';
	$('lightbox_leftarrow').style.top = '0px';
	$('lightbox_rightarrow').style.top = '0px';
	$('mylightbox').style.display = 'none';
	$('lightboxpica').innerHTML = '';
	$('lightboxtext').innerHTML ='';
	$('lightboxcontainer').style.width = '56px';
	$('lightboxcontainer').style.height = '56px';
	$('lightboxtable_centtd').style.width = '56px';
	$('lightboxtable_centtd').style.height = '56px';
	$('mylightbox').style.width = '56px';
	$('mylightbox').style.height = '56px';
	$('mylightbox').style.left = ((document.viewport.getWidth()/2)) + 'px';
	$('mylightbox').style.top = ((document.viewport.getHeight()/2) + scrollOffsets[1]) + 'px';
	

}

function addToLightbox(e){
	
	$('lightboxpica').innerHTML = '';
	$('lightboxpica').appendChild(img);
	$('lightboxtext').innerHTML ='';
	$('lightboxtext').innerHTML = lightboxTitle
	var padding = 60
	var myDuration = 0.3
	var myTransition = Effect.Transitions.sinoidal
	
	Event.stop(e);
	var scrollOffsets = document.viewport.getScrollOffsets();
	
	$('lightbox_leftarrow').style.display = 'none';
	$('lightbox_rightarrow').style.display = 'none';
	$('lightbox_leftarrow').style.top = '0px';
	$('lightbox_rightarrow').style.top = '0px';
	$('lightboxinfo').style.display = 'none';
	$('mylightbox').style.visibility = 'hidden';
	$('mylightbox').style.display = 'block';
	
	
	$('lightboxcontainer').morph('width:'+img.getWidth()+'px; height:'+img.getHeight()+'px;', {duration:myDuration, transition: myTransition})
	$('lightboxtable_centtd').morph('width:'+(img.getWidth())+'px; height:'+((img.getHeight()))+'px;', {duration:myDuration, transition: myTransition})
	$('mylightbox').morph('width:'+(img.getWidth() + padding + 140)+'px; height:'+((img.getHeight() + padding)+120)+'px;', {duration:myDuration, transition: myTransition})
	$('mylightbox').style.left = ((document.viewport.getWidth()/2)-62) + 'px';
	$('mylightbox').style.top = ((document.viewport.getHeight()/2) + scrollOffsets[1]) + 'px';
	
	new Effect.Move('mylightbox', { x: ((document.viewport.getWidth()/2)-((img.getWidth() + padding)/2)-62), y: (((document.viewport.getHeight()/2)-((img.getHeight() + padding)/2)) + scrollOffsets[1]), mode: 'absolute', transition: myTransition, duration:myDuration, afterFinish: function(){fadePictureIn()}});
	
	
	
	$('lightboxcontainer').style.display = 'none';
	$('mylightbox').style.visibility = 'visible';
	lightboxTitle = ''
}

function fadePictureIn(){
	var picpicFiles = new Array();
	picpicArray = document.getElementsByClassName('kepekbox');
	
	for(var n=0; n<picpicArray.length; n++){
		var cumo = picpicArray[n].innerHTML;
		var daraboltString = cumo.split("'");
		picpicFiles[n] = daraboltString[1];	
	}
	
	thisid = picpicFiles.indexOf(currentPicture)
	//alert(thisid)
	
	$('lightboxcontainer').appear({duration: 0.3, afterFinish: function(){showLightInfo()}})
	
	$('lightbox_leftarrow').style.top = (($('mylightbox').getHeight()/2) - 180)+'px';
	if(thisid > 0){$('lightbox_leftarrow').style.display = 'block';}

	$('lightbox_rightarrow').style.top = (($('mylightbox').getHeight()/2) - 180)+'px';
	if(thisid < (picpicArray.length-1)){$('lightbox_rightarrow').style.display = 'block';}

	
}

function showLightInfo(){
	Effect.SlideDown('lightboxinfo', { duration: 0.2 });
}

function lightboxNextpic(){
	picpicArray:Array
	var picpicFiles = new Array();
	var picpicTitles = new Array();
	picpicArray = document.getElementsByClassName('kepekbox');
	
	for(var n=0; n<picpicArray.length; n++){
		var cumo = picpicArray[n].innerHTML;
		var daraboltString = cumo.split("'");
		picpicFiles[n] = daraboltString[1];
		picpicTitles[n] = daraboltString[3];	
	}
	
	thisid = picpicFiles.indexOf(currentPicture)
	changeLightbox(picpicFiles[(thisid+1)], picpicTitles[(thisid+1)]);
}

function lightboxPrevpic(){
	picpicArray:Array
	var picpicFiles = new Array();
	var picpicTitles = new Array();
	picpicArray = document.getElementsByClassName('kepekbox');
	
	for(var n=0; n<picpicArray.length; n++){
		var cumo = picpicArray[n].innerHTML;
		var daraboltString = cumo.split("'");
		picpicFiles[n] = daraboltString[1];
		picpicTitles[n] = daraboltString[3];	
	}
	
	thisid = picpicFiles.indexOf(currentPicture)
	changeLightbox(picpicFiles[(thisid-1)], picpicTitles[(thisid-1)]);
}

function changeLightbox(imgurl, title){
	$('lightboxloadimage').fade({duration:0.07})
	$('lightbox_leftarrow').style.display = 'none';
	$('lightbox_rightarrow').style.display = 'none';
	$('lightboxinfo').fade({duration:0.07, afterFinish: function(){changeLightbox_smaller(imgurl, title)}})
	//closelightbox()
	//var setfunc = 'showLightbox(\''+imgurl+'\', \''+title+'\')';
	//setTimeout(setfunc,500);
}

function changeLightbox_smaller(imgurl, title){
	var padding = 60
	var myDuration = 0.3
	var mysize = 200
	var myTransition = Effect.Transitions.sinoidal
	var scrollOffsets = document.viewport.getScrollOffsets();
	
	
	$('lightboxcontainer').morph('width:'+mysize+'px; height:'+mysize+'px;', {duration:myDuration, transition: myTransition})
	$('lightboxtable_centtd').morph('width:'+(mysize)+'px; height:'+(mysize)+'px;', {duration:myDuration, transition: myTransition})
	$('mylightbox').morph('width:'+(mysize + padding + 140)+'px; height:'+((mysize + padding)+120)+'px;', {duration:myDuration, transition: myTransition})
	new Effect.Move('mylightbox', { x: ((document.viewport.getWidth()/2)-((mysize + padding)/2)-62), y: (((document.viewport.getHeight()/2)-((mysize + padding)/2)) + scrollOffsets[1]), mode: 'absolute', transition: myTransition, duration:myDuration, afterFinish: function(){changeLightbox_newload(imgurl, title)}});

}

function changeLightbox_newload(imgurl, title){

	$('lightboxpica').innerHTML = '<img src="../images/ajaxloader.gif" alt="load" style="margin-top:88px; margin-left:88px;"/>';
	currentPicture = imgurl
	lightboxTitle = title;
	lightboxOpen = false
	if(!lightboxOpen){
		//showLoader()
		lightboxOpen = true
		img = document.createElement('img'); 
		img.id = 'lightboxloadimage'; 
		Event.observe(img, 'load', function(e){changeLightbox_ToLightbox(e);},false); 
		//$('lightboxpica').appendChild(img); 
		img.src = imgurl; 
	}
}

function changeLightbox_ToLightbox(e){
	
	$('lightboxpica').innerHTML = '';
	$('lightboxpica').appendChild(img);
	$('lightboxtext').innerHTML ='';
	$('lightboxtext').innerHTML = lightboxTitle
	var padding = 60
	var myDuration = 0.5
	var myTransition = Effect.Transitions.sinoidal
	
	Event.stop(e);
	var scrollOffsets = document.viewport.getScrollOffsets();
	
	$('lightbox_leftarrow').style.display = 'none';
	$('lightbox_rightarrow').style.display = 'none';
	$('lightbox_leftarrow').style.top = '0px';
	$('lightbox_rightarrow').style.top = '0px';
	$('lightboxinfo').style.display = 'none';
	//$('mylightbox').style.visibility = 'hidden';
	//$('mylightbox').style.display = 'block';
	
	
	$('lightboxcontainer').morph('width:'+img.getWidth()+'px; height:'+img.getHeight()+'px;', {duration:myDuration, transition: myTransition})
	$('lightboxtable_centtd').morph('width:'+(img.getWidth())+'px; height:'+((img.getHeight()))+'px;', {duration:myDuration, transition: myTransition})
	$('mylightbox').morph('width:'+(img.getWidth() + padding + 140)+'px; height:'+((img.getHeight() + padding)+120)+'px;', {duration:myDuration, transition: myTransition})
	//$('mylightbox').style.left = ((document.viewport.getWidth()/2)) + 'px';
	//$('mylightbox').style.top = ((document.viewport.getHeight()/2) + scrollOffsets[1]) + 'px';
	
	new Effect.Move('mylightbox', { x: ((document.viewport.getWidth()/2)-((img.getWidth() + padding)/2)-62), y: (((document.viewport.getHeight()/2)-((img.getHeight() + padding)/2)) + scrollOffsets[1]), mode: 'absolute', transition: myTransition, duration:myDuration, afterFinish: function(){fadePictureIn()}});
	
	
	
	$('lightboxcontainer').style.display = 'none';
	//$('mylightbox').style.visibility = 'visible';
	lightboxTitle = ''
}

//// alert

function alertposition(obj){
	var myViewWidth = 697
	var scrollOffsets = document.viewport.getScrollOffsets();
	$(obj).style.top = ((document.viewport.getHeight()/2) - ($(obj).offsetHeight/2))+ scrollOffsets[1] + 'px';
	$(obj).style.left = ((myViewWidth/2) - ($(obj).offsetWidth/2)) + 'px';
}

function showAlert(cim, szoveg, gomb){
	//alert('aaaa')
	if (browserType == 'Microsoft Internet Explorer' && browserVersion < 7){
		var selects = $('content').getElementsByTagName('select')
		for(var n=0; n<selects.length; n++){
			selects[n].style.display = 'none'
		}
	}
	//document.all.dropDownMenu.style.display = "none"
	
	//$('myselect').style.zIndex = 100
	//alert($('myselect').style.zIndex)
	$('ajaxmessage').style.display = 'block'
	$('ajaxalerttext').innerHTML = '<h3>'+cim+'</h3>'+szoveg;
	$('alertokbutt').innerHTML = gomb
	
	
	alertposition('ajaxmessage');
}

function closemessage(){
	if (browserType == 'Microsoft Internet Explorer' && browserVersion < 7){
		var selects = $('content').getElementsByTagName('select')
		for(var n=0; n<selects.length; n++){
			selects[n].style.display = 'block'
		}
	}
	
	$('ajaxmessage').style.display = 'none';
	try{extclosemessage()}catch(err){}
}

function showTooltip(element){
	$(element).next().style.display = 'block';
}

function hideTooltip(element){
	$(element).next().style.display = 'none';
	
}

function update_katlist(id, text){
	if($('kat_'+id).checked){
		$('kategoria_hidden').value = $('kategoria_hidden').value + ''+id+';';
		$('kategoria_inp').value = $('kategoria_inp').value + ''+text+', ';
	}else{
		var newValue = ''+$('kategoria_hidden').value+''
		$('kategoria_hidden').value = newValue.replace(';'+id+';', ';');
		
		var textValue = ''+$('kategoria_inp').value+''
		$('kategoria_inp').value = textValue.replace(''+text+', ', '');
	}
}

function kattable(){
	if($('categoryBox').style.display == 'none'){
		if($('kategoria_inp').value == 'Kérem, válasszon!'){$('kategoria_inp').value = ''}
		$('categoryBox').style.display = 'block';
		//$('myBody').onclick = kattableclose;
	}else{
		kattableclose()
	}
}

function katCheckEmpty(){
	var myret = true
	
	var katArray = new Array();
	katArray = $('categoryBox').getElementsByClassName('checkBox');
	
	//alert(katArray.length)
	
	for(var n=0; n<katArray.length; n++){
		if(katArray[n].checked){myret = false; break;}
	}
	
	return myret;
}

function kattableclose(){
	if(katCheckEmpty()){$('kategoria_inp').value = 'Kérem, válasszon!'}
	$('categoryBox').style.display = 'none';
	//$('myBody').onclick = null
}

function showBanner(caller, url, width, height, marginleft, margintop){
	
	$('loadedBannerContent').innerHTML = ''
	var myLeft = 0
	var myTop = 0
	
	if(marginleft !== undefined){
		myLeft = marginleft
	}
	
	if(margintop !== undefined){
		myTop = margintop
	}
	
	var posi
	posi = Position.positionedOffset($(caller));	
	$('showBannerBox').style.top = posi[1]+myTop+'px'
	$('showBannerBox').style.left = ( posi[0]+200 + myLeft )+'px'	
	
	$('showBannerBox').style.display = 'block'
	$('loadedBannerContent').innerHTML = '<iframe width="'+width+'" height="'+height+'" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" src="'+url+'"></iframe>'
	
}


function hideBanner(){
	$('showBannerBox').style.display = 'none'
	$('loadedBannerContent').innerHTML = ''
}


function bannerAreaShow(caller){
	
	if( $('areaWidth').value.length>0 && !isNaN($('areaWidth').value) && $('areaHeight').value.length>0 && !isNaN($('areaHeight').value)){
	
		if($('showBannerBox').style.display == 'none'){
			$('loadedBannerContent').innerHTML = ''
			var posi
			posi = Position.positionedOffset($(caller));	
			$('showBannerBox').style.top = ( posi[1]+20 )+'px'
			$('showBannerBox').style.left = ( posi[0]-6 )+'px'	
			
			$('showBannerBox').style.display = 'block'
			
				new Ajax.Request('/test_area.php', {
				method: 'post',
				parameters: { width:$('areaWidth').value, height:$('areaHeight').value },
				onSuccess: function(request) {
					if(request.responseText !== 'error'){
						$('loadedBannerContent').innerHTML = request.responseText
					}
				}
			});
			
		}else{
			$('showBannerBox').style.display = 'none'
			$('loadedBannerContent').innerHTML = ''
		}
	
	}else{
		alert('Az adatok nem megfelelőek!')
	}
}

function bannerAreaShowCode(caller, code){
	
	
		if($('showBannerBox').style.display == 'none'){
			$('loadedBannerContent').innerHTML = ''
			var posi
			posi = Position.positionedOffset($(caller));	
			$('showBannerBox').style.top = ( posi[1]+20 )+'px'
			$('showBannerBox').style.left = ( posi[0]-6 )+'px'	
			
			$('showBannerBox').style.display = 'block'
			
			$('loadedBannerContent').innerHTML = code
			
		}else{
			$('showBannerBox').style.display = 'none'
			$('loadedBannerContent').innerHTML = ''
		}
	
}

/* banner elonezetek */

function updateElonezet(){

	//try{ alert($('previewImage_1')) }catch(err){}
	
	//$('bannerElonezet_allo_kep').innerHTML = '<img src="'+$('previewImage_1').src+'" alt=""/>'
	
	var leiras = $('bannerLeiras').value
	var printUrl = $('bannerPrintUrl').value
	var printTitle = $('bannerPrintCim').value
	
	$('bannerElonezet_allo_title').innerHTML = printTitle
	$('bannerElonezet_fekvo_title').innerHTML = printTitle
	
	$('bannerElonezet_allo_text').innerHTML = leiras
	$('bannerElonezet_fekvo_text').innerHTML = leiras
	
	$('bannerElonezet_allo_url').innerHTML = printUrl
	$('bannerElonezet_fekvo_url').innerHTML = printUrl
	
	$('bannerElonezet_allo_url').style.color = $('color_1').value
	$('bannerElonezet_fekvo_url').style.color = $('color_1').value
	
	$('bannerElonezet_allo_title').style.color = $('color_2').value
	$('bannerElonezet_fekvo_title').style.color = $('color_2').value
	
	$('bannerElonezet_allo_text').style.color = $('color_3').value
	$('bannerElonezet_fekvo_text').style.color = $('color_3').value
	
	$('bannerElonezet_allo').style.background = $('color_4').value
	$('bannerElonezet_fekvo').style.background = $('color_4').value
	
	
}

function myPrewImage(input, target){

	$(target).innerHTML = ''
	var inpId = input.id
	var mySrc
	
	/*if(typeof(FileReader)!='undefined'){
      var reader = new FileReader();
      var self = this;
      reader.onload = function(e){
        mySrc = e.target.result;
      }
      reader.readAsDataURL(imagefile.files.item(0));
    }else */
    
    if ($(inpId).files){
		//alert($(inpId).files.item(0).getAsBinary())
      mySrc = $(inpId).files.item(0).getAsDataURL();
      
	}else{
		if(browserType == 'Microsoft Internet Explorer' &&  browserVersion<8){
			var myValue = $(inpId).value
			mySrc = $(inpId).value;
		}else{
			$(inpId).select();
			document.execCommand("Copy");
			mySrc = clipboardData.getData("text")
		}
	}
	
	var sizetag
	
	if(target == 'bannerElonezet_allo_kep'){
		sizetag = 'width="160" height="100%"';
	}else{
		sizetag = 'width="176" height="60"';
	}
	
	$(target).innerHTML = '<img src="'+mySrc+'" alt="" '+sizetag+'/>'
}

function createLocalUrl(string){
	var myStr = string
	myStr = myStr.replace('C:\\', '')
	myStr = myStr.split('\\').join('/')
	myStr = escape(myStr)
	myStr = 'file:///C:/'+myStr
	return myStr
}

///// textarea

function textareaCounter(num, areaid, charid, maxid){
	if($(areaid).value.length < (num+1)){
		$(charid).innerHTML = $(areaid).value.length
	}else{
		$(areaid).value = $(areaid).value.substring(0, num);
	}
}

function copyText(area){
	$(area).select();
	try{copy_clip($(area).value) }catch(err){}
}

function copy_clip(meintext)
{

 if (window.clipboardData) 
   {
   
   // the IE-manier
   window.clipboardData.setData("Text", meintext);
   
   // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
   // het is mij echter onbekend vanaf welke versie dit precies werkt:
   }
   else if (window.netscape) 
   { 
   
   // dit is belangrijk maar staat nergens duidelijk vermeld:
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
   
   // maak een interface naar het clipboard
   var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
   if (!clip) return;
   
   // maak een transferable
   var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
   if (!trans) return;
   
   // specificeer wat voor soort data we op willen halen; text in dit geval
   trans.addDataFlavor('text/unicode');
   
   // om de data uit de transferable te halen hebben we 2 nieuwe objecten nodig   om het in op te slaan
   var str = new Object();
   var len = new Object();
   
   var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
   
   var copytext=meintext;
   
   str.data=copytext;
   
   trans.setTransferData("text/unicode",str,copytext.length*2);
   
   var clipid=Components.interfaces.nsIClipboard;
   
   if (!clip) return false;
   
   clip.setData(trans,null,clipid.kGlobalClipboard);
   
   }
   //alert("Following info was copied to your clipboard:\n\n" + meintext);
   return false;
}


// partner sildeshow

var parnerSS_auto = true
var parnerSS_timeout
var parnerSS_width = 200
var parnerSS_Fullwidth
var parnerSS_automove = 'left'
var parnerSS_clickable = true
var partnerFiles = new Array();

function parnerSlideshowAuto(){
	//alert('aaaaaa')
	var myDuration = 1
	var myTransition = Effect.Transitions.sinoidal
	
	/*
	partnerFiles = document.getElementsByClassName('partner_slide');
	parnerSS_Fullwidth = partnerFiles.length * parnerSS_width
	*/
	//alert(parnerSS_Fullwidth)
	if($('partnerslides').style.left == '0px'){parnerSS_automove = 'left'}
	if($('partnerslides').style.left == '-'+(parnerSS_Fullwidth-parnerSS_width)+'px'){parnerSS_automove = 'right'}
	
	var szorzo
	if(parnerSS_automove == 'left'){
		szorzo = -1
	}else{
		szorzo = 1
	}
	
	if(parnerSS_auto){
			new Effect.Move('partnerslides', { x: szorzo*parnerSS_width, mode: 'relative', transition: myTransition, duration:myDuration});
			parnerSS_timeout = setTimeout('parnerSlideshowAuto()', 5000)
	}
	
	
}

function stopPartnerShow(){
	parnerSS_auto = false
	clearTimeout(parnerSS_timeout)
}

function againPartnerShow(){
	parnerSS_auto = true
	parnerSS_timeout = setTimeout("parnerSlideshowAuto()", 5000);
}

function partnerShowNext(){
	if($('partnerslides').style.left !== '-'+(parnerSS_Fullwidth-parnerSS_width)+'px'){
	if(parnerSS_clickable){
		parnerSS_clickable = false
		var myDuration = 1
		var myTransition = Effect.Transitions.sinoidal
		new Effect.Move('partnerslides', { x: -parnerSS_width, mode: 'relative', transition: myTransition, duration:myDuration, afterFinish: function(){parnerSS_clickable = true}});
	}
	}
}

function partnerShowPrev(){
	if($('partnerslides').style.left !== '0px'){
	if(parnerSS_clickable){
		parnerSS_clickable = false
		var myDuration = 1
		var myTransition = Effect.Transitions.sinoidal
		new Effect.Move('partnerslides', { x: parnerSS_width, mode: 'relative', transition: myTransition, duration:myDuration, afterFinish: function(){parnerSS_clickable = true}});
	}
	}
}

//// cropper

function showImgCropper(swf){
	//alert(swf)
	//var so = new SWFObject(''+swf+'', 'player', '620', '620', '90', '#FFFFFF');
	var myflash = swf
	//alert(myflash)
	var so = new SWFObject(myflash, 'player', '420', '420', '10', '#FFFFFF');
  	so.useExpressInstall('swfobject/expressinstall.swf');
    so.addParam('wmode', 'transparent');
    so.write('croppercontainer');
	
	var scrollOffsets = document.viewport.getScrollOffsets();
	$('mycropper').style.display = 'block';
	$('mycropper').style.left = ((document.viewport.getWidth()/2) - ($('mycropper').getWidth()/2)) + 'px';
	$('mycropper').style.top = ((document.viewport.getHeight()/2)- ($('mycropper').getHeight()/2) + scrollOffsets[1]) + 'px';
	$('ajaxmessage_curtain').style.height = $('netadclick').getHeight() + 'px';
	$('ajaxmessage_curtain').style.display = 'block';
	
}

function hideImgCropper(){
	$('mycropper').style.display = 'none';
	$('ajaxmessage_curtain').style.display = 'none';
}


function  keptarSlider(){
	var elements
	var tempelement
	elements = $('keptar_slide').childElements();
	tempelement = elements[0] //getHeight()
	
	var first_a = tempelement.childElements()
	var first_img = first_a[0].childElements()
	var first_dim = first_img[0].getDimensions()
	var padding = 7
	if (browserType == 'Microsoft Internet Explorer'){padding = 5}
	//alert(first_dim.height)
	
	
	new Effect.Move('keptar_slide', { y: (-1*(first_dim.height+padding)), mode: 'relative', transition: Effect.Transitions.linear, duration:5, afterFinish: function(){
		elements = $('keptar_slide').childElements();
		tempelement = elements[0]
		elements[0].remove();
		new Insertion.After(elements[(elements.length-1)], '<li>' + tempelement.innerHTML + '</li>')
		$('keptar_slide').style.top = '0px'
		keptarSlider()
	}});

}

