function toggleVisibility(theImage) {

	var pathToImages = "../images/products/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "pdt_dts_arrow_select_icon.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "pdt_dts_arrow_active_icon.gif";
    }
}

function checkCompareCount(form){
	if(form.products.length > 0){
		var checkedCount = 0;
		for(var i=0;i<form.products.length;i++){
			if(form.products[i].checked){
				checkedCount++;
			}
		}
		if(checkedCount > 1 && checkedCount < 5){
			form.submit();
		}else{
			alert("Salīdzināšanai lūdzam izvēlēties 2-4 produktus");
		}
	}
	return false;
}

function showModel(path,direction){
    var theCell = document.getElementById("product_picture");
	if(path == '' && direction == -1){
		if(currentIndex == -1){
			currentIndex = EffPics.length-1;
		}else{
			currentIndex = (currentIndex+EffPics.length-1)%EffPics.length;
		}
		path = EffPics[currentIndex];
	}else if(path == '' && direction == 1){
		if(currentIndex == -1){
			currentIndex = 0;
		}else{
			currentIndex = (currentIndex+1)%EffPics.length;
		}
		path = EffPics[currentIndex];
	}
	theCell.src = "/thumb"+path + "?sizeh=335&sizew=382";

}

function showModelColour(path){
    var theCell = document.getElementById("product_picture");
	theCell.src = "/thumb" +path + "?sizeh=335&sizew=382";	
}

function showZoom(path){
    var theCell = document.getElementById("product_picture");

var a=window.open (theCell.src,"imagepopup","left=300,top=150,menubar=0,resizable=1,width=400,height=400"); 
	
//	theCell.src = path;	
}

