//portfolio dropdown


function Go(select) {
	if (document.body.className == "home") {
	    var folder = "portfolio/index.shtml";
  	} else var folder = "../portfolio/index.shtml";
  		var selectIndex = select.options.selectedIndex;
  		var selectValue = select.options[select.options.selectedIndex].value;
 		if (selectValue == "") {
    		select.form.reset();
    		window.focus();
    		return ;
  		} 
  		if (selectValue == "all") {
    		window.location.href = folder + '?class=' + selectValue;
    		window.focus();
  		} else {
      		window.location.href = folder + '?class=' + selectValue;
      		window.focus();
  	}
}


function show (select) {
  var allTablerows = document.getElementsBySelector('tbody tr');

  if (select != "all") {
	var tablerows = document.getElementsBySelector('tbody tr.' + select);
  
	for (j=0; j<allTablerows.length; j++) {
  		allTablerows[j].style.display = "none";
		allTablerows[j].parentNode.parentNode.parentNode.style.display = "none";
  	}
  	for (k=0; k<tablerows.length; k++) {
		tablerows[k].style.display = "";
		tablerows[k].parentNode.parentNode.parentNode.style.display = "";
  	}
  } else {
	  	document.forms["portfolio-form"].portfolio.options[1].selected = true;
		for (j=0; j<allTablerows.length; j++) {
  		allTablerows[j].style.display = "";
		allTablerows[j].parentNode.parentNode.parentNode.style.display = "";
  		}
	}
}


showList = function() {
	if (window.location.search != '') {
		selectClass = window.location.search.substr(7);
		//alert('readparam: '+ selectClass + document.forms["portfolio-form"].portfolio.length);
		
		for (i = 0; i < document.forms["portfolio-form"].portfolio.length; ++i) {
    		if (document.forms["portfolio-form"].portfolio.options[i].value == selectClass) {
		      document.forms["portfolio-form"].portfolio.options[i].selected = true;
			  show(selectClass);
			}
		}
	}
}
window.onload=showList;
/*if (window.location.search != '') {
	document.forms["portfolio-form"].portfolio.onchange = showList;
}*/
