//<script type="text/javascript" language="JavaScript1.2">
var nasobr = new Image();
var gsirka=0;
var gvyska=0;
var gcesta="";
var a;

function jed()
{
	if (!okno.document.all.grafika) 
	{
	a=setTimeout("jed()",1000);
	return;
	}
	if ((okno.document.all) && (okno.document.all.grafika))
	{
		clearTimeout(a); 
		okno.document.all.grafika.width=gsirka;
		okno.document.all.grafika.height=gvyska;
		okno.document.all.grafika.src=nasobr.src;
	//	okno.document.grafika.src=gcesta;
		okno.focus();
		okno.document.all.grafika.alt="Nahráno";
		
	}
}


function nahled(cesta,sirka,vyska,url)
{
	gsirka=sirka;
	gvyska=vyska;
	gcesta=cesta;

	url="nahled.php";
	//okno = new Window;
	//okno = window.open(url,'oknoo','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,dependent,width='+(gsirka+40)+',height='+(gvyska+70)+',left=130,top=15');
	sokna=sirka+0;
	vokna=vyska+0;
	okno = window.open(url,'oknoo','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,dependent,width='+sokna+',height='+vokna+',left=130,top=120');
	nasobr.src = cesta;
	a=setTimeout("jed()",1000);
  	
}

function jdi_new(mark,tofocus)
{
	
	if ((document.mainform) && (document.mainform.restore))
	{
	//alert('jede');
	document.mainform.restore.value = "true";
	//document.mainform.f_mark.value = mark; //kam se vratit
	//document.mainform.f_foc.value = tofocus; //co zaměřit
	//alert(document.mainform.f_foc.value);
	document.mainform.submit();
	}
}

function info(zalozka)  //info o ao a1 b1 atd..
{
	//alert('jo');
	okno = window.open('http://www.prazska.info/www/c/faq.php#'+zalozka,'faq','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,dependent,width=350,height=300,left=2,top=2');
	okno.focus();
	//return false;
}

function umistiReklamu(idElementu,xset,yset)
{
	//el = document.getElementById(idElementu); //,xset,yset);
	
	//html = '<div class="adv"> !!!!!!   </div>';
	
	var newAdv = document.createElement('div');
                   
	newAdv.setAttribute('class', 'adv');
	
	//newAdv.className = "adv";
	
	//newAdv.appendData = "!!!!!!!!";
    
	if (e = document.getElementById(idElementu))
	{
		idElementu.border = "1";
		e.appendChild(newAdv);
		alert("appended");
	}
	
	
	
	//alert(idElementu.currentStyle.left);

}

function umistiReklamu2(za_idElementu,idElementu,htmltext,pocet)
{
	sirka_stranky = 790;
	max_sirka = 430;	
	timeout = 50;
	
	if (e = document.getElementById(idElementu))
	{
		//alert("width : "+ parseInt(e.style.width))
		
		pocet++;
		
		if (parseInt(e.style.width) < max_sirka)
		{
			//x = Math.floor( parseInt(e.style.width)/2+0.8);
			x = pocet;
			//alert(x);
			if (parseInt(e.style.width) + x < max_sirka)
			e.style.width = (parseInt(e.style.width) + x) + "px";
		}
		else
		{
			if (za = document.getElementById(za_idElementu))
			{
				/*
				alert("des");
				za.removeChild(e);			
				*/
				return;
				
			}
			
		}
		
		
		//e.style.visibility = "hidden";
		//e.style.left = 200 + "px";
		//alert('existuje');
		
		
		
		
			
	}
	else
	{
		//alert('ne');
		
		
		//htmltext = "ahoj chlape";
		
		//el = document.getElementById(idElementu); //,xset,yset);
		
		//html = '<div class="adv"> !!!!!!   </div>';
		
		if (e = document.getElementById(za_idElementu))
		{
					
			if (document.all) //IE
			d_sirka = document.body.clientWidth;
			else //Firefox
			d_sirka = (document.width);
			
			okraj = 289;
			
			if (d_sirka > sirka_stranky )
			x_start = Math.floor(((d_sirka - sirka_stranky)/2) ) + okraj;
			else
			x_start =  okraj;
			
			//alert(d_sirka); 
			
			//alert("all:" + document.body.clientWidth);
			
			newAdv = document.createElement('div');
			
			//document.getElementById()
			
			newAdv.style.position = "absolute";
		                   
			newAdv.style.left = x_start + "px";
			newAdv.style.top = 220 + "px";
			
			newAdv.style.width = 1 + "px";
			newAdv.style.height = 74 + "px";
			
			newAdv.style.textAlign = "left";		
			start_clip_x = 100;
			//newAdv.style.clip = "rect(auto "+ start_clip_x + "px auto auto)";
			
			//rect(top right bottom left) 
			
			newAdv.style.overflowX = "hidden";
			
			//newAdv.style.whiteSpace = "nowrap";
			
			newAdv.style.overflowY = "hidden";
			
			//newAdv.style.border = "outset gray 1px";
					
			
			
			
			
			
			
			
			
			newAdv.style.visibility = "visible";
			
			newAdv.setAttribute('id', idElementu);
			
			//newAdv.innerHTML = htmltext;
			
			//o = new Image;
			//o.src = "banner_kurzy.gif";
			
			//newAdv.style.backgroundColor = "transparent";
			newAdv.innerHTML = '<a href="jazykove-kurzy-pro-verejnost-sleva/"><img border="0"  src="http://www.prazska.info/img/cimg/banner_kurzy.gif" id="img_banner"></a>';
			
			//newAdv.setAttribute('class', 'adv');
			//newAdv.setAttribute('className', 'adv'); //IE FIX
			
			e.appendChild(newAdv);
			
			//debugger;
			/*
			if (e = getElementById("img_banner"))
			{
			alert("Asd");
			//e.src = o.src;
			}
			*/
				//alert("appended");
			
		//newAdv.appendData = "!!!!!!!!";
	    
		
		
		}	
	}
	//alert(idElementu.currentStyle.left);
	
	/*if (i==undefined) */ 
	
	i = setTimeout('umistiReklamu2("adv_par","div_adv","nazdar chlape - ",'+ pocet+' )',timeout);
		//i=1;
	
	//ff  = "umistiReklamu2("+za_idElementu+","+idElementu+","+htmltext+")";
	//i = setTimeout(ff,2);
	
	//alert(ff);
	
	
	
	
	/*if (i == undefined)*/ 
	


	
	//if (i=undefined) i = setInterval("umistiReklamu2("+za_idElementu+","+idElementu+","+htmltext+")",1000);
	
}


