// JavaScript Document


function save() {
         document.form1.focim.value = focim_text.innerHTML;
		 document.form1.focim_en.value = focim_text_en.innerHTML;
		 document.form1.focim_de.value = focim_text_de.innerHTML;
		 document.form1.footer.value = footer_text.innerHTML;
		 document.form1.footer_en.value = footer_text_en.innerHTML;
		 document.form1.footer_de.value = footer_text_de.innerHTML;
		 document.form1.akt_text.value = valt_szov_text.innerHTML;
		 document.form1.akt_text_en.value = valt_szov_text_en.innerHTML;
		 document.form1.akt_text_de.value = valt_szov_text_de.innerHTML;
		 document.form1.submit();

}


function kep_beszur(picpath,alt)
  { 
htmlt = "<img src='"+picpath+"' alt='"+alt+"'>";
range = document.selection.createRange();
htmlt += range.htmlText;
range.pasteHTML(htmlt)
	  } 
 
    
function check() {
  with (document.pictures) {
    if (!i_picture.value.length) {
      alert("Válassz ki egy filet!");
      return false;
    }
  	
    submit();
    
  }
}

function fnBeforePaste() {
    event.returnValue = false;
}
// Cancel the returnValue in onpaste for the text input, which
// has a default behavior.
function fnPaste(v) {
    event.returnValue = false;
	thisitem = v;
   srange = thisitem.document.selection.createRange();
   srange.text = window.clipboardData.getData("text");

}

function submit_valt_szov(para_p)
{
	document.form1.para.value = para_p;
	document.form1.submit();
}

function torol_valt_szov(id_p)
{
	document.form1.torol.value = id_p;
	document.form1.para.value = 'delete';
	document.form1.submit();
}
function update_valt_szov_window()
{
opener.window.location.href='main_edit.php';
}
function close_valt_szov_window()
{
window.close();
}

//------------------------------Linkboxok linkjeihez----------------

function submit_linkbox(para_p)
{
	document.form1.text.value = focim_text.innerHTML;
	document.form1.text_en.value = focim_text_en.innerHTML;
   	document.form1.text_de.value = focim_text_de.innerHTML;
	document.form1.f.value = para_p;
	document.form1.submit();
}

function torol_linkbox(id_p,hova_p)
{
	document.form1.torol.value = id_p;
	document.form1.ide.value = hova_p;
	document.form1.para.value = 'delete';
	document.form1.submit();
}

function close_linkbox_window()
{
window.close();
}
//------------------------------META attribútumok szerkesztéséhez----------------

function submit_meta_edit(para_p)
{
	document.form1.para.value = para_p;
	if (para_p == 'new_meta' )
	{
	if (document.form1.uj_name.value == '' ) alert('Adja meg a NAME értékét!');
	 else document.form1.submit();
	}
	else document.form1.submit();
	
}

function torol_meta_edit(id_p)
{
	document.form1.torol.value = id_p;
	document.form1.para.value = 'delete';
	document.form1.submit();
}

function close_meta_edit_window()
{
window.close();
}

