var DHTML = (document.getElementById || document.all || document.layers);
var flag = 1;

function loginBox(loginform){
	loginform.password.onfocus=function() {};

	var size = loginform.password.size;
	// IE6 is evil so we can't just change the type
	var input = document.createElement('input');
	input.type='password';
	input.name='password';
	input.size=size;
	input.value='';
	input.className='inp';

	loginform.password.parentNode.replaceChild(input, loginform.password);
	loginform.password.input.focus();

}

function showPhoto(type,id,object){
	//$('product_photo').innerHTML="<img alt=\"Loading...\" src=\"/imgs/loading.gif\" width=\"18\" height=\"18\" align=\"absmiddle\"> &nbsp; Loading...";
	//object.className='selected';
	if(type=='photo') {
		if(id >= photoArray.length) id = 0;
		else if(id < 0) id = photoArray.length-1;
		photoIndex=id;
		id = photoArray[id];
		/*
		x = getObj('katalog_fotka');
		x.src = id;
		*/
		document.katalog_fotka.src = id;
	}
	//var superAjax = new Ajax.Updater('katalog_fotka',"/scripts/productphoto.php",{method: 'get', parameters: "&type="+type+"&id="+id});
	//var superAjax = new Ajax.Updater('katalog_fotka', id, {asynchronous:true});
	//object.src = filename;
}


function openPopup(path, sirka, vyska){
    availHeight = screen.height;
    availWidth = screen.width;

    if (availHeight < 342) {posTop = 0;}
    else {posTop = (availHeight - vyska)/2;}

    if (availWidth < 320) {posLeft = 0;}
    else {posLeft = (availWidth - sirka)/2;}

    atts = "width=" + sirka + ",height=" + vyska + ",toolbar=no,scrollbars=no,resizable=0,status=no,top=" + posTop + ",left=" + posLeft;
    window.open(path, "_blank", atts);
}

function pic(sirka, vyska, id)
{
    vyska= vyska + 20;

    availHeight = screen.height;
    availWidth = screen.width;

    if (availHeight < 342) {posTop = 0;}
    else {posTop = (availHeight - vyska)/2;}

    if (availWidth < 320) {posLeft = 0;}
    else {posLeft = (availWidth - sirka)/2;}

    atts = "width=" + sirka +",height=" + vyska + ",directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,top=" + posTop + ",left=" + posLeft;

    var pikcr="imgopener.php?id="+id;
    window.open(pikcr, 'pikcrzobrazovac', atts);
}

function change(co)
{
	if (!DHTML) return;
	var x = getObj(co);
	if (flag) {
		flag=0;
		}
	else {
		flag=1;
	}
	x.visibility = (flag) ? 'hidden' : 'visible';
}

function display_ad(co)
{
	if (!DHTML) return;
	var x = getObj(co);
	if (x.display == 'none') {
		flag2=0;
		}
	else {
		flag2=1;
	}
	x.display = (flag2) ? 'none' : 'block';
}

function changeColor(co)
{
	if (!DHTML) return;
	var x = getObj(co);
	if (x.backgroundColor == '#3d3d3d') {
		flagC=1;
	}
	else {
		flagC=0;
	}
	x.backgroundColor = (flagC) ? '#00B1EE' : '#3d3d3d';
}

function getObj(name)
{
	if (document.getElementById)
	{
		return document.getElementById(name).style;
	}
	else if (document.all)
	{
		return document.all[name].style;
	}
	else if (document.layers)
	{
		return document.layers[name];
	}
}

function podporujemeSwapImg(url, hiliteId, numLinks)
///{{{
{
	document.getElementById('podporujeme-big-img').src = url;

	for (i = 1; i <= numLinks; ++i) {
		if (i == hiliteId) {
			document.getElementById('pis-link-' + hiliteId).style.fontWeight = 'bold';
		} else {
			document.getElementById('pis-link-' + hiliteId).style.fontWeight = 'normal';
		}
	}

	return false;
}
///}}}

function makeNext(numLinks)
///{{{
{
	img = document.getElementById('podporujeme-big-img');
	num = img.src.match(/.*0([1-9])\.jpg$/);

	num_orig = parseInt(num[1]);

	if (num_orig < numLinks) {
		num_new = num_orig + 1;
	} else {
		num_new = 1;
	}

	src = img.src.replace("0" + num_orig + ".jpg", "0" + num_new + ".jpg");
	img.src = src;

	return false;
}
///}}}