function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++){
	      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
			theForm[z].checked = theElement.checked;
	  	}
     	}
}
function fill(selectCtrl, val){
	if (val == null){
	}
	else{
		selectCtrl.name.value = val[0];
		selectCtrl.surname.value = val[1];
		selectCtrl.street.value = val[2];
		selectCtrl.flatno.value = val[3];
		selectCtrl.city.value = val[4];
		selectCtrl.country.value = val[5];
		selectCtrl.zip.value = val[6];
		selectCtrl.phone.value = val[7];
		selectCtrl.homeno.value = val[8];
	}
}
function addCompare(prod_id,cat_id, time){
	advAJAX.get({
		url : "ajax.php?action=add&cookie=" + prod_id + "&cat=" + cat_id,
		mimeType: 'text/plain',
		onSuccess : function(obj) { 
				document.getElementById("prod"+prod_id).innerHTML = "<input type=checkbox onclick=\"deleteCompare(" + prod_id + "," + 1 + ");\" checked></input>";
				}
			});
}
function deleteCompare(prod_id,cat_id, time){
	advAJAX.get({
		url : "ajax.php?action=del&cookie=" + prod_id + "&cat=" + cat_id,
		mimeType: 'text/plain',
		onSuccess : function(obj) {
				document.getElementById("prod"+prod_id).innerHTML = "<input type=checkbox onclick=\"addCompare(" + prod_id + "," + 1 + ");\" ></input>";}
			});
}
function deleteCompareProd(prod_id, time){
	advAJAX.get({
		url : "ajax.php?action=delp&cookie=" + prod_id,
		mimeType: 'text/plain',
		onSuccess : function(obj) {
				document.getElementById("prod"+prod_id).innerHTML = "-";}
			});
}