//--------------------------------HELYI IDŐ MEGJELENÍTÉSÉHEZ!--------------------
var clockID = 0;
function UpdateClock() {
clockID = setTimeout("UpdateClock()", 1000);   

// Update frequency
// Where Number 1000 is is N/1000:= Seconds until next Update
// You can edit this program so that it only updates at a given rate
// Having at start forces 01-12 digit number
// Having at end forces 1-12 digit number,  Note exclusion of 0

TheTime = new Date()

        hours   = TheTime.getHours()

        AMPM    = TheTime.getHours()

        minutes = TheTime.getMinutes()

        seconds = TheTime.getSeconds()

        // THE FOLLOWING IMPORTED FROM COMPLEX CLOCK       

      

            if (hours<1)

        {

                hours=0

        } 

        hourString="0"+hours+""

        minuteString="0"+minutes+""

        secondString="0"+seconds+""

        // format the hour

        hour1=parseInt(hourString.charAt(hourString.length-1))

        hour2=parseInt(hourString.charAt(hourString.length-2))

        // format the minute

        minute1=parseInt(minuteString.charAt(minuteString.length-1))

        minute2=parseInt(minuteString.charAt(minuteString.length-2))
        // format the seconds

        second1=parseInt(secondString.charAt(secondString.length-1))

        second2=parseInt(secondString.charAt(secondString.length-2))
        //END INPORT
// THIS SECTION WILL DETERMIN AM or PM TIMESLOT
// AKA I DONT KNOW THE RETRIEVE A TRUE AMPM VALUE, IF IT EXISTS
// MAKE USE AM TEST IS FIRST ELSE 12:00:00-12:59:59 PM = 00:00:00-00:59:59 AM 
          
         theTime.innerHTML =  "Local time: "+hour2+hour1+":"+minute2+minute1+":"+second2+second1

        
}

// END OF FUNCTION UPDATECLOCK

function StartClock() {

   clockID = setTimeout("UpdateClock()", 0);
// Tells the Browser to initate clock

// Where Number 0 is N/1000:= Seconds until clock starts

}



function keret()
{ if (document.tables.border.checked == true)
  { document.tables.r1.disabled = false;
  document.tables.r2.disabled = false;
  document.tables.r3.disabled = false;
  document.tables.r4.disabled = false;
  document.tables.r5.disabled = false;
  document.tables.r6.disabled = false;
  document.tables.r7.disabled = false;
  document.tables.r8.disabled = false;
  	  }
 else 	  
	  { document.tables.r1.disabled = true;
  document.tables.r2.disabled = true;
  document.tables.r3.disabled = true;
  document.tables.r4.disabled = true;
  document.tables.r5.disabled = true;
  document.tables.r6.disabled = true;
  document.tables.r7.disabled = true;
  document.tables.r8.disabled = true;
	  }
	}

function csere(id1,id2)
{
	var egyik=document.getElementById(id1)
	var masik=document.getElementById(id2)
	egyik.checked=true;
	masik.checked=false;		
	}
	
function csere_(id1,id2)
{
	var egyik=document.getElementById(id1)
	var masik=document.getElementById(id2)
	masik.checked=false;		
	}	

function check_table() 
{
	
hiba = "";	
dupla = "cellspacing='0'";
kulso = "";
belso = "";

  with (document.tables) {
    if (oszlop.value == '') 
	{
      hiba = "Adja meg az oszlopok számát!\n";  
    }
   if (sor.value == '')
   {
	   hiba += "Adja meg a sorok számát!\n" ; 
    }
if (hiba != "") {alert(hiba);}
 else   {
	 o = oszlop.value;
	 s = sor.value;
	 if (width.value == "")   w = 500;
	 else w = width.value;		  
	 htmlt="<table width='"+w+"'";
	 if (border.checked) 
	 { 
	
	 if (r1.checked) dupla="cellspacing='5'";
	 if ((r3.checked) && (r5.checked)) clasz = "class='table3'";
	 if ((r3.checked) && (r6.checked)) clasz = "class='table4'";
	 if ((r4.checked) && (r5.checked)) clasz = "class='table1'";
	 if ((r4.checked) && (r6.checked)) clasz = "class='table2'";
	 kulso = clasz;
	 belso = clasz;
	 if (r7.checked) kulso= '';
	 if (r8.checked) belso= '';
     
	htmlt +=" cellpadding='0' "+dupla+" "+kulso+" >";
	  }
	 else htmlt +=">";
	 for (i=1;i<=s;i++)
	  { htmlt += "<tr>\n";
	    for (j=1;j<=o;j++) { htmlt += "<td "+belso+">cella"+i+j+"</td>\n";}	   
	    htmlt += "</tr>\n"
	  }
	 htmlt += "</table>"
	 range = opener.document.selection.createRange();
	 //htmlt += range.htmlText;
	 range.pasteHTML(htmlt)
	 window.close();
	 }
    
  }
  }
 
