function NCLProcess(f1){
	
	var ncl_name = f1.ncl_name.value;
	var ncl_email = f1.ncl_email.value;
	
	ajaxObject1 = new sack();
  ajaxObject1.requestFile = 'newsletter_consumers.php';
  ajaxObject1.setVar("ncl_name", ncl_name);
  ajaxObject1.setVar("ncl_email", ncl_email);
  ajaxObject1.method = "POST";
  
	ajaxObject1.onCompletion = function(){

                           var Answer = ajaxObject1.response;
                           document.getElementById('msg_subscr').innerHTML = Answer;
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject1.runAJAX();
	
}

function addBlankFields(ftype){
	
	ajaxObject2 = new sack();
  ajaxObject2.requestFile = 'blank_fields.php';
  ajaxObject2.setVar("ftype", ftype);
  ajaxObject2.method = "POST";
  
	ajaxObject2.onCompletion = function(){

                           var Answer = ajaxObject2.response;
                           document.getElementById('more_fields').innerHTML += Answer;
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject2.runAJAX();
	
}

function addBlankFieldsDE(ftype){
	
	ajaxObject18 = new sack();
  ajaxObject18.requestFile = 'blank_fields.php';
  ajaxObject18.setVar("ftype", ftype);
  ajaxObject18.method = "POST";
  
	ajaxObject18.onCompletion = function(){

                           var Answer = ajaxObject18.response;
                           document.getElementById('more_fields_de').innerHTML += Answer;
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject18.runAJAX();
	
}

function eshopRegister(f1){
	
	var esu_email = f1.esu_email.value;
	var esu_username = f1.esu_username.value;
	var esu_password = f1.esu_password.value;
	
	ajaxObject3 = new sack();
  ajaxObject3.requestFile = 'eshop_process_register.php';
  ajaxObject3.setVar("esu_email", esu_email);
  ajaxObject3.setVar("esu_username", esu_username);
  ajaxObject3.setVar("esu_password", esu_password);
  ajaxObject3.method = "POST";
  
	ajaxObject3.onCompletion = function(){

                           var Answer = ajaxObject3.response;
                           document.getElementById('msg_esu_register').innerHTML = Answer;
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject3.runAJAX();
	
}

function eshopLogin(f1){
	
	var esu_username = f1.esu_username.value;
	var esu_password = f1.esu_password.value;
	
	ajaxObject4 = new sack();
  ajaxObject4.requestFile = 'eshop_process_login.php';
  ajaxObject4.setVar("esu_username", esu_username);
  ajaxObject4.setVar("esu_password", esu_password);
  ajaxObject4.method = "POST";
  
	ajaxObject4.onCompletion = function(){

                           var Answer = ajaxObject4.response;
                           if(Answer!='1') { document.getElementById('msg_esu_login').innerHTML = Answer; }
                          else { window.location='eshop.php'; }
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject4.runAJAX();
	
}

function rslLogin(f1){
	
	var rsl_username = f1.rsl_username.value;
	var rsl_password = f1.rsl_password.value;
	
	ajaxObject6 = new sack();
  ajaxObject6.requestFile = 'rsl_process_login.php';
  ajaxObject6.setVar("rsl_username", rsl_username);
  ajaxObject6.setVar("rsl_password", rsl_password);
  ajaxObject6.method = "POST";
  
	ajaxObject6.onCompletion = function(){

                          var Answer = ajaxObject6.response;
                          if(Answer!='1') { document.getElementById('msg_rsl_login').innerHTML = Answer; }
                          else { window.location='reseller_area.php'; }
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject6.runAJAX();
	
}

function checkRSLAccountForm(f1){
	
	var rsl_company_name = f1.rsl_company_name.value;
	var rsl_contact_person = f1.rsl_contact_person.value;
	var rsl_email = f1.rsl_email.value;
	var rsl_username = f1.rsl_username.value;
	
	if(rsl_company_name==''){
		alert("Please enter Company Name!");
		return false;
	}
	
	if(rsl_contact_person==''){
		alert("Please enter Contact Person!");
		return false;
	}
	
	if(rsl_email==''){
		alert("Please enter E-mail!");
		return false;
	}
	
	/*if(rsl_username==''){
		alert("Please enter Username!");
		return false;
	}	*/
	
}

function addShopCartItem(f1){
	
	var prod_q = f1.prod_q.value;
	var pdi_id = f1.pdi_id.value;
	
	if(prod_q=='') { 
		alert('Please enter Quantity!');
		f1.prod_q.focus();
		return;
	}
  if(pdi_id=='') { 
  	alert('Please select product!');
		window.location='products.php';
		return;
	}
	
	ajaxObject7 = new sack();
  ajaxObject7.requestFile = 'shopcart_process.php';
  ajaxObject7.setVar("prod_q", prod_q);
  ajaxObject7.setVar("pdi_id", pdi_id);
  ajaxObject7.setVar("act", 'add');
  ajaxObject7.method = "POST";
  
	ajaxObject7.onCompletion = function(){

                          var Answer = ajaxObject7.response;
                          if(Answer=='error_q') { 
                          	alert('Please enter Quantity!');
                          	f1.prod_q.focus();
                          	return;
                          }
                          if(Answer=='error_q_inc') { 
                          	alert('Please enter integer Quantity!');
                          	f1.prod_q.focus();
                          	return;
                          }
                          if(Answer=='error_pdi') { 
                          	alert('Please select product!');
                          	window.location='products.php';
                          	return;
                          }
                          else { 
                          		alert(Answer);
                          		f1.prod_q.value = '1'; 
                          		return; 
                          		
                          }
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject7.runAJAX();
	
}

function saveShopCartItemQ(ush_id){
	
	var prod_q = document.getElementById('prod_q_'+ush_id).value;
	
	if(prod_q=='') { 
		alert('Please enter Quantity!');
		f1.prod_q.focus();
		return;
	}
  
	ajaxObject8 = new sack();
  ajaxObject8.requestFile = 'shopcart_process.php';
  ajaxObject8.setVar("prod_q", prod_q);
  ajaxObject8.setVar("ush_id", ush_id);
  ajaxObject8.setVar("act", 'edit');
  ajaxObject8.method = "POST";
  
	ajaxObject8.onCompletion = function(){

                          var Answer = ajaxObject8.response;
                          if(Answer=='error_q') { 
                          	alert('Please enter Quantity!');
                          	f1.prod_q.focus();
                          	return;
                          }
                          if(Answer=='error_q_inc') { 
                          	alert('Please enter integer Quantity!');
                          	f1.prod_q.focus();
                          	return;
                          }
                          if(Answer!='error_q' && Answer!='error_q_inc'){
                          	document.getElementById('shc_items').innerHTML = Answer;
                          }
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject8.runAJAX();
	
}

function deleteShopCartItem(ush_id){
	
	if(confirm('Do you want delete this item?')){
		
		ajaxObject9 = new sack();
	  ajaxObject9.requestFile = 'shopcart_process.php';
	  ajaxObject9.setVar("ush_id", ush_id);
	  ajaxObject9.setVar("act", 'delete');
	  ajaxObject9.method = "POST";
	  
		ajaxObject9.onCompletion = function(){
	
	                          var Answer = ajaxObject9.response;
	                          document.getElementById('shc_items').innerHTML = Answer;
	                          
	                           
	  };        // Specify function that will be executed after file has been found
		ajaxObject9.runAJAX();
		
	}
		
}

function getCheckedIndexes (oListbox){
  var arrIndexes = new Array;
  
  for (var i=0; i < oListbox.length; i++){
      if (oListbox[i].checked) arrIndexes.push(oListbox[i].value);
  }
  return arrIndexes;
}

function checkShopCartItemSLD(f1){
	
	var shc_items_checks = f1.elements['set_checkout[]'];
	
	shc_items = getCheckedIndexes(shc_items_checks);
	
	if(shc_items==''){
		alert('Please check shop cart items!');
		return false;
	} else return true;
	
}

function addShopCartItemFinish(f1){
	
	var prod_q = f1.prod_q.value;
	var pdi_id = f1.pdi_id.value;
	
	if(prod_q=='') { 
		alert('Please enter Quantity!');
		f1.prod_q.focus();
		return;
	}
  if(pdi_id=='') { 
  	alert('Please select product!');
		window.location='products.php';
		return;
	}
	
	ajaxObject10 = new sack();
  ajaxObject10.requestFile = 'shopcart_process.php';
  ajaxObject10.setVar("prod_q", prod_q);
  ajaxObject10.setVar("pdi_id", pdi_id);
  ajaxObject10.setVar("act", 'add');
  ajaxObject10.method = "POST";
  
	ajaxObject10.onCompletion = function(){

                          var Answer = ajaxObject10.response;
                          if(Answer=='error_q') { 
                          	alert('Please enter Quantity!');
                          	f1.prod_q.focus();
                          	return;
                          }
                          if(Answer=='error_q_inc') { 
                          	alert('Please enter integer Quantity!');
                          	f1.prod_q.focus();
                          	return;
                          }
                          if(Answer=='error_pdi') { 
                          	alert('Please select product!');
                          	window.location='products.php';
                          	return;
                          }
                          else { 
                          		window.location='orders.php?act=all_cart';
                          		return; 
                          		
                          }
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject10.runAJAX();
	
}

function CRequestProcess(f1){
	
	var cr_username = f1.cr_username.value;
	var cr_email = f1.cr_email.value;
	var cr_reason = f1.cr_reason.value;
	var cr_request = f1.cr_request.value;
	
	if(cr_username=='') { 
		alert('Please enter Your Name!');
		f1.cr_username.focus();
		return;
	}
	
	if(cr_email=='') { 
		alert('Please enter E-mail!');
		f1.cr_email.focus();
		return;
	}
	
	if(cr_request=='') { 
		alert('Please enter Request!');
		f1.cr_request.focus();
		return;
	}
	
	ajaxObject11 = new sack();
  ajaxObject11.requestFile = 'cr_process.php';
  ajaxObject11.setVar("cr_username", cr_username);
  ajaxObject11.setVar("cr_email", cr_email);
  ajaxObject11.setVar("cr_reason", cr_reason);
  ajaxObject11.setVar("cr_request", cr_request);
  ajaxObject11.method = "POST";
  
	ajaxObject11.onCompletion = function(){

                           var Answer = ajaxObject11.response;
                           document.getElementById('msg_request').innerHTML = Answer;
                           f1.reset();
                           
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject11.runAJAX();
	
}

function NMSGProcess(f1){
	
	var cr_reason = f1.cr_reason.value;
	var cr_request = f1.cr_request.value;
	
	if(cr_reason=='') { 
		alert('Please enter Subject!');
		f1.cr_reason.focus();
		return;
	}
	
	if(cr_request=='') { 
		alert('Please enter Text!');
		f1.cr_request.focus();
		return;
	}
	
	ajaxObject12 = new sack();
  ajaxObject12.requestFile = 'nmsg_process.php';
  ajaxObject12.setVar("cr_reason", cr_reason);
  ajaxObject12.setVar("cr_request", cr_request);
  ajaxObject12.method = "POST";
  
	ajaxObject12.onCompletion = function(){

                           var Answer = ajaxObject12.response;
                           
                           if(Answer!='1') { document.getElementById('msg_request').innerHTML = Answer; }
                          else { 
	                          alert('Message sent!');
	                          window.location='message_board.php'; 
                          }
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject12.runAJAX();
	
}

function showListUsers(user_type){
	
	ajaxObject13 = new sack();
  ajaxObject13.requestFile = 'users_list_select.php';
  ajaxObject13.setVar("user_type", user_type);
  ajaxObject13.method = "POST";
  
	ajaxObject13.onCompletion = function(){

                           var Answer = ajaxObject13.response;
                           document.getElementById('user_id_sel').innerHTML = Answer;
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject13.runAJAX();
	
}

function rslForgotten(f1){
	
	var rsl_email = f1.rsl_email.value;
	
	ajaxObject14 = new sack();
  ajaxObject14.requestFile = 'rsl_process_forgotten.php';
  ajaxObject14.setVar("rsl_email", rsl_email);
  ajaxObject14.method = "POST";
  
	ajaxObject14.onCompletion = function(){

                          var Answer = ajaxObject14.response;
                          document.getElementById('msg_rsl_login').innerHTML = Answer;
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject14.runAJAX();
	
}

function esuForgotten(f1){
	
	var esu_email = f1.esu_email.value;
	
	ajaxObject15 = new sack();
  ajaxObject15.requestFile = 'eshop_process_forgotten.php';
  ajaxObject15.setVar("esu_email", esu_email);
  ajaxObject15.method = "POST";
  
	ajaxObject15.onCompletion = function(){

                          var Answer = ajaxObject15.response;
                          document.getElementById('msg_rsl_login').innerHTML = Answer;
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject15.runAJAX();
	
}

function checkESUAccountForm(f1){
	
	var esu_username = f1.esu_username.value;
	var esu_email = f1.esu_email.value;
	
	if(esu_username==''){
		alert("Please enter Username!");
		return false;
	}
	
	if(esu_email==''){
		alert("Please enter E-mail!");
		return false;
	}
	
}

function showFaqItemOpen(faq_id){
	
	if(faq_id){
	
		ajaxObject16 = new sack();
	  ajaxObject16.requestFile = 'faq_process.php';
	  ajaxObject16.setVar("faq_id", faq_id);
	  ajaxObject16.method = "POST";
	  
		ajaxObject16.onCompletion = function(){
	
	                          var Answer = ajaxObject16.response;
	                          document.getElementById('faq_txt').innerHTML = Answer;
	                           
	  };        // Specify function that will be executed after file has been found
		ajaxObject16.runAJAX();
	
	}
	
}

function showRSLGroupItems(group){
	
	if(group){
	
		ajaxObject17 = new sack();
	  ajaxObject17.requestFile = 'retailers_process.php';
	  ajaxObject17.setVar("group", group);
	  ajaxObject17.method = "POST";
	  
		ajaxObject17.onCompletion = function(){
	
	                          var Answer = ajaxObject17.response;
	                          document.getElementById('rslg_txt').innerHTML = Answer;
	                           
	  };        // Specify function that will be executed after file has been found
		ajaxObject17.runAJAX();
	
	}
	
}

function ATRequestProcess(f1){
	
	var at_company = f1.at_company.value;
	var at_person = f1.at_person.value;
	var at_address = f1.at_address.value;
	var at_zip = f1.at_zip.value;
	var at_city = f1.at_city.value;
	var at_country = f1.at_country.value;
	var at_phone = f1.at_phone.value;
	var at_email = f1.at_email.value;
	var at_comments = f1.at_comments.value;
	
	
	ajaxObject19 = new sack();
  ajaxObject19.requestFile = 'molinari_at_work_process.php';
  
  ajaxObject19.setVar("at_company", at_company);
  ajaxObject19.setVar("at_person", at_person);
  ajaxObject19.setVar("at_address", at_address);
  ajaxObject19.setVar("at_zip", at_zip);
  ajaxObject19.setVar("at_city", at_city);
  ajaxObject19.setVar("at_country", at_country);
  ajaxObject19.setVar("at_phone", at_phone);
  ajaxObject19.setVar("at_email", at_email);
  ajaxObject19.setVar("at_comments", at_comments);
  
  ajaxObject19.method = "POST";
  
	ajaxObject19.onCompletion = function(){

                           var Answer = ajaxObject19.response;
                           document.getElementById('msg_request').innerHTML = Answer;
                           
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject19.runAJAX();
	
}

function RRRequestProcess(f1){
	
	var at_company = f1.at_company.value;
	var at_person = f1.at_person.value;
	var at_address = f1.at_address.value;
	var at_zip = f1.at_zip.value;
	var at_city = f1.at_city.value;
	var at_country = f1.at_country.value;
	var at_phone = f1.at_phone.value;
	var at_email = f1.at_email.value;
	var at_b_type = f1.at_b_type.value;
	var at_comments = f1.at_comments.value;
	
	
	ajaxObject20 = new sack();
  ajaxObject20.requestFile = 'rsl_request_process.php';
  
  ajaxObject20.setVar("at_company", at_company);
  ajaxObject20.setVar("at_person", at_person);
  ajaxObject20.setVar("at_address", at_address);
  ajaxObject20.setVar("at_zip", at_zip);
  ajaxObject20.setVar("at_city", at_city);
  ajaxObject20.setVar("at_country", at_country);
  ajaxObject20.setVar("at_phone", at_phone);
  ajaxObject20.setVar("at_email", at_email);
  ajaxObject20.setVar("at_b_type", at_b_type);
  ajaxObject20.setVar("at_comments", at_comments);
  
  ajaxObject20.method = "POST";
  
	ajaxObject20.onCompletion = function(){

                           var Answer = ajaxObject20.response;
                           document.getElementById('msg_request').innerHTML = Answer;
                           
                           
  };        // Specify function that will be executed after file has been found
	ajaxObject20.runAJAX();
	
}

function checkNoForm(f1){
	
	var address = f1.sha_address.value;
	var city = f1.sha_city.value;
	var state = f1.sha_state.value;
	var country = f1.sha_country.value;
	
	
	if(address==''){
		alert("Please enter Address!");
		return false;
	}
	
	if(city==''){
		alert("Please enter City!");
		return false;
	}
	
	if(state==''){
		alert("Please enter State!");
		return false;
	}
	
	if(country==''){
		alert("Please enter Country!");
		return false;
	}
	
}

function shoppingCart(product_id, cart_action){
	
	$.ajax({ 	type: 'POST',
   			url: 'shop_cart_mini.php',
   			data: 'product_id='+product_id,
   			success: function(msg){

					$('#shc_cart').html(msg) ;	
					
				}
 		});
}

function shoppingCartChangeCnt(product_id, cart_action){
	
	$.ajax({ 	type: 'POST',
   			url: 'shop_cart_mini.php',
   			data: 'product_id='+product_id+'&cart_action='+cart_action,
   			success: function(msg){

					$('#shc_cart').html(msg) ;	
					
				}
 		});
}
