$(document).ready(function(){
		setTimeout(function(){$("input:image[@name='Inquire']").each(function(){
                $(this).hide().after("<image src='"+this.src+"' border=0 align='absmiddle'>");
        });},0)
});
var tburl;
var a;
function add_full(FormName1,FormName2){
	tburl='http://www.allproducts.com/NewInquiry/inquiry.php?';
	a=0;
	var foritems = document.forms[FormName1];
	var rep = new RegExp("^to");
	for(var i=0;i<foritems.length;i++){
		if(foritems[i].name.match(rep) && foritems[i].checked){	
			a++;
            tburl=tburl+'&to[]='+foritems[i].value;
		}
	}
	foritems = document.forms[FormName2];
	for(var i=0;i<foritems.length;i++){
		if(foritems[i].name.match(rep) && foritems[i].checked){	
			a++;
            tburl=tburl+'&to[]='+foritems[i].value;
		}
	}
	if(a==0){
		alert('Please at least choose one supplier or product.');
		return false;
	}
	tburl=tburl+'&keepThis=true&TB_iframe=true&height=450&width=700&';
	TB_show(null,tburl,false);
}
function add_supplier(FormName){
	tburl='/Inquiry/inquiry.php?type=supplier';
	a=0;
	$("input[name^='to']").each(function(){
		if($(this).attr("checked")==true){
			a++;
			tburl=tburl+'&to[]='+$(this).val();
		}
	});
	if(a==0){
		alert('Please at least choose one supplier.');
		return false;
	}
	tburl=tburl+'&keepThis=true&TB_iframe=true&height=450&width=700&';
	window.open(tburl,'inquiry');
	return false;
}
function add_product(FormName){
	tburl='/Inquiry/inquiry.php?type=product';
	a=0;
	$("input[name^='to']").each(function(){
		if($(this).attr("checked")==true){
			a++;
			tburl=tburl+'&to[]='+$(this).val();
		}
	});
	if(a==0){
		alert('Please at least choose one product.');
		return false;
	}
	tburl=tburl+'&keepThis=true&TB_iframe=true&height=450&width=700&';
	window.open(tburl,'inquiry');
	return false;
}
function add_to_cart(){
	tburl='/Inquiry/inquiry_cart.php?';
	a=0;
	tburl+='type='+$("input[name='type']").val();
	$("input[name^='to']").each(function(){
		if($(this).attr("checked")==true){
			a++;
			tburl=tburl+'&to[]='+$(this).val();
		}
	});
	if(a==0){
		alert('Please at least choose one product.');
		return false;
	}
	window.open(tburl,'cart','width=470,height=350,scrollbars=yes');
	return false;
}
function addtocart(path,type){
	tburl='/Inquiry/inquiry_cart.php?type='+type+'&to[]=';
	window.open(tburl+path,'cart','width=470,height=350,scrollbars=yes');
}
function view_cart(){
	window.open('/Inquiry/inquiry_cart.php','cart','width=470,height=350,scrollbars=yes');
}
function change_view(){
	if($("#showlist").css("display")=='none'){
		$.get("/Ajax/view_mode.php",{view:"l"});
		$("#showlist").css("display","block");
		$("#showgallery").css("display","none");
	}else{
		$.get("/Ajax/view_mode.php",{view:"g"});
		$("#showlist").css("display","none");
		$("#showgallery").css("display","block");
	}
}
function _selectAll(){
	$("input[name^='to[']").each(function(){
		$(this).attr("checked",true);
	});
}
function _clearAll(){
	$("input[name^='to[']").each(function(){
		$(this).attr("checked",false);
	});
} 