<!-- vlastne skripty na animaciu vysky a sirky objektov -->

<!-- animacia vysky -->
/*function animH(id88, h, t)
{	
	t = new Tween(document.getElementById(id88).style, 'height', Tween.regularEaseOut, 
				   0, h, t, 'px');
	t.start();	
};*/
<!-- animacia sirky-->
function animW(id88, w, t)
{
	t = new Tween(document.getElementById(id88).style, 'width', Tween.bounceEaseOut, 
				   0, w, t, 'px');				   
				   
	t.start();
};
<!-- animacia vysky aj sirky -->
/*function animHW(id88, w, h, t)
{
	animH(id88, h);
	animW(id88, w);
};*/

<!-- je to mizerne IE6 ? -->
function isIE6()
{
	if ( (BrowserDetect.browser == 'Explorer') && (BrowserDetect.version == 6) )
		return true;
	else
		return false;
}

<!-- nastavenie gif miesto png obrazkov pre menu (kvoli mrzkemu IE6) -->
function initKrutomenuCSS()
{
	document.write('<style type="text/css">');
	document.write('<!--');
	
	if ( !isIE6() )
	{		
		<!-- .detail_car_name -->
		document.write('.detail_car_name');
		document.write('{');
		document.write('margin-left: 30px;');
		document.write('}');
		
		<!-- .detail_left -->
		document.write('.detail_left');
		document.write('{');
		document.write('margin-left: 15px; margin-right: 18px;');
		document.write('}');		
	}
	
	document.write('-->');
	document.write('</style>');
}

function preloadImages() 
{ 
  	var d = document; 
  	if(d.images)
  	{ 
  		if(!d.MM_p) d.MM_p = new Array();
    	var i,j = d.MM_p.length, a = preloadImages.arguments; 
	
		for(i = 0; i < a.length; i++)
    		if (a[i].indexOf("#") != 0)
			{ 
				d.MM_p[j] = new Image; 
				d.MM_p[j++].src = a[i];
			}
	}
}

function DisableButton(theButton)
{
	theButton.disabled = true;
    theButton.value = 'Odesílám';
    theButton.form.submit();
}

function isValid(formField,fieldLabel)
{
  var result = true;
  if (formField.value == "")
  {
    alert('Vyplňte položku ' + fieldLabel +'.');
    formField.focus();
    result = false;
  }
  return result;
}

function validateMail(formField)
{
	var result = true;
	var mail = formField.value;
 	var filter = /^.+@.+\..{2,3}$/;

	if (!filter.test(mail))
    {
		alert('Vyplňte správnou e-mailovou adresu.');
		formField.focus();
		result = false;
    }
	
	return result;
}

function validateLogin(theForm)
{
  if (!isValid(theForm.login,"login"))
    return false;
  if (!isValid(theForm.passwd,"heslo"))
    return false;
	
  return true;
}

function validatePasswds(theForm)
{
  if (!isValid(theForm.old_pwd,"staré heslo"))
    return false;
  if (!isValid(theForm.new_pwd1,"nové heslo"))
    return false;
  if (!isValid(theForm.new_pwd2,"nové heslo znovu"))
    return false;
	
  if (theForm.new_pwd1.value != theForm.new_pwd2.value)
  {
	    window.alert("Nová hesla se neshodují.");
	    document.change_password.new_pwd1.focus();
	    return false;
  }
  
  return true;
}

function validateVykup(theForm)
{
  if (!isValid(theForm.znacka,"značka"))
    return false;
  if (!isValid(theForm.typ,"typ"))
    return false;
  if (!isValid(theForm.rv,"rok výroby"))
    return false;
  if (!isValid(theForm.karoserie,"karoserie"))
    return false;
  if (!isValid(theForm.motor,"motor"))
    return false;
  if (!isValid(theForm.palivo,"palivo"))
    return false;
  if (!isValid(theForm.najeto,"najeto km"))
    return false;
  if (!isValid(theForm.jmeno,"jméno"))
    return false;
  if (!isValid(theForm.prijmeni,"příjmení"))
    return false;
  if (!isValid(theForm.predstava,"představa o ceně"))
    return false;
  if (!validateMail(theForm.email))
    return false;
  
  return true;
}

function validateDotaz(theForm)
{
  if (!isValid(theForm.jmeno,"jméno"))
    return false;
  if (!isValid(theForm.prijmeni,"příjmení"))
    return false;
  if (!validateMail(theForm.email))
    return false;
  if (!isValid(theForm.zprava,"zpráva"))
    return false;
	
  return true;
}

function validateKarta(theForm)
{
  if (!isValid(theForm.jmeno,"jméno"))
    return false;
  if (!validateMail(theForm.srcemail))
    return false;
  if (!validateMail(theForm.dstemail))
    return false;
	
  return true;
}
function BN_swapImgRestore() { 
  var i,x,a=document.BN_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function BN_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=BN_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function BN_swapImage() { 
  var i,j=0,x,a=BN_swapImage.arguments; document.BN_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=BN_findObj(a[i]))!=null){document.BN_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
