    	
function checkboxHideShow(checkbox_obj, div_id){
	//alert('Ku-ku '+checkbox_obj.checked); return
	if (checkbox_obj.checked == true){
		$('#'+div_id).show('normal');
	}else{
		$('#'+div_id).hide('normal');
	}
}
 
function showGroupFields(select_obj){
	if(select_obj.value == '4' || select_obj.value == '2'){
		//$('#sel_fields').show('normal');
		$('#cons_fields').hide('normal');
	}else if(select_obj.value == '6'){
		//$('#sel_fields').show('normal');
		$('#cons_fields').show('normal');
	}else{
		//$('#sel_fields').hide('normal');
		$('#cons_fields').hide('normal');
		//$('#pp_ac').val('');
		//$('#pp_addr').val('');
		//$('#phone').val('');
	}
}

function allAction(chk_obj){
	if (chk_obj.checked){
		$(".ind_chk").attr('checked', 'checked');
	}else{
		$(".ind_chk").attr('checked', '');
	}
	return;
}

function AlertDelete(){
    if (confirm("Are you sure you want to delete this item?")) {return true;} else {return false;}
}

function AlertEdit(){
	if (confirm("Are you sure you want to save your changes? The item will go back into 'Items waiting for approval' for the legit checkers to verify.")) {return true;} else {return false;}
}

function addOneSize(price, us_shipping, other_shipping){
	var size = $('#g_s').val();
    $('#s_v').val(size);
	total = price;
    AddShipping(total, us_shipping, other_shipping);
}

function addSize(price, us_shipping, other_shipping){

	var sizes = new Array();
	var total = 0;
	$(".sizes:checked").each(function (i) {
				sizes[sizes.length] = this.value;
				total += price;
	        	}
        	);
    $('#s_v').val(sizes.join(','));
    if (total == 0){
    	total = price;	//just loaded page and no one size selected yet 
    }
    AddShipping(total, us_shipping, other_shipping);
}

function CheskSizes(){
	var size_cnt = 0;
	$(".sizes:checked").each(function (i) {
				size_cnt++;
	        	}
        	);
    if(size_cnt){
    	return true;
    }else{
    	alert('Please select at least one size');
    	return false;
    }
}

function CheskOneSize(){
	if ( !$('#g_s').val().length ){
		alert('Please select size');
		return false;
	}
	return true;
}

function AddShipping(curr_amount, us_shipping, other_shipping){

	if ($('#shng').val() == 'US'){
		curr_amount += us_shipping;
	}else{
		curr_amount += other_shipping;
	}
	//alert(curr_amount);
	$('#inp_am').val(curr_amount.toFixed(2));
    $('#lbl_am').html(curr_amount.toFixed(2));
}

function showHelp(field){
	window.open("help.php?fld="+field,null,"height=320,width=340,status=no,menubar=no,location=no,scrollbars=no,top=400,left=500");
	return false;
}