function show_photo(text,file,width,height){
	no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
	with (no.document)
	{
		open();
		writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" style="border: 0px;" /></a></body>');
		close();
		no.focus();
	}
}

function openWindow(text,file,width,height,type){
	if (type=='img'){
		no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
		with (no.document)
		{
			open();
			writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" alt="'+text+'"style="border: 0px;" /></a></body>');
			close();
			no.focus();
		}
	}
	if (type=='file'){
		window.open(file, "zoom", "left=5, top=5, resizable,toolbar=no, location=no, status=no, scrollbars=yes");
		
		
	}
	return false;
}

function changeImage(id,src){
	$(".car-image").show();
	$(".car-info").show();
	$(".iko-sleva").show();
	$(".car-video").hide();
	$("#"+id).attr("src", src);
	
	return false;
}

function showLargeImage(url,width,height,type) {
	if (screen.height) {
		screenY = screen.height
		screenX = screen.width
	}
	var top = ((screenY/2)-(height/2));
	var left = ((screenX/2)-(width/2));
	window.open(url,'','resizable=no,status=no,scrollbars=no,width='+width+',height='+height+',top=50,left=50');
	return false;
}

function newWindow(url){
	x = window.open(url, "new_win", "");
	if (x) return false;
}

function kontrola_predvyber(oElement,value,url){
	oForm = oElement.form;
	oElement = oForm.elements[oElement.name]; 
	if(oElement.length){
		for(i = 0; i < oElement.length; i++){
			if (oElement[i].value != value)
				oElement[i].checked = false;
		}
	}
	location.replace(url);
}

function ajax(url,idElement){
	if (url != 0){
		if (window.ActiveXObject){
    		httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}
        else{
			httpRequest = new XMLHttpRequest();
		}
    	httpRequest.open("GET", url+'&popisek='+idElement, true);
        httpRequest.onreadystatechange= function () {processRequest(idElement); } ;
        httpRequest.send(null);
	}
	else{
		document.getElementById(idElement).innerHTML = "";
	}
	//setTimeout("alert('"+idElement+"')",10);
}

function processRequest(element){
	if (httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var vystup = document.getElementById(element);
			vystup.innerHTML = httpRequest.responseText;
		}
		else{
			alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
		}
	}
}

// vlozime id prvku jako parametr, pokud je viditelny, skryje se a naopak
function ShowORhidden(prvek){
	if (document.getElementById(prvek).style.display == 'none')
		document.getElementById(prvek).style.display='block';
	else
		document.getElementById(prvek).style.display='none';
}

// vypnutí ilayeru po osmi vterinach
function hideILAYER(prvek){
	if (document.getElementById(prvek).style.display == 'block')
		document.getElementById(prvek).style.display='none';
}

function topmenu(topmenu,submenu,sirka_menu){
	
	delka = sirka_menu + getObjX(topmenu) + getObjX('tm_kupuji-vuz') + 22;
	pozice = -(delka - getWinW() + 0);
	
	if (delka > (getWinW())){
		//window.alert(pozice);
		moveObjTo(submenu,pozice,'25');
		//setObjCSSProp(submenu,'border','10px solid black');
		//setObjCSSProp(submenu,'left', pozice+'px');
	}
}

function AddFavorite(linkObj,addUrl,addTitle)
{
  if (document.all && !window.opera)
  {
    window.external.AddFavorite(addUrl,addTitle);
    return false;
  }
  else if (window.opera && window.print)
  {
    linkObj.title = addTitle;
    return true;
  }
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
  {
    if (window.confirm('Přidat oblíbenou stránku jako nový panel?'))
    {
      window.sidebar.addPanel(addTitle,addUrl,'');
      return false;
    }
  }
  window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
  return false;
}
/*
function showHeight(ele, h) {
      $("#karta-vozidla").text("The height for the " + ele + 
                    " is " + h + "px.");
    }
    $("#karta-vozidla").click(function () { 
      showHeight("paragraph", $("#karta-vozidla").height()); 
      window.alert("test");
    });
}
*/


