function makeOne(el, id) {
  // alert (el.value);
  if (parseInt(el.value) == 0) { el.value = '1'; countThis (el, id); }
  
 }
 
 
 function displayMore (id) {
  
   if (OpenImages[id] != 1) {
   
  $.post("/ajax/displayinfo.php",
  { product: id },
  function(xml){
    //alert (id);
    document.getElementById('info_'+id).innerHTML = xml;
    document.getElementById('image_'+id).src = "/images/order_more_reverse.gif";
    OpenImages[id] = 1;
    
    $('#info_'+id).slideDown();
    
  }
  );
  
   } else {
     
    document.getElementById('image_'+id).src = "/images/order_more.gif";
    OpenImages[id] = 0;
    
    $('#info_'+id).slideUp();
   }
   
   
   return false; 
 }


function addToCart (cartId, productId, price) {
 document.getElementById('ajax').style.display = 'block';
 jsCart = document.getElementById('jsc').value;
 tmpjsCart = document.getElementById('jsc').value + '-' + productId;
 tmpjsPrice = parseInt(document.getElementById('jsprice').value) + parseInt(price);
 if (document.getElementById('jsc').value == '') tmpjsCart = productId;
    
 $.post("/ajax/addtocart.php",{
    product: productId,
    cart: cartId,
    prodlist: jsCart,
    priceAlready: document.getElementById('jsprice').value,
    priceAdd: price
  },function(xml){
    document.getElementById('cartq').innerHTML = xml;
    document.getElementById('jsc').value = tmpjsCart;
    document.getElementById('jsprice').value = tmpjsPrice;
    document.getElementById('ajax').style.display = 'none';
    
  });   
}

image = new Image();
image.src = "/images/ajax.gif";


nsName = {

	queryDefault: 'Ваше имя',
	queryClick: function() {
		if ($_('sub_name').value == nsName.queryDefault) { $_('sub_name').value = ''; }
	},
	queryBlur: function() {
		if ($_('sub_name').value == '') { $_('sub_name').value = nsName.queryDefault; }
	}
	
	
}

nsEmail = {

	queryDefault: 'Ваш email',
	queryClick: function() {
		if ($_('sub_email').value == nsEmail.queryDefault) { $_('sub_email').value = ''; }
	},
	queryBlur: function() {
		if ($_('sub_email').value == '') { $_('sub_email').value = nsEmail.queryDefault; }
	},
	querySubmit: function() {
		if ($_('sub_email').value == nsEmail.queryDefault || $_('sub_email').value == '' || $_('sub_name').value == nsName.queryDefault || $_('sub_name').value == '') {
			alert ('Пожалуйста, заполните оба поля.'); return false;	
		}
		return true;
	}
	
	
}




function $_() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}