function clearSearchTextfield(input, value) {
	var field = document.getElementById(input);
	if (field.value == value) {
		field.value='';
	}
	return false;
}
function switchVisibility(id1, id2) {
	var id1 = document.getElementById(id1);
	var id2 = document.getElementById(id2);
	id1.style.display='block';
	id2.style.display='none';
	return false;
}

function recalculatePTT() {
	var postarina = document.getElementById('postarina');
	var ukupno = document.getElementById('ukupno');
	var drzava = document.getElementById('drzava');
	var dostava1 = document.getElementById('dostava1');
	var dostava2 = document.getElementById('dostava2');
	var dostava3 = document.getElementById('dostava3');
	var total;
	if (dostava1.checked==true) {
		postarina.innerHTML = 0 +' EUR';
		ukupno.innerHTML = cenaArtikla +' EUR';
	} else {
		if (drzava.value=='YU') {
			postarina.innerHTML = postarinaY +' EUR';
			total = postarinaY+cenaArtikla;
			ukupno.innerHTML = total +' EUR';
		} else {
			postarina.innerHTML = postarinaW +' EUR';
			total = postarinaW+cenaArtikla;
			ukupno.innerHTML = total +' EUR';
		}
	}
	return false;
}

function turnon(id) {
	var id = document.getElementById(id);
	id.style.display='block';
	return false;
}

function turnoff(id) {
	var id = document.getElementById(id);
	id.style.display='none';
	return false;
}

function animateStrip(direction, maxval)
{
	var div = document.getElementById('scrollStrip');
	var step = 188;
	if(direction == 'right') {
		if (parseInt(div.style.left) > maxval+4*step) {
			div.style.left = parseInt(div.style.left) - 188 +'px';
		}
	} else {
		if (parseInt(div.style.left) < 0) {
			div.style.left = parseInt(div.style.left) + 188 +'px';
		}
	}
}
function animateStrip3(direction, maxval)
{
	var div = document.getElementById('scrollStrip');
	var step = 188;
	if(direction == 'right') {
		if (parseInt(div.style.left) > maxval+3*step) {
			div.style.left = parseInt(div.style.left) - 188 +'px';
		}
	} else {
		if (parseInt(div.style.left) < 0) {
			div.style.left = parseInt(div.style.left) + 188 +'px';
		}
	}
}
function animateStrip4(direction, maxval)
{
	var div = document.getElementById('scrollStripTop');
	var step = 156;
	if(direction == 'right') {
		if (parseInt(div.style.left) > maxval+5*step) {
			div.style.left = parseInt(div.style.left) - 156 +'px';
		}
	} else {
		if (parseInt(div.style.left) < 0) {
			div.style.left = parseInt(div.style.left) + 156 +'px';
		}
	}
}
function popitup(url, name) {
	newwindow=window.open(url,name,'scrollbars=1,height=400,width=600');
	if (window.focus) {newwindow.focus()}
	return false;
}
function cpi(value, path, prev) {
	var mainImg = document.getElementById('mainImg');
	var colorDisplay = document.getElementById('colorDisplay');
	var prev = document.getElementById(prev);
	var mb1 = document.getElementById('mb1');
	var diffPath = path.replace("/medium", "");
	mb1.href = diffPath +value.id +'.jpg';
	mainImg.src = path +value.id +'.jpg';
	
	colorDisplay.innerHTML = value.name;
	prev.setAttribute("class", "shoeColor");
	value.setAttribute("class", "shoeColora");
	return (value.id);
	
	//$(".shoe > img").addClass("shoeColora");
	//$(value).addClass("shoeColora");
}
function showMenu(id) {
	var elem = document.getElementById(id);
	elem.style.display = 'block';
}
function hideMenu(id) {
	var elem = document.getElementById(id);
	elem.style.display = 'none';
}

function toggleVisibility(id) {
   var e = document.getElementById(id);
   if(e.style.display == 'block') {
	  e.style.display = 'none';
   } else {
	  e.style.display = 'block';
  }
}

function addToFavorites(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}