//Javascript vyplni formularove pole, nutne pro odeslani e-mailu. Jinak je to nejspis spambot

function vyplnKontrolniKod() {
  document.getElementById('kontrolniKod').value='123';
  //document.getElementById('kontrolniKod').type='hidden';
  document.getElementById('kontrolniKod').style.display='none';
}

//-----------------------------------------------------------------------------------------------------------------


function checkEmailAddress(email)
{
  document.getElementById('kontrolniKod').value='123';
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(email))) { 
		alert('E-mailová adresa musí být správně vyplněna.');
    	return false;
    } else {
      return true;
	}
}


// Formular pro prekladatele (Martin Mates 27.8.2007)

function schovejKombinace(kolik) {
  var pom=0;
  
  for( i=8; i>0; i-- ) {
    pom++;
    if ( pom <= kolik ) {document.getElementById('schovana-kombinace-0'+i).className='schovane';} 
    else {
      document.getElementById('schovana-kombinace-0'+i).className='zobrazene';
    }
  }
}

function schovejOdkaz(id) {
  document.getElementById(id).className='schovane';
}


function inicialSoftware() {
  document.getElementById('ms-word-text').disabled=true;
  document.getElementById('ms-excel-text').disabled=true;
  document.getElementById('ms-power-point-text').disabled=true;
  document.getElementById('adobe-reader-text').disabled=true;
  document.getElementById('adobe-acrobat-text').disabled=true;
  document.getElementById('frame-maker-text').disabled=true;
  document.getElementById('page-maker-text').disabled=true;
  document.getElementById('quarkxpress-text').disabled=true;
  
  document.getElementById('trados-text').disabled=true;
  document.getElementById('sdlx-text').disabled=true;
  document.getElementById('transit-text').disabled=true;
  document.getElementById('trados-multiterm-text').disabled=true;
  document.getElementById('wordfast-text').disabled=true;
  document.getElementById('jine-text').disabled=true;
}

function softwareShow(id) {
  if (document.getElementById(id+'-text').disabled == false) {
    document.getElementById(id+'-text').disabled = true;
  } else {
    document.getElementById(id+'-text').disabled = false;
  }
}

function kontrolaPrazdna(id) {
  if (!jePrazdny(document.getElementById(id).value)) {
    document.getElementById(id).className='type-text-ok';
    return true;
  } else {
    document.getElementById(id).className='type-text-no';
    return false;
  }
}

function kontrolaPrazdnaLong(id) {
  if ((!jePrazdny(document.getElementById(id).value))&&(document.getElementById(id).value != '(jazyk, ze kterého překládáte)')) {
    document.getElementById(id).className='type-text-long-ok';
    return true;
  } else {
    document.getElementById(id).className='type-text-long-no';
    return false;
  }
}

function kontrolaMailu(id) {
    value=document.getElementById(id).value;
		reg_vyraz=/.+@.+\..+/;
		if (reg_vyraz.test(value)) {
      document.getElementById(id).className='type-text-ok';
      return true;
    } else {
      document.getElementById(id).className='type-text-no';
      return false;
    }
}

function kontrolaFormPrekladatele() {
  var kontrola = true;
  if (!kontrolaPrazdna('jmeno')) {kontrola=false;}
  if (!kontrolaPrazdna('prijmeni')) {kontrola=false;}
  if (!kontrolaPrazdnaLong('adresa')) {kontrola=false;}
  if (!kontrolaPrazdna('telefon')) {kontrola=false;} 
  if (!kontrolaMailu('e-mail')) {kontrola=false;}
  if (!kontrolaPrazdna('datum-narozeni')) {kontrola=false;}
  if (!kontrolaPrazdna('rodny-jazyk')) {kontrola=false;}
  if (!kontrolaPrazdnaLong('zdrojovy-jazyk')) {kontrola=false;}
  if (!kontrola) {alert('Špatně vyplněný formulář! \n\nZkontroluje všechny povinné položky.');}
  return kontrola; 
}


function jePrazdny(retezec)
    {
      for(var i = 0; i < retezec.length; i++) {
        var znak = retezec.charAt(i);
        if ((znak != ' ') && (znak != '\n') && (znak != '\t')) return false;
      }
      return true;
    }

//------------------------------------------------------------------------------







//</script>