function init()
{
szoveg_text=opener.document.selection.createRange();
document.links.szoveg.value = szoveg_text.text;
	}
	
function link()
{
if 	(document.links.protokol.value == "http://") {
htmlt = "<a class='hg' href='"+document.links.protokol.value+document.links.url.value+"' target='"+document.links.target.value+"'>";
htmlt += document.links.szoveg.value+"</a>";
}
else {
htmlt = "<a class='hg' href='"+document.links.protokol.value+document.links.url.value+"'>";
htmlt += document.links.szoveg.value+"</a>";	
	}
range = opener.document.selection.createRange();
range.pasteHTML(htmlt);
window.close();
	}
	

  
function elkuld(para)
 {
 if (document.form1.turi_file.value == '') alert('Válaszon ki egy file-t!');
 else {
 document.form1.parameter.value = para;
 document.form1.file_nev.value = document.form1.turi_file.value;
 document.form1.submit();
   }

 }
 
function layer_csere(id)
 {
 if (id == 'hu') 
	{
  	document.getElementById('hu').style.visibility = 'visible';
  	document.getElementById('en').style.visibility = 'hidden';
  	document.getElementById('de').style.visibility = 'hidden';
 	}
if (id == 'en') 
	{
  	document.getElementById('en').style.visibility = 'visible';
  	document.getElementById('hu').style.visibility = 'hidden';
  	document.getElementById('de').style.visibility = 'hidden';
 	}
if (id == 'de') 
	{
  	document.getElementById('de').style.visibility = 'visible';
  	document.getElementById('en').style.visibility = 'hidden';
  	document.getElementById('hu').style.visibility = 'hidden';
 	}	

if (id == 'focim') 
	{
  	document.getElementById('focim').style.visibility = 'visible';
  	document.getElementById('focimen').style.visibility = 'hidden';
  	document.getElementById('focimde').style.visibility = 'hidden';
	}
	
if (id == 'focimde') 
	{
  	document.getElementById('focimde').style.visibility = 'visible';
  	document.getElementById('focimen').style.visibility = 'hidden';
  	document.getElementById('focim').style.visibility = 'hidden';
	}
	
if (id == 'focimen') 
	{
  	document.getElementById('focimen').style.visibility = 'visible';
  	document.getElementById('focimde').style.visibility = 'hidden';
  	document.getElementById('focim').style.visibility = 'hidden';
	}
	
if (id == 'lfooter') 
	{
  	document.getElementById('lfooter').style.visibility = 'visible';
  	document.getElementById('lfooterde').style.visibility = 'hidden';
  	document.getElementById('lfooteren').style.visibility = 'hidden';
	}
if (id == 'lfooteren') 
	{
  	document.getElementById('lfooteren').style.visibility = 'visible';
  	document.getElementById('lfooterde').style.visibility = 'hidden';
  	document.getElementById('lfooter').style.visibility = 'hidden';
	}
if (id == 'lfooterde') 
	{
  	document.getElementById('lfooterde').style.visibility = 'visible';
  	document.getElementById('lfooter').style.visibility = 'hidden';
  	document.getElementById('lfooteren').style.visibility = 'hidden';
	}	
	
if (id == 'akt') 
	{
  	document.getElementById('akt').style.visibility = 'visible';
  	document.getElementById('aktde').style.visibility = 'hidden';
  	document.getElementById('akten').style.visibility = 'hidden';
	}
if (id == 'akten') 
	{
  	document.getElementById('akten').style.visibility = 'visible';
  	document.getElementById('aktde').style.visibility = 'hidden';
  	document.getElementById('akt').style.visibility = 'hidden';
	}
if (id == 'aktde') 
	{
  	document.getElementById('aktde').style.visibility = 'visible';
  	document.getElementById('akt').style.visibility = 'hidden';
  	document.getElementById('akten').style.visibility = 'hidden';
	}		
	 
}