
function expandCollapse(elem, changeImage)
{
        ecBlock = document.all(elem);
        if (ecBlock != undefined && ecBlock != null)
        {
                if (ecBlock.style.display == "none" || ecBlock.style.display == null || ecBlock.style.display == "")
                {
                    //shows the info.
					///document.all(elmnt).style.visibility="visible"
                    ecBlock.style.display = "block";
                }
                else if (ecBlock.style.display == "block")
                {
                    //hide info
                    ecBlock.style.display = "none";
                    
                }
                else
                {
                    //catch any weird circumstances.
                    ecBlock.style.display = "block";
					//ecBlock.style.visibility="visible"
                }
        }//end check ecBlock
}//end expandCollapse

function Gallery(link, width, height) {
	document.getElementById('gallery').innerHTML = '<img border="0" src="'+link+'" width="'+width+'"  height="'+height+'">';
}

function ToCart(id, num, color) {
        JsHttpRequest.query(
            'addtocart.php', // backend
            {
				'tovar_id': id,
				'tovar_color': color,
				'tovar_num': num
				  
            },
            function(result, errors) {
			            document.getElementById('basket').innerHTML = errors;
						
            },
            true  // do not disable caching
        );
}

function disableCheckbox(id){
	document.getElementById(id).checked=false;
}

function chFilter(the_name, arr){
    var temp      = '';
    var elts      = document.forms['filters'].elements[the_name];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;
    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
	    if(elts[i].checked){
		temp = temp + elts[i].value + ",";
	    }
        } // end for
    } else {
	if(elts[i].checked){
	 temp = elts[i].value;
	}
    } // end if... else
	
    document.getElementById(arr).value = temp;
}

function CloseCart(){
	hs.htmlExpand(document.getElementById('empty'), { contentId: 'highslide-html2'} );
	setTimeout("hs.close()",4500);
}


function AddToCart(id, color) {
	hs.htmlExpand(document.getElementById('id_'+id), { contentId: 'highslide-html',outlineWhileAnimating: true, objectLoadTime : 'after'});
	
	ToCart(id, 1, color);
	setTimeout("hs.close()",2000)
}