var DHTML = (document.getElementById || document.all || document.layers);
var flag = 1;

function highlight(category){
 var mapa;
 mapa = document.getElementById('logo_skatekm');

 switch(category){

   case('category_8')			:  mapa.style.backgroundPosition = '-220px 0px'; break;
   case('category_1')			:  mapa.style.backgroundPosition = '-440px 0px'; break;
   case('category_2')			:  mapa.style.backgroundPosition = '-660px 0px'; break;
   case('category_3')			:  mapa.style.backgroundPosition = '-880px 0px'; break;
   case('category_6')			:  mapa.style.backgroundPosition = '-1100px 0px'; break;
   case('category_5')			:  mapa.style.backgroundPosition = '-1320px 0px'; break;
   case('category_7')			:  mapa.style.backgroundPosition = '-1540px 0px'; break;

   case('none')			:  mapa.style.backgroundPosition = '0 0'; break;
   case('')				:  mapa.style.backgroundPosition = '0 0'; break;
 }

}

function hpoints(points){
 var mapa;
 mapa = document.getElementById('points');

 switch(points){

   case('points_0')			:  mapa.style.backgroundPosition = '0px 0px'; break;
   case('points_1')			:  mapa.style.backgroundPosition = '0px -23px'; break;
   case('points_2')			:  mapa.style.backgroundPosition = '0px -46px'; break;
   case('points_3')			:  mapa.style.backgroundPosition = '0px -69px'; break;
   case('points_4')			:  mapa.style.backgroundPosition = '0px -92px'; break;
   case('points_5')			:  mapa.style.backgroundPosition = '0px -115px'; break;
   case('points_6')			:  mapa.style.backgroundPosition = '0px -138px'; break;
   case('points_7')			:  mapa.style.backgroundPosition = '0px -161px'; break;
   case('points_8')			:  mapa.style.backgroundPosition = '0px -184px'; break;
   case('points_9')			:  mapa.style.backgroundPosition = '0px -207px'; break;
   case('points_10')			:  mapa.style.backgroundPosition = '0px -230px'; break;


   case('none')			:  mapa.style.backgroundPosition = '0 0'; break;
   case('')				:  mapa.style.backgroundPosition = '0 0'; break;
 }

}

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];
	}
}